xref: /plan9/sys/src/cmd/upas/smtp/smtp.h (revision ab6a5be186deff04fbbe60c477b11550cd87977e)
1 enum {
2 	Maxbustedmx = 100,
3 	Maxdomain = 1024,
4 };
5 
6 typedef struct Node Node;
7 typedef struct Field Field;
8 typedef Node *Nodeptr;
9 #define YYSTYPE Nodeptr
10 
11 struct Node {
12 	Node	*next;
13 	int	c;	/* token type */
14 	char	addr;	/* true if this is an address */
15 	String	*s;	/* string representing token */
16 	String	*white;	/* white space following token */
17 	char	*start;	/* first byte for this token */
18 	char	*end;	/* next byte in input */
19 };
20 
21 struct Field {
22 	Field	*next;
23 	Node	*node;
24 	int	source;
25 };
26 
27 typedef struct DS	DS;
28 struct DS {
29 	/* dist string */
30 	char	buf[128];
31 	char	expand[128];
32 	char	*netdir;
33 	char	*proto;
34 	char	*host;
35 	char	*service;
36 };
37 
38 extern Field	*firstfield;
39 extern Field	*lastfield;
40 extern Node	*usender;
41 extern Node	*usys;
42 extern Node	*udate;
43 extern int	originator;
44 extern int	destination;
45 extern int	date;
46 extern int	debug;
47 extern int	messageid;
48 extern char	*bustedmxs[Maxbustedmx];
49 
50 Node*	address(Node*);
51 Node*	anonymous(Node*);
52 int	badfieldname(Node*);
53 Node*	bang(Node*, Node*);
54 int	cistrcmp(char*, char*);
55 Node*	colon(Node*, Node*);
56 void	dial_string_parse(char*, DS*);
57 void	freefield(Field*);
58 void	freenode(Node*);
59 Node*	link2(Node*, Node*);
60 Node*	link3(Node*, Node*, Node*);
61 int	mxdial(char*, char*, char*);
62 void	newfield(Node*, int);
63 Node*	whiten(Node*);
64 void	yycleanup(void);
65 void	yyinit(char*, int);
66 int	yylex(void);
67 int	yyparse(void);
68 String*	yywhite(void);
69