home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 3 / PDCD_3.iso / internet / tcpipsrc / h / if / SMTP < prev    next >
Text File  |  1995-02-21  |  4KB  |  116 lines

  1. #define SMTPTRACE       1               /* enable tracing for smtp */
  2. #define MAXSESSIONS     10              /* most connections allowed */
  3. #define JOBNAME         13              /* max size of a job name with null */
  4. #define LINELEN         512
  5. #define SLINELEN        32
  6. #define MBOXLEN         10              /* max size of a mail box name */
  7.  
  8.  
  9. /* types of address used by smtp in an address list */
  10. #define BADADDR 0
  11. #define LOCAL   1
  12. #define DOMAIN  2
  13.  
  14. /* a list entry */
  15. struct list {
  16.         struct list *next;
  17.         char *val;
  18.         char type;
  19. };
  20.  
  21.  
  22. /* Per-session control block  used by smtp server */
  23. struct mail {
  24.         struct tcb *tcb;        /* TCP control block pointer */
  25.         char state;
  26. #define COMMAND_STATE   0
  27. #define DATA_STATE      1
  28.         char *system;           /* Name of remote system */
  29.         char *from;             /* sender address */
  30.         struct list *to;        /* Linked list of recipients */
  31.         char buf[LINELEN];      /* Input buffer */
  32.         int  cnt;               /* Length of input buffer */
  33.         FILE *data;             /* Temporary input file pointer */
  34. };
  35.  
  36. /* used by smtpcli as a queue entry for a single message */
  37. struct smtp_job {
  38.         struct  smtp_job *next; /* pointer to next mail job for this system */
  39.         char    jobname[9];     /* the prefix of the job file name */
  40.         char    *from;          /* address of sender */
  41.         struct list *to;        /* Linked list of recipients */
  42. };
  43.  
  44. /* control structure used by an smtp client session */
  45. struct smtp_cb {
  46.         struct tcb *tcb;        /* tcp task control buffer */
  47.         int32   ipdest;         /* address of forwarding system */
  48.         char     state;         /* state machine placeholder */
  49. #define CLI_INIT_STATE  0
  50. #define CLI_OPEN_STATE  1
  51. #define CLI_HELO_STATE  2
  52. #define CLI_MAIL_STATE  3
  53. #define CLI_RCPT_STATE  4
  54. #define CLI_SEND_STATE  5
  55. #define CLI_UNLK_STATE  6
  56. #define CLI_QUIT_STATE  7
  57. #define CLI_IDLE_STATE  8
  58.         char    *wname;         /* name of workfile */
  59.         char    *tname;         /* name of data file */
  60.         char    buf[LINELEN];   /* Input buffer */
  61.         int     cnt;            /* Length of input buffer */
  62.         FILE    *tfile;
  63.         struct  smtp_job *jobq;
  64.         char    goodrcpt;       /* are any of the rcpt ok */
  65.         char    cts;            /* clear to send state indication */
  66.         int     rcpts;          /* number of unacked rcpt commands */
  67.         struct  list    *errlog;
  68. };
  69.  
  70. /* smpt server routing mode */
  71. #define QUEUE   1
  72.  
  73. #define NULLLIST        (struct list *)0
  74. #define NULLMAIL        (struct mail *)0
  75. #define NULLCB          (struct smtp_cb *)0
  76. #define NULLJOB         (struct smtp_job *)0
  77.  
  78.  
  79. extern char mailspool[];
  80. extern char mailqdir[];         /* Outgoing spool directory */
  81. extern char routeqdir[];        /* spool directory for a router program */
  82. extern char mailqueue[];        /* Prototype of work file */
  83. extern char hostname[];
  84. extern char alias[];
  85. extern int smtpmode;
  86.  
  87. #define sep_UNIX  0
  88. #define sep_CTLA  1
  89. #define sep_RNEWS 2
  90. #define sep_RMAIL 3
  91.  
  92. extern int smtp_sep;
  93.  
  94. /* In SMTPCLI */
  95. int dosmtp(int, char **);
  96. int smtptick(void);
  97. void smtp_transaction(struct smtp_cb *);
  98. int mlock(char *, char *);
  99. int rmlock(char *, char *);
  100. void del_job(struct smtp_job *);
  101. void del_list(struct list *);
  102. struct smtp_job *setupjob(struct smtp_cb *, char *, char *);
  103. int32 mailroute(char *);
  104.  
  105. /* In SMTPSERV */
  106. int smtp1(int, char **);
  107. int smtp0(void);
  108. int mailit(struct tcb *, FILE *, char *, struct list *);
  109. char *ptime(time_t *);
  110. long get_msgid(void);
  111. int validate_address(char *);
  112. int queuejob(struct tcb *, FILE *, char *, char *, char *);
  113. int router_queue(struct tcb *, FILE *, char *, struct list *);
  114. struct list *addlist(struct list **, char *, int);
  115. struct list *expandalias(struct list **, char *);
  116.