1 /*
2 **  DLVRMAIL.H -- Global definitions for delivermail.
3 **
4 **	Most of these are actually allocated in globals.c
5 **
6 **	@(#)sendmail.h	1.5	10/11/80
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 
24 
25 
26 
27 
28 /*
29 **  Mailer definition structure.
30 **	Every mailer known to the system is declared in this
31 **	structure.  It defines the pathname of the mailer, some
32 **	flags associated with it, and the argument vector to
33 **	pass to it.  The flags are defined in conf.c
34 **
35 **	The argument vector is expanded before actual use.  Every-
36 **	thing is passed through except for things starting with "$".
37 **	"$x" defines some interpolation, as described in conf.c
38 **	"$x" where x is unknown expands to "x", so use "$$" to get "$".
39 */
40 
41 struct mailer
42 {
43 	char	*m_mailer;	/* pathname of the mailer to use */
44 	short	m_flags;	/* status flags, see below */
45 	short	m_badstat;	/* the status code to use on unknown error */
46 	char	**m_local;	/* list of local names for this host */
47 	char	*m_argv[MAXPV];	/* template argument vector */
48 };
49 
50 # define M_FOPT		0001	/* mailer takes picky -f flag */
51 # define M_ROPT		0002	/* mailer takes picky -r flag */
52 # define M_QUIET	0004	/* don't print error on bad status */
53 # define M_RESTR	0010	/* must be daemon to execute */
54 # define M_HDR		0020	/* insert From line */
55 # define M_NOHOST	0040	/* ignore host in comparisons */
56 # define M_STRIPQ	0100	/* strip quote characters from user/host */
57 
58 extern struct mailer Mailer[];
59 
60 
61 /*
62 **  Address structure.
63 **	Addresses are stored internally in this structure.
64 */
65 
66 struct address
67 {
68 	char		*q_paddr;	/* the printname for the address */
69 	char		*q_user;	/* user name */
70 	char		*q_host;	/* host name */
71 	struct mailer	*q_mailer;	/* mailer to use */
72 	struct address	*q_next;	/* chain */
73 	struct address	*q_prev;	/* back pointer */
74 };
75 
76 typedef struct address addrq;
77 
78 /* some other primitives */
79 # define nxtinq(q)	((q)->q_next)
80 # define clearq(q)	(q)->q_next = (q)->q_prev = NULL
81 
82 extern addrq SendQ;		/* queue of people to send to */
83 extern addrq AliasQ;		/* queue of people that are aliases */
84 
85 
86 /*
87 **  Parse structure.
88 **	This table drives the parser which determines the network
89 **	to send the mail to.
90 */
91 
92 struct parsetab
93 {
94 	char	p_char;		/* trigger character */
95 	char	p_mailer;	/* the index of the mailer to call */
96 	short	p_flags;	/* see below */
97 	char	*p_arg;		/* extra info needed for some flags */
98 };
99 
100 # define P_MAP		0001	/* map p_char -> p_arg[0] */
101 # define P_HLAST	0002	/* host is last, & right associative */
102 # define P_ONE		0004	/* can only be one p_char in addr */
103 # define P_MOVE		0010	/* send untouched to host p_arg */
104 # define P_USR_UPPER	0020	/* don't map UPPER->lower in user names */
105 # define P_HST_UPPER	0040	/* don't map UPPER->lower in host names */
106 
107 
108 
109 
110 /*
111 **  Global variables.
112 */
113 
114 extern bool	ArpaFmt;	/* if set, message is in arpanet fmt */
115 extern bool	FromFlag;	/* if set, "From" person is explicit */
116 extern bool	Debug;		/* if set, debugging info */
117 extern bool	MailBack;	/* mail back response on error */
118 extern bool	BerkNet;	/* called from BerkNet */
119 extern bool	WriteBack;	/* write back response on error */
120 extern bool	NoAlias;	/* if set, don't do any aliasing */
121 extern bool	ForceMail;	/* if set, mail even if already got a copy */
122 extern bool	MeToo;		/* send to the sender also */
123 extern bool	Error;		/* set if errors */
124 extern bool	UseMsgId;	/* put msg-id's in all msgs [conf.c] */
125 extern bool	IgnrDot;	/* don't let dot end messages */
126 extern bool	SaveFrom;	/* save leading "From" lines */
127 extern int	ExitStat;	/* exit status code */
128 extern char	InFileName[];	/* input file name */
129 extern char	Transcript[];	/* the transcript file name */
130 extern char	MsgId[];	/* the message id for this message */
131 extern addrq	From;		/* the person it is from */
132 extern char	*To;		/* the target person */
133 extern int	HopCount;	/* hop count */
134 
135 
136 # include	<sysexits.h>
137 
138 # define flagset(bits, word)	((bits) & (word))
139 # define setstat(s)		{ if (ExitStat == EX_OK) ExitStat = s; }
140