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