2016-03-07 16:23:49 +01:00
|
|
|
#include "capwap.h"
|
2016-08-22 16:59:55 +02:00
|
|
|
#include "element.h"
|
2016-03-07 16:23:49 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
* 0 1 2 3
|
|
|
|
* 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
|
|
|
|
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
* | MAC Address |
|
|
|
|
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
* | MAC Address |S| P |T|F|H|M| | Max RxFactor |
|
|
|
|
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
* | Min StaSpacing| HiSuppDataRate | AMPDUBufSize |
|
|
|
|
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
* | AMPDUBufSize | HtcSupp | MCS Set |
|
|
|
|
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
* | MCS Set |
|
|
|
|
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
* | MCS Set |
|
|
|
|
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
|
|
|
*
|
|
|
|
* Type: TBD2 for IEEE 802.11n Station Information
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* */
|
|
|
|
static void
|
|
|
|
capwap_80211n_station_info_element_create(void *data,
|
|
|
|
capwap_message_elements_handle handle,
|
|
|
|
struct capwap_write_message_elements_ops *func)
|
|
|
|
{
|
|
|
|
struct capwap_80211n_station_info_element *element = (struct capwap_80211n_station_info_element *)data;
|
|
|
|
|
|
|
|
ASSERT(data != NULL);
|
|
|
|
|
2016-03-08 12:00:01 +01:00
|
|
|
func->write_block(handle, element->address, MACADDRESS_EUI48_LENGTH);
|
2016-03-07 16:23:49 +01:00
|
|
|
func->write_u8(handle, element->flags);
|
|
|
|
func->write_u8(handle, element->maxrxfactor);
|
|
|
|
func->write_u8(handle, element->minstaspaceing);
|
|
|
|
func->write_u16(handle, element->hisuppdatarate);
|
|
|
|
func->write_u16(handle, element->ampdubufsize);
|
|
|
|
func->write_u8(handle, element->htcsupp);
|
2016-03-08 12:00:01 +01:00
|
|
|
func->write_block(handle, element->mcsset, MCS_SET_LENGTH);
|
2016-03-07 16:23:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* */
|
|
|
|
static void *
|
|
|
|
capwap_80211n_station_info_element_parsing(capwap_message_elements_handle handle,
|
|
|
|
struct capwap_read_message_elements_ops *func)
|
|
|
|
{
|
|
|
|
struct capwap_80211n_station_info_element *data;
|
2016-03-08 12:00:01 +01:00
|
|
|
|
2016-03-07 16:23:49 +01:00
|
|
|
ASSERT(handle != NULL);
|
|
|
|
ASSERT(func != NULL);
|
|
|
|
|
|
|
|
if (func->read_ready(handle) != 24) {
|
2016-03-30 14:47:57 +02:00
|
|
|
log_printf(LOG_DEBUG, "Invalid IEEE 802.11n Station Information");
|
2016-03-07 16:23:49 +01:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* */
|
|
|
|
data = (struct capwap_80211n_station_info_element*)capwap_alloc(sizeof(struct capwap_80211n_station_info_element));
|
|
|
|
memset(data, 0, sizeof(struct capwap_80211n_station_info_element));
|
|
|
|
|
|
|
|
/* Retrieve data */
|
2016-03-08 12:00:01 +01:00
|
|
|
func->read_block(handle, data->address, MACADDRESS_EUI48_LENGTH);
|
2016-03-07 16:23:49 +01:00
|
|
|
func->read_u8(handle, &data->flags);
|
|
|
|
func->read_u8(handle, &data->maxrxfactor);
|
|
|
|
func->read_u8(handle, &data->minstaspaceing);
|
|
|
|
func->read_u16(handle, &data->hisuppdatarate);
|
|
|
|
func->read_u16(handle, &data->ampdubufsize);
|
|
|
|
func->read_u8(handle, &data->htcsupp);
|
2016-03-08 12:00:01 +01:00
|
|
|
func->read_block(handle, data->mcsset, MCS_SET_LENGTH);
|
2016-03-07 16:23:49 +01:00
|
|
|
|
|
|
|
return data;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* */
|
|
|
|
static void *
|
|
|
|
capwap_80211n_station_info_element_clone(void *data)
|
|
|
|
{
|
|
|
|
ASSERT(data != NULL);
|
|
|
|
|
|
|
|
return capwap_clone(data, sizeof(struct capwap_80211n_station_info_element));
|
|
|
|
}
|
|
|
|
|
|
|
|
/* */
|
|
|
|
static void
|
|
|
|
capwap_80211n_station_info_element_free(void* data)
|
|
|
|
{
|
|
|
|
ASSERT(data != NULL);
|
2016-03-08 12:00:01 +01:00
|
|
|
|
2016-03-07 16:23:49 +01:00
|
|
|
capwap_free(data);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* */
|
2016-03-07 18:07:46 +01:00
|
|
|
const struct capwap_message_elements_ops capwap_element_80211n_station_info_ops = {
|
2016-03-07 18:08:35 +01:00
|
|
|
.category = CAPWAP_MESSAGE_ELEMENT_SINGLE,
|
2016-03-07 17:12:48 +01:00
|
|
|
.create = capwap_80211n_station_info_element_create,
|
|
|
|
.parse = capwap_80211n_station_info_element_parsing,
|
|
|
|
.clone = capwap_80211n_station_info_element_clone,
|
|
|
|
.free = capwap_80211n_station_info_element_free
|
2016-03-07 16:23:49 +01:00
|
|
|
};
|