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  	RADIUS_DAS_COA_FAILED,
20  };
21  
22  struct radius_das_attrs {
23  	/* NAS identification attributes */
24  	const u8 *nas_ip_addr;
25  	const u8 *nas_identifier;
26  	size_t nas_identifier_len;
27  	const u8 *nas_ipv6_addr;
28  
29  	/* Session identification attributes */
30  	const u8 *sta_addr;
31  	const u8 *user_name;
32  	size_t user_name_len;
33  	const u8 *acct_session_id;
34  	size_t acct_session_id_len;
35  	const u8 *acct_multi_session_id;
36  	size_t acct_multi_session_id_len;
37  	const u8 *cui;
38  	size_t cui_len;
39  
40  	/* Authorization changes */
41  	const u8 *hs20_t_c_filtering;
42  };
43  
44  struct radius_das_conf {
45  	int port;
46  	const u8 *shared_secret;
47  	size_t shared_secret_len;
48  	const struct hostapd_ip_addr *client_addr;
49  	unsigned int time_window;
50  	int require_event_timestamp;
51  	int require_message_authenticator;
52  	void *ctx;
53  	enum radius_das_res (*disconnect)(void *ctx,
54  					  struct radius_das_attrs *attr);
55  	enum radius_das_res (*coa)(void *ctx, struct radius_das_attrs *attr);
56  };
57  
58  struct radius_das_data *
59  radius_das_init(struct radius_das_conf *conf);
60  
61  void radius_das_deinit(struct radius_das_data *data);
62  
63  #endif /* RADIUS_DAS_H */
64