]> Pileus Git - ~andy/fetchmail/blobdiff - fetchmail.h
First round ofmlong-delayed bug fixes.
[~andy/fetchmail] / fetchmail.h
index b8963ce89b346ab8f92b9f68e3de4ce91bc5f970..8b4280b3c57d8c53d62539f66bb20d0ab32626ca 100644 (file)
@@ -5,6 +5,9 @@
 /* We need this for HAVE_STDARG_H, etc */
 #include "config.h"
 
+/* We need this for size_t */
+#include <sys/types.h>
+
 /* constants designating the various supported protocols */
 #define                P_AUTO          1
 #define                P_POP2          2
 #define                PS_BSMTP        12      /* output batch could not be opened */
 #define                PS_MAXFETCH     13      /* poll ended by fetch limit */
 #define                PS_SERVBUSY     14      /* server is busy */
+#define                PS_IDLETIMEOUT  15      /* timeout on imap IDLE */
 /* leave space for more codes */
 #define                PS_UNDEFINED    23      /* something I hadn't thought of */
 #define                PS_TRANSIENT    24      /* transient failure (internal use) */
 #define                PS_REFUSED      25      /* mail refused (internal use) */
 #define                PS_RETAINED     26      /* message retained (internal use) */
 #define                PS_TRUNCATED    27      /* headers incomplete (internal use) */
+#define                PS_REPOLL       28      /* repoll immediately with changed parameters (internal use) */
 
 /* output noise level */
 #define         O_SILENT       0       /* mute, max squelch, etc. */
@@ -187,6 +192,8 @@ struct method               /* describe methods for protocol state machine */
                                /* eat trailer of a message */
     int (*delete)(int, struct query *, int);
                                /* delete method */
+    int (*mark_seen)(int, struct query *, int);
+                               /* mark as seen method */
     int (*logout_cmd)(int, struct query *);
                                /* logout command */
     flag retry;                        /* can getrange poll for new messages? */
@@ -220,7 +227,7 @@ struct hostdata             /* shared among all user connections to given server */
 #endif /* SDPS_ENABLE */
     flag checkalias;                   /* resolve aliases by comparing IPs? */
     char *principal;                   /* Kerberos principal for mail service */
-
+    char *esmtp_name, *esmtp_password; /* ESMTP AUTH information */
 
 #if defined(linux) || defined(__FreeBSD__)
     char *interface;
@@ -307,7 +314,9 @@ struct query
     unsigned int uid;          /* UID of user to deliver to */
     struct idlist *skipped;    /* messages skipped on the mail server */
     struct idlist *oldsaved, *newsaved;
+    struct idlist **oldsavedend;
     char *lastid;              /* last Message-ID seen on this connection */
+    char *thisid;              /* Message-ID of current message */
 
     /* internal use -- per-message state */
     int mimemsg;               /* bitmask indicating MIME body-type */
@@ -382,7 +391,7 @@ extern int pass;            /* number of re-polling pass */
 extern flag configdump;                /* dump control blocks as Python dictionary */
 extern char *fetchmailhost;    /* either "localhost" or an FQDN */
 extern int suppress_tags;      /* suppress tags in tagged protocols? */
-extern char shroud[PASSWORDLEN];       /* string to shroud in debug output */
+extern char shroud[PASSWORDLEN*2+1];   /* string to shroud in debug output */
 #ifdef SDPS_ENABLE
 extern char *sdps_envfrom;
 extern char *sdps_envto;
@@ -390,13 +399,26 @@ extern char *sdps_envto;
 
 /* prototypes for globally callable functions */
 
+/* from /usr/include/sys/cdefs.h */
+#if !defined __GNUC__ || __GNUC__ < 2
+# define __attribute__(xyz)    /* Ignore. */
+#endif
+
 /* error.c: Error reporting */
 #if defined(HAVE_STDARG_H)
 void report_init(int foreground);
-void report (FILE *fp, const char *format, ...);
-void report_build (FILE *fp, const char *format, ...);
-void report_complete (FILE *fp, const char *format, ...);
-void report_at_line (FILE *fp, int, const char *, unsigned int, const char *, ...);
+void report (FILE *fp, const char *format, ...)
+    __attribute__ ((format (printf, 2, 3)))
+    ;
+void report_build (FILE *fp, const char *format, ...)
+    __attribute__ ((format (printf, 2, 3)))
+    ;
+void report_complete (FILE *fp, const char *format, ...)
+    __attribute__ ((format (printf, 2, 3)))
+    ;
+void report_at_line (FILE *fp, int, const char *, unsigned int, const char *, ...)
+    __attribute__ ((format (printf, 5, 6)))
+    ;
 #else
 void report ();
 void report_build ();
@@ -406,6 +428,7 @@ void report_at_line ();
 
 /* driver.c -- main driver loop */
 void set_timeout(int);
+int isidletimeout(void);
 int do_protocol(struct query *, const struct method *);
 
 /* transact.c: transaction support */
@@ -417,9 +440,13 @@ int readheaders(int sock,
                int num);
 int readbody(int sock, struct query *ctl, flag forward, int len);
 #if defined(HAVE_STDARG_H)
