2 * hostapd / RADIUS client
3 * Copyright (c) 2002-2005, Jouni Malinen <j@w1.fi>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
9 * Alternatively, this software may be distributed under the terms of BSD
12 * See README and COPYING for more details.
15 #ifndef RADIUS_CLIENT_H
16 #define RADIUS_CLIENT_H
18 #include "config_types.h"
22 struct hostapd_radius_server
{
23 /* MIB prefix for shared variables:
24 * @ = radiusAuth or radiusAcc depending on the type of the server */
25 struct hostapd_ip_addr addr
; /* @ServerAddress */
26 int port
; /* @ClientServerPortNumber */
28 size_t shared_secret_len
;
30 /* Dynamic (not from configuration file) MIB data */
31 int index
; /* @ServerIndex */
32 int round_trip_time
; /* @ClientRoundTripTime; in hundredths of a
34 u32 requests
; /* @Client{Access,}Requests */
35 u32 retransmissions
; /* @Client{Access,}Retransmissions */
36 u32 access_accepts
; /* radiusAuthClientAccessAccepts */
37 u32 access_rejects
; /* radiusAuthClientAccessRejects */
38 u32 access_challenges
; /* radiusAuthClientAccessChallenges */
39 u32 responses
; /* radiusAccClientResponses */
40 u32 malformed_responses
; /* @ClientMalformed{Access,}Responses */
41 u32 bad_authenticators
; /* @ClientBadAuthenticators */
42 u32 timeouts
; /* @ClientTimeouts */
43 u32 unknown_types
; /* @ClientUnknownTypes */
44 u32 packets_dropped
; /* @ClientPacketsDropped */
45 /* @ClientPendingRequests: length of hapd->radius->msgs for matching
49 struct hostapd_radius_servers
{
50 /* RADIUS Authentication and Accounting servers in priority order */
51 struct hostapd_radius_server
*auth_servers
, *auth_server
;
53 struct hostapd_radius_server
*acct_servers
, *acct_server
;
56 int retry_primary_interval
;
57 int acct_interim_interval
;
66 RADIUS_ACCT_INTERIM
/* used only with radius_client_send(); just like
67 * RADIUS_ACCT, but removes any pending interim
68 * RADIUS Accounting packages for the same STA
69 * before sending the new interim update */
76 RADIUS_RX_INVALID_AUTHENTICATOR
79 struct radius_client_data
;
81 int radius_client_register(struct radius_client_data
*radius
,
83 RadiusRxResult (*handler
)
84 (struct radius_msg
*msg
, struct radius_msg
*req
,
85 u8
*shared_secret
, size_t shared_secret_len
,
88 int radius_client_send(struct radius_client_data
*radius
,
89 struct radius_msg
*msg
,
90 RadiusType msg_type
, const u8
*addr
);
91 u8
radius_client_get_id(struct radius_client_data
*radius
);
93 void radius_client_flush(struct radius_client_data
*radius
, int only_auth
);
94 struct radius_client_data
*
95 radius_client_init(void *ctx
, struct hostapd_radius_servers
*conf
);
96 void radius_client_deinit(struct radius_client_data
*radius
);
97 void radius_client_flush_auth(struct radius_client_data
*radius
, u8
*addr
);
98 int radius_client_get_mib(struct radius_client_data
*radius
, char *buf
,
100 struct radius_client_data
*
101 radius_client_reconfig(struct radius_client_data
*old
, void *ctx
,
102 struct hostapd_radius_servers
*oldconf
,
103 struct hostapd_radius_servers
*newconf
);
105 #endif /* RADIUS_CLIENT_H */