Improve management SOAP request/response
This commit is contained in:
parent
b0fac2068e
commit
3fd122e9fd
File diff suppressed because it is too large
Load Diff
@ -198,7 +198,7 @@ static struct ac_soap_response* ac_dfa_state_configure_parsing_request(struct ac
|
||||
|
||||
/* Parsing only IEEE 802.11 message element */
|
||||
if (IS_80211_MESSAGE_ELEMENTS(messageelement->type)) {
|
||||
if (!ac_json_ieee80211_addmessageelement(&wtpradio, messageelement)) {
|
||||
if (!ac_json_ieee80211_parsingmessageelement(&wtpradio, messageelement)) {
|
||||
json_object_put(jsonparam);
|
||||
return NULL;
|
||||
}
|
||||
@ -243,6 +243,7 @@ static uint32_t ac_dfa_state_configure_create_response(struct ac_session_t* sess
|
||||
struct capwap_timers_element responsetimers;
|
||||
struct capwap_idletimeout_element responseidletimeout;
|
||||
struct capwap_wtpfallback_element responsewtpfallback;
|
||||
unsigned short binding = GET_WBID_HEADER(packet->rxmngpacket->header);
|
||||
|
||||
if ((response->responsecode != HTTP_RESULT_OK) || !response->xmlResponseReturn) {
|
||||
return CAPWAP_RESULTCODE_FAILURE;
|
||||
@ -282,6 +283,94 @@ static uint32_t ac_dfa_state_configure_create_response(struct ac_session_t* sess
|
||||
Gateway: [string],
|
||||
Static: [int]
|
||||
}
|
||||
<IEEE 802.11 BINDING>
|
||||
WTPRadio: [
|
||||
{
|
||||
RadioID: [int],
|
||||
IEEE80211Antenna: {
|
||||
Diversity: [bool],
|
||||
Combiner: [int],
|
||||
AntennaSelection: [
|
||||
[int]
|
||||
]
|
||||
},
|
||||
IEEE80211DirectSequenceControl: {
|
||||
CurrentChan: [int],
|
||||
CurrentCCA: [int],
|
||||
EnergyDetectThreshold: [int]
|
||||
},
|
||||
IEEE80211MACOperation: {
|
||||
RTSThreshold: [int],
|
||||
ShortRetry: [int],
|
||||
LongRetry: [int],
|
||||
FragmentationThreshold: [int],
|
||||
TxMSDULifetime: [int],
|
||||
RxMSDULifetime: [int]
|
||||
},
|
||||
IEEE80211MultiDomainCapability: {
|
||||
FirstChannel: [int],
|
||||
NumberChannels: [int],
|
||||
MaxTxPowerLevel: [int]
|
||||
},
|
||||
IEEE80211OFDMControl: {
|
||||
CurrentChan: [int],
|
||||
BandSupport: [int],
|
||||
TIThreshold: [int]
|
||||
},
|
||||
IEEE80211Rateset: [
|
||||
[int]
|
||||
],
|
||||
IEEE80211SupportedRates: [
|
||||
[int]
|
||||
],
|
||||
IEEE80211TxPower: {
|
||||
CurrentTxPower: [int]
|
||||
},
|
||||
IEEE80211WTPQoS: {
|
||||
TaggingPolicy: [int],
|
||||
Voice: {
|
||||
QueueDepth: [int],
|
||||
CWMin: [int],
|
||||
CWMax: [int],
|
||||
AIFS: [int],
|
||||
Priority8021p: [int],
|
||||
DSCP: [int]
|
||||
}
|
||||
Video: {
|
||||
QueueDepth: [int],
|
||||
CWMin: [int],
|
||||
CWMax: [int],
|
||||
AIFS: [int],
|
||||
Priority8021p: [int],
|
||||
DSCP: [int]
|
||||
}
|
||||
BestEffort: {
|
||||
QueueDepth: [int],
|
||||
CWMin: [int],
|
||||
CWMax: [int],
|
||||
AIFS: [int],
|
||||
Priority8021p: [int],
|
||||
DSCP: [int]
|
||||
}
|
||||
Background: {
|
||||
QueueDepth: [int],
|
||||
CWMin: [int],
|
||||
CWMax: [int],
|
||||
AIFS: [int],
|
||||
Priority8021p: [int],
|
||||
DSCP: [int]
|
||||
}
|
||||
}
|
||||
IEEE80211WTPRadioConfiguration: {
|
||||
ShortPreamble: [int],
|
||||
NumBSSIDs: [int],
|
||||
DTIMPeriod: [int],
|
||||
BSSID: [string],
|
||||
BeaconPeriod: [int],
|
||||
CountryString: [string]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
*/
|
||||
|
||||
@ -588,16 +677,26 @@ static uint32_t ac_dfa_state_configure_create_response(struct ac_session_t* sess
|
||||
}
|
||||
}
|
||||
|
||||
/* CAPWAP_ELEMENT_80211_ANTENNA */ /* TODO */
|
||||
/* CAPWAP_ELEMENT_80211_DIRECTSEQUENCECONTROL */ /* TODO */
|
||||
/* CAPWAP_ELEMENT_80211_MACOPERATION */ /* TODO */
|
||||
/* CAPWAP_ELEMENT_80211_MULTIDOMAINCAPABILITY */ /* TODO */
|
||||
/* CAPWAP_ELEMENT_80211_OFDMCONTROL */ /* TODO */
|
||||
/* CAPWAP_ELEMENT_80211_RATESET */ /* TODO */
|
||||
/* CAPWAP_ELEMENT_80211_SUPPORTEDRATES */ /* TODO */
|
||||
/* CAPWAP_ELEMENT_80211_TXPOWER */ /* TODO */
|
||||
/* CAPWAP_ELEMENT_80211_WTP_QOS */ /* TODO */
|
||||
/* CAPWAP_ELEMENT_80211_WTP_RADIO_CONF */ /* TODO */
|
||||
/* WTP Radio Information */
|
||||
if (binding == CAPWAP_WIRELESS_BINDING_IEEE80211) {
|
||||
struct ac_json_ieee80211_wtpradio wtpradio;
|
||||
|
||||
/* */
|
||||
ac_json_ieee80211_init(&wtpradio);
|
||||
|
||||
/* Parsing SOAP response */
|
||||
jsonelement = json_object_object_get(jsonroot, "WTPRadio");
|
||||
if (jsonelement) {
|
||||
if (ac_json_ieee80211_parsingjson(&wtpradio, jsonelement)) {
|
||||
/* Add IEEE802.11 message elements to packet */
|
||||
ac_json_ieee80211_buildpacket(&wtpradio, txmngpacket);
|
||||
}
|
||||
}
|
||||
|
||||
/* Free resource */
|
||||
ac_json_ieee80211_free(&wtpradio);
|
||||
}
|
||||
|
||||
/* CAPWAP_ELEMENT_VENDORPAYLOAD */ /* TODO */
|
||||
|
||||
if (jsonroot) {
|
||||
|
@ -241,7 +241,7 @@ static struct ac_soap_response* ac_dfa_state_join_parsing_request(struct ac_sess
|
||||
|
||||
/* Parsing only IEEE 802.11 message element */
|
||||
if (IS_80211_MESSAGE_ELEMENTS(messageelement->type)) {
|
||||
if (!ac_json_ieee80211_addmessageelement(&wtpradio, messageelement)) {
|
||||
if (!ac_json_ieee80211_parsingmessageelement(&wtpradio, messageelement)) {
|
||||
json_object_put(jsonparam);
|
||||
return NULL;
|
||||
}
|
||||
@ -259,28 +259,6 @@ static struct ac_soap_response* ac_dfa_state_join_parsing_request(struct ac_sess
|
||||
ac_json_ieee80211_free(&wtpradio);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* WTPRadioInformation */
|
||||
/*if (binding == CAPWAP_WIRELESS_BINDING_IEEE80211) {
|
||||
struct capwap_array* wtpradioinformation = (struct capwap_array*)capwap_get_message_element_data(packet, CAPWAP_ELEMENT_80211_WTPRADIOINFORMATION);
|
||||
|
||||
jsonarray = json_object_new_array();
|
||||
for (i = 0; i < wtpradioinformation->count; i++) {
|
||||
struct json_object* jsonradio;
|
||||
struct capwap_80211_wtpradioinformation_element* radio = *(struct capwap_80211_wtpradioinformation_element**)capwap_array_get_item_pointer(wtpradioinformation, i);
|
||||
|
||||
jsonradio = json_object_new_object();
|
||||
json_object_object_add(jsonradio, "RadioID", json_object_new_int((int)radio->radioid));
|
||||
json_object_object_add(jsonradio, "Mode", json_object_new_int((int)radio->radiotype));
|
||||
json_object_array_add(jsonarray, jsonradio);
|
||||
}
|
||||
|
||||
jsonhash = json_object_new_object();
|
||||
json_object_object_add(jsonhash, "IEEE80211WTPRadioInformation", jsonarray);
|
||||
json_object_object_add(jsonparam, "WTPRadioInformation", jsonhash);
|
||||
}*/
|
||||
|
||||
/* ECNSupport */
|
||||
ecnsupport = (struct capwap_ecnsupport_element*)capwap_get_message_element_data(packet, CAPWAP_ELEMENT_ECNSUPPORT);
|
||||
|
||||
@ -374,6 +352,15 @@ static uint32_t ac_dfa_state_join_create_response(struct ac_session_t* session,
|
||||
ACIPAddress: [string]
|
||||
}
|
||||
]
|
||||
<IEEE 802.11 BINDING>
|
||||
WTPRadio: [
|
||||
{
|
||||
RadioID: [int],
|
||||
IEEE80211WTPRadioInformation: {
|
||||
Mode: [int]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
*/
|
||||
|
||||
@ -409,49 +396,28 @@ static uint32_t ac_dfa_state_join_create_response(struct ac_session_t* session,
|
||||
|
||||
/* WTP Radio Information */
|
||||
if (binding == CAPWAP_WIRELESS_BINDING_IEEE80211) {
|
||||
struct ac_json_ieee80211_wtpradio wtpradio;
|
||||
struct capwap_array* wtpradioinformation = (struct capwap_array*)capwap_get_message_element_data(packet, CAPWAP_ELEMENT_80211_WTPRADIOINFORMATION);
|
||||
|
||||
/* */
|
||||
jsonelement = NULL;
|
||||
if (jsonroot) {
|
||||
jsonelement = json_object_object_get(jsonroot, "WTPRadioInformation");
|
||||
if (jsonelement && (json_object_get_type(jsonelement) == json_type_array)) {
|
||||
length = json_object_array_length(jsonelement);
|
||||
} else {
|
||||
jsonelement = NULL;
|
||||
ac_json_ieee80211_init(&wtpradio);
|
||||
|
||||
/* */
|
||||
jsonelement = json_object_object_get(jsonroot, "WTPRadio");
|
||||
if (jsonelement) {
|
||||
ac_json_ieee80211_parsingjson(&wtpradio, jsonelement);
|
||||
}
|
||||
|
||||
/* Copy WTP Radio Information if not present into SOAP response */
|
||||
for (i = 0; i < wtpradioinformation->count; i++) {
|
||||
ac_json_ieee80211_addmessageelement(&wtpradio, CAPWAP_ELEMENT_80211_WTPRADIOINFORMATION, *(struct capwap_80211_wtpradioinformation_element**)capwap_array_get_item_pointer(wtpradioinformation, i), 0);
|
||||
}
|
||||
|
||||
/* */
|
||||
for (i = 0; i < wtpradioinformation->count; i++) {
|
||||
struct capwap_80211_wtpradioinformation_element radio;
|
||||
ac_json_ieee80211_buildpacket(&wtpradio, txmngpacket);
|
||||
|
||||
/* Override WTP Radio Information value with SOAP response */
|
||||
memcpy(&radio, *(struct capwap_80211_wtpradioinformation_element**)capwap_array_get_item_pointer(wtpradioinformation, i), sizeof(struct capwap_80211_wtpradioinformation_element));
|
||||
if (jsonelement && length) {
|
||||
for (j = 0; j < length; j++) {
|
||||
struct json_object* jsonvalue = json_object_array_get_idx(jsonelement, i);
|
||||
if (jsonvalue && (json_object_get_type(jsonvalue) == json_type_object)) {
|
||||
struct json_object* jsonitem;
|
||||
|
||||
/* RadioID */
|
||||
jsonitem = json_object_object_get(jsonvalue, "RadioID");
|
||||
if (jsonitem && (json_object_get_type(jsonitem) == json_type_int)) {
|
||||
if ((int)radio.radioid == json_object_get_int(jsonitem)) {
|
||||
jsonitem = json_object_object_get(jsonvalue, "Mode");
|
||||
if (jsonitem && (json_object_get_type(jsonitem) == json_type_int)) {
|
||||
radio.radiotype = (uint32_t)(json_object_get_int(jsonitem) & CAPWAP_RADIO_TYPE_MASK);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
capwap_packet_txmng_add_message_element(txmngpacket, CAPWAP_ELEMENT_80211_WTPRADIOINFORMATION, &radio);
|
||||
}
|
||||
/* Free resource */
|
||||
ac_json_ieee80211_free(&wtpradio);
|
||||
}
|
||||
|
||||
/* ECN Support */
|
||||
|
@ -2,6 +2,7 @@
|
||||
#define __AC_JSON_HEADER__
|
||||
|
||||
#include "capwap_array.h"
|
||||
#include <json/json.h>
|
||||
|
||||
struct ac_json_ieee80211_item {
|
||||
int valid;
|
||||
@ -34,9 +35,17 @@ struct ac_json_ieee80211_wtpradio {
|
||||
|
||||
/* */
|
||||
void ac_json_ieee80211_init(struct ac_json_ieee80211_wtpradio* wtpradio);
|
||||
int ac_json_ieee80211_addmessageelement(struct ac_json_ieee80211_wtpradio* wtpradio, struct capwap_message_element_itemlist* messageelement);
|
||||
struct json_object* ac_json_ieee80211_getjson(struct ac_json_ieee80211_wtpradio* wtpradio);
|
||||
void ac_json_ieee80211_free(struct ac_json_ieee80211_wtpradio* wtpradio);
|
||||
|
||||
/* */
|
||||
int ac_json_ieee80211_addmessageelement(struct ac_json_ieee80211_wtpradio* wtpradio, uint16_t type, void* data, int overwrite);
|
||||
int ac_json_ieee80211_parsingmessageelement(struct ac_json_ieee80211_wtpradio* wtpradio, struct capwap_message_element_itemlist* messageelement);
|
||||
int ac_json_ieee80211_parsingjson(struct ac_json_ieee80211_wtpradio* wtpradio, struct json_object* jsonroot);
|
||||
|
||||
/* */
|
||||
struct json_object* ac_json_ieee80211_getjson(struct ac_json_ieee80211_wtpradio* wtpradio);
|
||||
void ac_json_ieee80211_buildpacket(struct ac_json_ieee80211_wtpradio* wtpradio, struct capwap_packet_txmng* txmngpacket);
|
||||
|
||||
|
||||
|
||||
#endif /* __AC_JSON_HEADER__ */
|
||||
|
Loading…
Reference in New Issue
Block a user