1295Seric /*
2406Seric **  DLVRMAIL.H -- Global definitions for delivermail.
3295Seric **
4295Seric **	Most of these are actually allocated in globals.c
5295Seric **
6*1390Seric **	@(#)sendmail.h	1.5	10/11/80
7295Seric */
8295Seric 
9295Seric 
10295Seric 
11295Seric 
12*1390Seric # include "useful.h"
13*1390Seric 
14295Seric /*
15295Seric **  Manifest constants.
16295Seric */
17295Seric 
18295Seric # define MAXLINE	256	/* maximum line length */
19295Seric # define MAXNAME	128	/* maximum length of a name */
201379Seric # define MAXFIELD	2500	/* maximum total length of a header field */
21295Seric # define MAXPV		15	/* maximum # of parms to mailers */
22295Seric # define MAXHOP		30	/* maximum value of HopCount */
23295Seric 
24295Seric 
25295Seric 
26295Seric 
27295Seric 
28295Seric /*
29295Seric **  Mailer definition structure.
30295Seric **	Every mailer known to the system is declared in this
31295Seric **	structure.  It defines the pathname of the mailer, some
32295Seric **	flags associated with it, and the argument vector to
33*1390Seric **	pass to it.  The flags are defined in conf.c
34295Seric **
35295Seric **	The argument vector is expanded before actual use.  Every-
36295Seric **	thing is passed through except for things starting with "$".
37*1390Seric **	"$x" defines some interpolation, as described in conf.c
38295Seric **	"$x" where x is unknown expands to "x", so use "$$" to get "$".
39295Seric */
40295Seric 
41295Seric struct mailer
42295Seric {
43295Seric 	char	*m_mailer;	/* pathname of the mailer to use */
44295Seric 	short	m_flags;	/* status flags, see below */
45295Seric 	short	m_badstat;	/* the status code to use on unknown error */
46295Seric 	char	**m_local;	/* list of local names for this host */
47295Seric 	char	*m_argv[MAXPV];	/* template argument vector */
48295Seric };
49295Seric 
50295Seric # define M_FOPT		0001	/* mailer takes picky -f flag */
51295Seric # define M_ROPT		0002	/* mailer takes picky -r flag */
52295Seric # define M_QUIET	0004	/* don't print error on bad status */
53295Seric # define M_RESTR	0010	/* must be daemon to execute */
54295Seric # define M_HDR		0020	/* insert From line */
55295Seric # define M_NOHOST	0040	/* ignore host in comparisons */
56295Seric # define M_STRIPQ	0100	/* strip quote characters from user/host */
57295Seric 
58295Seric extern struct mailer Mailer[];
59295Seric 
60295Seric 
61295Seric /*
62295Seric **  Address structure.
63295Seric **	Addresses are stored internally in this structure.
64295Seric */
65295Seric 
66295Seric struct address
67295Seric {
68295Seric 	char		*q_paddr;	/* the printname for the address */
69295Seric 	char		*q_user;	/* user name */
70295Seric 	char		*q_host;	/* host name */
71295Seric 	struct mailer	*q_mailer;	/* mailer to use */
72295Seric 	struct address	*q_next;	/* chain */
73295Seric 	struct address	*q_prev;	/* back pointer */
74295Seric };
75295Seric 
76295Seric typedef struct address addrq;
77295Seric 
78295Seric /* some other primitives */
79295Seric # define nxtinq(q)	((q)->q_next)
80295Seric # define clearq(q)	(q)->q_next = (q)->q_prev = NULL
81295Seric 
82295Seric extern addrq SendQ;		/* queue of people to send to */
83295Seric extern addrq AliasQ;		/* queue of people that are aliases */
84295Seric 
85295Seric 
86295Seric /*
87295Seric **  Parse structure.
88295Seric **	This table drives the parser which determines the network
89295Seric **	to send the mail to.
90295Seric */
91295Seric 
92295Seric struct parsetab
93295Seric {
94295Seric 	char	p_char;		/* trigger character */
95295Seric 	char	p_mailer;	/* the index of the mailer to call */
96295Seric 	short	p_flags;	/* see below */
97295Seric 	char	*p_arg;		/* extra info needed for some flags */
98295Seric };
99295Seric 
100295Seric # define P_MAP		0001	/* map p_char -> p_arg[0] */
101295Seric # define P_HLAST	0002	/* host is last, & right associative */
102295Seric # define P_ONE		0004	/* can only be one p_char in addr */
103295Seric # define P_MOVE		0010	/* send untouched to host p_arg */
104295Seric # define P_USR_UPPER	0020	/* don't map UPPER->lower in user names */
105295Seric # define P_HST_UPPER	0040	/* don't map UPPER->lower in host names */
106295Seric 
107295Seric 
108295Seric 
109295Seric 
110295Seric /*
111295Seric **  Global variables.
112295Seric */
113295Seric 
114*1390Seric extern bool	ArpaFmt;	/* if set, message is in arpanet fmt */
115*1390Seric extern bool	FromFlag;	/* if set, "From" person is explicit */
116*1390Seric extern bool	Debug;		/* if set, debugging info */
117*1390Seric extern bool	MailBack;	/* mail back response on error */
118*1390Seric extern bool	BerkNet;	/* called from BerkNet */
119*1390Seric extern bool	WriteBack;	/* write back response on error */
120*1390Seric extern bool	NoAlias;	/* if set, don't do any aliasing */
121*1390Seric extern bool	ForceMail;	/* if set, mail even if already got a copy */
122*1390Seric extern bool	MeToo;		/* send to the sender also */
123*1390Seric extern bool	Error;		/* set if errors */
124*1390Seric extern bool	UseMsgId;	/* put msg-id's in all msgs [conf.c] */
125*1390Seric extern bool	IgnrDot;	/* don't let dot end messages */
126*1390Seric extern bool	SaveFrom;	/* save leading "From" lines */
127295Seric extern int	ExitStat;	/* exit status code */
128295Seric extern char	InFileName[];	/* input file name */
129295Seric extern char	Transcript[];	/* the transcript file name */
130*1390Seric extern char	MsgId[];	/* the message id for this message */
131295Seric extern addrq	From;		/* the person it is from */
132295Seric extern char	*To;		/* the target person */
133295Seric extern int	HopCount;	/* hop count */
134295Seric 
135295Seric 
136295Seric # include	<sysexits.h>
137295Seric 
138295Seric # define flagset(bits, word)	((bits) & (word))
139295Seric # define setstat(s)		{ if (ExitStat == EX_OK) ExitStat = s; }
140