cw_dbg_missing_mand_elems added.
FossilOrigin-Name: 8c59a56c7d6388abc4c4bef75e96b7302e9ea6a714fdaf5a68cba84bd8066073
This commit is contained in:
parent
d9bd7d3339
commit
f7dbcac0d8
@ -94,6 +94,7 @@ extern int cw_dbg_opt_level;
|
||||
#define cw_log_dbg_dmp(type,str,len,...) cw_log_dbg_dmp_(type,__FILE__,__LINE__,str,len,__VA_ARGS__)
|
||||
#define cw_dbg_dmp(type,str,len,...) cw_log_dbg_dmp_(type,__FILE__,__LINE__,str,len,__VA_ARGS__)
|
||||
#define cw_dbg_msgelem(msgtype,msgelemtype,msgbuf,msglen) cw_dbg_msgelem_(msgtype,msgelemtype,msgbuf,msglen)
|
||||
#define cw_dbg_missing_mand_elems(conn, msgtyoe, mand) cw_dbg_missing_mand_elems_(conn, msgtyoe, mand)
|
||||
|
||||
#else
|
||||
#define cw_log_dbg(...)
|
||||
@ -108,6 +109,9 @@ extern int cw_dbg_opt_level;
|
||||
#define cw_log_debug0_dump(level,str,len)
|
||||
#define cw_log_debug1_dump(level,str,len)
|
||||
#define cw_log_debug2_dump(level,str,len)
|
||||
|
||||
#define cw_dbg_missing_mand_elems(conn, msgtyoe, mand)
|
||||
|
||||
#endif
|
||||
|
||||
extern void (*cw_log_cb)(int level,const char * fromat, ...);
|
||||
@ -121,6 +125,8 @@ extern void cw_log_tofile(int level,const char *format, ...);
|
||||
|
||||
|
||||
extern void cw_dbg_msgelem_(int msg, int msgelem, const uint8_t *msgbuf,int len);
|
||||
struct conn;
|
||||
extern void cw_dbg_missing_mand_elems_(struct conn * conn,int msgtyoe, int * mand);
|
||||
|
||||
|
||||
|
||||
|
@ -23,6 +23,7 @@
|
||||
|
||||
#include "cw_log.h"
|
||||
#include "capwap.h"
|
||||
#include "cw_util.h"
|
||||
|
||||
|
||||
static void cw_log_debug0_(const char *format, ...)
|
||||
@ -59,7 +60,8 @@ static void cw_log_debug2_(const char *format, ...)
|
||||
closelog();
|
||||
}
|
||||
|
||||
int cw_log_debug_dump_(int level,const uint8_t * data, int len,const char * format, ...)
|
||||
int cw_log_debug_dump_(int level, const uint8_t * data, int len,
|
||||
const char *format, ...)
|
||||
{
|
||||
int maxtlen = 2048;
|
||||
int i;
|
||||
@ -114,7 +116,8 @@ int cw_dbg_opt_detail=0;
|
||||
int cw_dbg_opt_level = 0;
|
||||
|
||||
|
||||
void cw_log_dbg_(int level, const char * file, int line, const char * format, ...)
|
||||
void cw_log_dbg_(int level, const char *file, int line, const char *format,
|
||||
...)
|
||||
{
|
||||
if (!(level & cw_dbg_opt_level))
|
||||
return;
|
||||
@ -134,7 +137,9 @@ void cw_log_dbg_(int level, const char * file, int line, const char * format, ..
|
||||
|
||||
|
||||
|
||||
void cw_log_dbg_dmp_(int level,const char * file, int line, const uint8_t * data, int len,const char * format, ...)
|
||||
void cw_log_dbg_dmp_(int level, const char *file, int line,
|
||||
const uint8_t * data, int len, const char *format,
|
||||
...)
|
||||
{
|
||||
|
||||
if (!(level & cw_dbg_opt_level))
|
||||
@ -199,8 +204,7 @@ void cw_log_dbg_dmp_(int level,const char * file, int line, const uint8_t * data
|
||||
l = sprintf(pdst, " | %s\n\t", asc_buffer);
|
||||
ascdst = asc_buffer;
|
||||
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
l = sprintf(pdst, "\n\t");
|
||||
}
|
||||
pdst += l;
|
||||
@ -231,15 +235,12 @@ void cw_log_dbg_dmp_(int level,const char * file, int line, const uint8_t * data
|
||||
|
||||
|
||||
void (*cw_log_debug_cbs[]) (const char *fromat, ...) = {
|
||||
cw_log_debug0_,
|
||||
cw_log_debug1_,
|
||||
cw_log_debug2_
|
||||
};
|
||||
cw_log_debug0_, cw_log_debug1_, cw_log_debug2_};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* print debug info
|
||||
* print debug info for message elements
|
||||
*/
|
||||
|
||||
void cw_dbg_msgelem_(int msg, int msgelem, const uint8_t * msgbuf, int len)
|
||||
@ -254,35 +255,36 @@ void cw_dbg_msgelem_(int msg, int msgelem, const uint8_t *msgbuf,int len)
|
||||
int type = ntohs(*((uint16_t *) (msgbuf + 4)));
|
||||
sprintf(vendorname, "%s/%s/%d",
|
||||
(char *) cw_msgelemtostr(msgelem),
|
||||
(char*)cw_ianavendoridtostr(vendor),
|
||||
type);
|
||||
(char *) cw_ianavendoridtostr(vendor), type);
|
||||
elemname = vendorname;
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
elemname = cw_msgelemtostr(msgelem);
|
||||
}
|
||||
|
||||
|
||||
if (!cw_dbg_is_level(DBG_CW_MSGELEM_DMP))
|
||||
cw_dbg(DBG_CW_MSGELEM,"Reading %s msgelem, type=%d (%s), len=%d",
|
||||
cw_msgtostr(msg),
|
||||
msgelem,
|
||||
elemname,
|
||||
len);
|
||||
cw_dbg(DBG_CW_MSGELEM,
|
||||
"Reading %s msgelem, type=%d (%s), len=%d",
|
||||
cw_msgtostr(msg), msgelem, elemname, len);
|
||||
|
||||
else
|
||||
cw_dbg_dmp(DBG_CW_MSGELEM,msgbuf,len,"Reading %s msgelem, type=%d (%s), len=%d\n\t Dump ...",
|
||||
cw_msgtostr(msg),
|
||||
msgelem,
|
||||
elemname,
|
||||
len);
|
||||
|
||||
|
||||
cw_dbg_dmp(DBG_CW_MSGELEM, msgbuf, len,
|
||||
"Reading %s msgelem, type=%d (%s), len=%d\n\t Dump ...",
|
||||
cw_msgtostr(msg), msgelem, elemname, len);
|
||||
}
|
||||
|
||||
void cw_dbg_missing_mand_elems_(struct conn *conn, int msgtype, int *mand)
|
||||
{
|
||||
if (!cw_dbg_is_level(DBG_CW_RFC))
|
||||
return;
|
||||
|
||||
if (cw_is_missing_mand_elems(mand)) {
|
||||
char str[512];
|
||||
cw_get_missing_mand_elems(str, mand);
|
||||
cw_dbg(DBG_CW_RFC, "Missing msgelems in %s: %s",
|
||||
cw_msgtostr(msgtype), str);
|
||||
}
|
||||
}
|
||||
|
||||
//cw_dbg(DBG_CW_MSGELEM,"Process discovery req msgelem, type=%d (%s), len=%d",type,cw_msgelemtostr(type),len);
|
||||
//cw_dbg_dmp(DBG_CW_MSGELEM_DMP,msgelem,len,"Dump for msgelem ...");
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user