]> Pileus Git - ~andy/fetchmail/blob - fetchmail.h
RC file syntax change, folder->mailbox, remote->remotename.
[~andy/fetchmail] / fetchmail.h
1 /* Copyright 1993-95 by Carl Harris, Jr. Copyright 1996 by Eric S. Raymond
2  * All rights reserved.
3  * For license terms, see the file COPYING in this directory.
4  */
5
6 /***********************************************************************
7   module:       fetchmail.h
8   project:      fetchmail
9   programmer:   Carl Harris, ceharris@mal.com
10   description:  global constant, type, and variable definitions.
11
12  ***********************************************************************/
13
14 /* constants designating the various supported protocols */
15 #define         P_AUTO  0
16 #define         P_POP2  2
17 #define         P_POP3  3
18 #define         P_IMAP  4
19 #define         P_APOP  5
20 #define         P_RPOP  6
21
22 /* definitions for buffer sizes -- somewhat arbitrary */
23 #define         POPBUFSIZE      512     /* per RFC 937 */
24 #define         MSGBUFSIZE      2048    /* size of message read buffer */
25 #define         HOSTLEN         128     /* max hostname length */
26 #define         USERNAMELEN     32      /* max user-length */
27 #define         PASSWORDLEN     MAX_PASSWORD_LENGTH
28 #define         FOLDERLEN       256     /* max folder name length */
29 #define         DIGESTLEN       33      /* length of MD5 digest */
30 #define         MDALEN          256     /* length of delivery agent command */
31 #define         IDLEN           128     /* length of UIDL message ID */
32
33 /* exit code values */
34 #define         PS_SUCCESS      0       /* successful receipt of messages */
35 #define         PS_NOMAIL       1       /* no mail available */
36 #define         PS_SOCKET       2       /* socket I/O woes */
37 #define         PS_AUTHFAIL     3       /* user authorization failed */
38 #define         PS_PROTOCOL     4       /* protocol violation */
39 #define         PS_SYNTAX       5       /* command-line syntax error */
40 #define         PS_IOERR        6       /* bad permissions on rc file */
41 #define         PS_ERROR        7       /* protocol error */
42 #define         PS_EXCLUDE      8       /* exclusion error */
43 #define         PS_SMTP         9       /* SMTP error */
44 #define         PS_UNDEFINED    10      /* something I hadn't thought of */
45
46 /* output noise level */
47 #define         O_SILENT        0       /* mute, max squelch, etc. */
48 #define         O_NORMAL        1       /* user-friendly */
49 #define         O_VERBOSE       2       /* excessive */
50
51 #define         SIZETICKER      1024    /* print 1 dot per this many bytes */
52
53 struct hostrec
54 {
55     /* per-host data */
56     char servername [HOSTLEN+1];
57     char localname [USERNAMELEN+1];
58     char remotename [USERNAMELEN+1];
59     char password [PASSWORDLEN+1];
60     char mailbox [FOLDERLEN];
61     char smtphost[HOSTLEN+1];
62     char mda [MDALEN+1];
63     int protocol;
64     int port;
65
66     /* MDA arguments */
67     char *mda_argv[32];
68     char mdabuf[MDALEN+1];
69
70     /* control flags */
71     int keep;
72     int fetchall;
73     int flush;
74     int norewrite;
75     int skip;
76
77     /* internal use */
78     struct hostrec *next;       /* next host in chain */
79     char digest [DIGESTLEN];
80 };
81
82 struct method
83 {
84     char *name;                 /* protocol name */
85     int port;                   /* service port */
86     int tagged;                 /* if true, generate & expect command tags */
87     int delimited;              /* if true, accept "." message delimiter */
88     int (*parse_response)();    /* response_parsing function */
89     int (*getauth)();           /* authorization fetcher */
90     int (*getrange)();          /* get message range to fetch */
91     int (*is_old)();            /* check for old message */
92     int (*fetch)();             /* fetch a given message */
93     int (*trail)();             /* eat trailer of a message */
94     int (*delete)();            /* delete method */
95     char *expunge_cmd;          /* expunge command */
96     char *exit_cmd;             /* exit command */
97 };
98
99 #define TAGLEN  6
100 extern char tag[TAGLEN];
101
102 /* controls the detail level of status/progress messages written to stderr */
103 extern int outlevel;            /* see the O_.* constants above */
104 extern int yydebug;             /* enable parse debugging */
105
106 /* daemon mode control */
107 extern int poll_interval;       /* poll interval in seconds */
108 extern char *logfile;           /* log file for daemon mode */
109 extern int quitmode;            /* if --quit was set */
110
111 /* miscellaneous global controls */
112 extern char *rcfile;            /* path name of rc file */
113 extern int linelimit;           /* limit # lines retrieved per site */
114 extern int versioninfo;         /* emit only version info */
115
116 #ifdef HAVE_PROTOTYPES
117
118 /* prototypes for globally callable functions */
119 void gen_send ();
120 int gen_transact ();
121
122 int doPOP2 (struct hostrec *); 
123 int doPOP3 (struct hostrec *);
124 int doIMAP (struct hostrec *);
125
126 int parsecmdline (int, char **, struct hostrec *);
127 int setdefaults (struct hostrec *);
128 char *getnextserver (int argc, char **, int *);
129 char *MD5Digest (char *);
130 int openmailpipe (struct hostrec *);
131 void append_server_names(int *, char **, int);
132 int daemonize(const char *, void (*)(int));
133
134 #else
135
136 char *getnextserver();
137 char *MD5Digest ();
138 void append_server_names ();
139 int daemonize ();
140
141 #endif
142