-void gen_send(int sock, const char *, ... );
+void gen_send(int sock, const char *, ... )
+    __attribute__ ((format (printf, 2, 3)))
+    ;
 int gen_recv(int sock, char *buf, int size);
-int gen_transact(int sock, const char *, ... );
+int gen_transact(int sock, const char *, ... )
+    __attribute__ ((format (printf, 2, 3)))
+    ;
 #else
 void gen_send();
 int gen_recv();
@@ -461,14 +488,18 @@ extern int mytimeout;
 int interruptible_idle(int interval);
 
 /* sink.c: forwarding */
+void smtp_close(struct query *, int);
 int smtp_open(struct query *);
+char *rcpt_address(struct query *, const char *, int);
 int stuffline(struct query *, char *);
 int open_sink(struct query*, struct msgblk *, int*, int*);
 void release_sink(struct query *);
 int close_sink(struct query *, struct msgblk *, flag);
 int open_warning_by_mail(struct query *, struct msgblk *);
 #if defined(HAVE_STDARG_H)
-void stuff_warning(struct query *, const char *, ... );
+void stuff_warning(struct query *, const char *, ... )
+    __attribute__ ((format (printf, 2, 3)))
+    ;
 #else
 void stuff_warning();
 #endif
@@ -485,14 +516,14 @@ void free_str_list(struct idlist **);
 struct idlist *copy_str_list(struct idlist *idl);
 void save_str_pair(struct idlist **, const char *, const char *);
 void free_str_pair_list(struct idlist **);
-int delete_str(struct idlist **, int);
+int delete_str(struct idlist **, long);
 int str_in_list(struct idlist **, const char *, const flag);
 int str_nr_in_list(struct idlist **, const char *);
 int str_nr_last_in_list(struct idlist **, const char *);
 void str_set_mark( struct idlist **, const char *, const flag);
 int count_list( struct idlist **idl );
-char *str_from_nr_list( struct idlist **idl, int number );
-char *str_find(struct idlist **, int);
+char *str_from_nr_list( struct idlist **idl, long number );
+char *str_find(struct idlist **, long);
 char *idpair_find(struct idlist **, const char *);
 void append_str_list(struct idlist **, struct idlist **);
 void expunge_uids(struct query *);
@@ -505,7 +536,7 @@ int prc_filecheck(const char *, const flag);
 
 /* base64.c */
 void to64frombits(unsigned char *, const unsigned char *, int);
-int from64tobits(char *, const char *);
+int from64tobits(char *, const char *, int maxlen);
 
 /* unmime.c */
 /* Bit-mask returned by MimeBodyType */
@@ -528,8 +559,8 @@ int interface_approve(struct hostdata *, flag domonitor);
 #else
 #define XMALLOCTYPE char
 #endif
-XMALLOCTYPE *xmalloc(int);
-XMALLOCTYPE *xrealloc(XMALLOCTYPE *, int);
+XMALLOCTYPE *xmalloc(size_t);
+XMALLOCTYPE *xrealloc(/*@null@*/ XMALLOCTYPE *, size_t);
 char *xstrdup(const char *);
 #if defined(HAVE_ALLOCA_H)
 #include <alloca.h>
@@ -540,7 +571,7 @@ char *xstrdup(const char *);
 #endif
 #define        xalloca(ptr, t, n)      if (!(ptr = (t) alloca(n)))\
        {report(stderr, GT_("alloca failed")); exit(PS_UNDEFINED);}
-#if FALSE
+#if 0
 /*
  * This is a hack to help xgettext which cannot find strings in
  * macro definitions like the one for xalloca above.
@@ -562,11 +593,20 @@ int do_gssauth(int sock, char *command, char *hostname, char *username);
 int do_otp(int sock, char *command, struct query *ctl);
 
 /* miscellanea */
+
+/* these should be of size PATH_MAX */
+extern char currentwd[1024], rcfiledir[1024];
+
 struct query *hostalloc(struct query *); 
 int parsecmdline (int, char **, struct runctl *, struct query *);
+char *prependdir (const char *, const char *);
 char *MD5Digest (unsigned char *);
+void hmac_md5 (unsigned char *, size_t, unsigned char *, size_t, unsigned char *, size_t);
 int POP3_auth_rpa(unsigned char *, unsigned char *, int socket);
+typedef RETSIGTYPE (*SIGHANDLERTYPE) (int);
 void deal_with_sigchld(void);
+RETSIGTYPE null_signal_handler(int sig);
+SIGHANDLERTYPE set_signal_handler(int sig, SIGHANDLERTYPE handler);
 int daemonize(const char *, void (*)(int));
 char *fm_getpassword(char *);
 void escapes(const char *, char *);
@@ -621,4 +661,10 @@ char *strerror ();
        } while(0)
 #endif /* FETCHMAIL_DEBUG */
 
+#ifdef __CYGWIN__
+#define ROOT_UID 18
+#else /* !__CYGWIN__ */
+#define ROOT_UID 0
+#endif /* __CYGWIN__ */
+
 /* fetchmail.h ends here */