xref: /openbsd-src/usr.sbin/relayctl/parser.h (revision 43003dfe3ad45d1698bed8a37f2b0f5b14f20d4f)
1 /*	$OpenBSD: parser.h,v 1.10 2009/08/17 11:36:01 reyk Exp $	*/
2 
3 /*
4  * Copyright (c) 2006 Pierre-Yves Ritschard <pyr@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 enum actions {
20 	NONE,
21 	SHOW_SUM,
22 	SHOW_HOSTS,
23 	SHOW_RDRS,
24 	SHOW_RELAYS,
25 	SHOW_SESSIONS,
26 	SHOW_ROUTERS,
27 	RDR_DISABLE,
28 	RDR_ENABLE,
29 	TABLE_DISABLE,
30 	TABLE_ENABLE,
31 	HOST_DISABLE,
32 	HOST_ENABLE,
33 	SHUTDOWN,
34 	POLL,
35 	RELOAD,
36 	MONITOR
37 };
38 
39 struct parse_result {
40 	struct ctl_id	id;
41 	enum actions	action;
42 };
43 
44 struct parse_result	*parse(int, char *[]);
45 const struct token      *match_token(const char *, const struct token []);
46 void                     show_valid_args(const struct token []);
47