~ubuntu-branches/ubuntu/saucy/wpasupplicant/saucy

« back to all changes in this revision

Viewing changes to src/radius/radius_client.h

  • Committer: Bazaar Package Importer
  • Author(s): Mathieu Trudel-Lapierre
  • Date: 2010-11-22 09:43:43 UTC
  • mfrom: (1.1.16 upstream)
  • Revision ID: james.westby@ubuntu.com-20101122094343-qgsxaojvmswfri77
Tags: 0.7.3-0ubuntu1
* Get wpasupplicant 0.7.3 from Debian's SVN. Leaving 0.7.3-1 as unreleased
  for now.
* Build-Depend on debhelper 8, since the packaging from Debian uses compat 8.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * hostapd / RADIUS client
3
 
 * Copyright (c) 2002-2005, Jouni Malinen <j@w1.fi>
 
2
 * RADIUS client
 
3
 * Copyright (c) 2002-2009, Jouni Malinen <j@w1.fi>
4
4
 *
5
5
 * This program is free software; you can redistribute it and/or modify
6
6
 * it under the terms of the GNU General Public License version 2 as
19
19
 
20
20
struct radius_msg;
21
21
 
 
22
/**
 
23
 * struct hostapd_radius_server - RADIUS server information for RADIUS client
 
24
 *
 
25
 * This structure contains information about a RADIUS server. The values are
 
26
 * mainly for MIB information. The MIB variable prefix (radiusAuth or
 
27
 * radiusAcc) depends on whether this is an authentication or accounting
 
28
 * server.
 
29
 *
 
30
 * radiusAuthClientPendingRequests (or radiusAccClientPendingRequests) is the
 
31
 * number struct radius_client_data::msgs for matching msg_type.
 
32
 */
22
33
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 */
 
34
        /**
 
35
         * addr - radiusAuthServerAddress or radiusAccServerAddress
 
36
         */
 
37
        struct hostapd_ip_addr addr;
 
38
 
 
39
        /**
 
40
         * port - radiusAuthClientServerPortNumber or radiusAccClientServerPortNumber
 
41
         */
 
42
        int port;
 
43
 
 
44
        /**
 
45
         * shared_secret - Shared secret for authenticating RADIUS messages
 
46
         */
27
47
        u8 *shared_secret;
 
48
 
 
49
        /**
 
50
         * shared_secret_len - Length of shared_secret in octets
 
51
         */
28
52
        size_t shared_secret_len;
29
53
 
30
54
        /* Dynamic (not from configuration file) MIB data */
31
 
        int index; /* @ServerIndex */
32
 
        int round_trip_time; /* @ClientRoundTripTime; in hundredths of a
33
 
                              * second */
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
46
 
         * msg_type */
 
55
 
 
56
        /**
 
57
         * index - radiusAuthServerIndex or radiusAccServerIndex
 
58
         */
 
59
        int index;
 
60
 
 
61
        /**
 
62
         * round_trip_time - radiusAuthClientRoundTripTime or radiusAccClientRoundTripTime
 
63
         * Round-trip time in hundredths of a second.
 
64
         */
 
65
        int round_trip_time;
 
66
 
 
67
        /**
 
68
         * requests - radiusAuthClientAccessRequests or radiusAccClientRequests
 
69
         */
 
70
        u32 requests;
 
71
 
 
72
        /**
 
73
         * retransmissions - radiusAuthClientAccessRetransmissions or radiusAccClientRetransmissions
 
74
         */
 
75
        u32 retransmissions;
 
76
 
 
77
        /**
 
78
         * access_accepts - radiusAuthClientAccessAccepts
 
79
         */
 
80
        u32 access_accepts;
 
81
 
 
82
        /**
 
83
         * access_rejects - radiusAuthClientAccessRejects
 
84
         */
 
85
        u32 access_rejects;
 
86
 
 
87
        /**
 
88
         * access_challenges - radiusAuthClientAccessChallenges
 
89
         */
 
90
        u32 access_challenges;
 
91
 
 
92
        /**
 
93
         * responses - radiusAccClientResponses
 
94
         */
 
95
        u32 responses;
 
96
 
 
97
        /**
 
98
         * malformed_responses - radiusAuthClientMalformedAccessResponses or radiusAccClientMalformedResponses
 
99
         */
 
100
        u32 malformed_responses;
 
101
 
 
102
        /**
 
103
         * bad_authenticators - radiusAuthClientBadAuthenticators or radiusAccClientBadAuthenticators
 
104
         */
 
105
        u32 bad_authenticators;
 
106
 
 
107
        /**
 
108
         * timeouts - radiusAuthClientTimeouts or radiusAccClientTimeouts
 
109
         */
 
110
        u32 timeouts;
 
111
 
 
112
        /**
 
113
         * unknown_types - radiusAuthClientUnknownTypes or radiusAccClientUnknownTypes
 
114
         */
 
115
        u32 unknown_types;
 
116
 
 
117
        /**
 
118
         * packets_dropped - radiusAuthClientPacketsDropped or radiusAccClientPacketsDropped
 
119
         */
 
120
        u32 packets_dropped;
47
121
};
48
122
 
 
123
/**
 
124
 * struct hostapd_radius_servers - RADIUS servers for RADIUS client
 
125
 */
49
126
struct hostapd_radius_servers {
50
 
        /* RADIUS Authentication and Accounting servers in priority order */
51
 
