masqmail

annotate src/smtp_out.h @ 405:0dd84c8f2524

Broke long lines.
author markus schnalke <meillo@marmaro.de>
date Wed, 29 Feb 2012 10:28:23 +0100
parents b0708fac99dd
children
rev   line source
meillo@367 1 /*
meillo@367 2 ** smtp_out.h
meillo@367 3 ** Copyright (C) Oliver Kurth,
meillo@367 4 **
meillo@367 5 ** This program is free software; you can redistribute it and/or modify
meillo@367 6 ** it under the terms of the GNU General Public License as published by
meillo@367 7 ** the Free Software Foundation; either version 2 of the License, or
meillo@367 8 ** (at your option) any later version.
meillo@367 9 **
meillo@367 10 ** This program is distributed in the hope that it will be useful,
meillo@367 11 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
meillo@367 12 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
meillo@367 13 ** GNU General Public License for more details.
meillo@367 14 **
meillo@367 15 ** You should have received a copy of the GNU General Public License
meillo@367 16 ** along with this program; if not, write to the Free Software
meillo@367 17 ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
meillo@367 18 */
meillo@0 19
meillo@0 20 #include <unistd.h>
meillo@0 21 #include <sys/types.h>
meillo@0 22 #include <sys/socket.h>
meillo@0 23 #include <sys/time.h>
meillo@0 24 #include <netinet/in.h>
meillo@0 25 #include <netdb.h>
meillo@0 26
meillo@0 27 #define SMTP_BUF_LEN 1024
meillo@119 28 #define SMTP_SIZE_ADD 1024 /* add to the size of a message */
meillo@0 29
meillo@0 30 #define SMTP_INITIAL_TIMEOUT 5*60
meillo@0 31 #define SMTP_CMD_TIMEOUT 5*60
meillo@0 32 #define SMTP_DATA_TIMEOUT 5*60
meillo@0 33 #define SMTP_FINAL_TIMEOUT 10*60
meillo@0 34
meillo@10 35 typedef enum _smtp_error {
meillo@10 36 smtp_ok = 0, /* mail was delivered to at least one recpient */
meillo@10 37 smtp_trylater, /* server responded with 4xx */
meillo@10 38 smtp_fail, /* server responded with 5xx */
meillo@10 39 smtp_timeout, /* connection timed out */
meillo@10 40 smtp_eof, /* got unexpected EOF */
meillo@10 41 smtp_syntax, /* unexpected response */
meillo@10 42 smtp_cancel /* we gave up (eg. size) */
meillo@0 43 } smtp_error;
meillo@0 44
meillo@0 45
meillo@10 46 typedef struct _smtp_base {
meillo@10 47 FILE *in;
meillo@10 48 FILE *out;
meillo@0 49
meillo@10 50 gint sock;
meillo@10 51 gint dup_sock;
meillo@0 52
meillo@10 53 gchar *remote_host;
meillo@10 54 gchar *helo_name;
meillo@0 55
meillo@10 56 gchar *buffer;
meillo@10 57 gint last_code;
meillo@0 58
meillo@10 59 gboolean use_size;
meillo@10 60 gboolean use_pipelining;
meillo@10 61 gboolean use_auth;
meillo@0 62
meillo@10 63 gint max_size;
meillo@0 64
meillo@10 65 gchar **auth_names;
meillo@0 66
meillo@10 67 gchar *auth_name;
meillo@10 68 gchar *auth_login;
meillo@10 69 gchar *auth_secret;
meillo@10 70
meillo@10 71 smtp_error error;
meillo@0 72
meillo@0 73 } smtp_base;
meillo@0 74
meillo@366 75 gchar *set_heloname(smtp_base *psb, gchar *default_name, gboolean do_correct);
meillo@366 76 gboolean set_auth(smtp_base *psb, gchar *name, gchar *login, gchar *secret);
meillo@366 77 void destroy_smtpbase(smtp_base *psb);
meillo@366 78 smtp_base *smtp_out_open(gchar *host, gint port, GList *resolve_list);
meillo@372 79 smtp_base *smtp_out_open_child(gchar *cmd);
meillo@366 80 gboolean smtp_out_rset(smtp_base *psb);
meillo@366 81 gboolean smtp_out_init(smtp_base *psb, gboolean instant_helo);
meillo@366 82 gint smtp_out_msg(smtp_base *psb, message *msg, address *return_path, GList *rcpt_list, GList *hdr_list);
meillo@366 83 gboolean smtp_out_quit(smtp_base *psb);
meillo@377 84 void smtp_out_mark_rcpts(smtp_base *psb, GList *rcpt_list);
meillo@0 85
meillo@366 86 gint smtp_deliver(gchar *host, gint port, GList *resolve_list, message *msg, address *return_path, GList *rcpt_list);