xref: /openbsd/usr.sbin/radiusctl/parser.h (revision 4cfece93)
1 /*	$OpenBSD: parser.h,v 1.2 2020/02/24 07:07:11 dlg Exp $	*/
2 
3 /* This file is derived from OpenBSD:src/usr.sbin/ikectl/parser.h 1.9 */
4 /*
5  * Copyright (c) 2007, 2008 Reyk Floeter <reyk@vantronix.net>
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 _RADIUSCTL_PARSER_H
21 #define _RADIUSCTL_PARSER_H
22 
23 enum actions {
24 	NONE,
25 	TEST
26 };
27 
28 enum auth_method {
29 	PAP,
30 	CHAP,
31 	MSCHAPV2
32 };
33 
34 #define TEST_TRIES_MIN		1
35 #define TEST_TRIES_MAX		32
36 #define TEST_TRIES_DEFAULT	3
37 
38 #define TEST_INTERVAL_MIN	1
39 #define TEST_INTERVAL_MAX	10
40 #define TEST_INTERVAL_DEFAULT	2
41 
42 #define TEST_MAXWAIT_MIN	3
43 #define TEST_MAXWAIT_MAX	60
44 #define TEST_MAXWAIT_DEFAULT	8
45 
46 struct parse_result {
47 	enum actions		 action;
48 	const char		*hostname;
49 	const char		*secret;
50 	const char		*username;
51 	const char		*password;
52 	u_short			 port;
53 	int			 nas_port;
54 	enum auth_method	 auth_method;
55 
56 	/* number of packets to try sending */
57 	unsigned int		 tries;
58 	/* how long between packet sends */
59 	struct timeval		 interval;
60 	/* overall process wait time for a reply */
61 	struct timeval		 maxwait;
62 };
63 
64 struct parse_result	*parse(int, char *[]);
65 
66 #endif /* _RADIUSCTL_PARSER_H */
67