Improved discriptor sub-element handling and debugging.

FossilOrigin-Name: 1be3acc6e8fe2f1b579bf1d84589aca685effc8c551372b536488f66ce0e0d84
This commit is contained in:
7u83@mail.ru
2016-03-14 23:31:31 +00:00
parent f8891001d6
commit f2d477ec97
14 changed files with 139 additions and 284 deletions

View File

@ -7,7 +7,8 @@ OBJS=\
cisco_out_ap_timesync.o \
cisco_in_wtp_descriptor.o \
cisco_out_ac_descriptor.o \
cisco_out_wtp_descriptor.o
cisco_out_wtp_descriptor.o \
cisco_in_ac_descriptor.o\
NAME=libcisco.a

View File

@ -11,5 +11,7 @@ extern int cisco_out_ac_descriptor(struct conn *conn,struct cw_action_out * a,ui
extern int cisco_out_wtp_descriptor(struct conn *conn, struct cw_action_out *a, uint8_t * dst);
extern int cisco_in_ac_descriptor(struct conn *conn, struct cw_action_in *a, uint8_t * data,
int len, struct sockaddr *from);
#endif

View File

@ -195,8 +195,28 @@ static cw_action_out_t actions_out[]={
.out = cisco_out_ac_descriptor,
.mand = 1
}
,
/* AC Descriptor - Join Response */
{
.msg_id = CW_MSG_JOIN_RESPONSE,
.item_id = CW_ITEM_AC_DESCRIPTOR,
.elem_id = CW_ELEM_AC_DESCRIPTOR,
.out = cisco_out_ac_descriptor,
.mand = 1
}
,
/* ECN Support - Join Response */
{
.msg_id = CW_MSG_JOIN_RESPONSE,
.elem_id = CW_ELEM_ECN_SUPPORT,
.item_id = CW_ITEM_ECN_SUPPORT
}
,

View File

@ -32,8 +32,22 @@
static cw_action_in_t actions_in[] = {
/* AC Descriptor - Discovery Response */
{
.capwap_state = CW_STATE_DISCOVERY,
.msg_id = CW_MSG_DISCOVERY_RESPONSE,
.elem_id = CW_ELEM_AC_DESCRIPTOR,
.item_id = CW_ITEM_AC_DESCRIPTOR,
.start = cisco_in_ac_descriptor,
.min_len = 12,
.max_len = 8192,
.mand = 1
}
,
/* ECN Support - Join Request */
/* ECN Support - Join Response */
{
.capwap_state = CW_STATE_JOIN,
.msg_id = CW_MSG_JOIN_RESPONSE,
@ -46,6 +60,19 @@ static cw_action_in_t actions_in[] = {
}
,
/* AC Descriptor - Join Response */
{
.capwap_state = CW_STATE_JOIN,
.msg_id = CW_MSG_JOIN_RESPONSE,
.elem_id = CW_ELEM_AC_DESCRIPTOR,
.item_id = CW_ITEM_AC_DESCRIPTOR,
.start = cisco_in_ac_descriptor,
.min_len = 12,
.max_len = 8192,
.mand = 1
}
,
/* End of list */

View File

@ -18,16 +18,24 @@
#include "cw/cw.h"
#include "cw/vendors.h"
#include "cw/capwap_items.h"
int cisco_in_wtp_descriptor(struct conn *conn, struct cw_action_in *a, uint8_t * data,
int len, struct sockaddr *from)
{
mbag_t mbag = conn->incomming;
static struct cw_descriptor_subelem_def allowed[] = {
{CW_VENDOR_ID_CISCO,CW_SUBELEM_WTP_HARDWARE_VERSION, CW_ITEM_WTP_HARDWARE_VERSION, 1024,0},
{CW_VENDOR_ID_CISCO,CW_SUBELEM_WTP_SOFTWARE_VERSION, CW_ITEM_WTP_SOFTWARE_VERSION, 1024.0},
{CW_VENDOR_ID_CISCO,CW_SUBELEM_WTP_BOOTLOADER_VERSION, CW_ITEM_WTP_BOOTLOADER_VERSION, 1024.0},
{CW_VENDOR_ID_CISCO,CW_SUBELEM_WTP_OTHERSOFTWARE_VERSION, "other", 1024.0},
{0,0, NULL, 0,0}
};
int rc =cw_read_wtp_descriptor_7(mbag, conn, a, data, len);
return rc;
return cw_read_wtp_descriptor_7(conn->incomming, conn, a, data, len, allowed);
}

View File

@ -21,8 +21,12 @@ int cisco_out_ac_descriptor(struct conn *conn,struct cw_action_out * a,uint8_t *
d+=cw_put_ac_status(d ,(struct cw_ac_status*)(i->data));
// i = mbag_get(conn->local,CW_ITEM_AC_SOFTWARE_VERSION);
/* Send back the same software as the WTP has,
otherwise the AP wants us to send an image */
i = mbag_get(conn->incomming,CW_ITEM_WTP_SOFTWARE_VERSION);
//i = mbag_get(conn->local,CW_ITEM_AC_SOFTWARE_VERSION);
if ( i ) {
d += cw_put_version(d,1,i->data);
}