radius_client.h

Go to the documentation of this file.
00001 
00016 #ifndef RADIUS_CLIENT_H
00017 #define RADIUS_CLIENT_H
00018 
00019 #include "ip_addr.h"
00020 
00021 struct radius_msg;
00022 
00023 struct hostapd_radius_server {
00024         /* MIB prefix for shared variables:
00025          * @ = radiusAuth or radiusAcc depending on the type of the server */
00026         struct hostapd_ip_addr addr; /* @ServerAddress */
00027         int port; /* @ClientServerPortNumber */
00028         u8 *shared_secret;
00029         size_t shared_secret_len;
00030 
00031         /* Dynamic (not from configuration file) MIB data */
00032         int index; /* @ServerIndex */
00033         int round_trip_time; /* @ClientRoundTripTime; in hundredths of a
00034                               * second */
00035         u32 requests; /* @Client{Access,}Requests */
00036         u32 retransmissions; /* @Client{Access,}Retransmissions */
00037         u32 access_accepts; /* radiusAuthClientAccessAccepts */
00038         u32 access_rejects; /* radiusAuthClientAccessRejects */
00039         u32 access_challenges; /* radiusAuthClientAccessChallenges */
00040         u32 responses; /* radiusAccClientResponses */
00041         u32 malformed_responses; /* @ClientMalformed{Access,}Responses */
00042         u32 bad_authenticators; /* @ClientBadAuthenticators */
00043         u32 timeouts; /* @ClientTimeouts */
00044         u32 unknown_types; /* @ClientUnknownTypes */
00045         u32 packets_dropped; /* @ClientPacketsDropped */
00046         /* @ClientPendingRequests: length of hapd->radius->msgs for matching
00047          * msg_type */
00048 };
00049 
00050 struct hostapd_radius_servers {
00051         /* RADIUS Authentication and Accounting servers in priority order */
00052         struct hostapd_radius_server *auth_servers, *auth_server;
00053         int num_auth_servers;
00054         struct hostapd_radius_server *acct_servers, *acct_server;
00055         int num_acct_servers;
00056 
00057         int retry_primary_interval;
00058         int acct_interim_interval;
00059 
00060         int msg_dumps;
00061 
00062         struct hostapd_ip_addr client_addr;
00063         int force_client_addr;
00064 };
00065 
00066 
00067 typedef enum {
00068         RADIUS_AUTH,
00069         RADIUS_ACCT,
00070         RADIUS_ACCT_INTERIM /* used only with radius_client_send(); just like
00071                              * RADIUS_ACCT, but removes any pending interim
00072                              * RADIUS Accounting packages for the same STA
00073                              * before sending the new interim update */
00074 } RadiusType;
00075 
00076 typedef enum {
00077         RADIUS_RX_PROCESSED,
00078         RADIUS_RX_QUEUED,
00079         RADIUS_RX_UNKNOWN,
00080         RADIUS_RX_INVALID_AUTHENTICATOR
00081 } RadiusRxResult;
00082 
00083 struct radius_client_data;
00084 
00085 int radius_client_register(struct radius_client_data *radius,
00086                            RadiusType msg_type,
00087                            RadiusRxResult (*handler)
00088                            (struct radius_msg *msg, struct radius_msg *req,
00089                             const u8 *shared_secret, size_t shared_secret_len,
00090                             void *data),
00091                            void *data);
00092 int radius_client_send(struct radius_client_data *radius,
00093                        struct radius_msg *msg,
00094                        RadiusType msg_type, const u8 *addr);
00095 u8 radius_client_get_id(struct radius_client_data *radius);
00096 
00097 #ifdef CONFIG_NO_RADIUS
00098 static inline void radius_client_flush(struct radius_client_data *radius,
00099                                        int only_auth)
00100 {
00101 }
00102 
00103 static inline struct radius_client_data *
00104 radius_client_init(void *ctx, struct hostapd_radius_servers *conf)
00105 {
00106         return (void *) -1;
00107 }
00108 
00109 static inline void radius_client_deinit(struct radius_client_data *radius)
00110 {
00111 }
00112 
00113 static inline void radius_client_flush_auth(struct radius_client_data *radius,
00114                                             u8 *addr)
00115 {
00116 }
00117 
00118 static inline int radius_client_get_mib(struct radius_client_data *radius,
00119                                         char *buf, size_t buflen)
00120 {
00121         return 0;
00122 }
00123 #else /* CONFIG_NO_RADIUS */
00124 void radius_client_flush(struct radius_client_data *radius, int only_auth);
00125 struct radius_client_data *
00126 radius_client_init(void *ctx, struct hostapd_radius_servers *conf);
00127 void radius_client_deinit(struct radius_client_data *radius);
00128 void radius_client_flush_auth(struct radius_client_data *radius, u8 *addr);
00129 int radius_client_get_mib(struct radius_client_data *radius, char *buf,
00130                           size_t buflen);
00131 #endif /* CONFIG_NO_RADIUS */
00132 struct radius_client_data *
00133 radius_client_reconfig(struct radius_client_data *old, void *ctx,
00134                        struct hostapd_radius_servers *oldconf,
00135                        struct hostapd_radius_servers *newconf);
00136 
00137 #endif /* RADIUS_CLIENT_H */
00138 
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines

Generated on Sat Nov 21 23:16:52 2009 for hostapd by  doxygen 1.6.1