        struct hostapd_radius_server *auth_servers, *auth_server;
 
127
        /**
 
128
         * auth_servers - RADIUS Authentication servers in priority order
 
129
         */
 
130
        struct hostapd_radius_server *auth_servers;
 
131
 
 
132
        /**
 
133
         * num_auth_servers - Number of auth_servers entries
 
134
         */
52
135
        int num_auth_servers;
53
 
        struct hostapd_radius_server *acct_servers, *acct_server;
 
136
 
 
137
        /**
 
138
         * auth_server - The current Authentication server
 
139
         */
 
140
        struct hostapd_radius_server *auth_server;
 
141
 
 
142
        /**
 
143
         * acct_servers - RADIUS Accounting servers in priority order
 
144
         */
 
145
        struct hostapd_radius_server *acct_servers;
 
146
 
 
147
        /**
 
148
         * num_acct_servers - Number of acct_servers entries
 
149
         */
54
150
        int num_acct_servers;
55
151
 
 
152
        /**
 
153
         * acct_server - The current Accounting server
 
154
         */
 
155
        struct hostapd_radius_server *acct_server;
 
156
 
 
157
        /**
 
158
         * retry_primary_interval - Retry interval for trying primary server
 
159
         *
 
160
         * This specifies a retry interval in sexconds for trying to return to
 
161
         * the primary RADIUS server. RADIUS client code will automatically try
 
162
         * to use the next server when the current server is not replying to
 
163
         * requests. If this interval is set (non-zero), the primary server
 
164
         * will be retried after the specified number of seconds has passed
 
165
         * even if the current used secondary server is still working.
 
166
         */
56
167
        int retry_primary_interval;
57
 
        int acct_interim_interval;
58
168
 
 
169
        /**
 
170
         * msg_dumps - Whether RADIUS message details are shown in stdout
 
171
         */
59
172
        int msg_dumps;
60
173
 
 
174
        /**
 
175
         * client_addr - Client (local) address to use if force_client_addr
 
176
         */
61
177
        struct hostapd_ip_addr client_addr;
 
178
 
 
179
        /**
 
180
         * force_client_addr - Whether to force client (local) address
 
181
         */
62
182
        int force_client_addr;
63
183
};
64
184
 
65
185
 
 
186
/**
 
187
 * RadiusType - RADIUS server type for RADIUS client
 
188
 */
66
189
typedef enum {
 
190
        /**
 
191
         * RADIUS authentication
 
192
         */
67
193
        RADIUS_AUTH,
 
194
 
 
195
        /**
 
196
         * RADIUS_ACCT - RADIUS accounting
 
197
         */
68
198
        RADIUS_ACCT,
69
 
        RADIUS_ACCT_INTERIM /* used only with radius_client_send(); just like
70
 
                             * RADIUS_ACCT, but removes any pending interim
71
 
                             * RADIUS Accounting packages for the same STA
72
 
                             * before sending the new interim update */
 
199
 
 
200
        /**
 
201
         * RADIUS_ACCT_INTERIM - RADIUS interim accounting message
 
202
         *
 
203
         * Used only with radius_client_send(). This behaves just like
 
204
         * RADIUS_ACCT, but removes any pending interim RADIUS Accounting
 
205
         * messages for the same STA before sending the new interim update.
 
206
         */
 
207
        RADIUS_ACCT_INTERIM
73
208
} RadiusType;
74
209
 
 
210
/**
 
211
 * RadiusRxResult - RADIUS client RX handler result
 
212
 */
75
213
typedef enum {
 
214
        /**
 
215
         * RADIUS_RX_PROCESSED - Message processed
 
216
         *
 
217
         * This stops handler calls and frees the message.
 
218
         */
76
219
        RADIUS_RX_PROCESSED,
 
220
 
 
221
        /**
 
222
         * RADIUS_RX_QUEUED - Message has been queued
 
223
         *
 
224
         * This stops handler calls, but does not free the message; the handler
 
225
         * that returned this is responsible for eventually freeing the
 
226
         * message.
 
227
         */
77
228
        RADIUS_RX_QUEUED,
 
229
 
 
230
        /**
 
231
         * RADIUS_RX_UNKNOWN - Message is not for this handler
 
232
         */
78
233
        RADIUS_RX_UNKNOWN,
 
234
 
 
235
        /**
 
236
         * RADIUS_RX_INVALID_AUTHENTICATOR - Message has invalid Authenticator
 
237
         */
79
238
        RADIUS_RX_INVALID_AUTHENTICATOR
80
239
} RadiusRxResult;
81
240
 
92
251
                       struct radius_msg *msg,
93
252
                       RadiusType msg_type, const u8 *addr);
94
253
u8 radius_client_get_id(struct radius_client_data *radius);
95
 
 
96
254
void radius_client_flush(struct radius_client_data *radius, int only_auth);
97
255
struct radius_client_data *
98
256
radius_client_init(void *ctx, struct hostapd_radius_servers *conf);
99
257
void radius_client_deinit(struct radius_client_data *radius);
100
 
void radius_client_flush_auth(struct radius_client_data *radius, u8 *addr);
 
258
void radius_client_flush_auth(struct radius_client_data *radius,
 
259
                              const u8 *addr);
101
260
int radius_client_get_mib(struct radius_client_data *radius, char *buf,
102
261
                          size_t buflen);
103
 
struct radius_client_data *
104
 
radius_client_reconfig(struct radius_client_data *old, void *ctx,
105
 
                       struct hostapd_radius_servers *oldconf,
106
 
                       struct hostapd_radius_servers *newconf);
107
262
 
108
263
#endif /* RADIUS_CLIENT_H */