]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/wpa_supplicant/radius_client.h
This commit was generated by cvs2svn to compensate for changes in r147013,
[FreeBSD/FreeBSD.git] / contrib / wpa_supplicant / radius_client.h
1 #ifndef RADIUS_CLIENT_H
2 #define RADIUS_CLIENT_H
3
4 typedef enum {
5         RADIUS_AUTH,
6         RADIUS_ACCT,
7         RADIUS_ACCT_INTERIM /* used only with radius_client_send(); just like
8                              * RADIUS_ACCT, but removes any pending interim
9                              * RADIUS Accounting packages for the same STA
10                              * before sending the new interim update */
11 } RadiusType;
12
13 /* RADIUS message retransmit list */
14 struct radius_msg_list {
15         u8 addr[ETH_ALEN]; /* STA/client address; used to find RADIUS messages
16                             * for the same STA. */
17         struct radius_msg *msg;
18         RadiusType msg_type;
19         time_t first_try;
20         time_t next_try;
21         int attempts;
22         int next_wait;
23
24         u8 *shared_secret;
25         size_t shared_secret_len;
26
27         /* TODO: server config with failover to backup server(s) */
28
29         struct radius_msg_list *next;
30 };
31
32
33 typedef enum {
34         RADIUS_RX_PROCESSED,
35         RADIUS_RX_QUEUED,
36         RADIUS_RX_UNKNOWN
37 } RadiusRxResult;
38
39 struct radius_rx_handler {
40         RadiusRxResult (*handler)(struct wpa_supplicant *wpa_s,
41                                   struct radius_msg *msg,
42                                   struct radius_msg *req,
43                                   u8 *shared_secret, size_t shared_secret_len,
44                                   void *data);
45         void *data;
46 };
47
48 struct radius_client_data {
49         int auth_serv_sock; /* socket for authentication RADIUS messages */
50         int acct_serv_sock; /* socket for accounting RADIUS messages */
51
52         struct radius_rx_handler *auth_handlers;
53         size_t num_auth_handlers;
54         struct radius_rx_handler *acct_handlers;
55         size_t num_acct_handlers;
56
57         struct radius_msg_list *msgs;
58         size_t num_msgs;
59
60         u8 next_radius_identifier;
61         u32 acct_session_id_hi;
62         u32 acct_session_id_lo;
63 };
64
65
66 int radius_client_register(struct wpa_supplicant *wpa_s, RadiusType msg_type,
67                            RadiusRxResult (*handler)
68                            (struct wpa_supplicant *wpa_s,
69                             struct radius_msg *msg, struct radius_msg *req,
70                             u8 *shared_secret, size_t shared_secret_len,
71                             void *data),
72                            void *data);
73 int radius_client_send(struct wpa_supplicant *wpa_s, struct radius_msg *msg,
74                        RadiusType msg_type, u8 *addr);
75 u8 radius_client_get_id(struct wpa_supplicant *wpa_s);
76
77 void radius_client_flush(struct wpa_supplicant *wpa_s);
78 int radius_client_init(struct wpa_supplicant *wpa_s);
79 void radius_client_deinit(struct wpa_supplicant *wpa_s);
80
81 #endif /* RADIUS_CLIENT_H */