Complete all message elements
This commit is contained in:
parent
4e01450d5c
commit
444f1e7e92
@ -31,10 +31,18 @@ capwap_SOURCES = \
|
||||
$(top_srcdir)/src/common/capwap_element_acdescriptor.c \
|
||||
$(top_srcdir)/src/common/capwap_element_actimestamp.c \
|
||||
$(top_srcdir)/src/common/capwap_element_addmacacl.c \
|
||||
$(top_srcdir)/src/common/capwap_element_deletemacacl.c \
|
||||
$(top_srcdir)/src/common/capwap_element_addstation.c \
|
||||
$(top_srcdir)/src/common/capwap_element_deletestation.c \
|
||||
$(top_srcdir)/src/common/capwap_element_discoverytype.c \
|
||||
$(top_srcdir)/src/common/capwap_element_duplicateipv4.c \
|
||||
$(top_srcdir)/src/common/capwap_element_duplicateipv6.c \
|
||||
$(top_srcdir)/src/common/capwap_element_datatransferdata.c \
|
||||
$(top_srcdir)/src/common/capwap_element_datatransfermode.c \
|
||||
$(top_srcdir)/src/common/capwap_element_decrypterrorreport.c \
|
||||
$(top_srcdir)/src/common/capwap_element_imagedata.c \
|
||||
$(top_srcdir)/src/common/capwap_element_imageinfo.c \
|
||||
$(top_srcdir)/src/common/capwap_element_initdownload.c \
|
||||
$(top_srcdir)/src/common/capwap_element_wtpboarddata.c \
|
||||
$(top_srcdir)/src/common/capwap_element_wtpdescriptor.c \
|
||||
$(top_srcdir)/src/common/capwap_element_wtpframetunnelmode.c \
|
||||
@ -53,6 +61,7 @@ capwap_SOURCES = \
|
||||
$(top_srcdir)/src/common/capwap_element_vendorpayload.c \
|
||||
$(top_srcdir)/src/common/capwap_element_maximumlength.c \
|
||||
$(top_srcdir)/src/common/capwap_element_wtprebootstat.c \
|
||||
$(top_srcdir)/src/common/capwap_element_wtpradiostat.c \
|
||||
$(top_srcdir)/src/common/capwap_element_resultcode.c \
|
||||
$(top_srcdir)/src/common/capwap_element_returnedmessage.c \
|
||||
$(top_srcdir)/src/common/capwap_element_acipv4list.c \
|
||||
|
@ -49,19 +49,19 @@ static struct capwap_message_elements_ops* capwap_message_elements[CAPWAP_MESSAG
|
||||
/* CAPWAP_ELEMENT_TIMERS */ &capwap_element_timers_ops,
|
||||
/* CAPWAP_ELEMENT_DATATRANSFERDATA */ &capwap_element_datatransferdata_ops,
|
||||
/* CAPWAP_ELEMENT_DATATRANSFERMODE */ &capwap_element_datatransfermode_ops,
|
||||
/* */ NULL,
|
||||
/* CAPWAP_ELEMENT_DECRYPTERRORREPORT */ &capwap_element_decrypterrorreport_ops,
|
||||
/* CAPWAP_ELEMENT_DECRYPTERRORREPORTPERIOD */ &capwap_element_decrypterrorreportperiod_ops,
|
||||
/* */ NULL,
|
||||
/* */ NULL,
|
||||
/* CAPWAP_ELEMENT_DELETEMACACL */ &capwap_element_deletemacacl_ops,
|
||||
/* CAPWAP_ELEMENT_DELETESTATION */ &capwap_element_deletestation_ops,
|
||||
/* Reserved */ NULL,
|
||||
/* CAPWAP_ELEMENT_DISCOVERYTYPE */ &capwap_element_discoverytype_ops,
|
||||
/* */ NULL,
|
||||
/* */ NULL,
|
||||
/* CAPWAP_ELEMENT_DUPLICATEIPV4 */ &capwap_element_duplicateipv4_ops,
|
||||
/* CAPWAP_ELEMENT_DUPLICATEIPV6 */ &capwap_element_duplicateipv6_ops,
|
||||
/* CAPWAP_ELEMENT_IDLETIMEOUT */ &capwap_element_idletimeout_ops,
|
||||
/* */ NULL,
|
||||
/* CAPWAP_ELEMENT_IMAGEDATA */ &capwap_element_imagedata_ops,
|
||||
/* CAPWAP_ELEMENT_IMAGEIDENTIFIER */ &capwap_element_imageidentifier_ops,
|
||||
/* */ NULL,
|
||||
/* */ NULL,
|
||||
/* CAPWAP_ELEMENT_IMAGEINFO */ &capwap_element_imageinfo_ops,
|
||||
/* CAPWAP_ELEMENT_INITIATEDOWNLOAD */ &capwap_element_initdownload_ops,
|
||||
/* CAPWAP_ELEMENT_LOCATION */ &capwap_element_location_ops,
|
||||
/* CAPWAP_ELEMENT_MAXIMUMLENGTH */ &capwap_element_maximumlength_ops,
|
||||
/* CAPWAP_ELEMENT_LOCALIPV4 */ &capwap_element_localipv4_ops,
|
||||
@ -81,7 +81,7 @@ static struct capwap_message_elements_ops* capwap_message_elements[CAPWAP_MESSAG
|
||||
/* CAPWAP_ELEMENT_WTPMACTYPE */ &capwap_element_wtpmactype_ops,
|
||||
/* CAPWAP_ELEMENT_WTPNAME */ &capwap_element_wtpname_ops,
|
||||
/* Reserved */ NULL,
|
||||
/* */ NULL,
|
||||
/* CAPWAP_ELEMENT_WTPRADIOSTAT */ &capwap_element_wtpradiostat_ops,
|
||||
/* CAPWAP_ELEMENT_WTPREBOOTSTAT */ &capwap_element_wtprebootstat_ops,
|
||||
/* CAPWAP_ELEMENT_WTPSTATICIPADDRESS */ &capwap_element_wtpstaticipaddress_ops,
|
||||
/* CAPWAP_ELEMENT_LOCALIPV6 */ &capwap_element_localipv6_ops,
|
||||
|
@ -17,6 +17,9 @@
|
||||
#define CAPWAP_80211_MESSAGE_ELEMENTS_COUNT ((CAPWAP_80211_MESSAGE_ELEMENTS_STOP - CAPWAP_80211_MESSAGE_ELEMENTS_START) + 1)
|
||||
#define IS_80211_MESSAGE_ELEMENTS(x) (((x >= CAPWAP_80211_MESSAGE_ELEMENTS_START) && (x <= CAPWAP_80211_MESSAGE_ELEMENTS_STOP)) ? 1 : 0)
|
||||
|
||||
/* */
|
||||
#define IS_VALID_RADIOID(x) ((x >= 1) && (x <= 31))
|
||||
|
||||
/* */
|
||||
typedef void* capwap_message_elements_handle;
|
||||
struct capwap_write_message_elements_ops {
|
||||
@ -61,19 +64,19 @@ struct capwap_message_elements_ops* capwap_get_message_element_ops(unsigned shor
|
||||
#include "capwap_element_timers.h" /* 00012 */
|
||||
#include "capwap_element_datatransferdata.h" /* 00013 */
|
||||
#include "capwap_element_datatransfermode.h" /* 00014 */
|
||||
/* 00015 */
|
||||
#include "capwap_element_decrypterrorreport.h" /* 00015 */
|
||||
#include "capwap_element_decrypterrorreportperiod.h" /* 00016 */
|
||||
/* 00017 */
|
||||
/* 00018 */
|
||||
#include "capwap_element_deletemacacl.h" /* 00017 */
|
||||
#include "capwap_element_deletestation.h" /* 00018 */
|
||||
/* Reserved */ /* 00019 */
|
||||
#include "capwap_element_discoverytype.h" /* 00020 */
|
||||
/* 00021 */
|
||||
/* 00022 */
|
||||
#include "capwap_element_duplicateipv4.h" /* 00021 */
|
||||
#include "capwap_element_duplicateipv6.h" /* 00022 */
|
||||
#include "capwap_element_idletimeout.h" /* 00023 */
|
||||
/* 00024 */
|
||||
#include "capwap_element_imagedata.h" /* 00024 */
|
||||
#include "capwap_element_imageidentifier.h" /* 00025 */
|
||||
/* 00026 */
|
||||
/* 00027 */
|
||||
#include "capwap_element_imageinfo.h" /* 00026 */
|
||||
#include "capwap_element_initdownload.h" /* 00027 */
|
||||
#include "capwap_element_location.h" /* 00028 */
|
||||
#include "capwap_element_maximumlength.h" /* 00029 */
|
||||
#include "capwap_element_localipv4.h" /* 00030 */
|
||||
@ -93,7 +96,7 @@ struct capwap_message_elements_ops* capwap_get_message_element_ops(unsigned shor
|
||||
#include "capwap_element_wtpmactype.h" /* 00044 */
|
||||
#include "capwap_element_wtpname.h" /* 00045 */
|
||||
/* Reserved */ /* 00046 */
|
||||
/* 00047 */
|
||||
#include "capwap_element_wtpradiostat.h" /* 00047 */
|
||||
#include "capwap_element_wtprebootstat.h" /* 00048 */
|
||||
#include "capwap_element_wtpstaticipaddress.h" /* 00049 */
|
||||
#include "capwap_element_localipv6.h" /* 00050 */
|
||||
|
@ -1,5 +1,5 @@
|
||||
#ifndef __CAPWAP_ELEMENT_80211_ADD_MAC_ACL__HEADER__
|
||||
#define __CAPWAP_ELEMENT_80211_ADD_MAC_ACL__HEADER__
|
||||
#ifndef __CAPWAP_ELEMENT_ADD_MAC_ACL__HEADER__
|
||||
#define __CAPWAP_ELEMENT_ADD_MAC_ACL__HEADER__
|
||||
|
||||
#define CAPWAP_ELEMENT_ADDMACACL 7
|
||||
|
||||
@ -11,4 +11,4 @@ struct capwap_addmacacl_element {
|
||||
|
||||
extern struct capwap_message_elements_ops capwap_element_addmacacl_ops;
|
||||
|
||||
#endif /* __CAPWAP_ELEMENT_80211_ADD_MAC_ACL__HEADER__ */
|
||||
#endif /* __CAPWAP_ELEMENT_ADD_MAC_ACL__HEADER__ */
|
||||
|
@ -37,6 +37,10 @@ static void capwap_addstation_element_free(void* data) {
|
||||
|
||||
ASSERT(data != NULL);
|
||||
|
||||
if (element->vlan) {
|
||||
capwap_free(element->vlan);
|
||||
}
|
||||
|
||||
if (element->address) {
|
||||
capwap_free(element->address);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
#ifndef __CAPWAP_ELEMENT_80211_ADD_STATION__HEADER__
|
||||
#define __CAPWAP_ELEMENT_80211_ADD_STATION__HEADER__
|
||||
#ifndef __CAPWAP_ELEMENT_ADD_STATION__HEADER__
|
||||
#define __CAPWAP_ELEMENT_ADD_STATION__HEADER__
|
||||
|
||||
#define CAPWAP_ELEMENT_ADDSTATION 8
|
||||
|
||||
@ -12,4 +12,4 @@ struct capwap_addstation_element {
|
||||
|
||||
extern struct capwap_message_elements_ops capwap_element_addstation_ops;
|
||||
|
||||
#endif /* __CAPWAP_ELEMENT_80211_ADD_STATION__HEADER__ */
|
||||
#endif /* __CAPWAP_ELEMENT_ADD_STATION__HEADER__ */
|
||||
|
@ -1,5 +1,5 @@
|
||||
#ifndef __CAPWAP_ELEMENT_80211_DATA_TRANSFER_DATA_HEADER__
|
||||
#define __CAPWAP_ELEMENT_80211_DATA_TRANSFER_DATA_HEADER__
|
||||
#ifndef __CAPWAP_ELEMENT_DATA_TRANSFER_DATA_HEADER__
|
||||
#define __CAPWAP_ELEMENT_DATA_TRANSFER_DATA_HEADER__
|
||||
|
||||
#define CAPWAP_ELEMENT_DATATRANSFERDATA 13
|
||||
|
||||
@ -19,4 +19,4 @@ struct capwap_datatransferdata_element {
|
||||
|
||||
extern struct capwap_message_elements_ops capwap_element_datatransferdata_ops;
|
||||
|
||||
#endif /* __CAPWAP_ELEMENT_80211_DATA_TRANSFER_DATA_HEADER__ */
|
||||
#endif /* __CAPWAP_ELEMENT_DATA_TRANSFER_DATA_HEADER__ */
|
||||
|
@ -1,5 +1,5 @@
|
||||
#ifndef __CAPWAP_ELEMENT_80211_DATA_TRANSFER_MODE_HEADER__
|
||||
#define __CAPWAP_ELEMENT_80211_DATA_TRANSFER_MODE_HEADER__
|
||||
#ifndef __CAPWAP_ELEMENT_DATA_TRANSFER_MODE_HEADER__
|
||||
#define __CAPWAP_ELEMENT_DATA_TRANSFER_MODE_HEADER__
|
||||
|
||||
#define CAPWAP_ELEMENT_DATATRANSFERMODE 14
|
||||
|
||||
@ -12,4 +12,4 @@ struct capwap_datatransfermode_element {
|
||||
|
||||
extern struct capwap_message_elements_ops capwap_element_datatransfermode_ops;
|
||||
|
||||
#endif /* __CAPWAP_ELEMENT_80211_DATA_TRANSFER_MODE_HEADER__ */
|
||||
#endif /* __CAPWAP_ELEMENT_DATA_TRANSFER_MODE_HEADER__ */
|
||||
|
97
src/common/capwap_element_decrypterrorreport.c
Normal file
97
src/common/capwap_element_decrypterrorreport.c
Normal file
@ -0,0 +1,97 @@
|
||||
#include "capwap.h"
|
||||
#include "capwap_element.h"
|
||||
|
||||
/********************************************************************
|
||||
|
||||
0 1 2
|
||||
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
| Radio ID |Num Of Entries | Length | MAC Address...
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
|
||||
Type: 15 for Decryption Error Report
|
||||
|
||||
Length: >= 9
|
||||
|
||||
********************************************************************/
|
||||
|
||||
/* */
|
||||
static void capwap_decrypterrorreport_element_create(void* data, capwap_message_elements_handle handle, struct capwap_write_message_elements_ops* func) {
|
||||
struct capwap_decrypterrorreport_element* element = (struct capwap_decrypterrorreport_element*)data;
|
||||
|
||||
ASSERT(data != NULL);
|
||||
|
||||
func->write_u8(handle, element->radioid);
|
||||
func->write_u8(handle, element->entry);
|
||||
func->write_u8(handle, element->length);
|
||||
func->write_block(handle, element->address, element->entry * element->length);
|
||||
}
|
||||
|
||||
/* */
|
||||
static void capwap_decrypterrorreport_element_free(void* data) {
|
||||
struct capwap_decrypterrorreport_element* element = (struct capwap_decrypterrorreport_element*)data;
|
||||
|
||||
ASSERT(data != NULL);
|
||||
|
||||
if (element->address) {
|
||||
capwap_free(element->address);
|
||||
}
|
||||
|
||||
capwap_free(element);
|
||||
}
|
||||
|
||||
/* */
|
||||
static void* capwap_decrypterrorreport_element_parsing(capwap_message_elements_handle handle, struct capwap_read_message_elements_ops* func) {
|
||||
unsigned short length;
|
||||
struct capwap_decrypterrorreport_element* data;
|
||||
|
||||
ASSERT(handle != NULL);
|
||||
ASSERT(func != NULL);
|
||||
|
||||
length = func->read_ready(handle);
|
||||
if (length < 9) {
|
||||
capwap_logging_debug("Invalid Decryption Error Report element");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
length -= 3;
|
||||
if ((length % 6) && (length % 8)) {
|
||||
capwap_logging_debug("Invalid Decryption Error Report element");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* */
|
||||
data = (struct capwap_decrypterrorreport_element*)capwap_alloc(sizeof(struct capwap_decrypterrorreport_element));
|
||||
if (!data) {
|
||||
capwap_outofmemory();
|
||||
}
|
||||
|
||||
/* Retrieve data */
|
||||
memset(data, 0, sizeof(struct capwap_decrypterrorreport_element));
|
||||
|
||||
func->read_u8(handle, &data->radioid);
|
||||
func->read_u8(handle, &data->entry);
|
||||
func->read_u8(handle, &data->length);
|
||||
|
||||
if (length != (data->entry * data->length)) {
|
||||
capwap_decrypterrorreport_element_free((void*)data);
|
||||
capwap_logging_debug("Invalid Decryption Error Report element");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
data->address = (uint8_t*)capwap_alloc(length);
|
||||
if (!data->address) {
|
||||
capwap_outofmemory();
|
||||
}
|
||||
|
||||
func->read_block(handle, data->address, length);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
/* */
|
||||
struct capwap_message_elements_ops capwap_element_decrypterrorreport_ops = {
|
||||
.create_message_element = capwap_decrypterrorreport_element_create,
|
||||
.parsing_message_element = capwap_decrypterrorreport_element_parsing,
|
||||
.free_parsed_message_element = capwap_decrypterrorreport_element_free
|
||||
};
|
15
src/common/capwap_element_decrypterrorreport.h
Normal file
15
src/common/capwap_element_decrypterrorreport.h
Normal file
@ -0,0 +1,15 @@
|
||||
#ifndef __CAPWAP_ELEMENT_DECRYPT_ERROR_REPORT__HEADER__
|
||||
#define __CAPWAP_ELEMENT_DECRYPT_ERROR_REPORT__HEADER__
|
||||
|
||||
#define CAPWAP_ELEMENT_DECRYPTERRORREPORT 15
|
||||
|
||||
struct capwap_decrypterrorreport_element {
|
||||
uint8_t radioid;
|
||||
uint8_t entry;
|
||||
uint8_t length;
|
||||
uint8_t* address;
|
||||
};
|
||||
|
||||
extern struct capwap_message_elements_ops capwap_element_decrypterrorreport_ops;
|
||||
|
||||
#endif /* __CAPWAP_ELEMENT_DECRYPT_ERROR_REPORT__HEADER__ */
|
95
src/common/capwap_element_deletemacacl.c
Normal file
95
src/common/capwap_element_deletemacacl.c
Normal file
@ -0,0 +1,95 @@
|
||||
#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
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
| Num of Entries| Length | MAC Address ...
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
|
||||
Type: 17 for Delete MAC ACL Entry
|
||||
|
||||
Length: >= 8
|
||||
|
||||
********************************************************************/
|
||||
|
||||
/* */
|
||||
static void capwap_deletemacacl_element_create(void* data, capwap_message_elements_handle handle, struct capwap_write_message_elements_ops* func) {
|
||||
struct capwap_deletemacacl_element* element = (struct capwap_deletemacacl_element*)data;
|
||||
|
||||
ASSERT(data != NULL);
|
||||
|
||||
func->write_u8(handle, element->entry);
|
||||
func->write_u8(handle, element->length);
|
||||
func->write_block(handle, element->address, element->entry * element->length);
|
||||
}
|
||||
|
||||
/* */
|
||||
static void capwap_deletemacacl_element_free(void* data) {
|
||||
struct capwap_deletemacacl_element* element = (struct capwap_deletemacacl_element*)data;
|
||||
|
||||
ASSERT(data != NULL);
|
||||
|
||||
if (element->address) {
|
||||
capwap_free(element->address);
|
||||
}
|
||||
|
||||
capwap_free(element);
|
||||
}
|
||||
|
||||
/* */
|
||||
static void* capwap_deletemacacl_element_parsing(capwap_message_elements_handle handle, struct capwap_read_message_elements_ops* func) {
|
||||
unsigned short length;
|
||||
struct capwap_deletemacacl_element* data;
|
||||
|
||||
ASSERT(handle != NULL);
|
||||
ASSERT(func != NULL);
|
||||
|
||||
length = func->read_ready(handle);
|
||||
if (length < 8) {
|
||||
capwap_logging_debug("Invalid Delete MAC ACL Entry element");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
length -= 2;
|
||||
if ((length % 6) && (length % 8)) {
|
||||
capwap_logging_debug("Invalid Delete MAC ACL Entry element");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* */
|
||||
data = (struct capwap_deletemacacl_element*)capwap_alloc(sizeof(struct capwap_deletemacacl_element));
|
||||
if (!data) {
|
||||
capwap_outofmemory();
|
||||
}
|
||||
|
||||
/* Retrieve data */
|
||||
memset(data, 0, sizeof(struct capwap_deletemacacl_element));
|
||||
|
||||
func->read_u8(handle, &data->entry);
|
||||
func->read_u8(handle, &data->length);
|
||||
|
||||
if (length != (data->entry * data->length)) {
|
||||
capwap_deletemacacl_element_free((void*)data);
|
||||
capwap_logging_debug("Invalid Delete MAC ACL Entry element");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
data->address = (uint8_t*)capwap_alloc(length);
|
||||
if (!data->address) {
|
||||
capwap_outofmemory();
|
||||
}
|
||||
|
||||
func->read_block(handle, data->address, length);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
/* */
|
||||
struct capwap_message_elements_ops capwap_element_deletemacacl_ops = {
|
||||
.create_message_element = capwap_deletemacacl_element_create,
|
||||
.parsing_message_element = capwap_deletemacacl_element_parsing,
|
||||
.free_parsed_message_element = capwap_deletemacacl_element_free
|
||||
};
|
14
src/common/capwap_element_deletemacacl.h
Normal file
14
src/common/capwap_element_deletemacacl.h
Normal file
@ -0,0 +1,14 @@
|
||||
#ifndef __CAPWAP_ELEMENT_DELETE_MAC_ACL__HEADER__
|
||||
#define __CAPWAP_ELEMENT_DELETE_MAC_ACL__HEADER__
|
||||
|
||||
#define CAPWAP_ELEMENT_DELETEMACACL 17
|
||||
|
||||
struct capwap_deletemacacl_element {
|
||||
uint8_t entry;
|
||||
uint8_t length;
|
||||
uint8_t* address;
|
||||
};
|
||||
|
||||
extern struct capwap_message_elements_ops capwap_element_deletemacacl_ops;
|
||||
|
||||
#endif /* __CAPWAP_ELEMENT_DELETE_MAC_ACL__HEADER__ */
|
91
src/common/capwap_element_deletestation.c
Normal file
91
src/common/capwap_element_deletestation.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 | Length | MAC Address ...
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
|
||||
Type: 18 for Delete Station
|
||||
|
||||
Length: >= 8
|
||||
|
||||
********************************************************************/
|
||||
|
||||
/* */
|
||||
static void capwap_deletestation_element_create(void* data, capwap_message_elements_handle handle, struct capwap_write_message_elements_ops* func) {
|
||||
struct capwap_deletestation_element* element = (struct capwap_deletestation_element*)data;
|
||||
|
||||
ASSERT(data != NULL);
|
||||
|
||||
func->write_u8(handle, element->radioid);
|
||||
func->write_u8(handle, element->length);
|
||||
func->write_block(handle, element->address, element->length);
|
||||
}
|
||||
|
||||
/* */
|
||||
static void capwap_deletestation_element_free(void* data) {
|
||||
struct capwap_deletestation_element* element = (struct capwap_deletestation_element*)data;
|
||||
|
||||
ASSERT(data != NULL);
|
||||
|
||||
if (element->address) {
|
||||
capwap_free(element->address);
|
||||
}
|
||||
|
||||
capwap_free(element);
|
||||
}
|
||||
|
||||
/* */
|
||||
static void* capwap_deletestation_element_parsing(capwap_message_elements_handle handle, struct capwap_read_message_elements_ops* func) {
|
||||
unsigned short length;
|
||||
struct capwap_deletestation_element* data;
|
||||
|
||||
ASSERT(handle != NULL);
|
||||
ASSERT(func != NULL);
|
||||
|
||||
length = func->read_ready(handle);
|
||||
if (length < 8) {
|
||||
capwap_logging_debug("Invalid Delete Station element");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
length -= 2;
|
||||
|
||||
/* */
|
||||
data = (struct capwap_deletestation_element*)capwap_alloc(sizeof(struct capwap_deletestation_element));
|
||||
if (!data) {
|
||||
capwap_outofmemory();
|
||||
}
|
||||
|
||||
/* Retrieve data */
|
||||
memset(data, 0, sizeof(struct capwap_deletestation_element));
|
||||
|
||||
func->read_u8(handle, &data->radioid);
|
||||
func->read_u8(handle, &data->length);
|
||||
|
||||
if (length != data->length) {
|
||||
capwap_deletestation_element_free((void*)data);
|
||||
capwap_logging_debug("Invalid Delete Station element");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
data->address = (uint8_t*)capwap_alloc(data->length);
|
||||
if (!data->address) {
|
||||
capwap_outofmemory();
|
||||
}
|
||||
|
||||
func->read_block(handle, data->address, data->length);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
/* */
|
||||
struct capwap_message_elements_ops capwap_element_deletestation_ops = {
|
||||
.create_message_element = capwap_deletestation_element_create,
|
||||
.parsing_message_element = capwap_deletestation_element_parsing,
|
||||
.free_parsed_message_element = capwap_deletestation_element_free
|
||||
};
|
14
src/common/capwap_element_deletestation.h
Normal file
14
src/common/capwap_element_deletestation.h
Normal file
@ -0,0 +1,14 @@
|
||||
#ifndef __CAPWAP_ELEMENT_DELETE_STATION__HEADER__
|
||||
#define __CAPWAP_ELEMENT_DELETE_STATION__HEADER__
|
||||
|
||||
#define CAPWAP_ELEMENT_DELETESTATION 18
|
||||
|
||||
struct capwap_deletestation_element {
|
||||
uint8_t radioid;
|
||||
uint8_t length;
|
||||
uint8_t* address;
|
||||
};
|
||||
|
||||
extern struct capwap_message_elements_ops capwap_element_deletestation_ops;
|
||||
|
||||
#endif /* __CAPWAP_ELEMENT_DELETE_STATION__HEADER__ */
|
95
src/common/capwap_element_duplicateipv4.c
Normal file
95
src/common/capwap_element_duplicateipv4.c
Normal file
@ -0,0 +1,95 @@
|
||||
#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
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
| IP Address |
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
| Status | Length | MAC Address ...
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
|
||||
Type: 21 for Duplicate IPv4 Address
|
||||
|
||||
Length: >= 12
|
||||
|
||||
********************************************************************/
|
||||
|
||||
/* */
|
||||
static void capwap_duplicateipv4_element_create(void* data, capwap_message_elements_handle handle, struct capwap_write_message_elements_ops* func) {
|
||||
struct capwap_duplicateipv4_element* element = (struct capwap_duplicateipv4_element*)data;
|
||||
|
||||
ASSERT(data != NULL);
|
||||
|
||||
func->write_block(handle, (uint8_t*)&element->address, sizeof(struct in_addr));
|
||||
func->write_u8(handle, element->status);
|
||||
func->write_u8(handle, element->length);
|
||||
func->write_block(handle, element->macaddress, element->length);
|
||||
}
|
||||
|
||||
/* */
|
||||
static void capwap_duplicateipv4_element_free(void* data) {
|
||||
struct capwap_duplicateipv4_element* element = (struct capwap_duplicateipv4_element*)data;
|
||||
|
||||
ASSERT(data != NULL);
|
||||
|
||||
if (element->macaddress) {
|
||||
capwap_free(element->macaddress);
|
||||
}
|
||||
|
||||
capwap_free(element);
|
||||
}
|
||||
|
||||
/* */
|
||||
static void* capwap_duplicateipv4_element_parsing(capwap_message_elements_handle handle, struct capwap_read_message_elements_ops* func) {
|
||||
unsigned short length;
|
||||
struct capwap_duplicateipv4_element* data;
|
||||
|
||||
ASSERT(handle != NULL);
|
||||
ASSERT(func != NULL);
|
||||
|
||||
length = func->read_ready(handle);
|
||||
if (length < 12) {
|
||||
capwap_logging_debug("Invalid Duplicate IPv4 Address element");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
length -= 6;
|
||||
|
||||
/* */
|
||||
data = (struct capwap_duplicateipv4_element*)capwap_alloc(sizeof(struct capwap_duplicateipv4_element));
|
||||
if (!data) {
|
||||
capwap_outofmemory();
|
||||
}
|
||||
|
||||
/* Retrieve data */
|
||||
memset(data, 0, sizeof(struct capwap_duplicateipv4_element));
|
||||
|
||||
func->read_block(handle, (uint8_t*)&data->address, sizeof(struct in_addr));
|
||||
func->read_u8(handle, &data->status);
|
||||
func->read_u8(handle, &data->length);
|
||||
|
||||
if (length != data->length) {
|
||||
capwap_duplicateipv4_element_free((void*)data);
|
||||
capwap_logging_debug("Invalid Duplicate IPv4 Address element");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
data->macaddress = (uint8_t*)capwap_alloc(data->length);
|
||||
if (!data->macaddress) {
|
||||
capwap_outofmemory();
|
||||
}
|
||||
|
||||
func->read_block(handle, data->macaddress, data->length);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
/* */
|
||||
struct capwap_message_elements_ops capwap_element_duplicateipv4_ops = {
|
||||
.create_message_element = capwap_duplicateipv4_element_create,
|
||||
.parsing_message_element = capwap_duplicateipv4_element_parsing,
|
||||
.free_parsed_message_element = capwap_duplicateipv4_element_free
|
||||
};
|
15
src/common/capwap_element_duplicateipv4.h
Normal file
15
src/common/capwap_element_duplicateipv4.h
Normal file
@ -0,0 +1,15 @@
|
||||
#ifndef __CAPWAP_ELEMENT_DUPLICATE_IPv4__HEADER__
|
||||
#define __CAPWAP_ELEMENT_DUPLICATE_IPv4__HEADER__
|
||||
|
||||
#define CAPWAP_ELEMENT_DUPLICATEIPV4 21
|
||||
|
||||
struct capwap_duplicateipv4_element {
|
||||
struct in_addr address;
|
||||
uint8_t status;
|
||||
uint8_t length;
|
||||
uint8_t* macaddress;
|
||||
};
|
||||
|
||||
extern struct capwap_message_elements_ops capwap_element_duplicateipv4_ops;
|
||||
|
||||
#endif /* __CAPWAP_ELEMENT_DUPLICATE_IPv4__HEADER__ */
|
101
src/common/capwap_element_duplicateipv6.c
Normal file
101
src/common/capwap_element_duplicateipv6.c
Normal file
@ -0,0 +1,101 @@
|
||||
#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
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
| IP Address |
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
| IP Address |
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
| IP Address |
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
| IP Address |
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
| Status | Length | MAC Address ...
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
|
||||
Type: 22 for Duplicate IPv6 Address
|
||||
|
||||
Length: >= 24
|
||||
|
||||
********************************************************************/
|
||||
|
||||
/* */
|
||||
static void capwap_duplicateipv6_element_create(void* data, capwap_message_elements_handle handle, struct capwap_write_message_elements_ops* func) {
|
||||
struct capwap_duplicateipv6_element* element = (struct capwap_duplicateipv6_element*)data;
|
||||
|
||||
ASSERT(data != NULL);
|
||||
|
||||
func->write_block(handle, (uint8_t*)&element->address, sizeof(struct in6_addr));
|
||||
func->write_u8(handle, element->status);
|
||||
func->write_u8(handle, element->length);
|
||||
func->write_block(handle, element->macaddress, element->length);
|
||||
}
|
||||
|
||||
/* */
|
||||
static void capwap_duplicateipv6_element_free(void* data) {
|
||||
struct capwap_duplicateipv6_element* element = (struct capwap_duplicateipv6_element*)data;
|
||||
|
||||
ASSERT(data != NULL);
|
||||
|
||||
if (element->macaddress) {
|
||||
capwap_free(element->macaddress);
|
||||
}
|
||||
|
||||
capwap_free(element);
|
||||
}
|
||||
|
||||
/* */
|
||||
static void* capwap_duplicateipv6_element_parsing(capwap_message_elements_handle handle, struct capwap_read_message_elements_ops* func) {
|
||||
unsigned short length;
|
||||
struct capwap_duplicateipv6_element* data;
|
||||
|
||||
ASSERT(handle != NULL);
|
||||
ASSERT(func != NULL);
|
||||
|
||||
length = func->read_ready(handle);
|
||||
if (length < 24) {
|
||||
capwap_logging_debug("Invalid Duplicate IPv6 Address element");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
length -= 18;
|
||||
|
||||
/* */
|
||||
data = (struct capwap_duplicateipv6_element*)capwap_alloc(sizeof(struct capwap_duplicateipv6_element));
|
||||
if (!data) {
|
||||
capwap_outofmemory();
|
||||
}
|
||||
|
||||
/* Retrieve data */
|
||||
memset(data, 0, sizeof(struct capwap_duplicateipv6_element));
|
||||
|
||||
func->read_block(handle, (uint8_t*)&data->address, sizeof(struct in6_addr));
|
||||
func->read_u8(handle, &data->status);
|
||||
func->read_u8(handle, &data->length);
|
||||
|
||||
if (length != data->length) {
|
||||
capwap_duplicateipv6_element_free((void*)data);
|
||||
capwap_logging_debug("Invalid Duplicate IPv6 Address element");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
data->macaddress = (uint8_t*)capwap_alloc(data->length);
|
||||
if (!data->macaddress) {
|
||||
capwap_outofmemory();
|
||||
}
|
||||
|
||||
func->read_block(handle, data->macaddress, data->length);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
/* */
|
||||
struct capwap_message_elements_ops capwap_element_duplicateipv6_ops = {
|
||||
.create_message_element = capwap_duplicateipv6_element_create,
|
||||
.parsing_message_element = capwap_duplicateipv6_element_parsing,
|
||||
.free_parsed_message_element = capwap_duplicateipv6_element_free
|
||||
};
|
15
src/common/capwap_element_duplicateipv6.h
Normal file
15
src/common/capwap_element_duplicateipv6.h
Normal file
@ -0,0 +1,15 @@
|
||||
#ifndef __CAPWAP_ELEMENT_DUPLICATE_IPv6__HEADER__
|
||||
#define __CAPWAP_ELEMENT_DUPLICATE_IPv6__HEADER__
|
||||
|
||||
#define CAPWAP_ELEMENT_DUPLICATEIPV6 22
|
||||
|
||||
struct capwap_duplicateipv6_element {
|
||||
struct in6_addr address;
|
||||
uint8_t status;
|
||||
uint8_t length;
|
||||
uint8_t* macaddress;
|
||||
};
|
||||
|
||||
extern struct capwap_message_elements_ops capwap_element_duplicateipv6_ops;
|
||||
|
||||
#endif /* __CAPWAP_ELEMENT_DUPLICATE_IPv6__HEADER__ */
|
85
src/common/capwap_element_imagedata.c
Normal file
85
src/common/capwap_element_imagedata.c
Normal file
@ -0,0 +1,85 @@
|
||||
#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
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
| Data Type | Data ....
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
|
||||
Type: 24 for Image Data
|
||||
|
||||
Length: >= 1
|
||||
|
||||
********************************************************************/
|
||||
|
||||
/* */
|
||||
static void capwap_imagedata_element_create(void* data, capwap_message_elements_handle handle, struct capwap_write_message_elements_ops* func) {
|
||||
struct capwap_imagedata_element* element = (struct capwap_imagedata_element*)data;
|
||||
|
||||
ASSERT(data != NULL);
|
||||
|
||||
func->write_u8(handle, element->type);
|
||||
func->write_block(handle, element->data, element->length);
|
||||
}
|
||||
|
||||
/* */
|
||||
static void capwap_imagedata_element_free(void* data) {
|
||||
struct capwap_imagedata_element* element = (struct capwap_imagedata_element*)data;
|
||||
|
||||
ASSERT(data != NULL);
|
||||
|
||||
if (element->data) {
|
||||
capwap_free(element->data);
|
||||
}
|
||||
|
||||
capwap_free(element);
|
||||
}
|
||||
|
||||
/* */
|
||||
static void* capwap_imagedata_element_parsing(capwap_message_elements_handle handle, struct capwap_read_message_elements_ops* func) {
|
||||
unsigned short length;
|
||||
struct capwap_imagedata_element* data;
|
||||
|
||||
ASSERT(handle != NULL);
|
||||
ASSERT(func != NULL);
|
||||
|
||||
length = func->read_ready(handle);
|
||||
if (length < 1) {
|
||||
capwap_logging_debug("Invalid Image Data element");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
length -= 1;
|
||||
|
||||
/* */
|
||||
data = (struct capwap_imagedata_element*)capwap_alloc(sizeof(struct capwap_imagedata_element));
|
||||
if (!data) {
|
||||
capwap_outofmemory();
|
||||
}
|
||||
|
||||
/* Retrieve data */
|
||||
memset(data, 0, sizeof(struct capwap_imagedata_element));
|
||||
|
||||
func->read_u8(handle, &data->type);
|
||||
data->length = length;
|
||||
if (length > 0) {
|
||||
data->data = (uint8_t*)capwap_alloc(length);
|
||||
if (!data->data) {
|
||||
capwap_outofmemory();
|
||||
}
|
||||
|
||||
func->read_block(handle, data->data, length);
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
/* */
|
||||
struct capwap_message_elements_ops capwap_element_imagedata_ops = {
|
||||
.create_message_element = capwap_imagedata_element_create,
|
||||
.parsing_message_element = capwap_imagedata_element_parsing,
|
||||
.free_parsed_message_element = capwap_imagedata_element_free
|
||||
};
|
18
src/common/capwap_element_imagedata.h
Normal file
18
src/common/capwap_element_imagedata.h
Normal file
@ -0,0 +1,18 @@
|
||||
#ifndef __CAPWAP_ELEMENT_IMAGE_DATA_HEADER__
|
||||
#define __CAPWAP_ELEMENT_IMAGE_DATA_HEADER__
|
||||
|
||||
#define CAPWAP_ELEMENT_IMAGEDATA 24
|
||||
|
||||
#define CAPWAP_IMAGEDATA_TYPE_DATA_IS_INCLUDED 1
|
||||
#define CAPWAP_IMAGEDATA_TYPE_DATA_EOF 2
|
||||
#define CAPWAP_IMAGEDATA_TYPE_ERROR 5
|
||||
|
||||
struct capwap_imagedata_element {
|
||||
uint8_t type;
|
||||
uint16_t length;
|
||||
uint8_t* data;
|
||||
};
|
||||
|
||||
extern struct capwap_message_elements_ops capwap_element_imagedata_ops;
|
||||
|
||||
#endif /* __CAPWAP_ELEMENT_IMAGE_DATA_HEADER__ */
|
74
src/common/capwap_element_imageinfo.c
Normal file
74
src/common/capwap_element_imageinfo.c
Normal file
@ -0,0 +1,74 @@
|
||||
#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
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
| File Size |
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
| Hash |
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
| Hash |
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
| Hash |
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
| Hash |
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
|
||||
Type: 26 for Image Information
|
||||
|
||||
Length: 20
|
||||
|
||||
********************************************************************/
|
||||
|
||||
/* */
|
||||
static void capwap_imageinfo_element_create(void* data, capwap_message_elements_handle handle, struct capwap_write_message_elements_ops* func) {
|
||||
struct capwap_imageinfo_element* element = (struct capwap_imageinfo_element*)data;
|
||||
|
||||
ASSERT(data != NULL);
|
||||
|
||||
func->write_u32(handle, element->length);
|
||||
func->write_block(handle, element->hash, CAPWAP_IMAGEINFO_HASH_LENGTH);
|
||||
}
|
||||
|
||||
/* */
|
||||
static void capwap_imageinfo_element_free(void* data) {
|
||||
ASSERT(data != NULL);
|
||||
|
||||
capwap_free(data);
|
||||
}
|
||||
|
||||
/* */
|
||||
static void* capwap_imageinfo_element_parsing(capwap_message_elements_handle handle, struct capwap_read_message_elements_ops* func) {
|
||||
struct capwap_imageinfo_element* data;
|
||||
|
||||
ASSERT(handle != NULL);
|
||||
ASSERT(func != NULL);
|
||||
|
||||
if (func->read_ready(handle) != 20) {
|
||||
capwap_logging_debug("Invalid Image Information element");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* */
|
||||
data = (struct capwap_imageinfo_element*)capwap_alloc(sizeof(struct capwap_imageinfo_element));
|
||||
if (!data) {
|
||||
capwap_outofmemory();
|
||||
}
|
||||
|
||||
/* Retrieve data */
|
||||
memset(data, 0, sizeof(struct capwap_imageinfo_element));
|
||||
func->read_u32(handle, &data->length);
|
||||
func->read_block(handle, data->hash, CAPWAP_IMAGEINFO_HASH_LENGTH);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
/* */
|
||||
struct capwap_message_elements_ops capwap_element_imageinfo_ops = {
|
||||
.create_message_element = capwap_imageinfo_element_create,
|
||||
.parsing_message_element = capwap_imageinfo_element_parsing,
|
||||
.free_parsed_message_element = capwap_imageinfo_element_free
|
||||
};
|
15
src/common/capwap_element_imageinfo.h
Normal file
15
src/common/capwap_element_imageinfo.h
Normal file
@ -0,0 +1,15 @@
|
||||
#ifndef __CAPWAP_ELEMENT_IMAGE_INFO_HEADER__
|
||||
#define __CAPWAP_ELEMENT_IMAGE_INFO_HEADER__
|
||||
|
||||
#define CAPWAP_ELEMENT_IMAGEINFO 26
|
||||
|
||||
#define CAPWAP_IMAGEINFO_HASH_LENGTH 16
|
||||
|
||||
struct capwap_imageinfo_element {
|
||||
uint32_t length;
|
||||
uint8_t hash[CAPWAP_IMAGEINFO_HASH_LENGTH];
|
||||
};
|
||||
|
||||
extern struct capwap_message_elements_ops capwap_element_imageinfo_ops;
|
||||
|
||||
#endif /* __CAPWAP_ELEMENT_IMAGE_INFO_HEADER__ */
|
52
src/common/capwap_element_initdownload.c
Normal file
52
src/common/capwap_element_initdownload.c
Normal file
@ -0,0 +1,52 @@
|
||||
#include "capwap.h"
|
||||
#include "capwap_element.h"
|
||||
|
||||
/********************************************************************
|
||||
|
||||
Type: 27 for Initiate Download
|
||||
|
||||
Length: 0
|
||||
|
||||
********************************************************************/
|
||||
|
||||
/* */
|
||||
static void capwap_initdownload_element_create(void* data, capwap_message_elements_handle handle, struct capwap_write_message_elements_ops* func) {
|
||||
}
|
||||
|
||||
/* */
|
||||
static void* capwap_initdownload_element_parsing(capwap_message_elements_handle handle, struct capwap_read_message_elements_ops* func) {
|
||||
struct capwap_initdownload_element* data;
|
||||
|
||||
ASSERT(handle != NULL);
|
||||
ASSERT(func != NULL);
|
||||
|
||||
if (func->read_ready(handle) != 0) {
|
||||
capwap_logging_debug("Invalid Initiate Download element");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* */
|
||||
data = (struct capwap_initdownload_element*)capwap_alloc(sizeof(struct capwap_initdownload_element));
|
||||
if (!data) {
|
||||
capwap_outofmemory();
|
||||
}
|
||||
|
||||
/* Retrieve data */
|
||||
memset(data, 0, sizeof(struct capwap_initdownload_element));
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
/* */
|
||||
static void capwap_initdownload_element_free(void* data) {
|
||||
ASSERT(data != NULL);
|
||||
|
||||
capwap_free(data);
|
||||
}
|
||||
|
||||
/* */
|
||||
struct capwap_message_elements_ops capwap_element_initdownload_ops = {
|
||||
.create_message_element = capwap_initdownload_element_create,
|
||||
.parsing_message_element = capwap_initdownload_element_parsing,
|
||||
.free_parsed_message_element = capwap_initdownload_element_free
|
||||
};
|
15
src/common/capwap_element_initdownload.h
Normal file
15
src/common/capwap_element_initdownload.h
Normal file
@ -0,0 +1,15 @@
|
||||
#ifndef __CAPWAP_ELEMENT_INIT_DOWNLOAD_HEADER__
|
||||
#define __CAPWAP_ELEMENT_INIT_DOWNLOAD_HEADER__
|
||||
|
||||
#define CAPWAP_ELEMENT_INITIATEDOWNLOAD 27
|
||||
|
||||
#define CAPWAP_LIMITED_ECN_SUPPORT 0
|
||||
#define CAPWAP_FULL_ECN_SUPPORT 1
|
||||
|
||||
struct capwap_initdownload_element {
|
||||
uint8_t dummy;
|
||||
};
|
||||
|
||||
extern struct capwap_message_elements_ops capwap_element_initdownload_ops;
|
||||
|
||||
#endif /* __CAPWAP_ELEMENT_INIT_DOWNLOAD_HEADER__ */
|
93
src/common/capwap_element_wtpradiostat.c
Normal file
93
src/common/capwap_element_wtpradiostat.c
Normal file
@ -0,0 +1,93 @@
|
||||
#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 | Last Fail Type| Reset Count |
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
| SW Failure Count | HW Failure Count |
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
| Other Failure Count | Unknown Failure Count |
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
| Config Update Count | Channel Change Count |
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
| Band Change Count | Current Noise Floor |
|
||||
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|
||||
|
||||
Type: 47 for WTP Radio Statistics
|
||||
|
||||
Length: 20
|
||||
|
||||
********************************************************************/
|
||||
|
||||
/* */
|
||||
static void capwap_wtpradiostat_element_create(void* data, capwap_message_elements_handle handle, struct capwap_write_message_elements_ops* func) {
|
||||
struct capwap_wtpradiostat_element* element = (struct capwap_wtpradiostat_element*)data;
|
||||
|
||||
ASSERT(data != NULL);
|
||||
|
||||
/* */
|
||||
func->write_u8(handle, element->radioid);
|
||||
func->write_u8(handle, element->lastfailtype);
|
||||
func->write_u16(handle, element->resetcount);
|
||||
func->write_u16(handle, element->swfailercount);
|
||||
func->write_u16(handle, element->hwfailercount);
|
||||
func->write_u16(handle, element->otherfailercount);
|
||||
func->write_u16(handle, element->unknownfailercount);
|
||||
func->write_u16(handle, element->configupdatecount);
|
||||
func->write_u16(handle, element->channelchangecount);
|
||||
func->write_u16(handle, element->bandchangecount);
|
||||
func->write_u16(handle, element->currentnoisefloor);
|
||||
}
|
||||
|
||||
/* */
|
||||
static void* capwap_wtpradiostat_element_parsing(capwap_message_elements_handle handle, struct capwap_read_message_elements_ops* func) {
|
||||
struct capwap_wtpradiostat_element* data;
|
||||
|
||||
ASSERT(handle != NULL);
|
||||
ASSERT(func != NULL);
|
||||
|
||||
if (func->read_ready(handle) != 20) {
|
||||
capwap_logging_debug("Invalid WTP Radio Statistics element");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* */
|
||||
data = (struct capwap_wtpradiostat_element*)capwap_alloc(sizeof(struct capwap_wtpradiostat_element));
|
||||
if (!data) {
|
||||
capwap_outofmemory();
|
||||
}
|
||||
|
||||
/* Retrieve data */
|
||||
memset(data, 0, sizeof(struct capwap_wtpradiostat_element));
|
||||
func->read_u8(handle, &data->radioid);
|
||||
func->read_u8(handle, &data->lastfailtype);
|
||||
func->read_u16(handle, &data->resetcount);
|
||||
func->read_u16(handle, &data->swfailercount);
|
||||
func->read_u16(handle, &data->hwfailercount);
|
||||
func->read_u16(handle, &data->otherfailercount);
|
||||
func->read_u16(handle, &data->unknownfailercount);
|
||||
func->read_u16(handle, &data->configupdatecount);
|
||||
func->read_u16(handle, &data->channelchangecount);
|
||||
func->read_u16(handle, &data->bandchangecount);
|
||||
func->read_u16(handle, &data->currentnoisefloor);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
/* */
|
||||
static void capwap_wtpradiostat_element_free(void* data) {
|
||||
ASSERT(data != NULL);
|
||||
|
||||
capwap_free(data);
|
||||
}
|
||||
|
||||
/* */
|
||||
struct capwap_message_elements_ops capwap_element_wtpradiostat_ops = {
|
||||
.create_message_element = capwap_wtpradiostat_element_create,
|
||||
.parsing_message_element = capwap_wtpradiostat_element_parsing,
|
||||
.free_parsed_message_element = capwap_wtpradiostat_element_free
|
||||
};
|
28
src/common/capwap_element_wtpradiostat.h
Normal file
28
src/common/capwap_element_wtpradiostat.h
Normal file
@ -0,0 +1,28 @@
|
||||
#ifndef __CAPWAP_ELEMENT_WTPRADIOSTAT_HEADER__
|
||||
#define __CAPWAP_ELEMENT_WTPRADIOSTAT_HEADER__
|
||||
|
||||
#define CAPWAP_ELEMENT_WTPRADIOSTAT 47
|
||||
|
||||
#define CAPWAP_WTPRADIOSTAT_FAILER_TYPE_STATNOTSUPP 0
|
||||
#define CAPWAP_WTPRADIOSTAT_FAILER_TYPE_SWFAIL 1
|
||||
#define CAPWAP_WTPRADIOSTAT_FAILER_TYPE_HWFAIL 2
|
||||
#define CAPWAP_WTPRADIOSTAT_FAILER_TYPE_OTHERFAIL 3
|
||||
#define CAPWAP_WTPRADIOSTAT_FAILER_TYPE_UNKNOWN 255
|
||||
|
||||
struct capwap_wtpradiostat_element {
|
||||
uint8_t radioid;
|
||||
uint8_t lastfailtype;
|
||||
uint16_t resetcount;
|
||||
uint16_t swfailercount;
|
||||
uint16_t hwfailercount;
|
||||
uint16_t otherfailercount;
|
||||
uint16_t unknownfailercount;
|
||||
uint16_t configupdatecount;
|
||||
uint16_t channelchangecount;
|
||||
uint16_t bandchangecount;
|
||||
uint16_t currentnoisefloor;
|
||||
};
|
||||
|
||||
extern struct capwap_message_elements_ops capwap_element_wtpradiostat_ops;
|
||||
|
||||
#endif /* __CAPWAP_ELEMENT_WTPRADIOSTAT_HEADER__ */
|
@ -182,13 +182,17 @@ struct capwap_data_message {
|
||||
#define IS_SEQUENCE_SMALLER(s1, s2) (((((s1) < (s2)) && (((s2) - (s1)) < 128)) || (((s1) > (s2)) && (((s1) - (s2)) > 128))) ? 1 : 0)
|
||||
|
||||
/* */
|
||||
#define MACADDRESS_EUI48_LENGTH 6
|
||||
struct capwap_macaddress_eui48 {
|
||||
uint8_t macaddress[6];
|
||||
uint8_t macaddress[MACADDRESS_EUI48_LENGTH];
|
||||
} STRUCT_PACKED;
|
||||
|
||||
/* */
|
||||
#define MACADDRESS_EUI64_LENGTH 8
|
||||
struct capwap_macaddress_eui64 {
|
||||
uint8_t macaddress[8];
|
||||
uint8_t macaddress[MACADDRESS_EUI64_LENGTH];
|
||||
} STRUCT_PACKED;
|
||||
|
||||
#define IS_VALID_MACADDRESS_LENGTH(x) ((x == MACADDRESS_EUI48_LENGTH) || (x == MACADDRESS_EUI64_LENGTH))
|
||||
|
||||
#endif /* __CAPWAP_RFC_HEADER__ */
|
||||
|
Loading…
Reference in New Issue
Block a user