xref: /openbsd/usr.sbin/radiusd/radiusd.h (revision d89ec533)
1 /*	$OpenBSD: radiusd.h,v 1.4 2019/04/03 11:54:56 yasuoka Exp $	*/
2 
3 #ifndef	RADIUSD_H
4 #define	RADIUSD_H 1
5 /*
6  * Copyright (c) 2013 Internet Initiative Japan Inc.
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 #include <stdbool.h>
21 
22 #define	RADIUSD_MODULE_NAME_LEN		32
23 #define	RADIUSD_SECRET_MAX		128
24 #define	RADIUSD_USER			"_radiusd"
25 
26 enum imsg_type {
27 	IMSG_NONE = 0,
28 	IMSG_OK,
29 	IMSG_NG,
30 	IMSG_RADIUSD_MODULE_LOAD,
31 	IMSG_RADIUSD_MODULE_SET_CONFIG,
32 	IMSG_RADIUSD_MODULE_START,
33 	IMSG_RADIUSD_MODULE_NOTIFY_SECRET,
34 	IMSG_RADIUSD_MODULE_USERPASS,
35 	IMSG_RADIUSD_MODULE_USERPASS_OK,
36 	IMSG_RADIUSD_MODULE_USERPASS_FAIL,
37 	IMSG_RADIUSD_MODULE_ACCSREQ,
38 	/* Check the response's authenticator if the module doesn't */
39 	IMSG_RADIUSD_MODULE_ACCSREQ_ANSWER,
40 	IMSG_RADIUSD_MODULE_ACCSREQ_ABORTED,
41 	IMSG_RADIUSD_MODULE_STOP
42 };
43 
44 /* Module sends LOAD when it becomes ready */
45 struct radiusd_module_load_arg {
46 	uint32_t	cap;	/* module capabity bits */
47 #define RADIUSD_MODULE_CAP_USERPASS	0x1
48 #define RADIUSD_MODULE_CAP_ACCSREQ	0x2
49 };
50 
51 struct radiusd_module_object {
52 	size_t	size;
53 };
54 
55 struct radiusd_module_set_arg {
56 	char	paramname[32];
57 	u_int	nparamval;
58 };
59 
60 struct radiusd_module_userpass_arg {
61 	u_int	q_id;
62 	bool	has_pass;
63 	char	user[256];
64 	char	pass[256];
65 };
66 
67 struct radiusd_module_radpkt_arg {
68 	u_int	q_id;
69 	bool	final;
70 	int	pktlen;		/* total length of radpkt */
71 };
72 
73 #endif
74