ac descriptor, struct reader

FossilOrigin-Name: 3b8718025cc9d01c66afddbc09fda047e4c78427fe342d8a800ba066eae62270
This commit is contained in:
7u83@mail.ru
2018-03-25 06:34:32 +00:00
parent 54e852c6a1
commit c1f1d91b28
22 changed files with 176 additions and 145 deletions

View File

@ -1,43 +1,43 @@
#include "cw.h"
#include "cw.h"
#include "dbg.h"
#include "ktv.h"
static struct cw_DescriptorSubelemDef allowed_default[] = {
{0,CW_SUBELEM_AC_HARDWARE_VERSION, "ac_hardware_versision", 1024,1},
{0,CW_SUBELEM_AC_SOFTWARE_VERSION, "ac_software_version", 1024,1},
{0,CAPWAP_SUBELEM_AC_HARDWARE_VERSION, "hardware", 1024,1},
{0,CAPWAP_SUBELEM_AC_SOFTWARE_VERSION, "software", 1024,1},
{0,0, NULL,0, 0}
};
cw_KTVStruct_t acstatus [] = {
/* type key len, pos */
{CW_TYPE_WORD, "stations", 2, -1},
{CW_TYPE_WORD, "station-limit", 2, -1},
{CW_TYPE_WORD, "avtive-wtps", 2, -1},
{CW_TYPE_WORD, "max-wtps", 2, -1},
{CW_TYPE_BYTE, "security", 1, -1},
{CW_TYPE_BYTE, "r-mac-field", 1, -1},
{CW_TYPE_BYTE, "reserved1", 1, -1},
{CW_TYPE_BYTE, "dtls-policy", 1, -1},
{NULL,NULL,0,0}
};
int cw_read_ac_descriptor(mavl_t store, uint8_t *data, int len,
struct cw_DescriptorSubelemDef *allowed)
int cw_read_ac_descriptor(mavl_t store,
struct cw_ElemHandler *eh,
struct cw_ElemHandlerParams * params,
uint8_t *data, int len,
struct cw_DescriptorSubelemDef *allowed)
{
char key[CW_KTV_MAX_KEY_LEN];
cw_KTV_t * stations, *limit;
stations = cw_ktv_add(store,"ac-descriptor/stations",CW_TYPE_WORD,data,4);
/* status->stations = cw_get_word(data);
status->limit = cw_get_word(data + 2);
status->active_wtps = cw_get_word(data + 4);
status->max_wtps = cw_get_word(data + 6);
status->security = cw_get_byte(data + 8);
status->rmac_field = cw_get_byte(data + 9);
status->dtls_policy = cw_get_byte(data + 11);
cw_dbg(DBG_SUBELEM,
"AC Descriptor: WTPs:%d/%d, Stations:%d/%d, Security:%d, Rmac:%d, DTLS-Policy:%d",
status->active_wtps, status->max_wtps, status->stations, status->limit,
status->security, status->rmac_field, status->dtls_policy);
*/
/* mbag_set_ptr(store, CW_ITEM_AC_STATUS, status);*/
cw_ktv_read_struct(params->conn->remote_cfg,acstatus,eh->key,data,len);
if (!allowed)
allowed=allowed_default;
return cw_read_descriptor_subelems(store, "key", data + 12, len - 12, allowed);
return cw_read_descriptor_subelems(store, eh->key, data + 12, len - 12, allowed);
}