1: /*
2: * Copyright (c) 1989 Regents of the University of California.
3: * All rights reserved. The Berkeley software License Agreement
4: * specifies the terms and conditions for redistribution.
5: *
6: * static char copyright[] = "Copyright (c) 1990 Regents of the University of California.\nAll rights reserved.\n";
7: * static char SccsId[] = "@(#)@(#)popper.h 2.2.2 (2.11BSD) 1996/3/21";
8: *
9: */
10:
11: /* LINTLIBRARY */
12:
13: /*
14: * Header file for the POP programs
15: */
16:
17: #include <syslog.h>
18: #include <paths.h>
19: #include "version.h"
20:
21: #define NULLCP ((char *) 0)
22: #define SPACE 32
23: #define TAB 9
24: #define TRUE 1
25: #define FALSE 0
26: #define NEWLINE '\n'
27:
28: #define MAXHOSTNAMELEN 256
29: #define MAXUSERNAMELEN 65
30: #define MAXDROPLEN 64
31: #define MAXLINELEN 1024
32: #define MAXMSGLINELEN 1024
33: #define MAXCMDLEN 4
34: #define MAXPARMCOUNT 5
35: #define MAXPARMLEN 10
36: #define ALLOC_MSGS 20
37: #define MAIL_COMMAND _PATH_SENDMAIL
38:
39: #define POP_FACILITY LOG_LOCAL0
40: #define POP_PRIORITY LOG_NOTICE
41: #define POP_DEBUG LOG_DEBUG
42: #define POP_LOGOPTS 0
43: #define POP_MAILDIR "/usr/spool/mail"
44: #define POP_DROP "/usr/spool/mail/.%s.pop"
45: /* POP_TMPSIZE needs to be big enough to hold the string
46: * defined by POP_TMPDROP. POP_DROP and POP_TMPDROP
47: * must be in the same filesystem.
48: */
49: #define POP_TMPDROP "/usr/spool/mail/tmpXXXXXX"
50: #define POP_TMPSIZE 256
51: #define POP_TMPXMIT "/tmp/xmitXXXXXX"
52: #define POP_OK "+OK"
53: #define POP_ERR "-ERR"
54: #define POP_SUCCESS 1
55: #define POP_FAILURE 0
56: #define POP_TERMINATE '.'
57:
58: extern int errno;
59: extern char * sys_siglist[];
60:
61: #define pop_command pop_parm[0] /* POP command is first token */
62: #define pop_subcommand pop_parm[1] /* POP XTND subcommand is the
63: second token */
64:
65: typedef enum { /* POP processing states */
66: auth1, /* Authorization: waiting for
67: USER command */
68: auth2, /* Authorization: waiting for
69: PASS command */
70: trans, /* Transaction */
71: update, /* Update: session ended,
72: process maildrop changes */
73: halt, /* (Halt): stop processing
74: and exit */
75: error /* (Error): something really
76: bad happened */
77: } state;
78:
79: typedef struct { /* State information for
80: each POP command */
81: state ValidCurrentState; /* The operating state of
82: the command */
83: char * command; /* The POP command */
84: int min_parms; /* Minimum number of parms
85: for the command */
86: int max_parms; /* Maximum number of parms
87: for the command */
88: int (*function) (); /* The function that process
89: the command */
90: state result[2]; /* The resulting state after
91: command processing */
92: #define success_state result[0] /* State when a command
93: succeeds */
94: } state_table;
95:
96: typedef struct { /* Table of extensions */
97: char * subcommand; /* The POP XTND subcommand */
98: int min_parms; /* Minimum number of parms for
99: the subcommand */
100: int max_parms; /* Maximum number of parms for
101: the subcommand */
102: int (*function) (); /* The function that processes
103: the subcommand */
104: } xtnd_table;
105:
106: typedef struct { /* Message information */
107: int number; /* Message number relative to
108: the beginning of list */
109: long length; /* Length of message in
110: bytes */
111: int lines; /* Number of (null-terminated) lines in the message */
112: long offset; /* Offset from beginning of
113: file */
114: int del_flag; /* Flag indicating if message
115: is marked for deletion */
116: int retr_flag; /* Flag indicating if message
117: was retrieved */
118: } MsgInfoList;
119:
120: typedef struct { /* POP parameter block */
121: int debug; /* Debugging requested */
122: char * myname; /* The name of this POP
123: daemon program */
124: char myhost[MAXHOSTNAMELEN]; /* The name of our host
125: computer */
126: char * client; /* Canonical name of client
127: computer */
128: char * ipaddr; /* Dotted-notation format of
129: client IP address */
130: unsigned short ipport; /* Client port for privileged
131: operations */
132: char user[MAXUSERNAMELEN]; /* Name of the POP user */
133: state CurrentState; /* The current POP operational state */
134: MsgInfoList * mlp; /* Message information list */
135: int msg_count; /* Number of messages in
136: the maildrop */
137: int msgs_deleted; /* Number of messages flagged
138: for deletion */
139: int last_msg; /* Last message touched by
140: the user */
141: long bytes_deleted; /* Number of maildrop bytes
142: flagged for deletion */
143: char drop_name[MAXDROPLEN]; /* The name of the user's
144: maildrop */
145: char temp_drop[MAXDROPLEN]; /* The name of the user's
146: temporary maildrop */
147: long drop_size; /* Size of the maildrop in
148: bytes */
149: FILE * drop; /* (Temporary) mail drop */
150: FILE * input; /* Input TCP/IP communication
151: stream */
152: FILE * output; /* Output TCP/IP communication stream */
153: FILE * trace; /* Debugging trace file */
154: char * pop_parm[MAXPARMCOUNT]; /* Parse POP parameter list */
155: int parm_count; /* Number of parameters in
156: parsed list */
157: } POP;
158:
159: extern int pop_dele();
160: extern int pop_last();
161: extern int pop_list();
162: extern int pop_pass();
163: extern int pop_quit();
164: extern int pop_rset();
165: extern int pop_send();
166: extern int pop_stat();
167: extern int pop_updt();
168: extern int pop_user();
169: extern int pop_xtnd();
170: extern int pop_xmit();
171: extern long lseek();
Defined macros
FALSE
defined in line
25; used 3 times
POP_FAILURE
defined in line
55; used 36 times
- in /usr/src/libexec/popper/pop_dele.c line
31,
38
- in /usr/src/libexec/popper/pop_dropcopy.c line
62,
92,
100-104(2),
118,
150
- in /usr/src/libexec/popper/pop_dropinfo.c line
48,
70
- in /usr/src/libexec/popper/pop_get_command.c line
80-85(2),
94
- in /usr/src/libexec/popper/pop_get_subcommand.c line
38,
44,
54
- in /usr/src/libexec/popper/pop_list.c line
33,
41
- in /usr/src/libexec/popper/pop_parse.c line
41
- in /usr/src/libexec/popper/pop_pass.c line
30-40(3),
48-51(2)
- in /usr/src/libexec/popper/pop_send.c line
35,
42
- in /usr/src/libexec/popper/pop_updt.c line
69,
75,
93,
177,
192
- in /usr/src/libexec/popper/pop_xmit.c line
43,
83,
89
- in /usr/src/libexec/popper/pop_xtnd.c line
31
- in /usr/src/libexec/popper/popper.c line
47
SPACE
defined in line
22;
never used
TAB
defined in line
23;
never used
TRUE
defined in line
24; used 2 times
Usage of this include