# 2.11BSD#431 - /usr/src/libexec/popper/popper.h

##### Macros

    ALLOC_MSGS        X
    FALSE             X
    MAIL_COMMAND      X
    MAXCMDLEN         X
    MAXDROPLEN        X
    MAXHOSTNAMELEN    X
    MAXLINELEN        X
    MAXMSGLINELEN     X
    MAXPARMCOUNT      X
    MAXPARMLEN        X
    MAXUSERNAMELEN    X
    NEWLINE           X
    NULLCP            X
    POP_DEBUG         X
    POP_DROP          X
    POP_ERR           X
    POP_FACILITY      X
    POP_FAILURE       X
    POP_LOGOPTS       X
    POP_MAILDIR       X
    POP_OK            X
    POP_PRIORITY      X
    POP_SUCCESS       X
    POP_TERMINATE     X
    POP_TMPDROP       X
    POP_TMPSIZE       X
    POP_TMPXMIT       X
    SPACE             X
    TAB               X
    TRUE              X
    pop_command       X
    pop_subcommand    X
    success_state     X

       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

- in /usr/src/libexec/popper/pop_dropinfo.c line 43, 66

FALSE defined in line 25; used 3 times

- in /usr/src/libexec/popper/pop_dropinfo.c line 87-88(2)
- in /usr/src/libexec/popper/pop_rset.c line 28

MAIL_COMMAND defined in line 37; used 3 times

- in /usr/src/libexec/popper/pop_xmit.c line 68, 77, 84

MAXCMDLEN defined in line 33; never used
MAXDROPLEN defined in line 30; used 3 times

- in line 143-145(2)
- in /usr/src/libexec/popper/pop_xmit.c line 29

MAXHOSTNAMELEN defined in line 28; used 2 times

- in line 124
- in /usr/src/libexec/popper/pop_init.c line 50

MAXLINELEN defined in line 31; used 6 times

- in /usr/src/libexec/popper/pop_log.c line 21
- in /usr/src/libexec/popper/pop_msg.c line 30
- in /usr/src/libexec/popper/pop_xmit.c line 28, 54
- in /usr/src/libexec/popper/popper.c line 27, 45

MAXMSGLINELEN defined in line 32; used 7 times

- in /usr/src/libexec/popper/pop_dropinfo.c line 58
- in /usr/src/libexec/popper/pop_get_command.c line 48
- in /usr/src/libexec/popper/pop_send.c line 28, 64-67(2), 75
- in /usr/src/libexec/popper/pop_updt.c line 134

MAXPARMCOUNT defined in line 34; used 2 times

- in line 154
- in /usr/src/libexec/popper/pop_parse.c line 40

MAXPARMLEN defined in line 35; never used
MAXUSERNAMELEN defined in line 29; used 1 times

- in line 132

NEWLINE defined in line 26; used 1 times

- in /usr/src/libexec/popper/pop_send.c line 102

NULLCP defined in line 21; used 1 times

- in /usr/src/libexec/popper/pop_xmit.c line 77

POP_DEBUG defined in line 41; used 21 times

- in /usr/src/libexec/popper/pop_dele.c line 46
- in /usr/src/libexec/popper/pop_dropcopy.c line 46, 84
- in /usr/src/libexec/popper/pop_dropinfo.c line 78, 91, 104
- in /usr/src/libexec/popper/pop_get_command.c line 62-66(2)
- in /usr/src/libexec/popper/pop_msg.c line 62
- in /usr/src/libexec/popper/pop_send.c line 108
- in /usr/src/libexec/popper/pop_stat.c line 24
- in /usr/src/libexec/popper/pop_updt.c line 48-49(2), 63, 107, 121, 131
- in /usr/src/libexec/popper/pop_xmit.c line 38, 52-57(2), 68

POP_DROP defined in line 44; used 1 times

- in /usr/src/libexec/popper/pop_dropcopy.c line 42

POP_ERR defined in line 53; used 1 times

- in /usr/src/libexec/popper/pop_msg.c line 45

POP_FACILITY defined in line 39; used 1 times

- in /usr/src/libexec/popper/pop_init.c line 56

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

POP_LOGOPTS defined in line 42; used 1 times

- in /usr/src/libexec/popper/pop_init.c line 56

POP_MAILDIR defined in line 43; used 1 times

- in /usr/src/libexec/popper/pop_pass.c line 44

POP_OK defined in line 52; used 1 times

- in /usr/src/libexec/popper/pop_msg.c line 43

POP_PRIORITY defined in line 40; used 14 times

