xref: /freebsd/contrib/wpa/src/radius/radius_das.h (revision f4b37ed0f8b307b1f3f0f630ca725d68f1dff30d)
1 /*
2  * RADIUS Dynamic Authorization Server (DAS)
3  * Copyright (c) 2012, Jouni Malinen <j@w1.fi>
4  *
5  * This software may be distributed under the terms of the BSD license.
6  * See README for more details.
7  */
8 
9 #ifndef RADIUS_DAS_H
10 #define RADIUS_DAS_H
11 
12 struct radius_das_data;
13 
14 enum radius_das_res {
15 	RADIUS_DAS_SUCCESS,
16 	RADIUS_DAS_NAS_MISMATCH,
17 	RADIUS_DAS_SESSION_NOT_FOUND,
18 	RADIUS_DAS_MULTI_SESSION_MATCH,
19 };
20 
21 struct radius_das_attrs {
22 	/* NAS identification attributes */
23 	const u8 *nas_ip_addr;
24 	const u8 *nas_identifier;
25 	size_t nas_identifier_len;
26 	const u8 *nas_ipv6_addr;
27 
28 	/* Session identification attributes */
29 	const u8 *sta_addr;
30 	const u8 *user_name;
31 	size_t user_name_len;
32 	const u8 *acct_session_id;
33 	size_t acct_session_id_len;
34 	const u8 *acct_multi_session_id;
35 	size_t acct_multi_session_id_len;
36 	const u8 *cui;
37 	size_t cui_len;
38 };
39 
40 struct radius_das_conf {
41 	int port;
42 	const u8 *shared_secret;
43 	size_t shared_secret_len;
44 	const struct hostapd_ip_addr *client_addr;
45 	unsigned int time_window;
46 	int require_event_timestamp;
47 	void *ctx;
48 	enum radius_das_res (*disconnect)(void *ctx,
49 					  struct radius_das_attrs *attr);
50 };
51 
52 struct radius_das_data *
53 radius_das_init(struct radius_das_conf *conf);
54 
55 void radius_das_deinit(struct radius_das_data *data);
56 
57 #endif /* RADIUS_DAS_H */
58