]> Pileus Git - ~andy/fetchmail/blob - fetchmail.h
This is what I sent Harris.
[~andy/fetchmail] / fetchmail.h
1 /* Copyright 1993-95 by Carl Harris, Jr.
2  * All rights reserved
3  *
4  * Distribute freely, except: don't remove my name from the source or
5  * documentation (don't take credit for my work), mark your changes (don't
6  * get me blamed for your possible bugs), don't alter or remove this
7  * notice.  May be sold if buildable source is provided to buyer.  No
8  * warrantee of any kind, express or implied, is included with this
9  * software; use at your own risk, responsibility for damages (if any) to
10  * anyone resulting from the use of this software rests entirely with the
11  * user.
12  *
13  * Send bug reports, bug fixes, enhancements, requests, flames, etc., and
14  * I'll try to keep a version up to date.  I can be reached as follows:
15  * Carl Harris <ceharris@mal.com>
16  */
17
18
19 /***********************************************************************
20   module:       popclient.h
21   project:      popclient
22   programmer:   Carl Harris, ceharris@mal.com
23   description:  global constant, type, and variable definitions.
24
25   $Log: fetchmail.h,v $
26   Revision 1.2  1996/06/26 19:08:59  esr
27   This is what I sent Harris.
28
29   Revision 1.1  1996/06/24 18:14:08  esr
30   Initial revision
31
32   Revision 1.6  1995/09/07 22:37:35  ceharris
33   Preparation for 3.0b4 release.
34
35   Revision 1.5  1995/08/14 18:36:44  ceharris
36   Patches to support POP3's LAST command.
37   Final revisions for beta3 release.
38
39   Revision 1.4  1995/08/10 00:32:40  ceharris
40   Preparation for 3.0b3 beta release:
41   -     added code for --kill/--keep, --limit, --protocol, --flush
42         options; --pop2 and --pop3 options now obsoleted by --protocol.
43   -     added support for APOP authentication, including --with-APOP
44         argument for configure.
45   -     provisional and broken support for RPOP
46   -     added buffering to SockGets and SockRead functions.
47   -     fixed problem of command-line options not being correctly
48         carried into the merged options record.
49
50   Revision 1.3  1995/08/09 01:32:57  ceharris
51   Version 3.0 beta 2 release.
52   Added
53   -     .poprc functionality
54   -     GNU long options
55   -     multiple servers on the command line.
56   Fixed
57   -     Passwords showing up in ps output.
58
59   Revision 1.2  1995/08/08 01:01:27  ceharris
60   Added GNU-style long options processing.
61   Fixed password in 'ps' output problem.
62   Fixed various RCS tag blunders.
63   Integrated .poprc parser, lexer, etc into Makefile processing.
64
65  ***********************************************************************/
66
67
68
69 /* definitions for buffer sizes -- somewhat arbitrary */
70 #define         POPBUFSIZE      512     /* per RFC 937 */
71 #define         MSGBUFSIZE      1024    /* size of message read buffer */
72 #define         HOSTLEN         128     /* max hostname length */
73 #define         USERNAMELEN     32      /* max user-length */
74 #define         PASSWORDLEN     MAX_PASSWORD_LENGTH
75 #define         FOLDERLEN       256     /* max folder name length */
76 #define         DIGESTLEN       33      /* length of MD5 digest */
77 #define         MDALEN          33      /* length of delivery agent command */
78
79 /* exit code values */
80 #define         PS_SUCCESS      0       /* successful receipt of messages */
81 #define         PS_NOMAIL       1       /* no mail available */
82 #define         PS_SOCKET       2       /* socket I/O woes */
83 #define         PS_AUTHFAIL     3       /* user authorization failed */
84 #define         PS_PROTOCOL     4       /* protocol violation */
85 #define         PS_SYNTAX       5       /* command-line syntax error */
86 #define         PS_IOERR        6       /* local folder I/O woes */
87 #define         PS_ERROR        7       /* some kind of POP3 error condition */
88 #define         PS_UNDEFINED    9       /* something I hadn't thought of */
89
90 /* output noise level */
91 #define         O_SILENT        0       /* mute, max squelch, etc. */
92 #define         O_NORMAL        1       /* user-friendly */
93 #define         O_VERBOSE       2       /* excessive */
94
95 /* output sink type */
96 #define         TO_FOLDER       1       /* use a mailbox */
97 #define         TO_STDOUT       2       /* use stdout */
98 #define         TO_MDA          3       /* use agent */
99
100 /* Command-line arguments are passed in this structure type */
101 struct optrec {
102   int versioninfo;
103   int keep;
104   int verbose;
105   int whichpop;
106   int silent;
107   int limit;
108   int fetchall;
109   int flush;
110   int output;
111   char loginid [USERNAMELEN];
112   char *poprcfile;
113   char username [USERNAMELEN];
114   char password [PASSWORDLEN];
115 #if defined(HAVE_APOP_SUPPORT)
116   char digest [DIGESTLEN];
117 #endif
118   char userfolder [FOLDERLEN];
119   char remotefolder [FOLDERLEN];
120   char mda [MDALEN];
121 };
122
123
124 /* .poprc records are passed in this structure type */
125 struct prc_server {
126   char *server;
127   int protocol;
128   char *username;
129   char *password;
130   char *remotefolder;
131   char *userfolder;
132   char *mda;
133   int keep;
134   int flush;
135   int fetchall;
136 };
137
138
139 /* Controls the detail of status/progress messages written to stderr */
140 extern int outlevel;    /* see the O_.* constants above */
141 extern int yydebug;     /* enable parse debugging */ 
142
143 /* daemon mode control */
144 extern int poll_interval;       /* poll interval in seconds */
145 extern char *logfile;           /* log file for daemon mode */
146
147 extern char *prc_pathname;      /* path name of rc file */
148
149 #ifdef HAVE_PROTOTYPES
150
151 /* prototypes for globally callable functions */
152 int doPOP2 (char *servername, struct optrec *options); 
153 int doPOP3 (char *servername, struct optrec *options);
154
155 int parsecmdline (int argc, char **argv, struct optrec *options);
156 int setdefaults (struct optrec *options);
157 char *getnextserver (int argc, char **argv, int *optind);
158 int openuserfolder (struct optrec *options);
159 int closeuserfolder (int fd);
160 int openmailpipe (struct optrec *options);
161 int closemailpipe (int fd);
162 char *MD5Digest (char *);
163 char *prc_getpathname (struct optrec *cmd_opts, struct optrec *def_opts);
164 void reply_hack(char *buf, const char *host);
165 void append_server_names(int *pargc, char **argv);
166 int daemonize(const char *logfile);
167
168 #else
169
170 char *getnextserver();
171 char *MD5Digest ();
172 char *prc_getpathname();
173 void reply_hack ();
174 void append_server_names ();
175 int daemonize ();
176
177 #endif
178