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

ALLOC_MSGS defined in line 36; used 2 times
MAIL_COMMAND defined in line 37; used 3 times
MAXCMDLEN defined in line 33; never used
MAXDROPLEN defined in line 30; used 3 times
MAXHOSTNAMELEN defined in line 28; used 2 times
MAXPARMCOUNT defined in line 34; used 2 times
MAXPARMLEN defined in line 35; never used
MAXUSERNAMELEN defined in line 29; used 1 times
NEWLINE defined in line 26; used 1 times
NULLCP defined in line 21; used 1 times
POP_DROP defined in line 44; used 1 times
POP_ERR defined in line 53; used 1 times
POP_FACILITY defined in line 39; used 1 times
POP_LOGOPTS defined in line 42; used 1 times
POP_MAILDIR defined in line 43; used 1 times
POP_OK defined in line 52; used 1 times
POP_TERMINATE defined in line 56; used 2 times
POP_TMPDROP defined in line 49; used 1 times
POP_TMPSIZE defined in line 50; used 1 times
POP_TMPXMIT defined in line 51; used 1 times
SPACE defined in line 22; never used
TAB defined in line 23; never used
TRUE defined in line 24; used 2 times
success_state defined in line 92; used 1 times

Usage of this include

Last modified: 1996-03-22
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 3781
Valid CSS Valid XHTML 1.0 Strict