aboutsummaryrefslogtreecommitdiffstats
path: root/src/radius
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2009-12-19 16:13:06 +0200
committerJouni Malinen <j@w1.fi>2009-12-19 16:13:06 +0200
commitd04a96b0d64c0bf6a1ab7527c24e2c8359349313 (patch)
treef84c7875a0876b44e633c4fa0f8e730a2c6ce179 /src/radius
parenta9f92c487f4f7ca10a139e62b013c14407e0e0fd (diff)
downloadexternal_wpa_supplicant_8_ti-d04a96b0d64c0bf6a1ab7527c24e2c8359349313.zip
external_wpa_supplicant_8_ti-d04a96b0d64c0bf6a1ab7527c24e2c8359349313.tar.gz
external_wpa_supplicant_8_ti-d04a96b0d64c0bf6a1ab7527c24e2c8359349313.tar.bz2
Add documentation for RADIUS code and some minor cleanup
Diffstat (limited to 'src/radius')
-rw-r--r--src/radius/radius.c29
-rw-r--r--src/radius/radius.h50
2 files changed, 54 insertions, 25 deletions
diff --git a/src/radius/radius.c b/src/radius/radius.c
index 75c2677..c3ce86d 100644
--- a/src/radius/radius.c
+++ b/src/radius/radius.c
@@ -1,6 +1,6 @@
/*
- * hostapd / RADIUS message processing
- * Copyright (c) 2002-2008, Jouni Malinen <j@w1.fi>
+ * RADIUS message processing
+ * Copyright (c) 2002-2009, Jouni Malinen <j@w1.fi>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
@@ -12,12 +12,15 @@
* See README and COPYING for more details.
*/
-#include "includes.h"
+#include "utils/includes.h"
-#include "common.h"
-#include "radius.h"
+#include "utils/common.h"
#include "crypto/md5.h"
#include "crypto/crypto.h"
+#include "radius.h"
+
+
+static int radius_msg_initialize(struct radius_msg *msg, size_t init_len);
static struct radius_attr_hdr *
@@ -27,6 +30,13 @@ radius_get_attr_hdr(struct radius_msg *msg, int idx)
}
+static void radius_msg_set_hdr(struct radius_msg *msg, u8 code, u8 identifier)
+{
+ msg->hdr->code = code;
+ msg->hdr->identifier = identifier;
+}
+
+
struct radius_msg *radius_msg_new(u8 code, u8 identifier)
{
struct radius_msg *msg;
@@ -46,7 +56,7 @@ struct radius_msg *radius_msg_new(u8 code, u8 identifier)
}
-int radius_msg_initialize(struct radius_msg *msg, size_t init_len)
+static int radius_msg_initialize(struct radius_msg *msg, size_t init_len)
{
if (msg == NULL || init_len < sizeof(struct radius_hdr))
return -1;
@@ -76,13 +86,6 @@ int radius_msg_initialize(struct radius_msg *msg, size_t init_len)
}
-void radius_msg_set_hdr(struct radius_msg *msg, u8 code, u8 identifier)
-{
- msg->hdr->code = code;
- msg->hdr->identifier = identifier;
-}
-
-
void radius_msg_free(struct radius_msg *msg)
{
os_free(msg->buf);
diff --git a/src/radius/radius.h b/src/radius/radius.h
index 76a5c13..9f77a5a 100644
--- a/src/radius/radius.h
+++ b/src/radius/radius.h
@@ -1,6 +1,6 @@
/*
- * hostapd / RADIUS message processing
- * Copyright (c) 2002-2007, Jouni Malinen <j@w1.fi>
+ * RADIUS message processing
+ * Copyright (c) 2002-2009, Jouni Malinen <j@w1.fi>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
@@ -173,19 +173,47 @@ struct radius_ms_mppe_keys {
};
-/* RADIUS message structure for new and parsed messages */
+/**
+ * struct radius_msg - RADIUS message structure for new and parsed messages
+ */
struct radius_msg {
+ /**
+ * buf - Allocated buffer for RADIUS message
+ */
unsigned char *buf;
- size_t buf_size; /* total size allocated for buf */
- size_t buf_used; /* bytes used in buf */
+ /**
+ * buf_size - Total size of the allocated buf in octets
+ */
+ size_t buf_size;
+
+ /**
+ * buf_used - bytes used in buf
+ */
+ size_t buf_used;
+
+ /**
+ * hdr - Pointer to the RADIUS header in buf
+ */
struct radius_hdr *hdr;
- size_t *attr_pos; /* array of indexes to attributes (number of bytes
- * from buf to the beginning of
- * struct radius_attr_hdr). */
- size_t attr_size; /* total size of the attribute pointer array */
- size_t attr_used; /* total number of attributes in the array */
+ /**
+ * attr_pos - Array of indexes to attributes
+ *
+ * The values are number of bytes from buf to the beginning of
+ * struct radius_attr_hdr.
+ */
+ size_t *attr_pos;
+
+ /**
+ * attr_size - Total size of the attribute pointer array
+ */
+ size_t attr_size;
+
+ /**
+ * attr_used - Total number of attributes in the array
+ */
+ size_t attr_used;
};
@@ -203,8 +231,6 @@ struct radius_msg {
#define RADIUS_ADDR_FORMAT "%02x%02x%02x%02x%02x%02x"
struct radius_msg *radius_msg_new(u8 code, u8 identifier);
-int radius_msg_initialize(struct radius_msg *msg, size_t init_len);
-void radius_msg_set_hdr(struct radius_msg *msg, u8 code, u8 identifier);
void radius_msg_free(struct radius_msg *msg);
void radius_msg_dump(struct radius_msg *msg);
int radius_msg_finish(struct radius_msg *msg, const u8 *secret,