~ubuntu-branches/ubuntu/wily/wpasupplicant/wily

« back to all changes in this revision

Viewing changes to src/radius/radius.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 message processing
3
 
 * Copyright (c) 2002-2007, Jouni Malinen <j@w1.fi>
 
2
 * RADIUS message processing
 
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
173
173
};
174
174
 
175
175
 
176
 
/* RADIUS message structure for new and parsed messages */
177
 
struct radius_msg {
178
 
        unsigned char *buf;
179
 
        size_t buf_size; /* total size allocated for buf */
180
 
        size_t buf_used; /* bytes used in buf */
181
 
 
182
 
        struct radius_hdr *hdr;
183
 
 
184
 
        size_t *attr_pos; /* array of indexes to attributes (number of bytes
185
 
                           * from buf to the beginning of
186
 
                           * struct radius_attr_hdr). */
187
 
        size_t attr_size; /* total size of the attribute pointer array */
188
 
        size_t attr_used; /* total number of attributes in the array */
189
 
};
190
 
 
 
176
struct radius_msg;
191
177
 
192
178
/* Default size to be allocated for new RADIUS messages */
193
179
#define RADIUS_DEFAULT_MSG_SIZE 1024
202
188
/* MAC address ASCII format for non-802.1X use */
203
189
#define RADIUS_ADDR_FORMAT "%02x%02x%02x%02x%02x%02x"
204
190
 
205
 
struct radius_msg *radius_msg_new(u8 code, u8 identifier);
206
 
int radius_msg_initialize(struct radius_msg *msg, size_t init_len);
207
 
void radius_msg_set_hdr(struct radius_msg *msg, u8 code, u8 identifier);
 
191
struct radius_hdr * radius_msg_get_hdr(struct radius_msg *msg);
 
192
struct wpabuf * radius_msg_get_buf(struct radius_msg *msg);
 
193
struct radius_msg * radius_msg_new(u8 code, u8 identifier);
208
194
void radius_msg_free(struct radius_msg *msg);
209
195
void radius_msg_dump(struct radius_msg *msg);
210
196
int radius_msg_finish(struct radius_msg *msg, const u8 *secret,
213
199
                          size_t secret_len, const u8 *req_authenticator);
214
200
void radius_msg_finish_acct(struct radius_msg *msg, const u8 *secret,
215
201
                            size_t secret_len);
216
 
struct radius_attr_hdr *radius_msg_add_attr(struct radius_msg *msg, u8 type,
217
 
                                            const u8 *data, size_t data_len);
218
 
struct radius_msg *radius_msg_parse(const u8 *data, size_t len);
 
202
struct radius_attr_hdr * radius_msg_add_attr(struct radius_msg *msg, u8 type,
 
203
                                             const u8 *data, size_t data_len);
 
204
struct radius_msg * radius_msg_parse(const u8 *data, size_t len);
219
205
int radius_msg_add_eap(struct radius_msg *msg, const u8 *data,
220
206
                       size_t data_len);
221
207
u8 *radius_msg_get_eap(struct radius_msg *msg, size_t *len);
269
255
                            size_t *len, const u8 *start);
270
256
int radius_msg_count_attr(struct radius_msg *msg, u8 type, int min_len);
271
257
 
 
258
 
 
259
struct radius_attr_data {
 
260
        u8 *data;
 
261
        size_t len;
 
262
};
 
263
 
 
264
struct radius_class_data {
 
265
        struct radius_attr_data *attr;
 
266
        size_t count;
 
267
};
 
268
 
 
269
void radius_free_class(struct radius_class_data *c);
 
270
int radius_copy_class(struct radius_class_data *dst,
 
271
                      const struct radius_class_data *src);
 
272
 
272
273
#endif /* RADIUS_H */