xref: /openbsd/usr.sbin/eigrpctl/parser.h (revision 956c66a0)
1 /*	$OpenBSD: parser.h,v 1.3 2016/01/15 12:57:49 renato Exp $ */
2 
3 /*
4  * Copyright (c) 2015 Renato Westphal <renato@openbsd.org>
5  * Copyright (c) 2004 Esben Norby <norby@openbsd.org>
6  * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
7  *
8  * Permission to use, copy, modify, and distribute this software for any
9  * purpose with or without fee is hereby granted, provided that the above
10  * copyright notice and this permission notice appear in all copies.
11  *
12  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
13  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
14  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
15  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
16  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
17  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
18  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19  */
20 
21 #ifndef _PARSER_H_
22 #define _PARSER_H_
23 
24 #include <sys/types.h>
25 #include <net/if.h>
26 #include <netinet/in.h>
27 
28 enum actions {
29 	NONE,
30 	FIB,
31 	FIB_COUPLE,
32 	FIB_DECOUPLE,
33 	LOG_VERBOSE,
34 	LOG_BRIEF,
35 	SHOW,
36 	SHOW_IFACE,
37 	SHOW_IFACE_DTAIL,
38 	SHOW_NBR,
39 	SHOW_TOPOLOGY,
40 	SHOW_FIB,
41 	SHOW_FIB_IFACE,
42 	SHOW_STATS,
43 	CLEAR_NBR,
44 	RELOAD
45 };
46 
47 struct parse_result {
48 	int			family;
49 	uint16_t		as;
50 	union eigrpd_addr	addr;
51 	uint8_t			prefixlen;
52 	char			ifname[IF_NAMESIZE];
53 	int			flags;
54 	enum actions		action;
55 };
56 
57 struct parse_result	*parse(int, char *[]);
58 int			 parse_asnum(const char *, uint16_t *);
59 int			 parse_addr(const char *, int *,
60     union eigrpd_addr *);
61 int			 parse_prefix(const char *, int *,
62     union eigrpd_addr *, uint8_t *);
63 
64 #endif	/* _PARSER_H_ */
65