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
00025
00026 struct hostapd_ip_addr addr;
00027 int port;
00028 u8 *shared_secret;
00029 size_t shared_secret_len;
00030
00031
00032 int index;
00033 int round_trip_time;
00034
00035 u32 requests;
00036 u32 retransmissions;
00037 u32 access_accepts;
00038 u32 access_rejects;
00039 u32 access_challenges;
00040 u32 responses;
00041 u32 malformed_responses;
00042 u32 bad_authenticators;
00043 u32 timeouts;
00044 u32 unknown_types;
00045 u32 packets_dropped;
00046
00047
00048 };
00049
00050 struct hostapd_radius_servers {
00051
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
00071
00072
00073
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
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
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
00138