elem debug shows value too
FossilOrigin-Name: c9075cb27a1f6dc681ed551243e32b075fb9e3808818020418226b9398b5df88
This commit is contained in:
parent
6a5bd334e5
commit
3fe12f1a5d
@ -8,7 +8,7 @@ struct cw_StrListElem capwap_strings_elem[] = {
|
||||
{CAPWAP_ELEM_AC_IPV6_LIST, "AC IPv6 List"},
|
||||
{CAPWAP_ELEM_AC_NAME, "AC Name"},
|
||||
{CW_ELEM_AC_NAME_WITH_PRIORITY, "AC Name with Priority"},
|
||||
// {CW_ELEM_AC_NAME_WITH_INDEX, "AC Name with Index"},
|
||||
/* {CW_ELEM_AC_NAME_WITH_INDEX, "AC Name with Index"}, */
|
||||
{CAPWAP_ELEM_AC_TIMESTAMP, "AC Timestamp"},
|
||||
{CW_ELEM_ADD_MAC_ACL_ENTRY, "Add MAC ACL Entry"},
|
||||
{CW_ELEM_ADD_STATION, "Add Station"},
|
||||
|
@ -183,16 +183,18 @@ static struct cw_MsgSet *load_msg_set(struct conn *conn, uint8_t * rawmsg, int l
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
int cw_in_check_generic(struct conn *conn, struct cw_action_in *a, uint8_t * data,
|
||||
int len,struct sockaddr *from)
|
||||
{
|
||||
/* if (cw_is_request(a->msg_id)){
|
||||
return cw_in_check_generic_req(conn,a,data,len,from);
|
||||
}
|
||||
return cw_in_check_generic_resp(conn,a,data,len,from);
|
||||
*/
|
||||
// if (cw_is_request(a->msg_id)){
|
||||
// return cw_in_check_generic_req(conn,a,data,len,from);
|
||||
// }
|
||||
// return cw_in_check_generic_resp(conn,a,data,len,from);
|
||||
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
void cw_read_elem(struct cw_ElemHandler * handler, struct conn * conn,
|
||||
@ -214,8 +216,9 @@ static int process_elements(struct conn *conn, uint8_t * rawmsg, int len,
|
||||
{
|
||||
mavl_t mand_found;
|
||||
mlist_t unrecognized;
|
||||
|
||||
|
||||
struct cw_MsgData search;
|
||||
struct cw_MsgData * message;
|
||||
|
||||
char sock_buf[SOCK_ADDR_BUFSIZE]; /**< to hold str from sockaddr2str */
|
||||
|
||||
/*struct cw_action_in as, *af, *afm;*/
|
||||
@ -278,11 +281,10 @@ static int process_elements(struct conn *conn, uint8_t * rawmsg, int len,
|
||||
cw_dbg_msg(DBG_MSG_IN, conn, rawmsg, len, from);
|
||||
|
||||
/* prepare struct for search operation */
|
||||
struct cw_MsgData search;
|
||||
search.type = cw_get_msg_id(msg_ptr);
|
||||
|
||||
/* Search message */
|
||||
struct cw_MsgData * message;
|
||||
|
||||
message = mavl_find(conn->msgset->msgdata,&search);
|
||||
|
||||
int result_code = 0;
|
||||
@ -723,6 +725,7 @@ int cw_read_messages(struct conn *conn)
|
||||
|
||||
int cw_read_from(struct conn *conn)
|
||||
{
|
||||
struct sockaddr_storage from;
|
||||
uint8_t buf[2024];
|
||||
int len = 2024;
|
||||
|
||||
@ -734,7 +737,7 @@ int cw_read_from(struct conn *conn)
|
||||
|
||||
|
||||
|
||||
struct sockaddr_storage from;
|
||||
|
||||
int n = conn->readfrom(conn, buf, len, &from);
|
||||
if (n < 0)
|
||||
return n;
|
||||
|
@ -15,7 +15,7 @@ int cw_out_generic(struct cw_ElemHandler * handler, struct cw_ElemHandlerParams
|
||||
int start, len;
|
||||
/* Get the element to put */
|
||||
|
||||
search.key=handler->key;
|
||||
search.key=(char*)handler->key;
|
||||
elem = mavl_get(params->conn->local_cfg, &search);
|
||||
|
||||
/* Size for msg elem header depends on
|
||||
@ -44,6 +44,7 @@ int cw_out_generic(struct cw_ElemHandler * handler, struct cw_ElemHandlerParams
|
||||
return 0;
|
||||
}
|
||||
len = handler->type->put(elem,dst+start);
|
||||
params->elem = elem;
|
||||
|
||||
/*(cw_put_mbag_item(dst + start, item);*/
|
||||
|
||||
|
@ -57,7 +57,7 @@ int cw_process_element(struct cw_ElemHandlerParams *params, int proto, int vendo
|
||||
return -1;
|
||||
}
|
||||
|
||||
cw_dbg_elem(DBG_ELEM_IN, params->conn, params->msgdata->type, handler,
|
||||
cw_dbg_elem(DBG_ELEM_IN, params->conn, params->msgdata->type, handler, params,
|
||||
data,len);
|
||||
|
||||
return handler->get(handler, params, data, len);
|
||||
|
@ -83,11 +83,13 @@ int cw_put_msg(struct conn *conn, uint8_t * rawout)
|
||||
|
||||
params.conn=conn;
|
||||
params.elemdata = data;
|
||||
params.elem=NULL;
|
||||
|
||||
l = handler->put(handler,¶ms,dst+len);
|
||||
len += l;
|
||||
|
||||
if(l>0)
|
||||
cw_dbg_elem(DBG_ELEM_OUT,conn,type,handler,dst+len,l);
|
||||
cw_dbg_elem(DBG_ELEM_OUT,conn,type,handler,¶ms,dst+len,l);
|
||||
}
|
||||
|
||||
cw_set_msg_elems_len(msgptr, len);
|
||||
|
16
src/cw/dbg.c
16
src/cw/dbg.c
@ -466,7 +466,8 @@ void cw_dbg(int level, const char *format, ...){
|
||||
|
||||
|
||||
void cw_dbg_elem(int level, struct conn *conn, int msg,
|
||||
struct cw_ElemHandler * handler,
|
||||
struct cw_ElemHandler * handler,
|
||||
struct cw_ElemHandlerParams *params,
|
||||
const uint8_t * msgbuf, int len)
|
||||
{
|
||||
char vendorname[256];
|
||||
@ -485,9 +486,18 @@ void cw_dbg_elem(int level, struct conn *conn, int msg,
|
||||
sprintf(vendorname,"");
|
||||
}
|
||||
|
||||
cw_dbg(level,"%s %d (%s), len=%d ",vendorname,handler->id,
|
||||
if (params->elem == NULL) {
|
||||
cw_dbg(level,"%s %d (%s), len=%d ",vendorname,handler->id,
|
||||
handler->name,len);
|
||||
|
||||
}else {
|
||||
char str[512];
|
||||
params->elem->type->to_str(params->elem,str,512);
|
||||
cw_dbg(level,"%s %d (%s), len=%d, val=%s ",vendorname,handler->id,
|
||||
handler->name,len, str);
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (cw_dbg_is_level(DBG_ELEM_DMP)) {
|
||||
/*dmp = cw_format_dump(msgbuf,len,NULL);*/
|
||||
|
||||
|
@ -194,7 +194,9 @@ void cw_dbg_dmp_(int level, const uint8_t * data, int len, const char *format, .
|
||||
|
||||
|
||||
|
||||
extern void cw_dbg_elem(int level, struct conn *conn, int msg, struct cw_ElemHandler * handler,
|
||||
void cw_dbg_elem(int level, struct conn *conn, int msg,
|
||||
struct cw_ElemHandler * handler, struct
|
||||
cw_ElemHandlerParams * params,
|
||||
const uint8_t * msgbuf, int len);
|
||||
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include "sock.h"
|
||||
#include "mavl.h"
|
||||
#include "conn.h"
|
||||
#include "ktv.h"
|
||||
|
||||
struct cw_MsgSet {
|
||||
mavl_t msgdata;
|
||||
@ -35,6 +36,7 @@ struct cw_ElemHandlerParams {
|
||||
struct cw_ElemData * elemdata;
|
||||
struct sockaddr *from;
|
||||
mavl_t mand_found;
|
||||
cw_KTV_t * elem;
|
||||
};
|
||||
|
||||
struct cw_ElemHandler {
|
||||
|
@ -33,7 +33,7 @@ int capwap_in_vendor_specific_payload(struct cw_ElemHandler *handler,
|
||||
return 0;
|
||||
}
|
||||
|
||||
cw_dbg_elem(DBG_ELEM_IN,params->conn,0,vhandler,data+6,len-6);
|
||||
cw_dbg_elem(DBG_ELEM_IN,params->conn,0,vhandler, params, data+6,len-6);
|
||||
//vhandler->get(vhandler, params, data+6, len-6);
|
||||
|
||||
cw_process_element(params,0,vendor_id,elem_id,data+6,len-6);
|
||||
|
Loading…
Reference in New Issue
Block a user