can partially read wtp descriptor

FossilOrigin-Name: 87c986decab2956c060dc9212e5bd4d89bed829ec528477817f8ab795c396853
This commit is contained in:
7u83@mail.ru
2018-03-06 02:08:14 +00:00
parent 8817d54d14
commit 14a9c95eb8
30 changed files with 329 additions and 382 deletions

View File

@ -2,27 +2,39 @@
#include "capwap.h"
#include "capwap_items.h"
#include "cw_types.h"
/**
* Read WTP Descriptor in Cisco-Style (Draft 7)
*/
int cw_read_wtp_descriptor_7(mbag_t mbag, struct conn *conn,
struct cw_action_in *a, uint8_t * data, int len,
struct cw_descriptor_subelem_def *allowed)
int cw_read_wtp_descriptor_7(mavl_t cfg, struct conn *conn,
struct cw_ElemHandler *eh, uint8_t * data, int len,
struct cw_DescriptorSubelemDef *allowed)
{
int ncrypt, pos,i;
mavldata_t md;
char key[64];
mbag_set_byte(mbag, CW_ITEM_WTP_MAX_RADIOS, cw_get_byte(data));
sprintf(key,"%s/%s",eh->key, "max_radios");
md.kv.key=strdup(key);
mavl_replace (cfg, cw_type_byte.get(&md,data,1));
sprintf(key,"%s/%s",eh->key, "radios_in_use");
md.kv.key=strdup(key);
mavl_replace (cfg, cw_type_byte.get(&md,data+1,1));
/* mbag_set_byte(mbag, CW_ITEM_WTP_MAX_RADIOS, cw_get_byte(data));
mbag_set_byte(mbag, CW_ITEM_WTP_RADIOS_IN_USE, cw_get_byte(data + 1));
*/
int pos = 2;
pos = 2;
/* Encryption element, for now dumy XXX */
//cw_get_word(data + pos + 2);
pos += 2;
static struct cw_descriptor_subelem_def allowed_default[] = {
static struct cw_DescriptorSubelemDef allowed_default[] = {
{-1,CW_SUBELEM_WTP_HARDWARE_VERSION, CW_ITEM_WTP_HARDWARE_VERSION, 1024,0},
{-1,CW_SUBELEM_WTP_SOFTWARE_VERSION, CW_ITEM_WTP_SOFTWARE_VERSION, 1024.0},
{-1,CW_SUBELEM_WTP_BOOTLOADER_VERSION, CW_ITEM_WTP_SOFTWARE_VERSION, 1024,0},
@ -33,5 +45,5 @@ int cw_read_wtp_descriptor_7(mbag_t mbag, struct conn *conn,
if (!allowed)
allowed=allowed_default;
return cw_read_descriptor_subelems(mbag, data + pos, len - pos, allowed);
return cw_read_descriptor_subelems(cfg, data + pos, len - pos, allowed);
}