]> Pileus Git - ~andy/fetchmail/blobdiff - fetchmail.h
Release 6.3.8.
[~andy/fetchmail] / fetchmail.h
index 3deeb63e04e8033a41c6cad5bfd623756b82cb8d..605bcb05d6b11cadafb99a9ecf0e201a26fe7a5a 100644 (file)
@@ -8,6 +8,8 @@
 /* We need this for HAVE_STDARG_H, etc */
 #include "config.h"
 
+struct addrinfo;
+
 /* We need this for size_t */
 #include <sys/types.h>
 
 # endif
 #endif
 
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#ifdef HAVE_NET_SOCKET_H
+#include <net/socket.h>
+#endif
+#include <netdb.h>
 #include <stdio.h>
 
 /* Import Trio if needed */
@@ -72,6 +81,7 @@ char *strstr(const char *, const char *);
 #define        A_GSSAPI        7       /* authenticate with GSSAPI */
 #define                A_SSH           8       /* authentication at session level */
 #define                A_MSN           9       /* same as NTLM with keyword MSN */
+#define                A_EXTERNAL      10      /* external authentication (client cert) */
 
 /* some protocols or authentication types (KERBEROS, GSSAPI, SSH) don't
  * require a password */
@@ -81,6 +91,7 @@ char *strstr(const char *, const char *);
      || (ctl)->server.authenticate == A_KERBEROS_V5 \
      || (ctl)->server.authenticate == A_GSSAPI \
      || (ctl)->server.authenticate == A_SSH \
+     || (ctl)->server.authenticate == A_EXTERNAL \
      || (ctl)->server.protocol == P_ETRN)
 
 /*
@@ -110,6 +121,8 @@ char *strstr(const char *, const char *);
 #define                DIGESTLEN       33      /* length of MD5 digest */
 
 /* exit code values */
+/* NOTE THAT PS_SUCCESS MUST ALWAYS BE 0 - SOME PARTS OF THE CODE
+ * RELY ON THIS VALUE! */
 #define                PS_SUCCESS      0       /* successful receipt of messages */
 #define                PS_NOMAIL       1       /* no mail available */
 #define                PS_SOCKET       2       /* socket I/O woes */
@@ -130,7 +143,6 @@ char *strstr(const char *, const char *);
 #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) */
 #define                PS_IDLETIMEOUT  29      /* timeout on imap IDLE (internal use) */
 
@@ -157,15 +169,17 @@ typedef   char    flag;
 #define FLAG_TRUE      2
 #define FLAG_FALSE     1
 
+/** run control data */
 struct runctl
 {
-    char       *logfile;
-    char       *idfile;
-    int                poll_interval;
+    char       *logfile;       /** where to write log information */
+    char       *idfile;        /** where to store UID data */
+    char       *pidfile;       /** where to record the PID of daemon mode processes */
     char       *postmaster;
+    char       *properties;
+    int                poll_interval;  /** poll interval in seconds (daemon mode, 0 == off) */
     flag       bouncemail;
     flag       spambounce;
-    char       *properties;
     flag       use_syslog;
     flag       invisible;
     flag       showdots;
@@ -182,8 +196,8 @@ struct idlist
            flag        mark;           /* UID-index information */
 #define UID_UNSEEN     0               /* hasn't been seen */
 #define UID_SEEN       1               /* seen, but not deleted */
-#define UID_DELETED    2               /* this message has been deleted */
-#define UID_EXPUNGED   3               /* this message has been expunged */ 
+#define UID_DELETED    2               /* this message has been marked deleted */
+#define UID_EXPUNGED   3               /* this message has been expunged */
         }
        status;
        char *id2;
@@ -213,10 +227,10 @@ struct method             /* describe methods for protocol state machine */
     int (*is_old)(int, struct query *, int);
                                /* check for old message */
     int (*fetch_headers)(int, struct query *, int, int *);
-                               /* fetch FROM headera given message */
+                               /* fetch header from a given message */
     int (*fetch_body)(int, struct query *, int, int *);
                                /* fetch a given message */
