can partially read wtp descriptor
FossilOrigin-Name: 87c986decab2956c060dc9212e5bd4d89bed829ec528477817f8ab795c396853
This commit is contained in:
@ -3,18 +3,41 @@
|
||||
#include "capwap.h"
|
||||
#include "capwap_items.h"
|
||||
#include "dbg.h"
|
||||
#include "cw_types.h"
|
||||
|
||||
|
||||
int cw_read_wtp_descriptor(mbag_t mbag, struct conn *conn,
|
||||
struct cw_action_in *a, uint8_t * data, int len,struct cw_descriptor_subelem_def *allowed)
|
||||
static struct cw_DescriptorSubelemDef allowed_default[] = {
|
||||
{0,CW_SUBELEM_WTP_HARDWARE_VERSION, "hardware_version", 1024,1},
|
||||
{0,CW_SUBELEM_WTP_SOFTWARE_VERSION, "software_version", 1024,1},
|
||||
{0,CW_SUBELEM_WTP_BOOTLOADER_VERSION, "bootloader_version", 1024,1},
|
||||
{0,CW_SUBELEM_WTP_OTHERSOFTWARE_VERSION, "other_software_version", 1024,0},
|
||||
{0,0, NULL, 0,0}
|
||||
};
|
||||
|
||||
|
||||
int cw_read_wtp_descriptor(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));
|
||||
|
||||
*/
|
||||
|
||||
/* Get number of encryption elements */
|
||||
int ncrypt = cw_get_byte(data + 2);
|
||||
ncrypt = cw_get_byte(data + 2);
|
||||
if (ncrypt == 0) {
|
||||
if (conn->strict_capwap) {
|
||||
cw_dbg(DBG_ELEM_ERR,
|
||||
@ -25,24 +48,16 @@ int cw_read_wtp_descriptor(mbag_t mbag, struct conn *conn,
|
||||
"Non standard conform WTP Descriptor, number of encryptoin elements is 0.");
|
||||
}
|
||||
|
||||
int pos = 3;
|
||||
int i;
|
||||
pos = 3;
|
||||
for (i = 0; i < ncrypt; i++) {
|
||||
// It's a dummy for now
|
||||
/* // It's a dummy for now */
|
||||
pos += 3;
|
||||
}
|
||||
|
||||
static struct cw_descriptor_subelem_def allowed_default[] = {
|
||||
{0,CW_SUBELEM_WTP_HARDWARE_VERSION, CW_ITEM_WTP_HARDWARE_VERSION, 1024,1},
|
||||
{0,CW_SUBELEM_WTP_SOFTWARE_VERSION, CW_ITEM_WTP_SOFTWARE_VERSION, 1024,1},
|
||||
{0,CW_SUBELEM_WTP_BOOTLOADER_VERSION, CW_ITEM_WTP_SOFTWARE_VERSION, 1024,1},
|
||||
{0,CW_SUBELEM_WTP_OTHERSOFTWARE_VERSION, CW_ITEM_WTP_SOFTWARE_VERSION, 1024,0},
|
||||
{0,0, NULL, 0,0}
|
||||
};
|
||||
|
||||
if (!allowed) {
|
||||
allowed=allowed_default;
|
||||
}
|
||||
|
||||
return cw_read_descriptor_subelems(conn->incomming, data + pos, len - pos, allowed);
|
||||
printf("call read subelems\n");
|
||||
return cw_read_descriptor_subelems(cfg, data + pos, len - pos, allowed);
|
||||
}
|
||||
|
Reference in New Issue
Block a user