xref: /openbsd-src/usr.sbin/smtpd/parser.h (revision 5b6a9ce9a8f744a2fbc4a4d3dd835996013212f1)
1*5b6a9ce9Seric /*	$OpenBSD: parser.h,v 1.29 2014/02/04 15:22:39 eric Exp $	*/
2c4f9d530Sgilles 
3c4f9d530Sgilles /*
47a7bc169Seric  * Copyright (c) 2013 Eric Faurot	<eric@openbsd.org>
5c4f9d530Sgilles  *
6c4f9d530Sgilles  * Permission to use, copy, modify, and distribute this software for any
7c4f9d530Sgilles  * purpose with or without fee is hereby granted, provided that the above
8c4f9d530Sgilles  * copyright notice and this permission notice appear in all copies.
9c4f9d530Sgilles  *
10c4f9d530Sgilles  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11c4f9d530Sgilles  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12c4f9d530Sgilles  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13c4f9d530Sgilles  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14c4f9d530Sgilles  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15c4f9d530Sgilles  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16c4f9d530Sgilles  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17c4f9d530Sgilles  */
18c4f9d530Sgilles 
197a7bc169Seric enum {
207a7bc169Seric 	P_TOKEN,
217a7bc169Seric 	P_STR,
227a7bc169Seric 	P_INT,
237a7bc169Seric 	P_MSGID,
247a7bc169Seric 	P_EVPID,
257a7bc169Seric 	P_ROUTEID,
26*5b6a9ce9Seric 	P_ADDR,
2765c4fdfbSgilles };
2865c4fdfbSgilles 
297a7bc169Seric struct parameter {
307a7bc169Seric 	int	type;
317a7bc169Seric 	union {
327a7bc169Seric 		const char	*u_str;
337a7bc169Seric 		int		 u_int;
347a7bc169Seric 		uint32_t	 u_msgid;
357a7bc169Seric 		uint64_t	 u_evpid;
367a7bc169Seric 		uint64_t	 u_routeid;
37*5b6a9ce9Seric 		struct sockaddr_storage u_ss;
387a7bc169Seric 	} u;
39c4f9d530Sgilles };
40c4f9d530Sgilles 
417a7bc169Seric int cmd_install(const char *, int (*)(int, struct parameter *));
427a7bc169Seric int cmd_run(int, char **);
437a7bc169Seric int cmd_show_params(int argc, struct parameter *argv);
44