Add 80211 message elements
This commit is contained in:
parent
96eda13334
commit
01f3dbd66c
@ -68,9 +68,14 @@ capwap_SOURCES = \
|
||||
$(top_srcdir)/src/common/capwap_element_80211_directsequencecontrol.c \
|
||||
$(top_srcdir)/src/common/capwap_element_80211_ie.c \
|
||||
$(top_srcdir)/src/common/capwap_element_80211_macoperation.c \
|
||||
$(top_srcdir)/src/common/capwap_element_80211_miccountermeasures.c \
|
||||
$(top_srcdir)/src/common/capwap_element_80211_multidomaincapability.c \
|
||||
$(top_srcdir)/src/common/capwap_element_80211_ofdmcontrol.c \
|
||||
$(top_srcdir)/src/common/capwap_element_80211_rateset.c \
|
||||
$(top_srcdir)/src/common/capwap_element_80211_rsnaerrorreport.c \
|
||||
$(top_srcdir)/src/common/capwap_element_80211_station.c \
|
||||
$(top_srcdir)/src/common/capwap_element_80211_stationqos.c \
|
||||
$(top_srcdir)/src/common/capwap_element_80211_stationkey.c \
|
||||
$(top_srcdir)/src/common/capwap_element_80211_supportedrates.c \
|
||||
$(top_srcdir)/src/common/capwap_element_80211_txpower.c \
|
||||
$(top_srcdir)/src/common/capwap_element_80211_txpowerlevel.c \
|
||||
|
@ -99,14 +99,14 @@ static struct capwap_message_elements_ops* capwap_80211_message_elements[CAPWAP_
|
||||
/* CAPWAP_ELEMENT_80211_DIRECTSEQUENCECONTROL */ &capwap_element_80211_directsequencecontrol_ops,
|
||||
/* CAPWAP_ELEMENT_80211_IE */ &capwap_element_80211_ie_ops,
|
||||
/* CAPWAP_ELEMENT_80211_MACOPERATION */ &capwap_element_80211_macoperation_ops,
|
||||
/* */ NULL,
|
||||
/* CAPWAP_ELEMENT_80211_MIC_COUNTERMEASURES */ &capwap_element_80211_miccountermeasures_ops,
|
||||
/* CAPWAP_ELEMENT_80211_MULTIDOMAINCAPABILITY */ &capwap_element_80211_multidomaincapability_ops,
|
||||
/* CAPWAP_ELEMENT_80211_OFDMCONTROL */ &capwap_element_80211_ofdmcontrol_ops,
|
||||
/* CAPWAP_ELEMENT_80211_RATESET */ &capwap_element_80211_rateset_ops,
|
||||
/* */ NULL,
|
||||
/* */ NULL,
|
||||
/* */ NULL,
|
||||
/* */ NULL,
|
||||
/* CAPWAP_ELEMENT_80211_RSNA_ERROR_REPORT */ &capwap_element_80211_rsnaerrorreport_ops,
|
||||
/* CAPWAP_ELEMENT_80211_STATION */ &capwap_element_80211_station_ops,
|
||||
/* CAPWAP_ELEMENT_80211_STATION_QOS_PROFILE */ &capwap_element_80211_stationqos_ops,
|
||||
/* CAPWAP_ELEMENT_80211_STATION_SESSION_KEY_PROFILE */ &capwap_element_80211_stationkey_ops,
|
||||
/* */ NULL,
|
||||
/* CAPWAP_ELEMENT_80211_SUPPORTEDRATES */ &capwap_element_80211_supportedrates_ops,
|
||||
/* CAPWAP_ELEMENT_80211_TXPOWER */ &capwap_element_80211_txpower_ops,
|
||||
|
@ -108,9 +108,15 @@ struct capwap_message_elements_ops* capwap_get_message_element_ops(unsigned shor
|
||||
#include "capwap_element_80211_directsequencecontrol.h" /* 01028 */
|
||||
#include "capwap_element_80211_ie.h" /* 01029 */
|
||||
#include "capwap_element_80211_macoperation.h" /* 01030 */
|
||||
#include "capwap_element_80211_miccountermeasures.h" /* 01031 */
|
||||
#include "capwap_element_80211_multidomaincapability.h" /* 01032 */
|
||||
#include "capwap_element_80211_ofdmcontrol.h" /* 01033 */
|
||||
#include "capwap_element_80211_rateset.h" /* 01034 */
|
||||
#include "capwap_element_80211_rsnaerrorreport.h" /* 01035 */
|
||||
#include "capwap_element_80211_station.h" /* 01036 */
|
||||
#include "capwap_element_80211_stationqos.h" /* 01037 */
|
||||
#include "capwap_element_80211_stationkey.h" /* 01038 */
|
||||
|
||||
#include "capwap_element_80211_supportedrates.h" /* 01040 */
|
||||
#include "capwap_element_80211_txpower.h" /* 01041 */
|
||||
#include "capwap_element_80211_txpowerlevel.h" /* 01042 */
|
||||
|
70
src/common/capwap_element_80211_miccountermeasures.c
Normal file
70
src/common/capwap_element_80211_miccountermeasures.c
Normal file
@ -0,0 +1,70 @@
|
||||
#include "capwap.h"
|
||||
#include "capwap_element.h"
|
||||
|
||||
/********************************************************************
|
||||
|
||||
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
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
| Radio ID | WLAN ID | BSSID
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
| BSSID |
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
|
||||
Type: 1031 for IEEE 802.11 MIC Countermeasures
|
||||
|
||||
Length: 8
|
||||
|
||||
********************************************************************/
|
||||
|
||||
/* */
|
||||
static void capwap_80211_miccountermeasures_element_create(void* data, capwap_message_elements_handle handle, struct capwap_write_message_elements_ops* func) {
|
||||
struct capwap_80211_miccountermeasures_element* element = (struct capwap_80211_miccountermeasures_element*)data;
|
||||
|
||||
ASSERT(data != NULL);
|
||||
|
||||
func->write_u8(handle, element->radioid);
|
||||
func->write_u8(handle, element->wlanid);
|
||||
func->write_block(handle, element->address, CAPWAP_MIC_COUNTERMEASURES_MACADDRESS_LENGTH);
|
||||
}
|
||||
|
||||
/* */
|
||||
static void* capwap_80211_miccountermeasures_element_parsing(capwap_message_elements_handle handle, struct capwap_read_message_elements_ops* func) {
|
||||
struct capwap_80211_miccountermeasures_element* data;
|
||||
|
||||
ASSERT(handle != NULL);
|
||||
ASSERT(func != NULL);
|
||||
|
||||
if (func->read_ready(handle) != 8) {
|
||||
capwap_logging_debug("Invalid IEEE 802.11 MIC Countermeasures element");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* */
|
||||
data = (struct capwap_80211_miccountermeasures_element*)capwap_alloc(sizeof(struct capwap_80211_miccountermeasures_element));
|
||||
if (!data) {
|
||||
capwap_outofmemory();
|
||||
}
|
||||
|
||||
/* Retrieve data */
|
||||
memset(data, 0, sizeof(struct capwap_80211_miccountermeasures_element));
|
||||
func->read_u8(handle, &data->radioid);
|
||||
func->read_u8(handle, &data->wlanid);
|
||||
func->read_block(handle, data->address, CAPWAP_MIC_COUNTERMEASURES_MACADDRESS_LENGTH);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
/* */
|
||||
static void capwap_80211_miccountermeasures_element_free(void* data) {
|
||||
ASSERT(data != NULL);
|
||||
|
||||
capwap_free(data);
|
||||
}
|
||||
|
||||
/* */
|
||||
struct capwap_message_elements_ops capwap_element_80211_miccountermeasures_ops = {
|
||||
.create_message_element = capwap_80211_miccountermeasures_element_create,
|
||||
.parsing_message_element = capwap_80211_miccountermeasures_element_parsing,
|
||||
.free_parsed_message_element = capwap_80211_miccountermeasures_element_free
|
||||
};
|
16
src/common/capwap_element_80211_miccountermeasures.h
Normal file
16
src/common/capwap_element_80211_miccountermeasures.h
Normal file
@ -0,0 +1,16 @@
|
||||
#ifndef __CAPWAP_ELEMENT_80211_MIC_COUNTERMEASURES_HEADER__
|
||||
#define __CAPWAP_ELEMENT_80211_MIC_COUNTERMEASURES_HEADER__
|
||||
|
||||
#define CAPWAP_ELEMENT_80211_MIC_COUNTERMEASURES 1031
|
||||
|
||||
#define CAPWAP_MIC_COUNTERMEASURES_MACADDRESS_LENGTH 6
|
||||
|
||||
struct capwap_80211_miccountermeasures_element {
|
||||
uint8_t radioid;
|
||||
uint8_t wlanid;
|
||||
uint8_t address[CAPWAP_MIC_COUNTERMEASURES_MACADDRESS_LENGTH];
|
||||
};
|
||||
|
||||
extern struct capwap_message_elements_ops capwap_element_80211_miccountermeasures_ops;
|
||||
|
||||
#endif /* __CAPWAP_ELEMENT_80211_MIC_COUNTERMEASURES_HEADER__ */
|
103
src/common/capwap_element_80211_rsnaerrorreport.c
Normal file
103
src/common/capwap_element_80211_rsnaerrorreport.c
Normal file
@ -0,0 +1,103 @@
|
||||
#include "capwap.h"
|
||||
#include "capwap_element.h"
|
||||
|
||||
/********************************************************************
|
||||
|
||||
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
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
| Client MAC Address |
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
| Client MAC Address | BSSID |
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
| BSSID |
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
| Radio ID | WLAN ID | Reserved |
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
| TKIP ICV Errors |
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
| TKIP Local MIC Failures |
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
| TKIP Remote MIC Failures |
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
| CCMP Replays |
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
| CCMP Decrypt Errors |
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
| TKIP Replays |
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
|
||||
|
||||
Type: 1035 for IEEE 802.11 RSNA Error Report From Station
|
||||
|
||||
Length: 40
|
||||
|
||||
********************************************************************/
|
||||
|
||||
/* */
|
||||
static void capwap_80211_rsnaerrorreport_element_create(void* data, capwap_message_elements_handle handle, struct capwap_write_message_elements_ops* func) {
|
||||
struct capwap_80211_rsnaerrorreport_element* element = (struct capwap_80211_rsnaerrorreport_element*)data;
|
||||
|
||||
ASSERT(data != NULL);
|
||||
|
||||
func->write_block(handle, element->client, CAPWAP_RSNA_ERROR_REPORT_CLIENT_LENGTH);
|
||||
func->write_block(handle, element->bssid, CAPWAP_RSNA_ERROR_REPORT_BSSID_LENGTH);
|
||||
func->write_u8(handle, element->radioid);
|
||||
func->write_u8(handle, element->wlanid);
|
||||
func->write_u16(handle, 0);
|
||||
func->write_u32(handle, element->tkipicverrors);
|
||||
func->write_u32(handle, element->tkiplocalmicfailure);
|
||||
func->write_u32(handle, element->tkipremotemicfailure);
|
||||
func->write_u32(handle, element->ccmpreplays);
|
||||
func->write_u32(handle, element->ccmpdecrypterrors);
|
||||
func->write_u32(handle, element->tkipreplays);
|
||||
}
|
||||
|
||||
/* */
|
||||
static void* capwap_80211_rsnaerrorreport_element_parsing(capwap_message_elements_handle handle, struct capwap_read_message_elements_ops* func) {
|
||||
struct capwap_80211_rsnaerrorreport_element* data;
|
||||
|
||||
ASSERT(handle != NULL);
|
||||
ASSERT(func != NULL);
|
||||
|
||||
if (func->read_ready(handle) != 40) {
|
||||
capwap_logging_debug("Invalid IEEE 802.11 RSNA Error Report From Station element");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* */
|
||||
data = (struct capwap_80211_rsnaerrorreport_element*)capwap_alloc(sizeof(struct capwap_80211_rsnaerrorreport_element));
|
||||
if (!data) {
|
||||
capwap_outofmemory();
|
||||
}
|
||||
|
||||
/* Retrieve data */
|
||||
memset(data, 0, sizeof(struct capwap_80211_rsnaerrorreport_element));
|
||||
func->read_block(handle, data->client, CAPWAP_RSNA_ERROR_REPORT_CLIENT_LENGTH);
|
||||
func->read_block(handle, data->bssid, CAPWAP_RSNA_ERROR_REPORT_BSSID_LENGTH);
|
||||
func->read_u8(handle, &data->radioid);
|
||||
func->read_u8(handle, &data->wlanid);
|
||||
func->read_u16(handle, NULL);
|
||||
func->read_u32(handle, &data->tkipicverrors);
|
||||
func->read_u32(handle, &data->tkiplocalmicfailure);
|
||||
func->read_u32(handle, &data->tkipremotemicfailure);
|
||||
func->read_u32(handle, &data->ccmpreplays);
|
||||
func->read_u32(handle, &data->ccmpdecrypterrors);
|
||||
func->read_u32(handle, &data->tkipreplays);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
/* */
|
||||
static void capwap_80211_rsnaerrorreport_element_free(void* data) {
|
||||
ASSERT(data != NULL);
|
||||
|
||||
capwap_free(data);
|
||||
}
|
||||
|
||||
/* */
|
||||
struct capwap_message_elements_ops capwap_element_80211_rsnaerrorreport_ops = {
|
||||
.create_message_element = capwap_80211_rsnaerrorreport_element_create,
|
||||
.parsing_message_element = capwap_80211_rsnaerrorreport_element_parsing,
|
||||
.free_parsed_message_element = capwap_80211_rsnaerrorreport_element_free
|
||||
};
|
24
src/common/capwap_element_80211_rsnaerrorreport.h
Normal file
24
src/common/capwap_element_80211_rsnaerrorreport.h
Normal file
@ -0,0 +1,24 @@
|
||||
#ifndef __CAPWAP_ELEMENT_80211_RSNA_ERROR_REPORT_HEADER__
|
||||
#define __CAPWAP_ELEMENT_80211_RSNA_ERROR_REPORT_HEADER__
|
||||
|
||||
#define CAPWAP_ELEMENT_80211_RSNA_ERROR_REPORT 1035
|
||||
|
||||
#define CAPWAP_RSNA_ERROR_REPORT_CLIENT_LENGTH 6
|
||||
#define CAPWAP_RSNA_ERROR_REPORT_BSSID_LENGTH 6
|
||||
|
||||
struct capwap_80211_rsnaerrorreport_element {
|
||||
uint8_t client[CAPWAP_RSNA_ERROR_REPORT_CLIENT_LENGTH];
|
||||
uint8_t bssid[CAPWAP_RSNA_ERROR_REPORT_BSSID_LENGTH];
|
||||
uint8_t radioid;
|
||||
uint8_t wlanid;
|
||||
uint32_t tkipicverrors;
|
||||
uint32_t tkiplocalmicfailure;
|
||||
uint32_t tkipremotemicfailure;
|
||||
uint32_t ccmpreplays;
|
||||
uint32_t ccmpdecrypterrors;
|
||||
uint32_t tkipreplays;
|
||||
};
|
||||
|
||||
extern struct capwap_message_elements_ops capwap_element_80211_rsnaerrorreport_ops;
|
||||
|
||||
#endif /* __CAPWAP_ELEMENT_80211_RSNA_ERROR_REPORT_HEADER__ */
|
91
src/common/capwap_element_80211_station.c
Normal file
91
src/common/capwap_element_80211_station.c
Normal file
@ -0,0 +1,91 @@
|
||||
#include "capwap.h"
|
||||
#include "capwap_element.h"
|
||||
|
||||
/********************************************************************
|
||||
|
||||
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
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
| Radio ID | Association ID | Flags |
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
| MAC Address |
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
| MAC Address | Capabilities |
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
| WLAN ID |Supported Rates|
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
|
||||
Type: 1036 for IEEE 802.11 Station
|
||||
|
||||
Length: >= 14
|
||||
|
||||
********************************************************************/
|
||||
|
||||
/* */
|
||||
static void capwap_80211_station_element_create(void* data, capwap_message_elements_handle handle, struct capwap_write_message_elements_ops* func) {
|
||||
struct capwap_80211_station_element* element = (struct capwap_80211_station_element*)data;
|
||||
|
||||
ASSERT(data != NULL);
|
||||
|
||||
func->write_u8(handle, element->radioid);
|
||||
func->write_u16(handle, element->associationid);
|
||||
func->write_u8(handle, element->flags);
|
||||
func->write_block(handle, element->address, CAPWAP_STATION_ADDRESS_LENGTH);
|
||||
func->write_u16(handle, element->capabilities);
|
||||
func->write_u8(handle, element->wlanid);
|
||||
func->write_block(handle, element->supportedrates, element->supportedratescount);
|
||||
}
|
||||
|
||||
/* */
|
||||
static void* capwap_80211_station_element_parsing(capwap_message_elements_handle handle, struct capwap_read_message_elements_ops* func) {
|
||||
unsigned short length;
|
||||
struct capwap_80211_station_element* data;
|
||||
|
||||
ASSERT(handle != NULL);
|
||||
ASSERT(func != NULL);
|
||||
|
||||
length = func->read_ready(handle);
|
||||
if (length < 14) {
|
||||
capwap_logging_debug("Invalid IEEE 802.11 Station element");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
length -= 13;
|
||||
if (length > CAPWAP_STATION_RATES_MAXLENGTH) {
|
||||
capwap_logging_debug("Invalid IEEE 802.11 Station element");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* */
|
||||
data = (struct capwap_80211_station_element*)capwap_alloc(sizeof(struct capwap_80211_station_element));
|
||||
if (!data) {
|
||||
capwap_outofmemory();
|
||||
}
|
||||
|
||||
/* Retrieve data */
|
||||
memset(data, 0, sizeof(struct capwap_80211_station_element));
|
||||
func->read_u8(handle, &data->radioid);
|
||||
func->read_u16(handle, &data->associationid);
|
||||
func->read_u8(handle, &data->flags);
|
||||
func->read_block(handle, data->address, CAPWAP_STATION_ADDRESS_LENGTH);
|
||||
func->read_u16(handle, &data->capabilities);
|
||||
func->read_u8(handle, &data->wlanid);
|
||||
data->supportedratescount = length;
|
||||
func->read_block(handle, data->supportedrates, length);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
/* */
|
||||
static void capwap_80211_station_element_free(void* data) {
|
||||
ASSERT(data != NULL);
|
||||
|
||||
capwap_free(data);
|
||||
}
|
||||
|
||||
/* */
|
||||
struct capwap_message_elements_ops capwap_element_80211_station_ops = {
|
||||
.create_message_element = capwap_80211_station_element_create,
|
||||
.parsing_message_element = capwap_80211_station_element_parsing,
|
||||
.free_parsed_message_element = capwap_80211_station_element_free
|
||||
};
|
22
src/common/capwap_element_80211_station.h
Normal file
22
src/common/capwap_element_80211_station.h
Normal file
@ -0,0 +1,22 @@
|
||||
#ifndef __CAPWAP_ELEMENT_80211_STATION_HEADER__
|
||||
#define __CAPWAP_ELEMENT_80211_STATION_HEADER__
|
||||
|
||||
#define CAPWAP_ELEMENT_80211_STATION 1036
|
||||
|
||||
#define CAPWAP_STATION_ADDRESS_LENGTH 6
|
||||
#define CAPWAP_STATION_RATES_MAXLENGTH 128
|
||||
|
||||
struct capwap_80211_station_element {
|
||||
uint8_t radioid;
|
||||
uint16_t associationid;
|
||||
uint8_t flags;
|
||||
uint8_t address[CAPWAP_STATION_ADDRESS_LENGTH];
|
||||
uint16_t capabilities;
|
||||
uint8_t wlanid;
|
||||
uint8_t supportedratescount;
|
||||
uint8_t supportedrates[CAPWAP_STATION_RATES_MAXLENGTH];
|
||||
};
|
||||
|
||||
extern struct capwap_message_elements_ops capwap_element_80211_station_ops;
|
||||
|
||||
#endif /* __CAPWAP_ELEMENT_80211_STATION_HEADER__ */
|
91
src/common/capwap_element_80211_stationkey.c
Normal file
91
src/common/capwap_element_80211_stationkey.c
Normal file
@ -0,0 +1,91 @@
|
||||
#include "capwap.h"
|
||||
#include "capwap_element.h"
|
||||
|
||||
/********************************************************************
|
||||
|
||||
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 |A|C| Flags |
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
| Pairwise TSC |
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
| Pairwise TSC | Pairwise RSC |
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
| Pairwise RSC |
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
| Key...
|
||||
+-+-+-+-+-+-+-+-
|
||||
|
||||
Type: 1038 for IEEE 802.11 Station Session Key
|
||||
|
||||
Length: >= 25
|
||||
|
||||
********************************************************************/
|
||||
|
||||
/* */
|
||||
static void capwap_80211_stationkey_element_create(void* data, capwap_message_elements_handle handle, struct capwap_write_message_elements_ops* func) {
|
||||
struct capwap_80211_stationkey_element* element = (struct capwap_80211_stationkey_element*)data;
|
||||
|
||||
ASSERT(data != NULL);
|
||||
|
||||
func->write_block(handle, element->address, CAPWAP_STATION_SESSION_KEY_ADDRESS_LENGTH);
|
||||
func->write_u16(handle, element->flags);
|
||||
func->write_block(handle, element->pairwisetsc, CAPWAP_STATION_SESSION_KEY_PAIRWISE_TSC_LENGTH);
|
||||
func->write_block(handle, element->pairwisersc, CAPWAP_STATION_SESSION_KEY_PAIRWISE_RSC_LENGTH);
|
||||
func->write_block(handle, element->key, element->keylength);
|
||||
}
|
||||
|
||||
/* */
|
||||
static void* capwap_80211_stationkey_element_parsing(capwap_message_elements_handle handle, struct capwap_read_message_elements_ops* func) {
|
||||
unsigned short length;
|
||||
struct capwap_80211_stationkey_element* data;
|
||||
|
||||
ASSERT(handle != NULL);
|
||||
ASSERT(func != NULL);
|
||||
|
||||
length = func->read_ready(handle);
|
||||
if (length < 25) {
|
||||
capwap_logging_debug("Invalid IEEE 802.11 Station Session Key element");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
length -= 20;
|
||||
if (length > CAPWAP_STATION_SESSION_KEY_KEY_LENGTH) {
|
||||
capwap_logging_debug("Invalid IEEE 802.11 Station Session Key element");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* */
|
||||
data = (struct capwap_80211_stationkey_element*)capwap_alloc(sizeof(struct capwap_80211_stationkey_element));
|
||||
if (!data) {
|
||||
capwap_outofmemory();
|
||||
}
|
||||
|
||||
/* Retrieve data */
|
||||
memset(data, 0, sizeof(struct capwap_80211_stationkey_element));
|
||||
func->read_block(handle, data->address, CAPWAP_STATION_SESSION_KEY_ADDRESS_LENGTH);
|
||||
func->read_u16(handle, &data->flags);
|
||||
func->read_block(handle, data->pairwisetsc, CAPWAP_STATION_SESSION_KEY_PAIRWISE_TSC_LENGTH);
|
||||
func->read_block(handle, data->pairwisersc, CAPWAP_STATION_SESSION_KEY_PAIRWISE_RSC_LENGTH);
|
||||
data->keylength = length;
|
||||
func->read_block(handle, data->key, data->keylength);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
/* */
|
||||
static void capwap_80211_stationkey_element_free(void* data) {
|
||||
ASSERT(data != NULL);
|
||||
|
||||
capwap_free(data);
|
||||
}
|
||||
|
||||
/* */
|
||||
struct capwap_message_elements_ops capwap_element_80211_stationkey_ops = {
|
||||
.create_message_element = capwap_80211_stationkey_element_create,
|
||||
.parsing_message_element = capwap_80211_stationkey_element_parsing,
|
||||
.free_parsed_message_element = capwap_80211_stationkey_element_free
|
||||
};
|
25
src/common/capwap_element_80211_stationkey.h
Normal file
25
src/common/capwap_element_80211_stationkey.h
Normal file
@ -0,0 +1,25 @@
|
||||
#ifndef __CAPWAP_ELEMENT_80211_STATION_SESSION_KEY_HEADER__
|
||||
#define __CAPWAP_ELEMENT_80211_STATION_SESSION_KEY_HEADER__
|
||||
|
||||
#define CAPWAP_ELEMENT_80211_STATION_SESSION_KEY_PROFILE 1037
|
||||
|
||||
#define CAPWAP_STATION_SESSION_KEY_ADDRESS_LENGTH 6
|
||||
#define CAPWAP_STATION_SESSION_KEY_PAIRWISE_TSC_LENGTH 6
|
||||
#define CAPWAP_STATION_SESSION_KEY_PAIRWISE_RSC_LENGTH 6
|
||||
#define CAPWAP_STATION_SESSION_KEY_KEY_LENGTH 32
|
||||
|
||||
#define CAPWAP_STATION_SESSION_KEY_AKM_ONLY 0x8000
|
||||
#define CAPWAP_STATION_SESSION_KEY_AC_ENCRYPT 0x4000
|
||||
|
||||
struct capwap_80211_stationkey_element {
|
||||
uint8_t address[CAPWAP_STATION_SESSION_KEY_ADDRESS_LENGTH];
|
||||
uint16_t flags;
|
||||
uint8_t pairwisetsc[CAPWAP_STATION_SESSION_KEY_PAIRWISE_TSC_LENGTH];
|
||||
uint8_t pairwisersc[CAPWAP_STATION_SESSION_KEY_PAIRWISE_RSC_LENGTH];
|
||||
uint16_t keylength;
|
||||
uint8_t key[CAPWAP_STATION_SESSION_KEY_KEY_LENGTH];
|
||||
};
|
||||
|
||||
extern struct capwap_message_elements_ops capwap_element_80211_stationkey_ops;
|
||||
|
||||
#endif /* __CAPWAP_ELEMENT_80211_STATION_SESSION_KEY_HEADER__ */
|
70
src/common/capwap_element_80211_stationqos.c
Normal file
70
src/common/capwap_element_80211_stationqos.c
Normal file
@ -0,0 +1,70 @@
|
||||
#include "capwap.h"
|
||||
#include "capwap_element.h"
|
||||
|
||||
/********************************************************************
|
||||
|
||||
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 | Reserved |8021p|
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
|
||||
Type: 1037 for IEEE 802.11 Station QoS Profile
|
||||
|
||||
Length: 8
|
||||
|
||||
********************************************************************/
|
||||
|
||||
/* */
|
||||
static void capwap_80211_stationqos_element_create(void* data, capwap_message_elements_handle handle, struct capwap_write_message_elements_ops* func) {
|
||||
struct capwap_80211_stationqos_element* element = (struct capwap_80211_stationqos_element*)data;
|
||||
|
||||
ASSERT(data != NULL);
|
||||
|
||||
func->write_block(handle, element->address, CAPWAP_STATION_QOS_ADDRESS_LENGTH);
|
||||
func->write_u8(handle, 0);
|
||||
func->write_u8(handle, element->priority);
|
||||
}
|
||||
|
||||
/* */
|
||||
static void* capwap_80211_stationqos_element_parsing(capwap_message_elements_handle handle, struct capwap_read_message_elements_ops* func) {
|
||||
struct capwap_80211_stationqos_element* data;
|
||||
|
||||
ASSERT(handle != NULL);
|
||||
ASSERT(func != NULL);
|
||||
|
||||
if (func->read_ready(handle) != 8) {
|
||||
capwap_logging_debug("Invalid IEEE 802.11 Station QoS Profile element");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* */
|
||||
data = (struct capwap_80211_stationqos_element*)capwap_alloc(sizeof(struct capwap_80211_stationqos_element));
|
||||
if (!data) {
|
||||
capwap_outofmemory();
|
||||
}
|
||||
|
||||
/* Retrieve data */
|
||||
memset(data, 0, sizeof(struct capwap_80211_stationqos_element));
|
||||
func->read_block(handle, data->address, CAPWAP_STATION_QOS_ADDRESS_LENGTH);
|
||||
func->read_u8(handle, NULL);
|
||||
func->read_u8(handle, &data->priority);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
/* */
|
||||
static void capwap_80211_stationqos_element_free(void* data) {
|
||||
ASSERT(data != NULL);
|
||||
|
||||
capwap_free(data);
|
||||
}
|
||||
|
||||
/* */
|
||||
struct capwap_message_elements_ops capwap_element_80211_stationqos_ops = {
|
||||
.create_message_element = capwap_80211_stationqos_element_create,
|
||||
.parsing_message_element = capwap_80211_stationqos_element_parsing,
|
||||
.free_parsed_message_element = capwap_80211_stationqos_element_free
|
||||
};
|
15
src/common/capwap_element_80211_stationqos.h
Normal file
15
src/common/capwap_element_80211_stationqos.h
Normal file
@ -0,0 +1,15 @@
|
||||
#ifndef __CAPWAP_ELEMENT_80211_STATION_QOS_PROFILE_HEADER__
|
||||
#define __CAPWAP_ELEMENT_80211_STATION_QOS_PROFILE_HEADER__
|
||||
|
||||
#define CAPWAP_ELEMENT_80211_STATION_QOS_PROFILE 1037
|
||||
|
||||
#define CAPWAP_STATION_QOS_ADDRESS_LENGTH 6
|
||||
|
||||
struct capwap_80211_stationqos_element {
|
||||
uint8_t address[CAPWAP_STATION_QOS_ADDRESS_LENGTH];
|
||||
uint8_t priority;
|
||||
};
|
||||
|
||||
extern struct capwap_message_elements_ops capwap_element_80211_stationqos_ops;
|
||||
|
||||
#endif /* __CAPWAP_ELEMENT_80211_STATION_QOS_PROFILE_HEADER__ */
|
Loading…
Reference in New Issue
Block a user