masqmail-0.2

diff src/smtp_out.h @ 0:08114f7dcc23

this is masqmail-0.2.21 from oliver kurth
author meillo@marmaro.de
date Fri, 26 Sep 2008 17:05:23 +0200
parents
children 26e34ae9a3e3
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/smtp_out.h	Fri Sep 26 17:05:23 2008 +0200
     1.3 @@ -0,0 +1,91 @@
     1.4 +/* smtp_out.h, Copyright (C) Oliver Kurth,
     1.5 + *
     1.6 + * This program is free software; you can redistribute it and/or modify
     1.7 + * it under the terms of the GNU General Public License as published by
     1.8 + * the Free Software Foundation; either version 2 of the License, or
     1.9 + * (at your option) any later version.
    1.10 + * 
    1.11 + * This program is distributed in the hope that it will be useful,
    1.12 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.13 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1.14 + * GNU General Public License for more details.
    1.15 + *
    1.16 + * You should have received a copy of the GNU General Public License
    1.17 + * along with this program; if not, write to the Free Software
    1.18 + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
    1.19 + */
    1.20 +
    1.21 +#include <unistd.h>
    1.22 +#include <sys/types.h>
    1.23 +#include <sys/socket.h>
    1.24 +#include <sys/time.h>
    1.25 +#include <netinet/in.h>
    1.26 +#include <netdb.h>
    1.27 +
    1.28 +#define SMTP_BUF_LEN 1024
    1.29 +#define SMTP_SIZE_ADD 1024
    1.30 +
    1.31 +#define SMTP_INITIAL_TIMEOUT 5*60
    1.32 +#define SMTP_CMD_TIMEOUT 5*60
    1.33 +#define SMTP_DATA_TIMEOUT 5*60
    1.34 +#define SMTP_FINAL_TIMEOUT 10*60
    1.35 +
    1.36 +typedef
    1.37 +enum _smtp_error{
    1.38 +  smtp_ok = 0,   /* mail was delivered to at least one recpient */
    1.39 +  smtp_trylater, /* server responded with 4xx */
    1.40 +  smtp_fail,     /* server responded with 5xx */
    1.41 +  smtp_timeout,  /* connection timed out */
    1.42 +  smtp_eof,      /* got unexpected EOF */
    1.43 +  smtp_syntax,   /* unexpected response */
    1.44 +  smtp_cancel    /* we gave up (eg. size) */
    1.45 +} smtp_error;
    1.46 +
    1.47 +
    1.48 +typedef
    1.49 +struct _smtp_base{
    1.50 +  FILE *in;
    1.51 +  FILE *out;
    1.52 +
    1.53 +  gint sock;
    1.54 +  gint dup_sock;
    1.55 +
    1.56 +  gchar *remote_host;
    1.57 +  gchar *helo_name;
    1.58 +
    1.59 +  gchar *buffer;
    1.60 +  gint last_code;
    1.61 +
    1.62 +  gboolean use_esmtp;
    1.63 +  gboolean use_size;
    1.64 +  gboolean use_pipelining;
    1.65 +  gboolean use_auth;
    1.66 +  
    1.67 +  gint max_size;
    1.68 +
    1.69 +  gchar **auth_names;
    1.70 +
    1.71 +  gchar *auth_name;
    1.72 +  gchar *auth_login;
    1.73 +  gchar *auth_secret;
    1.74 +
    1.75 +  smtp_error error;
    1.76 +
    1.77 +} smtp_base;
    1.78 +
    1.79 +gchar *set_heloname(smtp_base *psb, gchar *default_name, gboolean do_correct);
    1.80 +gboolean set_auth(smtp_base *psb, gchar *name, gchar *login, gchar *secret);
    1.81 +void destroy_smtpbase(smtp_base *psb);
    1.82 +smtp_base *smtp_out_open(gchar *host, gint port, GList *resolve_list);
    1.83 +smtp_base *smtp_out_open_child(gchar *cmd);
    1.84 +gboolean smtp_out_rset(smtp_base *psb);
    1.85 +gboolean smtp_out_init(smtp_base *psb);
    1.86 +gint smtp_out_msg(smtp_base *psb,
    1.87 +		  message *msg, address *return_path,
    1.88 +		  GList *rcpt_list, GList *hdr_list);
    1.89 +gboolean smtp_out_quit(smtp_base *psb);
    1.90 +
    1.91 +gint smtp_deliver(gchar *host, gint port, GList *resolve_list,
    1.92 +		  message *msg,
    1.93 +		  address *return_path,
    1.94 +		  GList *rcpt_list);