xref: /openbsd-src/usr.sbin/dvmrpctl/parser.h (revision 6be5843ec61e3a3d3891b84615bd5eb6f8c55d63)
1*6be5843eStedu /*	$OpenBSD: parser.h,v 1.4 2010/09/04 21:31:04 tedu Exp $ */
289189827Snorby 
389189827Snorby /*
489189827Snorby  * Copyright (c) 2004, 2005, 2006 Esben Norby <norby@openbsd.org>
589189827Snorby  * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
689189827Snorby  *
789189827Snorby  * Permission to use, copy, modify, and distribute this software for any
889189827Snorby  * purpose with or without fee is hereby granted, provided that the above
989189827Snorby  * copyright notice and this permission notice appear in all copies.
1089189827Snorby  *
1189189827Snorby  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
1289189827Snorby  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
1389189827Snorby  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
1489189827Snorby  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
1589189827Snorby  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
1689189827Snorby  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
1789189827Snorby  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1889189827Snorby  */
1989189827Snorby 
2089189827Snorby #ifndef _PARSER_H_
2189189827Snorby #define _PARSER_H_
2289189827Snorby 
2389189827Snorby #include <sys/types.h>
2489189827Snorby #include <net/if.h>
2589189827Snorby #include <netinet/in.h>
2689189827Snorby 
2789189827Snorby enum actions {
2889189827Snorby 	NONE,
2989189827Snorby 	SHOW,
3089189827Snorby 	SHOW_SUM,
3189189827Snorby 	SHOW_IFACE,
3289189827Snorby 	SHOW_IFACE_DTAIL,
3389189827Snorby 	SHOW_IGMP,
3489189827Snorby 	SHOW_NBR,
3589189827Snorby 	SHOW_NBR_DTAIL,
3689189827Snorby 	SHOW_RIB,
3789189827Snorby 	SHOW_RIB_DTAIL,
3889189827Snorby 	SHOW_MFC,
3989189827Snorby 	SHOW_MFC_DTAIL,
40c3319070Sclaudio 	LOG_VERBOSE,
41c3319070Sclaudio 	LOG_BRIEF,
4289189827Snorby 	RELOAD
4389189827Snorby };
4489189827Snorby 
4589189827Snorby struct parse_result {
4689189827Snorby 	struct in_addr	addr;
4789189827Snorby 	char		ifname[IF_NAMESIZE];
4889189827Snorby 	int		flags;
4989189827Snorby 	enum actions	action;
5089189827Snorby 	u_int8_t	prefixlen;
5189189827Snorby };
5289189827Snorby 
5389189827Snorby struct parse_result	*parse(int, char *[]);
5489189827Snorby int			 parse_addr(const char *, struct in_addr *);
5589189827Snorby int			 parse_prefix(const char *, struct in_addr *,
5689189827Snorby 			     u_int8_t *);
5789189827Snorby 
5889189827Snorby #endif	/* _PARSER_H_ */
59