00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef RADIUS_CLIENT_H
00016 #define RADIUS_CLIENT_H
00017
00018 #include "ip_addr.h"
00019
00020 struct radius_msg;
00021
00033 struct hostapd_radius_server {
00037 struct hostapd_ip_addr addr;
00038
00042 int port;
00043
00047 u8 *shared_secret;
00048
00052 size_t shared_secret_len;
00053
00054
00055
00059 int index;
00060
00065 int round_trip_time;
00066
00070 u32 requests;
00071
00075 u32 retransmissions;
00076
00080 u32 access_accepts;
00081
00085 u32 access_rejects;
00086
00090 u32 access_challenges;
00091
00095 u32 responses;
00096
00100 u32 malformed_responses;
00101
00105 u32 bad_authenticators;
00106
00110 u32 timeouts;
00111
00115 u32 unknown_types;
00116
00120 u32 packets_dropped;
00121 };
00122
00126 struct hostapd_radius_servers {
00130 struct hostapd_radius_server *auth_servers;
00131
00135 int num_auth_servers;
00136
00140 struct hostapd_radius_server *auth_server;
00141
00145 struct hostapd_radius_server *acct_servers;
00146
00150 int num_acct_servers;
00151
00155 struct hostapd_radius_server *acct_server;
00156
00167 int retry_primary_interval;
00168
00172 int msg_dumps;
00173
00177 struct hostapd_ip_addr client_addr;
00178
00182 int force_client_addr;
00183 };
00184
00185
00189 typedef enum {
00193 RADIUS_AUTH,
00194
00198 RADIUS_ACCT,
00199
00207 RADIUS_ACCT_INTERIM
00208 } RadiusType;
00209
00213 typedef enum {
00219 RADIUS_RX_PROCESSED,
00220
00228 RADIUS_RX_QUEUED,
00229
00233 RADIUS_RX_UNKNOWN,
00234
00238 RADIUS_RX_INVALID_AUTHENTICATOR
00239 } RadiusRxResult;
00240
00241 struct radius_client_data;
00242
00243 int radius_client_register(struct radius_client_data *radius,
00244 RadiusType msg_type,
00245 RadiusRxResult (*handler)
00246 (struct radius_msg *msg, struct radius_msg *req,
00247 const u8 *shared_secret, size_t shared_secret_len,
00248 void *data),
00249 void *data);
00250 int radius_client_send(struct radius_client_data *radius,
00251 struct radius_msg *msg,
00252 RadiusType msg_type, const u8 *addr);
00253 u8 radius_client_get_id(struct radius_client_data *radius);
00254 void radius_client_flush(struct radius_client_data *radius, int only_auth);
00255 struct radius_client_data *
00256 radius_client_init(void *ctx, struct hostapd_radius_servers *conf);
00257 void radius_client_deinit(struct radius_client_data *radius);
00258 void radius_client_flush_auth(struct radius_client_data *radius,
00259 const u8 *addr);
00260 int radius_client_get_mib(struct radius_client_data *radius, char *buf,
00261 size_t buflen);
00262
00263 #endif