xref: /openbsd-src/usr.sbin/bgpctl/parser.h (revision d13be5d47e4149db2549a9828e244d59dbc43f15)
1 /*	$OpenBSD: parser.h,v 1.22 2010/05/03 13:11:41 claudio Exp $ */
2 
3 /*
4  * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
5  *
6  * Permission to use, copy, modify, and distribute this software for any
7  * purpose with or without fee is hereby granted, provided that the above
8  * copyright notice and this permission notice appear in all copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17  */
18 
19 #include <sys/types.h>
20 
21 #include "bgpd.h"
22 
23 enum actions {
24 	NONE,
25 	SHOW,
26 	SHOW_SUMMARY,
27 	SHOW_SUMMARY_TERSE,
28 	SHOW_NEIGHBOR,
29 	SHOW_NEIGHBOR_TIMERS,
30 	SHOW_NEIGHBOR_TERSE,
31 	SHOW_FIB,
32 	SHOW_FIB_TABLES,
33 	SHOW_RIB,
34 	SHOW_RIB_MEM,
35 	SHOW_NEXTHOP,
36 	SHOW_INTERFACE,
37 	RELOAD,
38 	FIB,
39 	FIB_COUPLE,
40 	FIB_DECOUPLE,
41 	LOG_VERBOSE,
42 	LOG_BRIEF,
43 	NEIGHBOR,
44 	NEIGHBOR_UP,
45 	NEIGHBOR_DOWN,
46 	NEIGHBOR_CLEAR,
47 	NEIGHBOR_RREFRESH,
48 	NETWORK_ADD,
49 	NETWORK_REMOVE,
50 	NETWORK_FLUSH,
51 	NETWORK_SHOW,
52 	IRRFILTER
53 };
54 
55 struct parse_result {
56 	struct bgpd_addr	 addr;
57 	struct bgpd_addr	 peeraddr;
58 	struct filter_as	 as;
59 	struct filter_set_head	 set;
60 	struct filter_community  community;
61 	char			 peerdesc[PEER_DESCR_LEN];
62 	char			 rib[PEER_DESCR_LEN];
63 	char			*irr_outdir;
64 	int			 flags;
65 	u_int			 rtableid;
66 	enum actions		 action;
67 	u_int8_t		 prefixlen;
68 	u_int8_t		 aid;
69 };
70 
71 __dead void		 usage(void);
72 struct parse_result	*parse(int, char *[]);
73