New message handler format
FossilOrigin-Name: bb2a1847072e2bf5e381dfdf0c4465b064c3feaab0faf51f93a7f4b8d2bcd999
This commit is contained in:
parent
06e50e8318
commit
5718781138
@ -318,7 +318,6 @@
|
|||||||
<File Name="src/cw/mavl_add_kv_byte.c"/>
|
<File Name="src/cw/mavl_add_kv_byte.c"/>
|
||||||
<File Name="src/cw/cw_types_mavl_delete.c"/>
|
<File Name="src/cw/cw_types_mavl_delete.c"/>
|
||||||
<File Name="src/cw/cw_format_scan_hex_bytes.c"/>
|
<File Name="src/cw/cw_format_scan_hex_bytes.c"/>
|
||||||
<File Name="src/cw/cw_type_version.c"/>
|
|
||||||
<File Name="src/cw/cw_dbg_elem.c"/>
|
<File Name="src/cw/cw_dbg_elem.c"/>
|
||||||
<File Name="src/cw/cw_kvstore_mavl_delete.c"/>
|
<File Name="src/cw/cw_kvstore_mavl_delete.c"/>
|
||||||
<File Name="src/cw/cw_format_version.c"/>
|
<File Name="src/cw/cw_format_version.c"/>
|
||||||
@ -326,6 +325,8 @@
|
|||||||
<File Name="src/cw/kvstore.h"/>
|
<File Name="src/cw/kvstore.h"/>
|
||||||
<File Name="src/cw/cw_kvstore_add.c"/>
|
<File Name="src/cw/cw_kvstore_add.c"/>
|
||||||
<File Name="src/cw/cw_types_del_null.c"/>
|
<File Name="src/cw/cw_types_del_null.c"/>
|
||||||
|
<File Name="src/cw/cw_type_bstr16.c"/>
|
||||||
|
<File Name="src/cw/cw_process_element.c"/>
|
||||||
</VirtualDirectory>
|
</VirtualDirectory>
|
||||||
</VirtualDirectory>
|
</VirtualDirectory>
|
||||||
<Description/>
|
<Description/>
|
||||||
|
@ -230,7 +230,7 @@
|
|||||||
#define CAPWAP_ELEM_DISCOVERY_TYPE 20
|
#define CAPWAP_ELEM_DISCOVERY_TYPE 20
|
||||||
#define CW_ELEM_DUPLICATE_IPV4_ADDRESS 21
|
#define CW_ELEM_DUPLICATE_IPV4_ADDRESS 21
|
||||||
#define CW_ELEM_DUPLICATE_IPV6_ADRESS 22
|
#define CW_ELEM_DUPLICATE_IPV6_ADRESS 22
|
||||||
#define CW_ELEM_ECN_SUPPORT 53
|
#define CAPWAP_ELEM_ECN_SUPPORT 53
|
||||||
#define CW_ELEM_IDLE_TIMEOUT 23
|
#define CW_ELEM_IDLE_TIMEOUT 23
|
||||||
#define CW_ELEM_IMAGE_DATA 24
|
#define CW_ELEM_IMAGE_DATA 24
|
||||||
#define CW_ELEM_IMAGE_IDENTIFIER 25
|
#define CW_ELEM_IMAGE_IDENTIFIER 25
|
||||||
@ -636,8 +636,11 @@ const char *cw_strelemp_(cw_strheap_t h, int msg_id);
|
|||||||
//int cw_process_msg(struct conn *conn, uint8_t * rawmsg, int len);
|
//int cw_process_msg(struct conn *conn, uint8_t * rawmsg, int len);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
extern int cw_in_vendor_specific_payload(struct conn *conn, struct cw_action_in *a,
|
extern int cw_in_vendor_specific_payload(struct conn *conn, struct cw_action_in *a,
|
||||||
uint8_t * data, int len,struct sockaddr *from);
|
uint8_t * data, int len,struct sockaddr *from);
|
||||||
|
*/
|
||||||
|
|
||||||
extern int cw_in_wtp_name(struct conn *conn, struct cw_action_in *a, uint8_t * data,
|
extern int cw_in_wtp_name(struct conn *conn, struct cw_action_in *a, uint8_t * data,
|
||||||
int len,struct sockaddr *from);
|
int len,struct sockaddr *from);
|
||||||
extern int cw_in_wtp_board_data(struct conn *conn, struct cw_action_in *a, uint8_t * data,
|
extern int cw_in_wtp_board_data(struct conn *conn, struct cw_action_in *a, uint8_t * data,
|
||||||
|
@ -29,7 +29,7 @@ struct cw_strlist_elem capwap_strings_elem[] = {
|
|||||||
{CAPWAP_ELEM_DISCOVERY_TYPE, "Discovery Type"},
|
{CAPWAP_ELEM_DISCOVERY_TYPE, "Discovery Type"},
|
||||||
{CW_ELEM_DUPLICATE_IPV4_ADDRESS, "Duplicate IPv4 Address"},
|
{CW_ELEM_DUPLICATE_IPV4_ADDRESS, "Duplicate IPv4 Address"},
|
||||||
{CW_ELEM_DUPLICATE_IPV6_ADRESS, "Duplicate IPv6 Address"},
|
{CW_ELEM_DUPLICATE_IPV6_ADRESS, "Duplicate IPv6 Address"},
|
||||||
{CW_ELEM_ECN_SUPPORT, "ECN Support"},
|
{CAPWAP_ELEM_ECN_SUPPORT, "ECN Support"},
|
||||||
{CW_ELEM_IDLE_TIMEOUT, "Idle Timeout"},
|
{CW_ELEM_IDLE_TIMEOUT, "Idle Timeout"},
|
||||||
{CW_ELEM_IMAGE_DATA, "Image Data"},
|
{CW_ELEM_IMAGE_DATA, "Image Data"},
|
||||||
{CW_ELEM_IMAGE_IDENTIFIER, "Image Identifier"},
|
{CW_ELEM_IMAGE_IDENTIFIER, "Image Identifier"},
|
||||||
|
@ -372,9 +372,32 @@ static int process_elements(struct conn *conn, uint8_t * rawmsg, int len,
|
|||||||
/* iterate through message elements */
|
/* iterate through message elements */
|
||||||
cw_foreach_elem(elem, elems_ptr, elems_len) {
|
cw_foreach_elem(elem, elems_ptr, elems_len) {
|
||||||
|
|
||||||
struct cw_ElemHandler *handler;
|
struct cw_ElemHandlerParams params;
|
||||||
struct cw_ElemData * elem_data, elem_data_search;
|
int elem_len, elem_id, max_len;
|
||||||
int elem_len, elem_id;
|
uint8_t * elem_data;
|
||||||
|
|
||||||
|
|
||||||
|
elem_len = cw_get_elem_len(elem);
|
||||||
|
elem_data=cw_get_elem_data(elem);
|
||||||
|
elem_id = cw_get_elem_id(elem);
|
||||||
|
|
||||||
|
max_len=elems_len-(elem_data-elems_ptr);
|
||||||
|
if (elem_len > max_len){
|
||||||
|
cw_dbg(DBG_RFC,
|
||||||
|
"Messag element claims size of %d bytes, but only %d bytes are left in the payload, truncating.",
|
||||||
|
elem_len,max_len-4);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
params.conn=conn;
|
||||||
|
params.from=from;
|
||||||
|
params.msgdata=message;
|
||||||
|
|
||||||
|
cw_process_element(¶ms,0,0,elem_id,elem_data,elem_len); //elems_len-(elem-elems_ptr));
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
elem_id = cw_get_elem_id(elem);
|
elem_id = cw_get_elem_id(elem);
|
||||||
|
|
||||||
@ -401,13 +424,14 @@ static int process_elements(struct conn *conn, uint8_t * rawmsg, int len,
|
|||||||
|
|
||||||
elem_len = cw_get_elem_len(elem);
|
elem_len = cw_get_elem_len(elem);
|
||||||
|
|
||||||
/*printf ("Would start elem processing now %d - %s\n",handler->id, handler->name);
|
|
||||||
*/
|
//printf ("Would start elem processing now %d - %s\n",handler->id, handler->name);
|
||||||
cw_dbg_elem(DBG_ELEM, conn, message->type, handler->id,
|
|
||||||
|
cw_dbg_elem(DBG_ELEM, conn, message->type, handler,
|
||||||
cw_get_elem_data(elem),elem_len);
|
cw_get_elem_data(elem),elem_len);
|
||||||
|
|
||||||
handler->get(conn, handler, cw_get_elem_data(elem), elem_len, from);
|
handler->get(conn, handler, cw_get_elem_data(elem), elem_len, from);
|
||||||
|
*/
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
exit(0);
|
exit(0);
|
||||||
|
@ -37,19 +37,18 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
static int cmp_by_addr(const mavldata_t * d1,const mavldata_t *d2)
|
||||||
static int cmp_by_addr(const void * d1,const void *d2)
|
|
||||||
{
|
{
|
||||||
struct conn * c1=(struct conn *) d1;
|
struct conn * c1=(struct conn *) d1->ptr;
|
||||||
struct conn * c2=(struct conn *) d2;
|
struct conn * c2=(struct conn *) d2->ptr;
|
||||||
|
|
||||||
return sock_cmpaddr((struct sockaddr*)&c1->addr,(struct sockaddr*)&c2->addr,1);
|
return sock_cmpaddr((struct sockaddr*)&c1->addr,(struct sockaddr*)&c2->addr,1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cmp_by_session_id(const void *d1, const void *d2)
|
static int cmp_by_session_id(const mavldata_t *d1, const mavldata_t *d2)
|
||||||
{
|
{
|
||||||
struct conn * c1=(struct conn *) d1;
|
struct conn * c1=(struct conn *) d1->ptr;
|
||||||
struct conn * c2=(struct conn *) d2;
|
struct conn * c2=(struct conn *) d2->ptr;
|
||||||
return memcmp(c1->session_id,c2->session_id,16);
|
return memcmp(c1->session_id,c2->session_id,16);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -111,7 +110,7 @@ struct conn * connlist_get(struct connlist * cl, const struct sockaddr * addr)
|
|||||||
{
|
{
|
||||||
struct conn search;
|
struct conn search;
|
||||||
sock_copyaddr(&search.addr,addr);
|
sock_copyaddr(&search.addr,addr);
|
||||||
return mavl_get(cl->by_addr,&search);
|
return mavl_get_ptr(cl->by_addr,&search);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -121,23 +120,26 @@ struct conn * connlist_add(struct connlist * cl, struct conn * conn)
|
|||||||
if (cl->by_addr->count>=cl->len)
|
if (cl->by_addr->count>=cl->len)
|
||||||
return NULL;
|
return NULL;
|
||||||
conn->connlist=cl;
|
conn->connlist=cl;
|
||||||
return mavl_add(cl->by_addr,conn);
|
return mavl_add_ptr(cl->by_addr,conn);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct conn * connlist_get_by_session_id(struct connlist *cl, struct conn * conn)
|
struct conn * connlist_get_by_session_id(struct connlist *cl, struct conn * conn)
|
||||||
{
|
{
|
||||||
return mavl_get(cl->by_session_id,conn);
|
return mavl_get_ptr(cl->by_session_id,conn);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct conn * connlist_add_by_session_id(struct connlist * cl, struct conn * conn)
|
struct conn * connlist_add_by_session_id(struct connlist * cl, struct conn * conn)
|
||||||
{
|
{
|
||||||
return mavl_add(cl->by_session_id,conn);
|
return mavl_add_ptr(cl->by_session_id,conn);
|
||||||
}
|
}
|
||||||
|
|
||||||
void connlist_remove(struct connlist *cl,struct conn * conn)
|
void connlist_remove(struct connlist *cl,struct conn * conn)
|
||||||
{
|
{
|
||||||
mavl_del(cl->by_session_id,conn);
|
mavldata_t md;
|
||||||
mavl_del(cl->by_addr,conn);
|
md.ptr=conn;
|
||||||
|
mavl_del(cl->by_session_id,&md);
|
||||||
|
md.ptr=conn;
|
||||||
|
mavl_del(cl->by_addr,&md);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
22
src/cw/cw.h
22
src/cw/cw.h
@ -350,10 +350,14 @@ extern int cw_in_mtu_discovery_padding(struct conn *conn, struct cw_action_in *a
|
|||||||
* @defgroup CWELEMIN Input Handlers for Message Elements
|
* @defgroup CWELEMIN Input Handlers for Message Elements
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
int cw_in_generic(struct conn * conn, struct cw_ElemHandler * handler,
|
int cw_in_generic(struct conn * conn, struct cw_ElemHandler * handler,
|
||||||
uint8_t * elem_data, int elem_len, struct sockaddr * from);
|
uint8_t * elem_data, int elem_len, struct sockaddr * from);
|
||||||
|
*/
|
||||||
|
|
||||||
|
int cw_in_generic(struct cw_ElemHandler * handler, struct cw_ElemHandlerParams * params,
|
||||||
|
uint8_t * elem_data, int elem_len);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -364,8 +368,10 @@ extern int cw_in_wtp_reboot_statistics(struct conn *conn, struct cw_action_in *a
|
|||||||
extern int cw_in_wtp_board_data(struct conn *conn, struct cw_action_in *a, uint8_t * data,
|
extern int cw_in_wtp_board_data(struct conn *conn, struct cw_action_in *a, uint8_t * data,
|
||||||
int len, struct sockaddr *from);
|
int len, struct sockaddr *from);
|
||||||
|
|
||||||
extern int cw_in_vendor_specific_payload(struct conn *conn, struct cw_action_in *a,
|
|
||||||
uint8_t * data, int len, struct sockaddr *from);
|
int cw_in_vendor_specific_payload(struct cw_ElemHandler *handler,
|
||||||
|
struct cw_ElemHandlerParams *params,
|
||||||
|
uint8_t * data, int len);
|
||||||
|
|
||||||
extern int cw_in_capwap_control_ip_address(struct conn *conn, struct cw_action_in *a,
|
extern int cw_in_capwap_control_ip_address(struct conn *conn, struct cw_action_in *a,
|
||||||
uint8_t * data, int len,
|
uint8_t * data, int len,
|
||||||
@ -383,8 +389,14 @@ extern int cw_in_radio_operational_state(struct conn *conn, struct cw_action_in
|
|||||||
uint8_t * data, int len, struct sockaddr *from);
|
uint8_t * data, int len, struct sockaddr *from);
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
int cw_process_element(struct conn * conn,
|
||||||
|
struct cw_MsgData * msgdata, int proto, int vendor,
|
||||||
|
uint8_t * elem, int max_len);
|
||||||
|
*/
|
||||||
|
int cw_process_element(struct cw_ElemHandlerParams *params,
|
||||||
|
int proto, int vendor,int msgid,
|
||||||
|
uint8_t * elem, int max_len);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @}
|
* @}
|
||||||
|
@ -3,11 +3,16 @@
|
|||||||
#include "dbg.h"
|
#include "dbg.h"
|
||||||
#include "format.h"
|
#include "format.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* print debug info for message elements
|
* print debug info for message elements
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void cw_dbg_elem_x(int level, struct conn *conn, int msg, int msgelem,
|
void cw_dbg_elem(int level, struct conn *conn, int msg,
|
||||||
|
struct cw_ElemHandler * handler,
|
||||||
const uint8_t * msgbuf, int len)
|
const uint8_t * msgbuf, int len)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -16,46 +21,57 @@ void cw_dbg_elem_x(int level, struct conn *conn, int msg, int msgelem,
|
|||||||
char vendorname[256];
|
char vendorname[256];
|
||||||
char vendor_details[265];
|
char vendor_details[265];
|
||||||
|
|
||||||
|
|
||||||
if (!cw_dbg_is_level(level))
|
if (!cw_dbg_is_level(level))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
*vendor_details = 0;
|
*vendor_details = 0;
|
||||||
|
|
||||||
|
/* handler = cw_msgset_get_elemhandler(conn->msgset,0,0,msgelem);
|
||||||
|
if (!handler)
|
||||||
|
return;
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
/// TODO XXXX
|
/// TODO XXXX
|
||||||
*/
|
*/
|
||||||
|
/* if (msgelem == -1) {
|
||||||
/*
|
|
||||||
if (msgelem == CAPWAP_ELEM_VENDOR_SPECIFIC_PAYLOAD) {
|
|
||||||
uint32_t vendor_id = ntohl(*((uint32_t *) msgbuf));
|
uint32_t vendor_id = ntohl(*((uint32_t *) msgbuf));
|
||||||
int type = ntohs(*((uint16_t *) (msgbuf + 4)));
|
int type = ntohs(*((uint16_t *) (msgbuf + 4)));
|
||||||
cw_format_vendor(vendor_details, vendor_id, type, msgbuf);
|
cw_format_vendor(vendor_details, vendor_id, type, msgbuf);
|
||||||
// sprintf(vendorname, "%s/%s/%s",
|
|
||||||
// cw_strelemp(conn->actions, msgelem),
|
|
||||||
// (char *) cw_strvendor(vendor_id), vendor_details);
|
|
||||||
|
|
||||||
elemname = vendorname;
|
elemname = vendorname;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
elemname=handler->name;
|
||||||
// elemname = cw_strelemp(conn->actions, msgelem);
|
|
||||||
|
|
||||||
elemname=0;
|
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
if (handler->vendor){
|
||||||
|
sprintf(vendorname,"Vendor %s",cw_strvendor(handler->vendor));
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
sprintf(vendorname,"");
|
||||||
|
}
|
||||||
|
|
||||||
/*&
|
|
||||||
if (!cw_dbg_is_level(DBG_ELEM_DMP)) {
|
if (cw_dbg_is_level(DBG_ELEM_DMP)) {
|
||||||
cw_dbg(DBG_ELEM, "%d (%s), len=%d", msgelem, elemname, len);
|
/*
|
||||||
} else {
|
char *dmp = cw_dbg_mkdmp(msgbuf, len);
|
||||||
|
*/
|
||||||
char *dmp;
|
char *dmp;
|
||||||
dmp = cw_format_dump(msgbuf,len,NULL);
|
dmp = cw_format_dump(msgbuf,len,NULL);
|
||||||
|
|
||||||
cw_dbg(DBG_ELEM, "%d (%s), len=%d%s%s",
|
cw_dbg(DBG_ELEM, "%s %d (%s), len=%d%s%s",
|
||||||
msgelem, elemname, len, get_dbg_color_ontext(DBG_ELEM_DMP), dmp);
|
vendorname,
|
||||||
|
handler->id, handler->name, len, /*get_dbg_color_ontext(DBG_ELEM_DMP)*/ "", dmp);
|
||||||
|
|
||||||
free(dmp);
|
free(dmp);
|
||||||
}
|
}
|
||||||
*/
|
else
|
||||||
}
|
cw_dbg(DBG_ELEM, "%s %d (%s), len=%d",
|
||||||
|
vendorname,
|
||||||
|
handler->id, handler->name, len);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -7,14 +7,14 @@
|
|||||||
|
|
||||||
|
|
||||||
static struct cw_FormatDumpSettings CW_FORMAT_DUMP_SETTINGS = {
|
static struct cw_FormatDumpSettings CW_FORMAT_DUMP_SETTINGS = {
|
||||||
32, /* row_len */
|
24, /* row_len */
|
||||||
8, /* marker_distance */
|
8, /* marker_distance */
|
||||||
'|', /* marker_char */
|
'|', /* marker_char */
|
||||||
1, /* ascii */
|
1, /* ascii */
|
||||||
0, /* inv_len */
|
0, /* inv_len */
|
||||||
'*', /* inv_char */
|
'*', /* inv_char */
|
||||||
"\n\t", /* dump_prefix */
|
"\n\t", /* dump_prefix */
|
||||||
"" /* dump_suffix */
|
"", /* dump_suffix */
|
||||||
" ", /* ascii_prefix */
|
" ", /* ascii_prefix */
|
||||||
"\n\t" /* newline */
|
"\n\t" /* newline */
|
||||||
};
|
};
|
||||||
@ -81,7 +81,7 @@ char *cw_format_dump(const uint8_t * data, int len,
|
|||||||
if (len % settings->row_len)
|
if (len % settings->row_len)
|
||||||
rows++;
|
rows++;
|
||||||
|
|
||||||
size = strlen(settings->dump_prefix) +
|
size = strlen(settings->dump_prefix) + strlen(settings->dump_suffix) +
|
||||||
rows * strlen(settings->newline) +
|
rows * strlen(settings->newline) +
|
||||||
(settings->ascii ? rows*settings->row_len*3 : len * 3);
|
(settings->ascii ? rows*settings->row_len*3 : len * 3);
|
||||||
|
|
||||||
@ -106,7 +106,7 @@ char *cw_format_dump(const uint8_t * data, int len,
|
|||||||
rlen = len-pos;
|
rlen = len-pos;
|
||||||
}
|
}
|
||||||
pdst += cw_format_dump_row(pdst,data+pos, rlen, settings);
|
pdst += cw_format_dump_row(pdst,data+pos, rlen, settings);
|
||||||
if(row<rows)
|
if(row<rows-1)
|
||||||
pdst += sprintf(pdst,"%s",settings->newline);
|
pdst += sprintf(pdst,"%s",settings->newline);
|
||||||
else
|
else
|
||||||
pdst += sprintf(pdst,"%s",settings->dump_suffix);
|
pdst += sprintf(pdst,"%s",settings->dump_suffix);
|
||||||
|
@ -3,8 +3,8 @@
|
|||||||
#include "kvstore.h"
|
#include "kvstore.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
||||||
int cw_in_generic(struct conn * conn, struct cw_ElemHandler * handler,
|
int cw_in_generic(struct cw_ElemHandler * handler, struct cw_ElemHandlerParams * params,
|
||||||
uint8_t * elem_data, int elem_len, struct sockaddr * from){
|
uint8_t * elem_data, int elem_len){
|
||||||
/* mavldata_t data, *result;
|
/* mavldata_t data, *result;
|
||||||
char str[30];
|
char str[30];
|
||||||
*/
|
*/
|
||||||
@ -13,7 +13,8 @@ int cw_in_generic(struct conn * conn, struct cw_ElemHandler * handler,
|
|||||||
cw_log(LOG_ERR,"Can't handle element: %s, no type defined",handler->name);
|
cw_log(LOG_ERR,"Can't handle element: %s, no type defined",handler->name);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
cw_kvstore_add(conn->remote_cfg, handler->key, handler->type, elem_data,elem_len);
|
cw_kvstore_add(params->conn->remote_cfg, handler->key, handler->type, elem_data,elem_len);
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
result = handler->type->get(&data,elem_data,elem_len);
|
result = handler->type->get(&data,elem_data,elem_len);
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
#include "cw.h"
|
#include "cw.h"
|
||||||
#include "dbg.h"
|
#include "dbg.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "stravltree.h"
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file
|
* @file
|
||||||
@ -12,38 +11,32 @@
|
|||||||
/**
|
/**
|
||||||
* Default handler for Vendor Specific Payload message elements.
|
* Default handler for Vendor Specific Payload message elements.
|
||||||
*/
|
*/
|
||||||
int cw_in_vendor_specific_payload(struct conn *conn, struct cw_action_in *a,
|
int cw_in_vendor_specific_payload(struct cw_ElemHandler *handler,
|
||||||
uint8_t * data, int len, struct sockaddr *from)
|
struct cw_ElemHandlerParams *params,
|
||||||
|
uint8_t * data, int len)
|
||||||
{
|
{
|
||||||
|
|
||||||
cw_action_in_t as, *af;
|
struct cw_ElemHandler *vhandler;
|
||||||
as = *a;
|
|
||||||
|
|
||||||
as.vendor_id = cw_get_dword(data);
|
uint32_t vendor_id, elem_id;
|
||||||
as.elem_id = cw_get_word(data + 4);
|
|
||||||
|
|
||||||
/*
|
vendor_id = cw_get_dword(data);
|
||||||
// TODO XXXX
|
elem_id = cw_get_word(data + 4);
|
||||||
// af = cw_actionlist_in_get(conn->actions->in, &as);
|
|
||||||
*/ af = 0;
|
|
||||||
|
|
||||||
if (!af) {
|
printf("Spec handler looking for %d %d %d\n",0,vendor_id,elem_id);
|
||||||
|
vhandler = cw_msgset_get_elemhandler(params->conn->msgset,0,vendor_id,elem_id);
|
||||||
|
|
||||||
|
|
||||||
|
if (!vhandler) {
|
||||||
cw_dbg(DBG_WARN,
|
cw_dbg(DBG_WARN,
|
||||||
"Can't handle Vendor Specific Payload %s/%d, in msg %d (%s) in %s state.",
|
"Can't handle Vendor Specific Payload %s/%d, in msg %d (%s) in %s state.",
|
||||||
cw_strvendor(as.vendor_id), as.elem_id, as.msg_id,
|
cw_strvendor(vendor_id), elem_id, params->msgdata->type,
|
||||||
cw_strmsg(as.msg_id), cw_strstate(as.capwap_state));
|
params->msgdata->name, cw_strstate(params->conn->capwap_state));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (af->start) {
|
cw_dbg_elem(DBG_ELEM,params->conn,0,vhandler,data+6,len-6);
|
||||||
int afrc = af->start(conn, af, data + 6, len - 6, from);
|
vhandler->get(vhandler, params, data+6, len-6);
|
||||||
if (af->mand && afrc) {
|
|
||||||
/* add found mandatory message element
|
|
||||||
to mand list */
|
|
||||||
stravltree_add(conn->mand, af->item_id);
|
|
||||||
}
|
|
||||||
return afrc;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
@ -3,12 +3,16 @@
|
|||||||
#include "cw.h"
|
#include "cw.h"
|
||||||
|
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
#include "dbg.h"
|
||||||
|
|
||||||
const char * cw_kvstore_add(mavl_t kvstore, const char *key, const struct cw_Type *type,
|
const char * cw_kvstore_add(mavl_t kvstore, const char *key, const struct cw_Type *type,
|
||||||
const uint8_t * data, int len)
|
const uint8_t * data, int len)
|
||||||
{
|
{
|
||||||
mavldata_t mdata, *mresult;
|
mavldata_t mdata, *mresult;
|
||||||
|
|
||||||
|
/* cw_dbg(DBG_ELEM,"KVStore (%p,%d) add elem (%s): %s", kvstore, kvstore->count,
|
||||||
|
type->name, key );
|
||||||
|
*/
|
||||||
mdata.kv.key=cw_strdup(key);
|
mdata.kv.key=cw_strdup(key);
|
||||||
if (!mdata.kv.key){
|
if (!mdata.kv.key){
|
||||||
cw_log(LOG_ERR, "Can't allocate memory for key %s: %s",
|
cw_log(LOG_ERR, "Can't allocate memory for key %s: %s",
|
||||||
@ -30,7 +34,7 @@ const char * cw_kvstore_add(mavl_t kvstore, const char *key, const struct cw_Typ
|
|||||||
cw_log(LOG_ERR, "Element already exists %s", key);
|
cw_log(LOG_ERR, "Element already exists %s", key);
|
||||||
/* element already exists */
|
/* element already exists */
|
||||||
free(mdata.kv.key);
|
free(mdata.kv.key);
|
||||||
type->del(mresult);
|
type->del(&mdata);
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ int cw_read_descriptor_subelems(mavl_t cfg, const char * parent_key,
|
|||||||
|
|
||||||
/* version */
|
/* version */
|
||||||
sprintf(key,"%s/%s/%s",parent_key,elems[i].key,CW_KEY_VERSION);
|
sprintf(key,"%s/%s/%s",parent_key,elems[i].key,CW_KEY_VERSION);
|
||||||
cw_kvstore_add(cfg,key,CW_TYPE_VERSION,data+sub+8,l);
|
cw_kvstore_add(cfg,key,CW_TYPE_BSTR16,data+sub+8,l);
|
||||||
|
|
||||||
sprintf(dbgstr, "%s", key);
|
sprintf(dbgstr, "%s", key);
|
||||||
cw_dbg_version_subelem(DBG_SUBELEM, dbgstr, subtype, vendor_id, data+sub+8,l);
|
cw_dbg_version_subelem(DBG_SUBELEM, dbgstr, subtype, vendor_id, data+sub+8,l);
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#include "capwap_items.h"
|
#include "capwap_items.h"
|
||||||
#include "cw_types.h"
|
#include "cw_types.h"
|
||||||
#include "keys.h"
|
#include "keys.h"
|
||||||
|
#include "kvstore.h"
|
||||||
|
|
||||||
|
|
||||||
static struct cw_DescriptorSubelemDef allowed_default[] = {
|
static struct cw_DescriptorSubelemDef allowed_default[] = {
|
||||||
@ -28,12 +29,17 @@ int cw_read_wtp_descriptor_7(mavl_t cfg, struct conn *conn,
|
|||||||
char key[64];
|
char key[64];
|
||||||
|
|
||||||
sprintf(key,"%s/%s",eh->key, "max_radios");
|
sprintf(key,"%s/%s",eh->key, "max_radios");
|
||||||
md.kv.key=strdup(key);
|
/* md.kv.key=strdup(key);
|
||||||
mavl_replace (cfg, cw_type_byte.get(&md,data,1));
|
mavl_replace (cfg, cw_type_byte.get(&md,data,1));
|
||||||
|
*/
|
||||||
|
cw_kvstore_add(cfg,key,CW_TYPE_BYTE,data,1);
|
||||||
|
|
||||||
sprintf(key,"%s/%s",eh->key, "radios_in_use");
|
sprintf(key,"%s/%s",eh->key, "radios_in_use");
|
||||||
md.kv.key=strdup(key);
|
cw_kvstore_add(cfg,key,CW_TYPE_BYTE,data+1,1);
|
||||||
|
|
||||||
|
/* md.kv.key=strdup(key);
|
||||||
mavl_replace (cfg, cw_type_byte.get(&md,data+1,1));
|
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_MAX_RADIOS, cw_get_byte(data));
|
||||||
mbag_set_byte(mbag, CW_ITEM_WTP_RADIOS_IN_USE, cw_get_byte(data + 1));
|
mbag_set_byte(mbag, CW_ITEM_WTP_RADIOS_IN_USE, cw_get_byte(data + 1));
|
||||||
|
@ -22,6 +22,11 @@
|
|||||||
#include "cw.h"
|
#include "cw.h"
|
||||||
#include "cw_types.h"
|
#include "cw_types.h"
|
||||||
|
|
||||||
|
|
||||||
|
static void del(mavldata_t * data){
|
||||||
|
free (data->kv.val.ptr);
|
||||||
|
}
|
||||||
|
|
||||||
static mavldata_t *get(mavldata_t * data, const uint8_t * src, int len)
|
static mavldata_t *get(mavldata_t * data, const uint8_t * src, int len)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -30,7 +35,7 @@ static mavldata_t *get(mavldata_t * data, const uint8_t * src, int len)
|
|||||||
if (!s)
|
if (!s)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
data->kv.priv = &cw_type_version;
|
data->kv.priv = &cw_type_bstr16;
|
||||||
data->kv.val.ptr=s;
|
data->kv.val.ptr=s;
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
@ -61,9 +66,9 @@ static mavldata_t *from_str(mavldata_t * data, const char *src)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const struct cw_Type cw_type_version = {
|
const struct cw_Type cw_type_bstr16 = {
|
||||||
"VersionStr", /* name */
|
"Bstr16", /* name */
|
||||||
NULL, /* del */
|
del, /* del */
|
||||||
put, /* put */
|
put, /* put */
|
||||||
get, /* get */
|
get, /* get */
|
||||||
to_str, /* to_str */
|
to_str, /* to_str */
|
@ -21,43 +21,36 @@
|
|||||||
#include "cw_types.h"
|
#include "cw_types.h"
|
||||||
#include "cw.h"
|
#include "cw.h"
|
||||||
|
|
||||||
/*
|
|
||||||
static struct mdata_Elem * from_str(const char *src)
|
|
||||||
{
|
|
||||||
struct mdata_Elem * e = mdata_elem_new(&cw_type_word);
|
|
||||||
if (!e)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
e->data.word=atoi(src);
|
static mavldata_t *get(mavldata_t * data, const uint8_t * src, int len)
|
||||||
return e;
|
{
|
||||||
|
data->kv.priv = &cw_type_word;
|
||||||
|
data->kv.val.word = cw_get_word(src);
|
||||||
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int put(mavldata_t *data, uint8_t * dst)
|
||||||
static int to_str(const struct mdata_Elem *e, char *dst)
|
|
||||||
{
|
{
|
||||||
return sprintf(dst, "%d", e->data.word);
|
return cw_put_word(dst, data->kv.val.word);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct mdata_Elem * get(const uint8_t *src,int len)
|
static int to_str(const mavldata_t *data, char *dst, int max_len)
|
||||||
{
|
{
|
||||||
struct mdata_Elem * e = mdata_elem_new(&cw_type_word);
|
return sprintf(dst, "%d", data->kv.val.word);
|
||||||
if (!e)
|
|
||||||
return NULL;
|
|
||||||
e->data.word=cw_get_word(src);
|
|
||||||
return e;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int put(struct mdata_Elem * e, uint8_t *dst)
|
static mavldata_t *from_str(mavldata_t * data, const char *src)
|
||||||
{
|
{
|
||||||
return cw_put_word(dst,e->data.word);
|
data->kv.val.word = atoi(src);
|
||||||
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define _I_NAME "Word"
|
const struct cw_Type cw_type_word = {
|
||||||
#define _I_PUT put
|
"Word", /* name */
|
||||||
#define _I_GET get
|
cw_types_del_null, /* del */
|
||||||
#define _I_DEL NULL
|
put, /* put */
|
||||||
#define _I_TO_STR to_str
|
get, /* get */
|
||||||
#define _I_FROM_STR from_str
|
to_str, /* to_str */
|
||||||
|
from_str /* from_str */
|
||||||
|
};
|
||||||
|
|
||||||
const struct mdata_Type cw_type_word = MDATA_TYPE_INIT();
|
|
||||||
*/
|
|
||||||
|
@ -36,11 +36,12 @@ struct cw_Type{
|
|||||||
extern const struct cw_Type cw_type_byte;
|
extern const struct cw_Type cw_type_byte;
|
||||||
extern const struct cw_Type cw_type_word;
|
extern const struct cw_Type cw_type_word;
|
||||||
extern const struct cw_Type cw_type_dword;
|
extern const struct cw_Type cw_type_dword;
|
||||||
extern const struct cw_Type cw_type_version;
|
extern const struct cw_Type cw_type_bstr16;
|
||||||
|
|
||||||
#define CW_TYPE_BYTE (&cw_type_byte)
|
#define CW_TYPE_BYTE (&cw_type_byte)
|
||||||
|
#define CW_TYPE_WORD (&cw_type_word)
|
||||||
#define CW_TYPE_DWORD (&cw_type_dword)
|
#define CW_TYPE_DWORD (&cw_type_dword)
|
||||||
#define CW_TYPE_VERSION (&cw_type_version)
|
#define CW_TYPE_BSTR16 (&cw_type_bstr16)
|
||||||
|
|
||||||
void cw_types_del_null(mavldata_t *data);
|
void cw_types_del_null(mavldata_t *data);
|
||||||
|
|
||||||
|
81
src/cw/dbg.c
81
src/cw/dbg.c
@ -375,65 +375,21 @@ static int cw_format_vendor(char *dst, uint32_t vendor_id, int elem_id,
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
void cw_dbg_version_subelem(int level, const char *context, int subtype,
|
||||||
* print debug info for message elements
|
uint32_t vendor_id, const uint8_t * vstr, int len)
|
||||||
*/
|
|
||||||
|
|
||||||
void cw_dbg_elem_colored(int level, struct conn *conn, int msg, int msgelem,
|
|
||||||
const uint8_t * msgbuf, int len)
|
|
||||||
{
|
{
|
||||||
|
char v[2048];
|
||||||
|
int n;
|
||||||
const char *elemname;
|
|
||||||
char vendorname[256];
|
|
||||||
char vendor_details[265];
|
|
||||||
struct cw_ElemHandler * handler;
|
|
||||||
|
|
||||||
if (!cw_dbg_is_level(level))
|
if (!cw_dbg_is_level(level))
|
||||||
return;
|
return;
|
||||||
|
if (!vstr)
|
||||||
*vendor_details = 0;
|
|
||||||
|
|
||||||
handler = cw_msgset_get_elemhandler(conn->msgset,0,0,msgelem);
|
|
||||||
if (!handler)
|
|
||||||
return;
|
return;
|
||||||
|
n = cw_format_version(v, vstr, len);
|
||||||
|
|
||||||
|
sprintf(v + n, ", Vendor Id: %d, %s", vendor_id, cw_strvendor(vendor_id));
|
||||||
|
|
||||||
/*
|
cw_dbg(level, "%s: SubType %d, %s", context, subtype, v);
|
||||||
/// TODO XXXX
|
|
||||||
*/
|
|
||||||
if (msgelem == CAPWAP_ELEM_VENDOR_SPECIFIC_PAYLOAD) {
|
|
||||||
uint32_t vendor_id = ntohl(*((uint32_t *) msgbuf));
|
|
||||||
int type = ntohs(*((uint16_t *) (msgbuf + 4)));
|
|
||||||
cw_format_vendor(vendor_details, vendor_id, type, msgbuf);
|
|
||||||
/* sprintf(vendorname, "%s/%s/%s",
|
|
||||||
cw_strelemp(conn->actions, msgelem),
|
|
||||||
(char *) cw_strvendor(vendor_id), vendor_details);
|
|
||||||
*/
|
|
||||||
elemname = vendorname;
|
|
||||||
|
|
||||||
} else {
|
|
||||||
/*
|
|
||||||
// elemname = cw_strelemp(conn->actions, msgelem);
|
|
||||||
*/
|
|
||||||
elemname=handler->name;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (!cw_dbg_is_level(DBG_ELEM_DMP)) {
|
|
||||||
cw_dbg(DBG_ELEM, "%d (%s), len=%d", msgelem, elemname, len);
|
|
||||||
} else {
|
|
||||||
/*
|
|
||||||
char *dmp = cw_dbg_mkdmp(msgbuf, len);
|
|
||||||
*/
|
|
||||||
char *dmp;
|
|
||||||
dmp = cw_format_dump(msgbuf,len,NULL);
|
|
||||||
|
|
||||||
cw_dbg(DBG_ELEM, "%d (%s), len=%d%s%s",
|
|
||||||
msgelem, elemname, len, get_dbg_color_ontext(DBG_ELEM_DMP), dmp);
|
|
||||||
|
|
||||||
free(dmp);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -479,27 +435,6 @@ int cw_format_item(char *dst, mbag_item_t * item)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void cw_dbg_version_subelem(int level, const char *context, int subtype,
|
|
||||||
uint32_t vendor_id, const uint8_t * vstr, int len)
|
|
||||||
{
|
|
||||||
char v[2048];
|
|
||||||
int n;
|
|
||||||
|
|
||||||
if (!cw_dbg_is_level(level))
|
|
||||||
return;
|
|
||||||
if (!vstr)
|
|
||||||
return;
|
|
||||||
n = cw_format_version(v, vstr, len);
|
|
||||||
|
|
||||||
sprintf(v + n, ", Vendor Id: %d, %s", vendor_id, cw_strvendor(vendor_id));
|
|
||||||
|
|
||||||
cw_dbg(level, "%s: SubType %d, %s", context, subtype, v);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#define __DBG_H
|
#define __DBG_H
|
||||||
|
|
||||||
#include "conn.h"
|
#include "conn.h"
|
||||||
|
#include "cw.h"
|
||||||
|
|
||||||
|
|
||||||
#ifndef CW_LOG_DUMP_ROW_LEN
|
#ifndef CW_LOG_DUMP_ROW_LEN
|
||||||
@ -57,9 +58,10 @@ void cw_dbg_dmp(int level, const uint8_t * data, int len, const char *format, ..
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
#define cw_dbg_elem(level,conn,msgtype,msgelemtype,msgbuf,msglen)\
|
#define cw_dbg_elem(level,conn,msgtype,msgelemtype,msgbuf,msglen)\
|
||||||
cw_dbg_elem_colored(level,conn,msgtype,msgelemtype,msgbuf,msglen)
|
cw_dbg_elem_colored(level,conn,msgtype,msgelemtype,msgbuf,msglen)
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@ -113,7 +115,8 @@ extern struct cw_strlist_elem cw_dbg_strings[];
|
|||||||
void cw_dbg_dmp_(int level, const uint8_t * data, int len, const char *format, ...);
|
void cw_dbg_dmp_(int level, const uint8_t * data, int len, const char *format, ...);
|
||||||
|
|
||||||
|
|
||||||
extern void cw_dbg_elem_colored(int level, struct conn *conn, int msg, int msgelem,
|
|
||||||
|
extern void cw_dbg_elem(int level, struct conn *conn, int msg, struct cw_ElemHandler * handler,
|
||||||
const uint8_t * msgbuf, int len);
|
const uint8_t * msgbuf, int len);
|
||||||
|
|
||||||
|
|
||||||
|
@ -39,29 +39,33 @@ int dtls_gnutls_accept(struct conn *conn)
|
|||||||
{
|
{
|
||||||
char sock_buf[SOCK_ADDR_BUFSIZE];
|
char sock_buf[SOCK_ADDR_BUFSIZE];
|
||||||
struct dtls_gnutls_data *d;
|
struct dtls_gnutls_data *d;
|
||||||
|
uint8_t buffer[2048];
|
||||||
|
int tlen, rc;
|
||||||
|
time_t c_timer;
|
||||||
|
|
||||||
gnutls_datum_t cookie_key;
|
gnutls_datum_t cookie_key;
|
||||||
|
gnutls_dtls_prestate_st prestate;
|
||||||
|
|
||||||
gnutls_key_generate(&cookie_key, GNUTLS_COOKIE_KEY_SIZE);
|
gnutls_key_generate(&cookie_key, GNUTLS_COOKIE_KEY_SIZE);
|
||||||
cw_dbg(DBG_DTLS, "Session cookie for %s generated: %s",
|
cw_dbg(DBG_DTLS, "Session cookie for %s generated: %s",
|
||||||
sock_addr2str(&conn->addr,sock_buf), sock_hwaddr2idstr((uint8_t *) (&cookie_key),
|
sock_addr2str(&conn->addr,sock_buf), sock_hwaddrtostr((uint8_t *) (&cookie_key),
|
||||||
sizeof(cookie_key)));
|
sizeof(cookie_key),sock_buf,""));
|
||||||
|
|
||||||
|
|
||||||
gnutls_dtls_prestate_st prestate;
|
|
||||||
memset(&prestate, 0, sizeof(prestate));
|
memset(&prestate, 0, sizeof(prestate));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
uint8_t buffer[2048];
|
|
||||||
int tlen;
|
|
||||||
tlen = dtls_gnutls_bio_read(conn, buffer, sizeof(buffer));
|
tlen = dtls_gnutls_bio_read(conn, buffer, sizeof(buffer));
|
||||||
|
|
||||||
gnutls_dtls_cookie_send(&cookie_key, &conn->addr, sizeof(conn->addr),
|
gnutls_dtls_cookie_send(&cookie_key, &conn->addr, sizeof(conn->addr),
|
||||||
&prestate, (gnutls_transport_ptr_t) conn, dtls_gnutls_bio_write);
|
&prestate, (gnutls_transport_ptr_t) conn, dtls_gnutls_bio_write);
|
||||||
|
|
||||||
int rc=-1;
|
rc=-1;
|
||||||
|
|
||||||
time_t c_timer = cw_timer_start(10);
|
|
||||||
|
|
||||||
|
c_timer = cw_timer_start(10);
|
||||||
|
|
||||||
while(!cw_timer_timeout(c_timer)){
|
while(!cw_timer_timeout(c_timer)){
|
||||||
|
|
||||||
@ -84,7 +88,6 @@ int dtls_gnutls_accept(struct conn *conn)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// dtls_gnutls_bio_read(conn, buffer, sizeof(buffer));
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -121,7 +121,7 @@ void mavlnode_destroy(struct mavl *t, struct mavlnode *n);
|
|||||||
|
|
||||||
void mavl_del_all(struct mavl *t);
|
void mavl_del_all(struct mavl *t);
|
||||||
union mavldata *mavl_del(struct mavl *t, union mavldata *data);
|
union mavldata *mavl_del(struct mavl *t, union mavldata *data);
|
||||||
union mavldata *mavl_add(struct mavl *t, const union mavldata *data);
|
union mavldata *mavl_add(struct mavl *t, union mavldata *data);
|
||||||
union mavldata * mavl_get(struct mavl *t ,union mavldata *data);
|
union mavldata * mavl_get(struct mavl *t ,union mavldata *data);
|
||||||
struct mavlnode *mavl_get_node(struct mavl *t, union mavldata *data);
|
struct mavlnode *mavl_get_node(struct mavl *t, union mavldata *data);
|
||||||
void * mavl_get_ptr(mavl_t tree, void * search);
|
void * mavl_get_ptr(mavl_t tree, void * search);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "mavl.h"
|
#include "mavl.h"
|
||||||
|
|
||||||
static struct mavlnode *mavlnode_create(union mavldata *data)
|
static struct mavlnode *mavlnode_create(const union mavldata *data)
|
||||||
{
|
{
|
||||||
struct mavlnode *n = malloc(sizeof(struct mavlnode));
|
struct mavlnode *n = malloc(sizeof(struct mavlnode));
|
||||||
if (!n)
|
if (!n)
|
||||||
@ -169,16 +169,19 @@ static int mavl_add0(struct mavl *t, struct mavlnode **parent, union mavldata **
|
|||||||
* @example mavl_add_example.c
|
* @example mavl_add_example.c
|
||||||
*/
|
*/
|
||||||
|
|
||||||
union mavldata *mavl_add(struct mavl *t, const union mavldata *data)
|
union mavldata *mavl_add(struct mavl *t, union mavldata *data)
|
||||||
{
|
{
|
||||||
union mavldata * d;
|
union mavldata * d;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
if (t->root == 0) {
|
|
||||||
|
if (t->root == NULL) {
|
||||||
t->root = mavlnode_create(data);
|
t->root = mavlnode_create(data);
|
||||||
if (t->root)
|
if (t->root)
|
||||||
t->count++;
|
t->count++;
|
||||||
return &t->root->data;
|
|
||||||
|
/* return &t->root->data; */
|
||||||
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
d = data;
|
d = data;
|
||||||
|
@ -28,6 +28,12 @@ struct cw_ElemData{
|
|||||||
int mand;
|
int mand;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct cw_ElemHandlerParams {
|
||||||
|
struct conn * conn;
|
||||||
|
struct cw_MsgData * msgdata;
|
||||||
|
struct sockaddr *from;
|
||||||
|
};
|
||||||
|
|
||||||
struct cw_ElemHandler {
|
struct cw_ElemHandler {
|
||||||
const char * name;
|
const char * name;
|
||||||
int id;
|
int id;
|
||||||
@ -37,8 +43,8 @@ struct cw_ElemHandler {
|
|||||||
int max_len;
|
int max_len;
|
||||||
const struct cw_Type * type;
|
const struct cw_Type * type;
|
||||||
const char * key;
|
const char * key;
|
||||||
int (*get)(struct conn *conn, struct cw_ElemHandler * handler,
|
int (*get)(struct cw_ElemHandler * handler, struct cw_ElemHandlerParams * params,
|
||||||
uint8_t*data,int len,struct sockaddr *from);
|
uint8_t*data, int len);
|
||||||
/*
|
/*
|
||||||
int (*end_in)(struct conn *conn,struct cw_action_in *a,uint8_t*elem,int len,struct sockaddr *from);
|
int (*end_in)(struct conn *conn,struct cw_action_in *a,uint8_t*elem,int len,struct sockaddr *from);
|
||||||
*/
|
*/
|
||||||
@ -66,6 +72,9 @@ struct cw_MsgData{
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
extern struct cw_MsgSet * cw_msgset_create();
|
extern struct cw_MsgSet * cw_msgset_create();
|
||||||
|
|
||||||
extern void cw_msgset_destroy(struct cw_MsgSet * set);
|
extern void cw_msgset_destroy(struct cw_MsgSet * set);
|
||||||
|
@ -25,7 +25,6 @@
|
|||||||
|
|
||||||
#include "mod_capwap.h"
|
#include "mod_capwap.h"
|
||||||
|
|
||||||
|
|
||||||
static struct cw_ElemHandler handlers[] = {
|
static struct cw_ElemHandler handlers[] = {
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -65,7 +64,7 @@ static struct cw_ElemHandler handlers[] = {
|
|||||||
4,128, /* min/max length */
|
4,128, /* min/max length */
|
||||||
NULL, /* type */
|
NULL, /* type */
|
||||||
"wtp_descriptor", /* Key */
|
"wtp_descriptor", /* Key */
|
||||||
capwap_in_wtp_descriptor /* get */
|
capwap_in_wtp_descriptor /* get */
|
||||||
}
|
}
|
||||||
,
|
,
|
||||||
{
|
{
|
||||||
@ -73,11 +72,23 @@ static struct cw_ElemHandler handlers[] = {
|
|||||||
CAPWAP_ELEM_WTP_FRAME_TUNNEL_MODE, /* Element ID */
|
CAPWAP_ELEM_WTP_FRAME_TUNNEL_MODE, /* Element ID */
|
||||||
0,0, /* Vendor / Proto */
|
0,0, /* Vendor / Proto */
|
||||||
1,1, /* min/max length */
|
1,1, /* min/max length */
|
||||||
CW_TYPE_BYTE, /* type */
|
CW_TYPE_BYTE, /* type */
|
||||||
"wtp_frame_tunnel_mode", /* Key */
|
"wtp_frame_tunnel_mode", /* Key */
|
||||||
cw_in_generic /* get */
|
cw_in_generic /* get */
|
||||||
}
|
}
|
||||||
,
|
,
|
||||||
|
|
||||||
|
{
|
||||||
|
"Vendor Specific Payload", /* name */
|
||||||
|
CAPWAP_ELEM_VENDOR_SPECIFIC_PAYLOAD, /* Element ID */
|
||||||
|
0,0, /* Vendor / Proto */
|
||||||
|
0,0, /* min/max length */
|
||||||
|
NULL, /* type */
|
||||||
|
"vendor_specific_payload", /* Key */
|
||||||
|
cw_in_vendor_specific_payload /* get */
|
||||||
|
}
|
||||||
|
,
|
||||||
|
|
||||||
{0,0,0,0,0,0,0,0}
|
{0,0,0,0,0,0,0,0}
|
||||||
|
|
||||||
};
|
};
|
||||||
@ -85,11 +96,12 @@ static struct cw_ElemHandler handlers[] = {
|
|||||||
|
|
||||||
static int discovery_request_states[] = {CAPWAP_STATE_DISCOVERY,0};
|
static int discovery_request_states[] = {CAPWAP_STATE_DISCOVERY,0};
|
||||||
static struct cw_ElemDef discovery_request_elements[] ={
|
static struct cw_ElemDef discovery_request_elements[] ={
|
||||||
{0,0,CAPWAP_ELEM_DISCOVERY_TYPE, 1, 0},
|
{0,0,CAPWAP_ELEM_DISCOVERY_TYPE, 1, 0},
|
||||||
{0,0,CAPWAP_ELEM_WTP_MAC_TYPE, 1, 0},
|
{0,0,CAPWAP_ELEM_WTP_MAC_TYPE, 1, 0},
|
||||||
{0,0,CAPWAP_ELEM_WTP_BOARD_DATA, 1, 0},
|
{0,0,CAPWAP_ELEM_WTP_BOARD_DATA, 1, 0},
|
||||||
{0,0,CAPWAP_ELEM_WTP_DESCRIPTOR, 1, 0},
|
{0,0,CAPWAP_ELEM_WTP_DESCRIPTOR, 1, 0},
|
||||||
{0,0,CAPWAP_ELEM_WTP_FRAME_TUNNEL_MODE, 1, 0},
|
{0,0,CAPWAP_ELEM_WTP_FRAME_TUNNEL_MODE, 1, 0},
|
||||||
|
{0,0,CAPWAP_ELEM_VENDOR_SPECIFIC_PAYLOAD, 0, 0},
|
||||||
{0,0,0,0,0}
|
{0,0,0,0,0}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
@ -150,7 +150,7 @@ static cw_action_in_t actions_in[] = {
|
|||||||
{
|
{
|
||||||
.capwap_state = CAPWAP_STATE_JOIN,
|
.capwap_state = CAPWAP_STATE_JOIN,
|
||||||
.msg_id = CAPWAP_MSG_JOIN_RESPONSE,
|
.msg_id = CAPWAP_MSG_JOIN_RESPONSE,
|
||||||
.elem_id = CW_ELEM_ECN_SUPPORT,
|
.elem_id = CAPWAP_ELEM_ECN_SUPPORT,
|
||||||
.item_id = CW_ITEM_ECN_SUPPORT,
|
.item_id = CW_ITEM_ECN_SUPPORT,
|
||||||
.start = cw_in_generic2,
|
.start = cw_in_generic2,
|
||||||
.min_len = 1,
|
.min_len = 1,
|
||||||
@ -589,7 +589,7 @@ static cw_action_out_t actions_out[] = {
|
|||||||
/* ECN Support - Join Request */
|
/* ECN Support - Join Request */
|
||||||
{
|
{
|
||||||
.msg_id = CAPWAP_MSG_JOIN_REQUEST,
|
.msg_id = CAPWAP_MSG_JOIN_REQUEST,
|
||||||
.elem_id = CW_ELEM_ECN_SUPPORT,
|
.elem_id = CAPWAP_ELEM_ECN_SUPPORT,
|
||||||
.item_id = CW_ITEM_ECN_SUPPORT,
|
.item_id = CW_ITEM_ECN_SUPPORT,
|
||||||
.out = cw_out_generic,
|
.out = cw_out_generic,
|
||||||
.get = cw_out_get_config,
|
.get = cw_out_get_config,
|
||||||
|
@ -24,16 +24,22 @@
|
|||||||
#include "cw/dbg.h"
|
#include "cw/dbg.h"
|
||||||
#include "cw/cw.h"
|
#include "cw/cw.h"
|
||||||
|
|
||||||
|
#include "cw/kvstore.h"
|
||||||
|
#include "cw/cw_types.h"
|
||||||
|
#include "cw/keys.h"
|
||||||
|
|
||||||
/*
|
|
||||||
static void readsubelems_wtp_board_data(mbag_t itemstore, uint8_t * msgelem,
|
static void readsubelems_wtp_board_data(mavl_t cfg, uint8_t * msgelem,
|
||||||
int len)
|
int len)
|
||||||
{
|
{
|
||||||
|
int i = 0;
|
||||||
|
uint32_t val;
|
||||||
|
const char * key;
|
||||||
|
|
||||||
if (len<4)
|
if (len<4)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int i = 0;
|
|
||||||
uint32_t val;
|
|
||||||
do {
|
do {
|
||||||
val = ntohl(*((uint32_t *) (msgelem + i)));
|
val = ntohl(*((uint32_t *) (msgelem + i)));
|
||||||
int subtype = (val >> 16) & 0xffff;
|
int subtype = (val >> 16) & 0xffff;
|
||||||
@ -50,46 +56,66 @@ static void readsubelems_wtp_board_data(mbag_t itemstore, uint8_t * msgelem,
|
|||||||
subtype, sublen);
|
subtype, sublen);
|
||||||
|
|
||||||
switch (subtype) {
|
switch (subtype) {
|
||||||
|
|
||||||
|
|
||||||
case CW_BOARDDATA_MODELNO:
|
case CW_BOARDDATA_MODELNO:
|
||||||
mbag_set_bstrn(itemstore,
|
/* mbag_set_bstrn(itemstore,
|
||||||
CW_ITEM_WTP_BOARD_MODELNO,
|
CW_ITEM_WTP_BOARD_MODELNO,
|
||||||
msgelem + i, sublen);
|
msgelem + i, sublen);
|
||||||
|
*/
|
||||||
|
key = "model_no";
|
||||||
break;
|
break;
|
||||||
case CW_BOARDDATA_SERIALNO:
|
case CW_BOARDDATA_SERIALNO:
|
||||||
mbag_set_bstrn(itemstore,
|
/* mbag_set_bstrn(itemstore,
|
||||||
CW_ITEM_WTP_BOARD_SERIALNO,
|
CW_ITEM_WTP_BOARD_SERIALNO,
|
||||||
msgelem + i, sublen);
|
msgelem + i, sublen);
|
||||||
|
|
||||||
|
*/
|
||||||
|
key = "serial_no";
|
||||||
break;
|
break;
|
||||||
case CW_BOARDDATA_MACADDRESS:
|
case CW_BOARDDATA_MACADDRESS:
|
||||||
mbag_set_bstrn(itemstore,
|
/* mbag_set_bstrn(itemstore,
|
||||||
CW_ITEM_WTP_BOARD_MACADDRESS,
|
CW_ITEM_WTP_BOARD_MACADDRESS,
|
||||||
msgelem + i, sublen);
|
msgelem + i, sublen);
|
||||||
|
*/
|
||||||
|
key = "mac_address";
|
||||||
break;
|
break;
|
||||||
case CW_BOARDDATA_BOARDID:
|
case CW_BOARDDATA_BOARDID:
|
||||||
mbag_set_bstrn(itemstore, CW_ITEM_WTP_BOARD_ID,
|
/* mbag_set_bstrn(itemstore, CW_ITEM_WTP_BOARD_ID,
|
||||||
msgelem + i, sublen);
|
msgelem + i, sublen);
|
||||||
|
*/
|
||||||
|
key = "board_id";
|
||||||
break;
|
break;
|
||||||
case CW_BOARDDATA_REVISION:
|
case CW_BOARDDATA_REVISION:
|
||||||
mbag_set_bstrn(itemstore,
|
/* mbag_set_bstrn(itemstore,
|
||||||
CW_ITEM_WTP_BOARD_REVISION,
|
CW_ITEM_WTP_BOARD_REVISION,
|
||||||
msgelem + i, sublen);
|
msgelem + i, sublen);
|
||||||
|
*/
|
||||||
|
key = "revision";
|
||||||
default:
|
default:
|
||||||
|
key = NULL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (key){
|
||||||
|
char add_key[256];
|
||||||
|
sprintf(add_key,"wtp_board_data/%s",key);
|
||||||
|
cw_kvstore_add(cfg,add_key,CW_TYPE_BSTR16,msgelem+i,sublen);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
i += sublen;
|
i += sublen;
|
||||||
|
|
||||||
} while (i < len);
|
} while (i < len);
|
||||||
}
|
}
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parse a WTP Board Data messag element and put results to itemstore.
|
* Parse a WTP Board Data messag element and put results to itemstore.
|
||||||
*/
|
*/
|
||||||
int capwap_in_wtp_board_data(struct conn *conn, struct cw_ElemHandler *eh, uint8_t * data,
|
int capwap_in_wtp_board_data(struct cw_ElemHandler *eh, struct cw_ElemHandlerParams *params,
|
||||||
int len, struct sockaddr *from)
|
uint8_t * data, int len)
|
||||||
{
|
{
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -101,18 +127,22 @@ int capwap_in_wtp_board_data(struct conn *conn, struct cw_ElemHandler *eh, uint8
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
char vendor_key[64];
|
|
||||||
|
|
||||||
printf("Have to read WTP Board Data\n");
|
char vendor_key[128];
|
||||||
sprintf(vendor_key,"%s/%s",eh->key,"vendor");
|
mavl_t cfg = params->conn->remote_cfg;
|
||||||
|
|
||||||
|
|
||||||
|
sprintf(vendor_key,"%s/%s",eh->key,CW_KEY_VENDOR);
|
||||||
|
|
||||||
|
cw_kvstore_add(cfg,vendor_key,CW_TYPE_DWORD,data,len);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
mbag_t itemstore = conn->incomming;
|
mbag_t itemstore = conn->incomming;
|
||||||
mbag_set_dword(itemstore, CW_ITEM_WTP_BOARD_VENDOR, cw_get_dword(data));
|
mbag_set_dword(itemstore, CW_ITEM_WTP_BOARD_VENDOR, cw_get_dword(data));
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* readsubelems_wtp_board_data(itemstore, data + 4, len - 4);
|
readsubelems_wtp_board_data(cfg, data + 4, len - 4);
|
||||||
*/
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,15 +22,15 @@
|
|||||||
|
|
||||||
#include "mod_capwap.h"
|
#include "mod_capwap.h"
|
||||||
|
|
||||||
int capwap_in_wtp_descriptor(struct conn *conn, struct cw_ElemHandler *eh, uint8_t * data,
|
int capwap_in_wtp_descriptor(struct cw_ElemHandler *eh, struct cw_ElemHandlerParams *params, uint8_t * data,
|
||||||
int len, struct sockaddr *from)
|
int len)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
printf("WTP Descriptor reader\n");
|
//printf("WTP Descriptor reader\n");
|
||||||
/*
|
/*
|
||||||
// mbag_t mbag = conn->incomming;
|
// mbag_t mbag = conn->incomming;
|
||||||
*/
|
*/
|
||||||
rc =cw_read_wtp_descriptor(conn->remote_cfg, conn, eh, data, len, NULL);
|
rc =cw_read_wtp_descriptor(params->conn->remote_cfg, params->conn, eh, data, len, NULL);
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
@ -8,12 +8,17 @@ struct cw_Mod *mod_capwap_wtp();
|
|||||||
#include "cw/conn.h"
|
#include "cw/conn.h"
|
||||||
|
|
||||||
|
|
||||||
extern int capwap_in_wtp_descriptor(struct conn *conn, struct cw_ElemHandler *eh,
|
/*extern int capwap_in_wtp_descriptor(struct conn *conn, struct cw_ElemHandler *eh,
|
||||||
uint8_t * data, int len, struct sockaddr *from);
|
uint8_t * data, int len, struct sockaddr *from);*/
|
||||||
|
|
||||||
|
|
||||||
|
int capwap_in_wtp_descriptor(struct cw_ElemHandler *eh, struct cw_ElemHandlerParams *params, uint8_t * data,
|
||||||
|
int len);
|
||||||
|
/*
|
||||||
extern int capwap_in_wtp_board_data(struct conn *conn, struct cw_ElemHandler *a,
|
extern int capwap_in_wtp_board_data(struct conn *conn, struct cw_ElemHandler *a,
|
||||||
uint8_t * data, int len, struct sockaddr *from);
|
uint8_t * data, int len, struct sockaddr *from);
|
||||||
|
*/
|
||||||
|
int capwap_in_wtp_board_data(struct cw_ElemHandler *eh, struct cw_ElemHandlerParams *params,
|
||||||
|
uint8_t * data, int len);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
extern int capwap_out_wtp_descriptor(struct conn *conn, struct cw_action_out *a,
|
extern int capwap_out_wtp_descriptor(struct conn *conn, struct cw_action_out *a,
|
||||||
|
@ -6,8 +6,13 @@
|
|||||||
|
|
||||||
extern int cisco_out_ap_timesync(struct conn *conn, struct cw_action_out *a,
|
extern int cisco_out_ap_timesync(struct conn *conn, struct cw_action_out *a,
|
||||||
uint8_t * dst);
|
uint8_t * dst);
|
||||||
|
/*
|
||||||
extern int cisco_in_wtp_descriptor(struct conn *conn, struct cw_action_in *a,
|
extern int cisco_in_wtp_descriptor(struct conn *conn, struct cw_action_in *a,
|
||||||
uint8_t * data, int len, struct sockaddr *from);
|
uint8_t * data, int len, struct sockaddr *from);*/
|
||||||
|
|
||||||
|
int cisco_in_wtp_descriptor(struct cw_ElemHandler *eh, struct cw_ElemHandlerParams * params, uint8_t * data,
|
||||||
|
int len);
|
||||||
|
|
||||||
extern int cisco_out_ac_descriptor(struct conn *conn, struct cw_action_out *a,
|
extern int cisco_out_ac_descriptor(struct conn *conn, struct cw_action_out *a,
|
||||||
uint8_t * dst);
|
uint8_t * dst);
|
||||||
extern int cisco_out_wtp_descriptor(struct conn *conn, struct cw_action_out *a,
|
extern int cisco_out_wtp_descriptor(struct conn *conn, struct cw_action_out *a,
|
||||||
|
@ -38,11 +38,13 @@
|
|||||||
|
|
||||||
#include "cisco_items.h"
|
#include "cisco_items.h"
|
||||||
|
|
||||||
|
|
||||||
#include "include/cipwap_items.h"
|
#include "include/cipwap_items.h"
|
||||||
|
|
||||||
#include "cw/message_set.h"
|
#include "cw/message_set.h"
|
||||||
#include "cw/cw_types.h"
|
#include "cw/cw_types.h"
|
||||||
|
|
||||||
|
|
||||||
static struct cw_ElemHandler handlers[] = {
|
static struct cw_ElemHandler handlers[] = {
|
||||||
{
|
{
|
||||||
"WTP Descriptor (Draft 7)", /* name */
|
"WTP Descriptor (Draft 7)", /* name */
|
||||||
@ -51,7 +53,28 @@ static struct cw_ElemHandler handlers[] = {
|
|||||||
4,128, /* min/max length */
|
4,128, /* min/max length */
|
||||||
NULL, /* type */
|
NULL, /* type */
|
||||||
"wtp_descriptor", /* Key */
|
"wtp_descriptor", /* Key */
|
||||||
cisco_in_wtp_descriptor /* get */
|
cisco_in_wtp_descriptor /* get */
|
||||||
|
}
|
||||||
|
,
|
||||||
|
{
|
||||||
|
"RAD Name -> CAPWAP WTP Name", /* name */
|
||||||
|
CW_CISCO_RAD_NAME, /* Element ID */
|
||||||
|
CW_VENDOR_ID_CISCO,0, /* Vendor / Proto */
|
||||||
|
1,512, /* min/max length */
|
||||||
|
CW_TYPE_BSTR16, /* type */
|
||||||
|
"wtp_name", /* Key */
|
||||||
|
cw_in_generic /* handler */
|
||||||
|
}
|
||||||
|
|
||||||
|
,
|
||||||
|
{
|
||||||
|
"Board Data Options", /* name */
|
||||||
|
CW_CISCO_BOARD_DATA_OPTIONS, /* Element ID */
|
||||||
|
CW_VENDOR_ID_CISCO,0, /* Vendor / Proto */
|
||||||
|
2,2, /* min/max length */
|
||||||
|
CW_TYPE_DWORD, /* type */
|
||||||
|
"cisco_board_data_options", /* Key */
|
||||||
|
cw_in_generic /* handler */
|
||||||
}
|
}
|
||||||
,
|
,
|
||||||
{0,0,0,0,0,0,0,0}
|
{0,0,0,0,0,0,0,0}
|
||||||
@ -61,7 +84,8 @@ static struct cw_ElemHandler handlers[] = {
|
|||||||
|
|
||||||
static int discovery_request_states[] = {CAPWAP_STATE_DISCOVERY,0};
|
static int discovery_request_states[] = {CAPWAP_STATE_DISCOVERY,0};
|
||||||
static struct cw_ElemDef discovery_request_elements[] ={
|
static struct cw_ElemDef discovery_request_elements[] ={
|
||||||
{0,0,CAPWAP_ELEM_WTP_DESCRIPTOR, 1, 0},
|
{0,0, CAPWAP_ELEM_WTP_DESCRIPTOR, 1, 0},
|
||||||
|
{0,CW_VENDOR_ID_CISCO, CW_CISCO_RAD_NAME, 1, 0},
|
||||||
{0,0,0,00}
|
{0,0,0,00}
|
||||||
|
|
||||||
};
|
};
|
||||||
@ -213,7 +237,7 @@ static cw_action_in_t actions_in[] = {
|
|||||||
* about ECN support, so make it non-mandatory */
|
* about ECN support, so make it non-mandatory */
|
||||||
.capwap_state = CAPWAP_STATE_JOIN,
|
.capwap_state = CAPWAP_STATE_JOIN,
|
||||||
.msg_id = CAPWAP_MSG_JOIN_REQUEST,
|
.msg_id = CAPWAP_MSG_JOIN_REQUEST,
|
||||||
.elem_id = CW_ELEM_ECN_SUPPORT,
|
.elem_id = CAPWAP_ELEM_ECN_SUPPORT,
|
||||||
.item_id = CW_ITEM_ECN_SUPPORT,
|
.item_id = CW_ITEM_ECN_SUPPORT,
|
||||||
.start = cw_in_generic,
|
.start = cw_in_generic,
|
||||||
.mand = 0,
|
.mand = 0,
|
||||||
@ -418,7 +442,7 @@ static cw_action_out_t actions_out[]={
|
|||||||
/* ECN Support - Join Response */
|
/* ECN Support - Join Response */
|
||||||
{
|
{
|
||||||
.msg_id = CAPWAP_MSG_JOIN_RESPONSE,
|
.msg_id = CAPWAP_MSG_JOIN_RESPONSE,
|
||||||
.elem_id = CW_ELEM_ECN_SUPPORT,
|
.elem_id = CAPWAP_ELEM_ECN_SUPPORT,
|
||||||
.item_id = CW_ITEM_ECN_SUPPORT
|
.item_id = CW_ITEM_ECN_SUPPORT
|
||||||
}
|
}
|
||||||
,
|
,
|
||||||
|
@ -68,7 +68,7 @@ static cw_action_in_t actions_in[] = {
|
|||||||
/* Make ECN Support non-mand */
|
/* Make ECN Support non-mand */
|
||||||
.capwap_state = CAPWAP_STATE_JOIN,
|
.capwap_state = CAPWAP_STATE_JOIN,
|
||||||
.msg_id = CAPWAP_MSG_JOIN_RESPONSE,
|
.msg_id = CAPWAP_MSG_JOIN_RESPONSE,
|
||||||
.elem_id = CW_ELEM_ECN_SUPPORT,
|
.elem_id = CAPWAP_ELEM_ECN_SUPPORT,
|
||||||
.item_id = CW_ITEM_ECN_SUPPORT,
|
.item_id = CW_ITEM_ECN_SUPPORT,
|
||||||
.start = cw_in_generic,
|
.start = cw_in_generic,
|
||||||
.mand = 0,
|
.mand = 0,
|
||||||
@ -345,7 +345,7 @@ static cw_action_out_t actions_out[]={
|
|||||||
/* Cisco doesn't know ECN support, so we
|
/* Cisco doesn't know ECN support, so we
|
||||||
define no output method */
|
define no output method */
|
||||||
.msg_id = CAPWAP_MSG_JOIN_REQUEST,
|
.msg_id = CAPWAP_MSG_JOIN_REQUEST,
|
||||||
.elem_id = CW_ELEM_ECN_SUPPORT,
|
.elem_id = CAPWAP_ELEM_ECN_SUPPORT,
|
||||||
.item_id = CW_ITEM_ECN_SUPPORT,
|
.item_id = CW_ITEM_ECN_SUPPORT,
|
||||||
.mand = 0
|
.mand = 0
|
||||||
}
|
}
|
||||||
|
@ -22,8 +22,8 @@
|
|||||||
#include "cw/capwap_items.h"
|
#include "cw/capwap_items.h"
|
||||||
|
|
||||||
|
|
||||||
int cisco_in_wtp_descriptor(struct conn *conn, struct cw_ElemHandler *eh, uint8_t * data,
|
int cisco_in_wtp_descriptor(struct cw_ElemHandler *eh, struct cw_ElemHandlerParams * params, uint8_t * data,
|
||||||
int len, struct sockaddr *from)
|
int len)
|
||||||
{
|
{
|
||||||
|
|
||||||
static struct cw_DescriptorSubelemDef allowed[] = {
|
static struct cw_DescriptorSubelemDef allowed[] = {
|
||||||
@ -35,7 +35,7 @@ int cisco_in_wtp_descriptor(struct conn *conn, struct cw_ElemHandler *eh, uint8_
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
return cw_read_wtp_descriptor_7(conn->remote_cfg, conn, eh, data, len, allowed);
|
return cw_read_wtp_descriptor_7(params->conn->remote_cfg, params->conn, eh, data, len, allowed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -135,7 +135,7 @@ static cw_action_in_t actions_in[] = {
|
|||||||
* about ECN support, so make it non-mandatory */
|
* about ECN support, so make it non-mandatory */
|
||||||
.capwap_state = CAPWAP_STATE_JOIN,
|
.capwap_state = CAPWAP_STATE_JOIN,
|
||||||
.msg_id = CW_MSG_JOIN_REQUEST,
|
.msg_id = CW_MSG_JOIN_REQUEST,
|
||||||
.elem_id = CW_ELEM_ECN_SUPPORT,
|
.elem_id = CAPWAP_ELEM_ECN_SUPPORT,
|
||||||
.item_id = CW_ITEM_ECN_SUPPORT,
|
.item_id = CW_ITEM_ECN_SUPPORT,
|
||||||
.start = cw_in_generic2,
|
.start = cw_in_generic2,
|
||||||
.mand = 0,
|
.mand = 0,
|
||||||
@ -216,7 +216,7 @@ static cw_action_out_t actions_out[]={
|
|||||||
/* ECN Support - Join Response */
|
/* ECN Support - Join Response */
|
||||||
{
|
{
|
||||||
.msg_id = CW_MSG_JOIN_RESPONSE,
|
.msg_id = CW_MSG_JOIN_RESPONSE,
|
||||||
.elem_id = CW_ELEM_ECN_SUPPORT,
|
.elem_id = CAPWAP_ELEM_ECN_SUPPORT,
|
||||||
.item_id = CW_ITEM_ECN_SUPPORT
|
.item_id = CW_ITEM_ECN_SUPPORT
|
||||||
}
|
}
|
||||||
,
|
,
|
||||||
|
@ -62,7 +62,7 @@ static cw_action_in_t actions_in[] = {
|
|||||||
/* Make ECN Support non-mand */
|
/* Make ECN Support non-mand */
|
||||||
.capwap_state = CAPWAP_STATE_JOIN,
|
.capwap_state = CAPWAP_STATE_JOIN,
|
||||||
.msg_id = CW_MSG_JOIN_RESPONSE,
|
.msg_id = CW_MSG_JOIN_RESPONSE,
|
||||||
.elem_id = CW_ELEM_ECN_SUPPORT,
|
.elem_id = CAPWAP_ELEM_ECN_SUPPORT,
|
||||||
.item_id = CW_ITEM_ECN_SUPPORT,
|
.item_id = CW_ITEM_ECN_SUPPORT,
|
||||||
.start = cw_in_generic2,
|
.start = cw_in_generic2,
|
||||||
.mand = 0,
|
.mand = 0,
|
||||||
@ -222,7 +222,7 @@ static cw_action_out_t actions_out[]={
|
|||||||
/* Cisco doesn't know ECN support, so we
|
/* Cisco doesn't know ECN support, so we
|
||||||
define no output method */
|
define no output method */
|
||||||
.msg_id = CW_MSG_JOIN_REQUEST,
|
.msg_id = CW_MSG_JOIN_REQUEST,
|
||||||
.elem_id = CW_ELEM_ECN_SUPPORT,
|
.elem_id = CAPWAP_ELEM_ECN_SUPPORT,
|
||||||
.item_id = CW_ITEM_ECN_SUPPORT,
|
.item_id = CW_ITEM_ECN_SUPPORT,
|
||||||
.mand = 0
|
.mand = 0
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user