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