home *** CD-ROM | disk | FTP | other *** search
/ High Voltage Shareware / high1.zip / high1 / DIR3 / KA9Q212.ZIP / SMTP.H < prev    next >
C/C++ Source or Header  |  1993-07-16  |  3KB  |  103 lines

  1. /****************************************************************************
  2. *    $Id: smtp.h 1.4 93/07/16 11:50:21 ROOT_DOS Exp $
  3. *    08 May 93    1.2        GT    Fix warnings.                                    *
  4. ****************************************************************************/
  5. #ifndef    _SMTP_H
  6. #define    _SMTP_H
  7.  
  8. #define SMTPTRACE            /* enable tracing for smtp */
  9. #define MAXSESSIONS    10        /* most connections allowed */
  10. #define JOBNAME        13        /* max size of a job name with null */
  11. #define    LINELEN        256
  12. #define SLINELEN    64
  13.  
  14. #ifdef NOVELL
  15. #define MBOXLEN        25        /* max size of a mail box name */
  16. #else
  17. #define MBOXLEN        8        /* max size of a mail box name */
  18. #endif
  19.  
  20. /* types of address used by smtp in an address list */
  21. #define BADADDR    0
  22. #define LOCAL    1
  23. #define DOMAIN    2
  24.  
  25. typedef enum {NO_FAIL, FAIL_BAD, FAIL_DEFAULT, FAIL_DELIVER} failure;
  26.  
  27. /* a list entry */
  28. struct list {
  29.     struct list *next;
  30.     char *val;
  31.     char type;
  32. };
  33.  
  34. /* Per-session control block  used by smtp server */
  35. struct smtpsv {
  36.     int s;            /* the socket for this connection */
  37.     char *system;        /* Name of remote system */
  38.     char *from;        /* sender address */
  39.     struct list *to;    /* Linked list of recipients */
  40.     FILE *data;        /* Temporary input file pointer */
  41. };
  42.  
  43. /* used by smtpcli as a queue entry for a single message */
  44. struct smtp_job {
  45.     struct     smtp_job *next;    /* pointer to next mail job for this system */
  46.     char    jobname[9];    /* the prefix of the job file name */
  47.     char    *from;        /* address of sender */
  48.     struct list *to;    /* Linked list of recipients */
  49. };
  50.  
  51. /* control structure used by an smtp client session */
  52. struct smtpcli {
  53.     int     s;        /* connection socket */
  54.     int32    ipdest;        /* address of forwarding system */
  55.     char    *destname;    /* domain address of forwarding system */
  56.     char    *wname;        /* name of workfile */
  57.     char    *tname;        /* name of data file */
  58.     char    buf[LINELEN];    /* Output buffer */
  59.     char    cnt;        /* Length of input buffer */
  60.     FILE    *tfile;
  61.     struct    smtp_job *jobq;
  62.     struct    list     *errlog;    
  63.     int lock;        /* In use */
  64. };
  65.  
  66. /* smtp server routing mode */
  67. #define    QUEUE    1
  68.  
  69. #define    NULLLIST    (struct list *)0
  70. #define    NULLSMTPSV    (struct smtpsv *)0
  71. #define    NULLSMTPCLI    (struct smtpcli *)0
  72. #define NULLJOB        (struct smtp_job *)0
  73.  
  74. extern int Smtpmode;
  75. extern char *Mailspool;
  76. extern char *Maillog;
  77. extern char *Mailqdir;        /* Outgoing spool directory */
  78. extern char *Routeqdir;    /* spool directory for a router program */
  79. extern char *Mailqueue;    /* Prototype of work file */
  80. extern char *Maillock;        /* Mail system lock */
  81. extern char *Alias;        /* File of local aliases */
  82.  
  83. /* In smtpserv.c: */
  84. char *ptime __ARGS((long *t));
  85. long get_msgid __ARGS((void));
  86. char *getname __ARGS((char *cp));
  87. int validate_address __ARGS((char *s));
  88. int queuejob __ARGS((FILE *dfile,char *host,struct list *to,char *from,int32 *msgid));
  89. struct list *addlist __ARGS((struct list **head,char *val,int type));
  90. int mdaemon __ARGS((FILE *data,char *to,struct list *lp,int bounce));
  91.  
  92. /* In smtpcli.c: */
  93. int smtptick __ARGS((void *t));
  94. int mlock __ARGS((char *dir,char *id));
  95. int rmlock __ARGS((char *dir,char *id));
  96. int mlock_suffix __ARGS((char *dir,char *id,char *suffix));
  97. int rmlock_suffix __ARGS((char *dir,char *id,char *suffix));
  98. void del_list __ARGS((struct list *lp));
  99. int32 mailroute __ARGS((char *dest, int32 gateway));
  100. void delay_job __ARGS((int32 msgid));
  101.  
  102. #endif    /* _SMTP_H */
  103.