Colored debugging, some code cleaning.
FossilOrigin-Name: 23a60b9297d5719fa502b2163680fa1af8bc0201cb777771dc30de045f84b341
This commit is contained in:
@ -17,10 +17,15 @@ void cw_dbg_missing_mand(int level,struct conn *conn,cw_action_in_t ** ml,int n,
|
||||
void cw_dbg_packet(struct conn *conn, uint8_t * packet, int len);
|
||||
|
||||
|
||||
#define DBGX(f,...) cw_dbg(DBG_X,f,__VA_ARGS__) //cw_dbg(DBG_X, f ,__VA_ARGS__)
|
||||
//#define DBGX(f,...) cw_dbg(DBG_X, f)
|
||||
//#define DBGX(f,...) printf("hallo\n")
|
||||
|
||||
|
||||
#ifdef WITH_CW_LOG_DEBUG
|
||||
|
||||
#define cw_dbg_elem(conn,msgtype,msgelemtype,msgbuf,msglen)\
|
||||
cw_dbg_elem_(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)
|
||||
|
||||
#else
|
||||
|
||||
@ -35,47 +40,76 @@ void cw_dbg_packet(struct conn *conn, uint8_t * packet, int len);
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Debug levels
|
||||
*/
|
||||
enum debug_levels{
|
||||
/** Show headers of incomming CAPWAP packets */
|
||||
DBG_PKT_IN=0,
|
||||
/** Show headers of outgoing CAPWAP packets */
|
||||
DBG_PKT_OUT,
|
||||
|
||||
#define DBG_PKT_IN 0x00000001 /* Headers of incoming CAPWAP packets */
|
||||
#define DBG_PKT_OUT 0x00000002 /* Headers of outgoing CAPWAP packets */
|
||||
#define DBG_PKT_ERR 0x00000004 /* Error of packets */
|
||||
#define DBG_PKT_DMP 0x00000008 /* Dump packts */
|
||||
/** Incomming CAPWAP packets with errors, wich would
|
||||
usually silently discarded */
|
||||
DBG_PKT_ERR,
|
||||
|
||||
/** Dump content of incomming packets */
|
||||
DBG_PKT_DMP,
|
||||
|
||||
/** Display incomming CAPWAP/LWAPP messages */
|
||||
DBG_MSG_IN,
|
||||
|
||||
/** Display outgoing CAPWAP/LWAPP messages */
|
||||
DBG_MSG_OUT,
|
||||
|
||||
/** Message errors */
|
||||
DBG_MSG_ERR,
|
||||
|
||||
/** Show message elements */
|
||||
DBG_ELEM,
|
||||
|
||||
/** Error in msg elements */
|
||||
DBG_ELEM_ERR,
|
||||
|
||||
/** Show subelements */
|
||||
DBG_SUBELEM,
|
||||
|
||||
/** hex dump elements */
|
||||
DBG_ELEM_DMP,
|
||||
|
||||
/** General infos, like CAPWAP state */
|
||||
DBG_INFO,
|
||||
|
||||
/** RFC related */
|
||||
DBG_RFC,
|
||||
|
||||
DBG_DTLS,
|
||||
DBG_DTLS_DETAIL,
|
||||
DBG_DTLS_BIO,
|
||||
DBG_DTLS_BIO_DMP,
|
||||
|
||||
DBG_X
|
||||
|
||||
|
||||
#define DBG_MSG_IN 0x00000010 /* Parsed CAPWAP/LWAPP messages */
|
||||
#define DBG_MSG_OUT 0x00000020 /* Parsed CAPWAP/LWAPP messages */
|
||||
};
|
||||
|
||||
#define DBG_ELEM 0x00000000 /* Show message elements */
|
||||
#define DBG_ELEM_DMP 0x00000000 /* Dump message elements */
|
||||
|
||||
#define DBG_INFO 0x00000000
|
||||
#define DBG_RFC 0x00000080 /* RCF-realted CAPWAP errors */
|
||||
|
||||
|
||||
#define DBG_MSG_ERR 0x00000000 /* Errors in CAPWAP messages */
|
||||
#define DBG_ELEM_ERR 0x00000000
|
||||
|
||||
/* driver specific debugs */
|
||||
|
||||
#define DBG_DRV 0x00010000
|
||||
#define DBG_DRV_ERR 0x00020000
|
||||
|
||||
/* DTLS debugs */
|
||||
#define DBG_DTLS 0x10000000
|
||||
#define DBG_DTLS_DETAIL 0x20000000
|
||||
#define DBG_DTLS_BIO 0x40000000
|
||||
#define DBG_DTLS_BIO_DMP 0x80000000
|
||||
|
||||
#define DBG_ALL 0xffffffff
|
||||
#define DBG_PKT_INOUT (DBG_CW_PKT_IN | DBG_CW_PKT_OUT)
|
||||
|
||||
|
||||
#define DBG_DISP_LINE_NUMBERS 0x00000001
|
||||
#define DBG_DISP_ASC_DMP 0x00000002
|
||||
#define DBG_DISP_COLORS 0x00000004
|
||||
|
||||
|
||||
#define DBG_DISP_LINE_NUMBERS (1<<0)
|
||||
#define DBG_DISP_ASC_DMP (1<<1)
|
||||
#define DBG_DISP_COLORS (1<<2)
|
||||
|
||||
#define DBG_DETAIL_ALL 0xffffffff
|
||||
#define DBG_ERR (DBG_MSG_ERR | DBG_CW_PKT_ERR)
|
||||
|
||||
|
||||
/**@}*/
|
||||
|
||||
@ -88,7 +122,6 @@ extern uint32_t cw_dbg_opt_level;
|
||||
extern struct cw_str cw_dbg_strings[];
|
||||
|
||||
|
||||
/**@}*/
|
||||
|
||||
|
||||
#define cw_dbg(type,...) cw_dbg_colored(type,__FILE__,__LINE__,__VA_ARGS__)
|
||||
@ -107,5 +140,12 @@ void cw_dbg_pkt(int level,struct conn *conn, uint8_t * packet, int len);
|
||||
void cw_dbg_msg(int level,struct conn *conn, uint8_t * packet, int len);
|
||||
|
||||
|
||||
#define cw_dbg_set_level(level,on)\
|
||||
(on ? cw_dbg_opt_level |= (1<<(level)) : (cw_dbg_opt_level &= (-1)^(1<<(level))))
|
||||
|
||||
#define cw_dbg_is_level(level)\
|
||||
(cw_dbg_opt_level & (1<<level))
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user