1 /* 2 ** POSTBOX.H -- Global definitions for postbox. 3 ** 4 ** Most of these are actually allocated in globals.c 5 ** 6 ** @(#)sendmail.h 3.2 03/07/81 7 */ 8 9 10 11 12 # include "useful.h" 13 14 /* 15 ** Manifest constants. 16 */ 17 18 # define MAXLINE 256 /* maximum line length */ 19 # define MAXNAME 128 /* maximum length of a name */ 20 # define MAXFIELD 2500 /* maximum total length of a header field */ 21 # define MAXPV 15 /* maximum # of parms to mailers */ 22 # define MAXHOP 30 /* maximum value of HopCount */ 23 # define ALIASFILE "/usr/lib/aliases" /* location of alias file */ 24 25 26 27 28 29 /* 30 ** Mailer definition structure. 31 ** Every mailer known to the system is declared in this 32 ** structure. It defines the pathname of the mailer, some 33 ** flags associated with it, and the argument vector to 34 ** pass to it. The flags are defined in conf.c 35 ** 36 ** The host map is a list of lists of strings. Within each 37 ** list, any host is mapped to the last host in the list. 38 ** This allows multiple names, as well as doing clever 39 ** mail grouping in point-to-point networks. Note: this 40 ** is only used internally, so the apparent host is still 41 ** kept around. 42 ** 43 ** The argument vector is expanded before actual use. Every- 44 ** thing is passed through except for things starting with "$". 45 ** "$x" defines some interpolation, as described in conf.c 46 ** "$x" where x is unknown expands to "x", so use "$$" to get "$". 47 */ 48 49 struct mailer 50 { 51 char *m_mailer; /* pathname of the mailer to use */ 52 short m_flags; /* status flags, see below */ 53 short m_badstat; /* the status code to use on unknown error */ 54 char **m_local; /* list of local names for this host */ 55 char *m_from; /* pattern for From: header */ 56 char ***m_hmap; /* host map */ 57 char *m_argv[MAXPV]; /* template argument vector */ 58 }; 59 60 # define M_FOPT 000001 /* mailer takes picky -f flag */ 61 # define M_ROPT 000002 /* mailer takes picky -r flag */ 62 # define M_QUIET 000004 /* don't print error on bad status */ 63 # define M_RESTR 000010 /* must be daemon to execute */ 64 # define M_HDR 000020 /* insert From line */ 65 # define M_NOHOST 000040 /* ignore host in comparisons */ 66 # define M_STRIPQ 000100 /* strip quote characters from user/host */ 67 # define M_FHDR 000200 /* force good From line */ 68 # define M_NEEDFROM 000400 /* need arpa-style From: line */ 69 # define M_NEEDDATE 001000 /* need arpa-style Date: line */ 70 # define M_MSGID 002000 /* need Message-Id: field */ 71 # define M_COMMAS 004000 /* need comma-seperated address lists */ 72 73 # define M_ARPAFMT (M_NEEDDATE|M_NEEDFROM|M_MSGID|M_COMMAS) 74 75 extern struct mailer Mailer[]; 76 77 78 /* 79 ** Address structure. 80 ** Addresses are stored internally in this structure. 81 */ 82 83 struct address 84 { 85 char *q_paddr; /* the printname for the address */ 86 char *q_user; /* user name */ 87 char *q_host; /* host name */ 88 struct mailer *q_mailer; /* mailer to use */ 89 struct address *q_next; /* chain */ 90 struct address *q_prev; /* back pointer */ 91 }; 92 93 typedef struct address ADDRESS; 94 95 /* some other primitives */ 96 # define nxtinq(q) ((q)->q_next) 97 # define clearq(q) (q)->q_next = (q)->q_prev = NULL 98 99 extern ADDRESS SendQ; /* queue of people to send to */ 100 extern ADDRESS AliasQ; /* queue of people that are aliases */ 101 102 103 /* 104 ** Parse structure. 105 ** This table drives the parser which determines the network 106 ** to send the mail to. 107 */ 108 109 struct parsetab 110 { 111 char p_char; /* trigger character */ 112 char p_mailer; /* the index of the mailer to call */ 113 short p_flags; /* see below */ 114 char *p_arg; /* extra info needed for some flags */ 115 }; 116 117 # define P_MAP 0001 /* map p_char -> p_arg[0] */ 118 # define P_HLAST 0002 /* host is last, & right associative */ 119 # define P_ONE 0004 /* can only be one p_char in addr */ 120 # define P_MOVE 0010 /* send untouched to host p_arg */ 121 # define P_USR_UPPER 0020 /* don't map UPPER->lower in user names */ 122 # define P_HST_UPPER 0040 /* don't map UPPER->lower in host names */ 123 124 125 /* 126 ** Header structure. 127 ** This structure is used internally to store header items. 128 */ 129 130 struct header 131 { 132 char *h_field; /* the name of the field */ 133 char *h_value; /* the value of that field */ 134 struct header *h_link; /* the next header */ 135 short h_flags; /* status bits, see below */ 136 }; 137 138 typedef struct header HDR; 139 140 extern HDR *Header; /* head of header list */ 141 142 /* 143 ** Header information structure. 144 ** Defined in conf.c, this struct declares the header fields 145 ** that have some magic meaning. 146 */ 147 148 struct hdrinfo 149 { 150 char *hi_field; /* the name of the field */ 151 short hi_flags; /* status bits, see below */ 152 }; 153 154 extern struct hdrinfo HdrInfo[]; 155 156 /* bits for h_flags and hi_flags */ 157 # define H_CONCAT 00001 /* comma-concat multiple fields */ 158 # define H_DELETE 00002 /* don't send this field */ 159 # define H_DEFAULT 00004 /* if another value is found, drop this */ 160 # define H_USED 00010 /* indicates that this has been output */ 161 162 163 164 165 /* 166 ** Global variables. 167 */ 168 169 extern bool ArpaFmt; /* if set, message is in arpanet fmt */ 170 extern bool FromFlag; /* if set, "From" person is explicit */ 171 extern bool Debug; /* if set, debugging info */ 172 extern bool MailBack; /* mail back response on error */ 173 extern bool BerkNet; /* called from BerkNet */ 174 extern bool WriteBack; /* write back response on error */ 175 extern bool NoAlias; /* if set, don't do any aliasing */ 176 extern bool ForceMail; /* if set, mail even if already got a copy */ 177 extern bool MeToo; /* send to the sender also */ 178 extern bool UseMsgId; /* put msg-id's in all msgs [conf.c] */ 179 extern bool IgnrDot; /* don't let dot end messages */ 180 extern bool SaveFrom; /* save leading "From" lines */ 181 extern int Errors; /* set if errors */ 182 extern int ExitStat; /* exit status code */ 183 extern char InFileName[]; /* input file name */ 184 extern char Transcript[]; /* the transcript file name */ 185 extern char *MsgId; /* the message id for this message */ 186 extern char *Date; /* origination date (UNIX format) */ 187 extern ADDRESS From; /* the person it is from */ 188 extern char *To; /* the target person */ 189 extern int HopCount; /* hop count */ 190 191 192 # include <sysexits.h> 193 194 # define setstat(s) { if (ExitStat == EX_OK) ExitStat = s; } 195