-    int (*trail)(int, struct query *, int, const char *);
+    int (*trail)(int, struct query *, const char *);
                                /* eat trailer of a message */
     int (*delete_msg)(int, struct query *, int);
                                /* delete method */
@@ -337,7 +351,8 @@ struct query
     flag use_ssl;              /* use SSL encrypted session */
     char *sslkey;              /* optional SSL private key file */
     char *sslcert;             /* optional SSL certificate file */
-       char *sslproto;         /* force usage of protocol (ssl2|ssl3|tls1) - defaults to ssl23 */
+    char *sslproto;            /** force transport protocol (ssl2|ssl3|ssl23|tls1) - if NULL,
+                                 use ssl23 for SSL and opportunistic tls1 for non-SSL connections. */
     char *sslcertpath;         /* Trusted certificate directory for checking the server cert */
     flag sslcertck;            /* Strictly check the server cert. */
     char *sslfingerprint;      /* Fingerprint to check against */
@@ -359,6 +374,7 @@ struct query
     struct idlist *oldsaved, *newsaved;
     struct idlist **oldsavedend;
     char lastdigest[DIGESTLEN];        /* last MD5 hash seen on this connection */
+    char *folder;              /* folder currently being polled */
 
     /* internal use -- per-message state */
     int mimemsg;               /* bitmask indicating MIME body-type */
@@ -504,14 +520,6 @@ int gen_transact();
 #endif
 extern struct msgblk msgblk;
 
-/* lock.c: concurrency locking */
-void lock_setup(void);
-void lock_assert(void);
-void lock_or_die(void);
-void fm_lock_release(void);
-int lock_state(void);
-void lock_dispose(void);
-
 /* use these to track what was happening when the nonresponse timer fired */
 #define GENERAL_WAIT   0       /* unknown wait type */
 #define OPEN_WAIT      1       /* waiting from mailserver open */
@@ -548,7 +556,7 @@ 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 *);
+int open_warning_by_mail(struct query *);
 #if defined(HAVE_STDARG_H)
 void stuff_warning(const char *, struct query *, const char *, ... )
     __attribute__ ((format (printf, 3, 4)))
@@ -650,13 +658,15 @@ 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));
+int daemonize(const char *);
 char *fm_getpassword(char *);
 void escapes(const char *, char *);
 char *visbuf(const char *);
 const char *showproto(int);
 void dump_config(struct runctl *runp, struct query *querylist);
-int is_host_alias(const char *, struct query *);
+int is_host_alias(const char *, struct query *, struct addrinfo **);
+
+extern struct addrinfo *ai0, *ai1;
 
 /** Try to obtain fully qualified hostname of current host. Exit with
  * PS_DNS if \a required is true and there is a DNS error. Exit with
@@ -687,11 +697,11 @@ void itimerthread(void*);
 #define chdir _chdir2
 #endif /* _EMX_ */
 
-# if HAVE_STRERROR
-#  ifndef strerror             /* On some systems, strerror is a macro */
+#ifdef HAVE_STRERROR
+#  if !defined(strerror) && !defined(HAVE_DECL_STRERROR)       /* On some systems, strerror is a macro */
 char *strerror (int);
 #  endif
-# endif /* HAVE_STRERROR */
+#endif /* HAVE_STRERROR */
 
 #define STRING_DISABLED        (char *)-1
 #define STRING_DUMMY   ""
@@ -753,5 +763,15 @@ int servport(const char *service);
 # define NI_DGRAM      16
 #endif
 
+int fm_getaddrinfo(const char *node, const char *serv, const struct addrinfo *hints, struct addrinfo **res);
+void fm_freeaddrinfo(struct addrinfo *ai);
+
+/* prototypes from tls.c */
+int maybe_tls(struct query *ctl);
+int must_tls(struct query *ctl);
+
+/* prototype from rfc822valid.c */
+int rfc822_valid_msgid(const unsigned char *);
+
 #endif
 /* fetchmail.h ends here */