- in /usr/src/libexec/popper/pop_dropcopy.c line 59, 89
- in /usr/src/libexec/popper/pop_init.c line 73, 95, 110, 135, 151, 162, 169-174(2), 180-184(2)
- in /usr/src/libexec/popper/pop_msg.c line 67
- in /usr/src/libexec/popper/popper.c line 69

POP_SUCCESS defined in line 54; used 27 times

- in /usr/src/libexec/popper/pop_dele.c line 58
- in /usr/src/libexec/popper/pop_dropcopy.c line 156
- in /usr/src/libexec/popper/pop_dropinfo.c line 110
- in /usr/src/libexec/popper/pop_init.c line 187
- in /usr/src/libexec/popper/pop_last.c line 23
- in /usr/src/libexec/popper/pop_list.c line 45-49(2), 63
- in /usr/src/libexec/popper/pop_msg.c line 42, 61-66(2)
- in /usr/src/libexec/popper/pop_pass.c line 48-51(2), 57
- in /usr/src/libexec/popper/pop_quit.c line 26
- in /usr/src/libexec/popper/pop_rset.c line 37
- in /usr/src/libexec/popper/pop_send.c line 58, 86
- in /usr/src/libexec/popper/pop_stat.c line 26
- in /usr/src/libexec/popper/pop_updt.c line 58
- in /usr/src/libexec/popper/pop_user.c line 28
- in /usr/src/libexec/popper/pop_xmit.c line 48, 90
- in /usr/src/libexec/popper/pop_xtnd.c line 37
- in /usr/src/libexec/popper/popper.c line 33, 60, 66

POP_TERMINATE defined in line 56; used 2 times

- in /usr/src/libexec/popper/pop_send.c line 99(2)

POP_TMPDROP defined in line 49; used 1 times

- in /usr/src/libexec/popper/pop_dropcopy.c line 56

POP_TMPSIZE defined in line 50; used 1 times

- in /usr/src/libexec/popper/pop_dropcopy.c line 35

POP_TMPXMIT defined in line 51; used 1 times

- in /usr/src/libexec/popper/pop_xmit.c line 35

SPACE defined in line 22; never used
TAB defined in line 23; never used
TRUE defined in line 24; used 2 times

- in /usr/src/libexec/popper/pop_dele.c line 42
- in /usr/src/libexec/popper/pop_send.c line 54

pop_command defined in line 61; used 11 times

- in /usr/src/libexec/popper/pop_get_command.c line 61-62(2), 75, 81-86(2), 95
- in /usr/src/libexec/popper/pop_get_subcommand.c line 40, 46, 55
- in /usr/src/libexec/popper/pop_parse.c line 59
- in /usr/src/libexec/popper/pop_send.c line 46

pop_subcommand defined in line 62; used 5 times

- in /usr/src/libexec/popper/pop_get_subcommand.c line 34, 40, 46, 55
- in /usr/src/libexec/popper/pop_xtnd.c line 28

success_state defined in line 92; used 1 times

- in /usr/src/libexec/popper/popper.c line 59

#### Usage of this include

popper.h used 21 times

- in /usr/src/libexec/popper/pop_dele.c line 15
- in /usr/src/libexec/popper/pop_dropcopy.c line 19
- in /usr/src/libexec/popper/pop_dropinfo.c line 18
- in /usr/src/libexec/popper/pop_get_command.c line 15
- in /usr/src/libexec/popper/pop_get_subcommand.c line 15
- in /usr/src/libexec/popper/pop_init.c line 19
- in /usr/src/libexec/popper/pop_last.c line 14
- in /usr/src/libexec/popper/pop_list.c line 14
- in /usr/src/libexec/popper/pop_log.c line 15
- in /usr/src/libexec/popper/pop_msg.c line 16
- in /usr/src/libexec/popper/pop_parse.c line 15
- in /usr/src/libexec/popper/pop_pass.c line 16
- in /usr/src/libexec/popper/pop_quit.c line 14
- in /usr/src/libexec/popper/pop_rset.c line 14
- in /usr/src/libexec/popper/pop_send.c line 15
- in /usr/src/libexec/popper/pop_stat.c line 14
- in /usr/src/libexec/popper/pop_updt.c line 18
- in /usr/src/libexec/popper/pop_user.c line 15
- in /usr/src/libexec/popper/pop_xmit.c line 16
- in /usr/src/libexec/popper/pop_xtnd.c line 14
- in /usr/src/libexec/popper/popper.c line 14

Last modified: 1996-03-22 Generated: 2016-12-26 | Generated by src2html V0.67 page hit count: 1558 |