added dump suffix
FossilOrigin-Name: 894e6305f65760e1e93fc575b96a45a487bdd253ef0f67f0ad2645f262d204ca
This commit is contained in:
parent
accc0929cd
commit
06e50e8318
@ -402,7 +402,10 @@ static int process_elements(struct conn *conn, uint8_t * rawmsg, int len,
|
||||
elem_len = cw_get_elem_len(elem);
|
||||
|
||||
/*printf ("Would start elem processing now %d - %s\n",handler->id, handler->name);
|
||||
*/
|
||||
*/
|
||||
cw_dbg_elem(DBG_ELEM, conn, message->type, handler->id,
|
||||
cw_get_elem_data(elem),elem_len);
|
||||
|
||||
handler->get(conn, handler, cw_get_elem_data(elem), elem_len, from);
|
||||
|
||||
|
||||
|
@ -14,6 +14,7 @@ static struct cw_FormatDumpSettings CW_FORMAT_DUMP_SETTINGS = {
|
||||
0, /* inv_len */
|
||||
'*', /* inv_char */
|
||||
"\n\t", /* dump_prefix */
|
||||
"" /* dump_suffix */
|
||||
" ", /* ascii_prefix */
|
||||
"\n\t" /* newline */
|
||||
};
|
||||
@ -53,7 +54,6 @@ static int cw_format_dump_row(char *dst, const uint8_t * data, int len,
|
||||
}
|
||||
}
|
||||
|
||||
pdst+=sprintf(pdst,"%s",settings->newline);
|
||||
return pdst-dst;
|
||||
}
|
||||
|
||||
@ -106,6 +106,10 @@ char *cw_format_dump(const uint8_t * data, int len,
|
||||
rlen = len-pos;
|
||||
}
|
||||
pdst += cw_format_dump_row(pdst,data+pos, rlen, settings);
|
||||
if(row<rows)
|
||||
pdst += sprintf(pdst,"%s",settings->newline);
|
||||
else
|
||||
pdst += sprintf(pdst,"%s",settings->dump_suffix);
|
||||
}
|
||||
|
||||
return dst;
|
||||
|
@ -1,17 +1,26 @@
|
||||
#include "message_set.h"
|
||||
#include "cw_types.h"
|
||||
#include "kvstore.h"
|
||||
#include "log.h"
|
||||
|
||||
int cw_in_generic(struct conn * conn, struct cw_ElemHandler * handler,
|
||||
uint8_t * elem_data, int elem_len, struct sockaddr * from){
|
||||
mavldata_t data, *result;
|
||||
/* mavldata_t data, *result;
|
||||
char str[30];
|
||||
|
||||
*/
|
||||
|
||||
if (!handler->type){
|
||||
cw_log(LOG_ERR,"Can't handle element: %s, no type defined",handler->name);
|
||||
return 0;
|
||||
}
|
||||
cw_kvstore_add(conn->remote_cfg, handler->key, handler->type, elem_data,elem_len);
|
||||
|
||||
/*
|
||||
result = handler->type->get(&data,elem_data,elem_len);
|
||||
result->kv.key = strdup(handler->key);
|
||||
|
||||
handler->type->to_str(result,str,30);
|
||||
/* printf("Read %d-%s: %s %s\n", handler->id, handler->name, handler->key, str);
|
||||
*/
|
||||
mavl_add(conn->remote_cfg, result);
|
||||
*/
|
||||
return 0;
|
||||
}
|
||||
|
@ -387,12 +387,17 @@ void cw_dbg_elem_colored(int level, struct conn *conn, int msg, int msgelem,
|
||||
const char *elemname;
|
||||
char vendorname[256];
|
||||
char vendor_details[265];
|
||||
|
||||
struct cw_ElemHandler * handler;
|
||||
|
||||
if (!cw_dbg_is_level(level))
|
||||
return;
|
||||
|
||||
*vendor_details = 0;
|
||||
|
||||
handler = cw_msgset_get_elemhandler(conn->msgset,0,0,msgelem);
|
||||
if (!handler)
|
||||
return;
|
||||
|
||||
|
||||
/*
|
||||
/// TODO XXXX
|
||||
@ -411,7 +416,7 @@ void cw_dbg_elem_colored(int level, struct conn *conn, int msg, int msgelem,
|
||||
/*
|
||||
// elemname = cw_strelemp(conn->actions, msgelem);
|
||||
*/
|
||||
elemname=0;
|
||||
elemname=handler->name;
|
||||
}
|
||||
|
||||
|
||||
|
@ -99,6 +99,7 @@ struct cw_FormatDumpSettings {
|
||||
char inv_char;
|
||||
|
||||
const char * dump_prefix;
|
||||
const char * dump_suffix;
|
||||
const char * ascii_prefix;
|
||||
const char *newline;
|
||||
};
|
||||
|
@ -68,7 +68,16 @@ static struct cw_ElemHandler handlers[] = {
|
||||
capwap_in_wtp_descriptor /* get */
|
||||
}
|
||||
,
|
||||
|
||||
{
|
||||
"WTP Frame Tunnel Mode", /* name */
|
||||
CAPWAP_ELEM_WTP_FRAME_TUNNEL_MODE, /* Element ID */
|
||||
0,0, /* Vendor / Proto */
|
||||
1,1, /* min/max length */
|
||||
CW_TYPE_BYTE, /* type */
|
||||
"wtp_frame_tunnel_mode", /* Key */
|
||||
cw_in_generic /* get */
|
||||
}
|
||||
,
|
||||
{0,0,0,0,0,0,0,0}
|
||||
|
||||
};
|
||||
@ -79,7 +88,8 @@ static struct cw_ElemDef discovery_request_elements[] ={
|
||||
{0,0,CAPWAP_ELEM_DISCOVERY_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_DESCRIPTOR, 1, 0},
|
||||
{0,0,CAPWAP_ELEM_WTP_DESCRIPTOR, 1, 0},
|
||||
{0,0,CAPWAP_ELEM_WTP_FRAME_TUNNEL_MODE, 1, 0},
|
||||
{0,0,0,0,0}
|
||||
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user