add RFC 7494 CAPWAP elements
This commit is contained in:
parent
c57eaca805
commit
ff290d80b5
@ -82,6 +82,7 @@ capwap_SOURCES = $(top_srcdir)/src/common/capwap.c \
|
||||
$(top_srcdir)/src/common/capwap_element_80211_deletewlan.c \
|
||||
$(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_mac_profile.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 \
|
||||
@ -92,6 +93,7 @@ capwap_SOURCES = $(top_srcdir)/src/common/capwap.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_statistics.c \
|
||||
$(top_srcdir)/src/common/capwap_element_80211_supported_mac_profiles.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 \
|
||||
@ -103,7 +105,9 @@ capwap_SOURCES = $(top_srcdir)/src/common/capwap.c \
|
||||
$(top_srcdir)/src/common/capwap_element_80211_wtpradioinformation.c \
|
||||
$(top_srcdir)/src/common/capwap_element_80211n_radioconf.c \
|
||||
$(top_srcdir)/src/common/capwap_element_80211n_station_information.c \
|
||||
$(top_srcdir)/src/common/capwap_element_vendor_travelping_wtp_timestamp.c
|
||||
$(top_srcdir)/src/common/capwap_element_vendor_travelping_wtp_timestamp.c \
|
||||
$(top_srcdir)/src/common/capwap_element_vendor_travelping_80211_encryption_capability.c \
|
||||
$(top_srcdir)/src/common/capwap_element_vendor_travelping_80211_update_key.c
|
||||
|
||||
if DEBUG_BUILD
|
||||
capwap_SOURCES += $(top_srcdir)/src/common/capwap_debug.c
|
||||
|
@ -66,6 +66,7 @@ static const struct capwap_message_elements_ops * capwap_80211_message_elements[
|
||||
element_ops(CAPWAP_ELEMENT_80211_DELETE_WLAN_TYPE, capwap_element_80211_deletewlan_ops),
|
||||
element_ops(CAPWAP_ELEMENT_80211_DIRECTSEQUENCECONTROL_TYPE, capwap_element_80211_directsequencecontrol_ops),
|
||||
element_ops(CAPWAP_ELEMENT_80211_IE_TYPE, capwap_element_80211_ie_ops),
|
||||
element_ops(CAPWAP_ELEMENT_80211_MAC_PROFILE_TYPE, capwap_element_80211_mac_profile_ops),
|
||||
element_ops(CAPWAP_ELEMENT_80211_MACOPERATION_TYPE, capwap_element_80211_macoperation_ops),
|
||||
element_ops(CAPWAP_ELEMENT_80211_MIC_COUNTERMEASURES_TYPE, capwap_element_80211_miccountermeasures_ops),
|
||||
element_ops(CAPWAP_ELEMENT_80211_MULTIDOMAINCAPABILITY_TYPE, capwap_element_80211_multidomaincapability_ops),
|
||||
@ -76,6 +77,7 @@ static const struct capwap_message_elements_ops * capwap_80211_message_elements[
|
||||
element_ops(CAPWAP_ELEMENT_80211_STATION_QOS_PROFILE_TYPE, capwap_element_80211_stationqos_ops),
|
||||
element_ops(CAPWAP_ELEMENT_80211_STATION_SESSION_KEY_PROFILE_TYPE, capwap_element_80211_stationkey_ops),
|
||||
element_ops(CAPWAP_ELEMENT_80211_STATISTICS_TYPE, capwap_element_80211_statistics_ops),
|
||||
element_ops(CAPWAP_ELEMENT_80211_SUPPORTED_MAC_PROFILES_TYPE, capwap_element_80211_supported_mac_profiles_ops),
|
||||
element_ops(CAPWAP_ELEMENT_80211_SUPPORTEDRATES_TYPE, capwap_element_80211_supportedrates_ops),
|
||||
element_ops(CAPWAP_ELEMENT_80211_TXPOWER_TYPE, capwap_element_80211_txpower_ops),
|
||||
element_ops(CAPWAP_ELEMENT_80211_TXPOWERLEVEL_TYPE, capwap_element_80211_txpowerlevel_ops),
|
||||
@ -84,7 +86,6 @@ static const struct capwap_message_elements_ops * capwap_80211_message_elements[
|
||||
element_ops(CAPWAP_ELEMENT_80211_WTP_QOS_TYPE, capwap_element_80211_wtpqos_ops),
|
||||
element_ops(CAPWAP_ELEMENT_80211_WTP_RADIO_CONF_TYPE, capwap_element_80211_wtpradioconf_ops),
|
||||
element_ops(CAPWAP_ELEMENT_80211_WTP_RADIO_FAIL_ALARM_TYPE, capwap_element_80211_wtpradiofailalarm_ops),
|
||||
element_ops(CAPWAP_ELEMENT_80211_WTPRADIOINFORMATION_TYPE, capwap_element_80211_wtpradioinformation_ops)
|
||||
};
|
||||
#undef element_ops
|
||||
|
||||
|
@ -130,6 +130,8 @@ const struct capwap_message_elements_ops *capwap_get_message_element_ops(const s
|
||||
#include "capwap_element_80211_wtpradioconf.h" /* 01046 */
|
||||
#include "capwap_element_80211_wtpradiofailalarm.h" /* 01047 */
|
||||
#include "capwap_element_80211_wtpradioinformation.h" /* 01048 */
|
||||
#include "capwap_element_80211_supported_mac_profiles.h" /* 01060 */
|
||||
#include "capwap_element_80211_mac_profile.h" /* 01061 */
|
||||
|
||||
#include "capwap_vendor_travelping.h"
|
||||
|
||||
|
89
src/common/capwap_element_80211_mac_profile.c
Normal file
89
src/common/capwap_element_80211_mac_profile.c
Normal file
@ -0,0 +1,89 @@
|
||||
#include "capwap.h"
|
||||
#include "capwap_element.h"
|
||||
|
||||
/*
|
||||
* The IEEE 802.11 MAC Profile message element allows the AC to select a
|
||||
* profile. This message element may be provided along with the IEEE
|
||||
* 802.11 ADD WLAN message element while configuring a WLAN on the WTP.
|
||||
*
|
||||
* 0 1 2 3 4 5 6 7
|
||||
* +=+-+-+-+-+-+-+-+
|
||||
* | Profile |
|
||||
* +-+-+-+-+-+-+-+-+
|
||||
*
|
||||
* o Type: 1061 for IEEE 802.11 MAC Profile
|
||||
*
|
||||
* o Profile: The profile is identified by a value as given below
|
||||
*
|
||||
* * 0: This refers to the IEEE 802.11 Split MAC Profile with WTP
|
||||
* encryption
|
||||
*
|
||||
* * 1: This refers to the IEEE 802.11 Split MAC Profile with AC
|
||||
* encryption
|
||||
*/
|
||||
|
||||
/* */
|
||||
static void
|
||||
capwap_80211_mac_profile_element_create(void *data, capwap_message_elements_handle handle,
|
||||
struct capwap_write_message_elements_ops *func)
|
||||
{
|
||||
struct capwap_80211_mac_profile_element *element =
|
||||
(struct capwap_80211_mac_profile_element*)data;
|
||||
|
||||
ASSERT(data != NULL);
|
||||
|
||||
func->write_u8(handle, element->mac_profile);
|
||||
}
|
||||
|
||||
/* */
|
||||
static void *
|
||||
capwap_80211_mac_profile_element_parsing(capwap_message_elements_handle handle,
|
||||
struct capwap_read_message_elements_ops *func)
|
||||
{
|
||||
unsigned short length;
|
||||
struct capwap_80211_mac_profile_element *data;
|
||||
|
||||
ASSERT(handle != NULL);
|
||||
ASSERT(func != NULL);
|
||||
|
||||
length = func->read_ready(handle);
|
||||
if (length != 1) {
|
||||
log_printf(LOG_DEBUG, "Invalid IEEE 802.11 Supported MAC Profiles element");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* */
|
||||
data = (struct capwap_80211_mac_profile_element *)
|
||||
capwap_alloc(sizeof(struct capwap_80211_mac_profile_element));
|
||||
memset(data, 0, sizeof(struct capwap_80211_mac_profile_element));
|
||||
|
||||
/* Retrieve data */
|
||||
func->read_u8(handle, &data->mac_profile);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
/* */
|
||||
static void *capwap_80211_mac_profile_element_clone(void *data)
|
||||
{
|
||||
ASSERT(data != NULL);
|
||||
|
||||
return capwap_clone(data, sizeof(struct capwap_80211_mac_profile_element));
|
||||
}
|
||||
|
||||
/* */
|
||||
static void capwap_80211_mac_profile_element_free(void *data)
|
||||
{
|
||||
ASSERT(data != NULL);
|
||||
|
||||
capwap_free(data);
|
||||
}
|
||||
|
||||
/* */
|
||||
const struct capwap_message_elements_ops capwap_element_80211_mac_profile_ops = {
|
||||
.category = CAPWAP_MESSAGE_ELEMENT_SINGLE,
|
||||
.create = capwap_80211_mac_profile_element_create,
|
||||
.parse = capwap_80211_mac_profile_element_parsing,
|
||||
.clone = capwap_80211_mac_profile_element_clone,
|
||||
.free = capwap_80211_mac_profile_element_free
|
||||
};
|
18
src/common/capwap_element_80211_mac_profile.h
Normal file
18
src/common/capwap_element_80211_mac_profile.h
Normal file
@ -0,0 +1,18 @@
|
||||
#ifndef __CAPWAP_ELEMENT_80211_MAC_PROFILE_HEADER__
|
||||
#define __CAPWAP_ELEMENT_80211_MAC_PROFILE_HEADER__
|
||||
|
||||
#define CAPWAP_ELEMENT_80211_MAC_PROFILE_VENDOR 0
|
||||
#define CAPWAP_ELEMENT_80211_MAC_PROFILE_TYPE 1061
|
||||
#define CAPWAP_ELEMENT_80211_MAC_PROFILE \
|
||||
(struct capwap_message_element_id) { \
|
||||
.vendor = CAPWAP_ELEMENT_80211_MAC_PROFILE_VENDOR, \
|
||||
.type = CAPWAP_ELEMENT_80211_MAC_PROFILE_TYPE \
|
||||
}
|
||||
|
||||
struct capwap_80211_mac_profile_element {
|
||||
uint8_t mac_profile;
|
||||
};
|
||||
|
||||
extern const struct capwap_message_elements_ops capwap_element_80211_mac_profile_ops;
|
||||
|
||||
#endif /* __CAPWAP_ELEMENT_80211_MAC_PROFILE_HEADER__ */
|
102
src/common/capwap_element_80211_supported_mac_profiles.c
Normal file
102
src/common/capwap_element_80211_supported_mac_profiles.c
Normal file
@ -0,0 +1,102 @@
|
||||
#include "capwap.h"
|
||||
#include "capwap_element.h"
|
||||
|
||||
/*
|
||||
* The IEEE 802.11 Supported MAC Profile message element allows the WTP
|
||||
* to communicate the profiles it supports. The Discovery Request
|
||||
* message, Primary Discovery Request message, and Join Request message
|
||||
* may include one such message element.
|
||||
*
|
||||
* 0 1 2 3
|
||||
* 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0
|
||||
* +=+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
|
||||
* | Num_Profiles | Profile_1 | Profile_[2..N]..
|
||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
|
||||
*
|
||||
* o Type: 1060 for IEEE 802.11 Supported MAC Profiles
|
||||
*
|
||||
* o Num_Profiles >=1: This refers to the number of profiles present in
|
||||
* this message element. There must be at least one profile.
|
||||
*
|
||||
* o Profile: Each profile is identified by a value specified in
|
||||
* Section 3.2.
|
||||
*/
|
||||
|
||||
/* */
|
||||
static void
|
||||
capwap_80211_supported_mac_profiles_element_create(void *data, capwap_message_elements_handle handle,
|
||||
struct capwap_write_message_elements_ops *func)
|
||||
{
|
||||
struct capwap_80211_supported_mac_profiles_element *element =
|
||||
(struct capwap_80211_supported_mac_profiles_element*)data;
|
||||
|
||||
ASSERT(data != NULL);
|
||||
|
||||
func->write_u8(handle, element->supported_mac_profilescount);
|
||||
func->write_block(handle, element->supported_mac_profiles, element->supported_mac_profilescount);
|
||||
}
|
||||
|
||||
/* */
|
||||
static void *
|
||||
capwap_80211_supported_mac_profiles_element_parsing(capwap_message_elements_handle handle,
|
||||
struct capwap_read_message_elements_ops *func)
|
||||
{
|
||||
unsigned short length;
|
||||
struct capwap_80211_supported_mac_profiles_element *data;
|
||||
|
||||
ASSERT(handle != NULL);
|
||||
ASSERT(func != NULL);
|
||||
|
||||
length = func->read_ready(handle);
|
||||
if (length < 1 || length > 255) {
|
||||
log_printf(LOG_DEBUG, "Invalid IEEE 802.11 Supported MAC Profiles element");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
length -= 1;
|
||||
|
||||
/* */
|
||||
data = (struct capwap_80211_supported_mac_profiles_element *)
|
||||
capwap_alloc(sizeof(struct capwap_80211_supported_mac_profiles_element) + length);
|
||||
memset(data, 0, sizeof(struct capwap_80211_supported_mac_profiles_element) + length);
|
||||
|
||||
/* Retrieve data */
|
||||
func->read_u8(handle, &data->supported_mac_profilescount);
|
||||
if (data->supported_mac_profilescount != length) {
|
||||
log_printf(LOG_DEBUG, "Invalid IEEE 802.11 Supported MAC Profiles element");
|
||||
capwap_free(data);
|
||||
return NULL;
|
||||
}
|
||||
func->read_block(handle, data->supported_mac_profiles, length);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
/* */
|
||||
static void *capwap_80211_supported_mac_profiles_element_clone(void *data)
|
||||
{
|
||||
struct capwap_80211_supported_mac_profiles_element *element =
|
||||
(struct capwap_80211_supported_mac_profiles_element*)data;
|
||||
|
||||
ASSERT(data != NULL);
|
||||
|
||||
return capwap_clone(data, sizeof(struct capwap_80211_supported_mac_profiles_element)
|
||||
+ element->supported_mac_profilescount);
|
||||
}
|
||||
|
||||
/* */
|
||||
static void capwap_80211_supported_mac_profiles_element_free(void *data)
|
||||
{
|
||||
ASSERT(data != NULL);
|
||||
|
||||
capwap_free(data);
|
||||
}
|
||||
|
||||
/* */
|
||||
const struct capwap_message_elements_ops capwap_element_80211_supported_mac_profiles_ops = {
|
||||
.category = CAPWAP_MESSAGE_ELEMENT_SINGLE,
|
||||
.create = capwap_80211_supported_mac_profiles_element_create,
|
||||
.parse = capwap_80211_supported_mac_profiles_element_parsing,
|
||||
.clone = capwap_80211_supported_mac_profiles_element_clone,
|
||||
.free = capwap_80211_supported_mac_profiles_element_free
|
||||
};
|
20
src/common/capwap_element_80211_supported_mac_profiles.h
Normal file
20
src/common/capwap_element_80211_supported_mac_profiles.h
Normal file
@ -0,0 +1,20 @@
|
||||
#ifndef __CAPWAP_ELEMENT_80211_SUPPORTED_MAC_PROFILES_HEADER__
|
||||
#define __CAPWAP_ELEMENT_80211_SUPPORTED_MAC_PROFILES_HEADER__
|
||||
|
||||
#define CAPWAP_ELEMENT_80211_SUPPORTED_MAC_PROFILES_VENDOR 0
|
||||
#define CAPWAP_ELEMENT_80211_SUPPORTED_MAC_PROFILES_TYPE 1060
|
||||
#define CAPWAP_ELEMENT_80211_SUPPORTED_MAC_PROFILES \
|
||||
(struct capwap_message_element_id) { \
|
||||
.vendor = CAPWAP_ELEMENT_80211_SUPPORTED_MAC_PROFILES_VENDOR, \
|
||||
.type = CAPWAP_ELEMENT_80211_SUPPORTED_MAC_PROFILES_TYPE \
|
||||
}
|
||||
|
||||
|
||||
struct capwap_80211_supported_mac_profiles_element {
|
||||
uint8_t supported_mac_profilescount;
|
||||
uint8_t supported_mac_profiles[];
|
||||
};
|
||||
|
||||
extern const struct capwap_message_elements_ops capwap_element_80211_supported_mac_profiles_ops;
|
||||
|
||||
#endif /* __CAPWAP_ELEMENT_80211_SUPPORTED_MAC_PROFILES_HEADER__ */
|
Loading…
Reference in New Issue
Block a user