Changed all "old-style" debug calls to new dbg calls.

FossilOrigin-Name: 2e98f08a020add71cecfd7d1902ba88cc5a5a48daf9574e85974674c9a6412cc
This commit is contained in:
7u83@mail.ru 2015-02-07 10:51:29 +00:00
parent e74e8bbf89
commit d5b690213e
17 changed files with 37 additions and 31 deletions

View File

@ -280,7 +280,7 @@ void process_lw_ctrl_packet(int index,struct sockaddr * addr, uint8_t * buffer,
int version = LWTH_GET_VERSION(m); int version = LWTH_GET_VERSION(m);
if (version != LW_VERSION){ if (version != LW_VERSION){
cw_log_debug1("Discarding LWAPP packet, wrong verson"); // cw_log_debug1("Discarding LWAPP packet, wrong verson");
return; return;
} }
@ -288,7 +288,7 @@ void process_lw_ctrl_packet(int index,struct sockaddr * addr, uint8_t * buffer,
printf ("LEN = %d\n",l); printf ("LEN = %d\n",l);
if (l+12 != len){ if (l+12 != len){
cw_log_debug1("Discarding LWAPP packet, wrong length"); // cw_log_debug1("Discarding LWAPP packet, wrong length");
return; return;
} }
@ -341,9 +341,11 @@ void process_ctrl_packet(int index,struct sockaddr * addr, uint8_t * buffer, int
#ifdef WITH_CW_LOG_DEBUG #ifdef WITH_CW_LOG_DEBUG
char str[100]; char str[100];
sock_addrtostr(addr,str,100); sock_addrtostr(addr,str,100);
cw_dbg(DBG_CW_PKT_IN,"Received packet from %s, len = %i, via %s\n",str,len, cw_dbg(DBG_CW_PKT_IN,"Received packet from %s, len = %i, via %s\n",sock_addr2str(addr),len,
socklist[index].type==SOCKLIST_UNICAST_SOCKET ? "unicast":"bcast/mcast"); socklist[index].type==SOCKLIST_UNICAST_SOCKET ? "unicast":"bcast/mcast");
cw_log_debug2_dump(buffer,len,"Packet data for packet, recevied from %s",str);
cw_dbg_dmp(DBG_CW_PKT_DMP,buffer,len,"Dump ...");
// cw_dbg_dmp(buffer,len,"Packet data for packet, recevied from %s",str);
#endif #endif
switch (socklist[index].ac_proto){ switch (socklist[index].ac_proto){

View File

@ -18,7 +18,7 @@ int db_init()
{ {
const char * filename="ac.sqlite3"; const char * filename="ac.sqlite3";
cw_log_debug0("Init sqlite3 db: %s",filename); cw_dbg(DBG_CW_INFO,"Init sqlite3 db: %s",filename);
int rc = sqlite3_open(filename,&handle); int rc = sqlite3_open(filename,&handle);
if (rc) if (rc)
{ {
@ -46,7 +46,7 @@ static sqlite3_stmt * ping_stmt;
int db_start() int db_start()
{ {
cw_log_debug0("Start sqlite3 db"); cw_dbg(DBG_CW_INFO,"Start sqlite3 db");
sqlite3_stmt *stmt; sqlite3_stmt *stmt;
int rc = sqlite3_prepare_v2(handle, "INSERT INTO acs (acid,acname) VALUES (?,?);",-1,&stmt,0); int rc = sqlite3_prepare_v2(handle, "INSERT INTO acs (acid,acname) VALUES (?,?);",-1,&stmt,0);

View File

@ -38,10 +38,12 @@
#define CLIENT_IP (sock_addrtostr((struct sockaddr*)&wtpman->conn->addr, (char[64]){0},64)) #define CLIENT_IP (sock_addrtostr((struct sockaddr*)&wtpman->conn->addr, (char[64]){0},64))
void conn_handle_echo_request(struct conn * conn) int conn_handle_echo_request(void * d)
{ {
struct conn * conn = (struct conn *)d;
struct cwrmsg * cwrmsg = &conn->cwrmsg; struct cwrmsg * cwrmsg = &conn->cwrmsg;
cwsend_echo_response(conn,cwrmsg->seqnum,0); cwsend_echo_response(conn,cwrmsg->seqnum,0);
return 0;
} }
@ -710,7 +712,7 @@ exit(0);
if (msg_counter < CAPWAP_ECHO_INTERVAL *2 ) if (msg_counter < CAPWAP_ECHO_INTERVAL *2 )
continue; continue;
cw_log_debug0("WTP died"); // cw_log_debug0("WTP died");
wtpman_remove(wtpman); wtpman_remove(wtpman);
return; return;
} }

View File

@ -28,7 +28,7 @@
#include "fragman.h" #include "fragman.h"
#include "cwmsg.h" #include "cwmsg.h"
#include "cwrmsg.h" #include "cwrmsg.h"
#include "wtpinfo.h"
struct conn{ struct conn{
int sock; int sock;
@ -182,6 +182,7 @@ struct image_data;
extern void conn_prepare_request(struct conn * conn, int type); extern void conn_prepare_request(struct conn * conn, int type);
extern int conn_prepare_image_data_request(struct conn * conn, struct image_data *, struct image_identifier *id ); extern int conn_prepare_image_data_request(struct conn * conn, struct image_data *, struct image_identifier *id );
extern void conn_detect_capwap(struct conn * conn, struct wtpinfo * wtpinfo);
#define conn_is_error(conn) (conn->dtls_error) #define conn_is_error(conn) (conn->dtls_error)

View File

@ -31,7 +31,7 @@ void conn_q_add_packet(struct conn * conn,uint8_t *packet,int len)
if (conn->qrpos==qwpos){ if (conn->qrpos==qwpos){
/* no buffers, discard packet */ /* no buffers, discard packet */
cw_log_debug0( "Discarding packet, no queue buffers left"); cw_dbg(DBG_CW_PKT_ERR, "Discarding packet, no queue buffers left");
return; return;
} }

View File

@ -29,14 +29,14 @@
int conn_send_packet(struct conn * conn, const uint8_t * buffer, int len) int conn_send_packet(struct conn * conn, const uint8_t * buffer, int len)
{ {
/*
#ifdef WITH_CW_LOG_DEBUG #ifdef WITH_CW_LOG_DEBUG
char addrstr[64]; char addrstr[64];
sock_addrtostr((struct sockaddr*)&conn->addr,addrstr,64); sock_addrtostr((struct sockaddr*)&conn->addr,addrstr,64);
cw_log_debug1("Sending packet to %s, len=%d",addrstr,len); cw_log_debug1("Sending packet to %s, len=%d",addrstr,len);
cw_log_debug2_dump(buffer,len,"Packet data for packet, sent to %s",addrstr); cw_log_debug2_dump(buffer,len,"Packet data for packet, sent to %s",addrstr);
#endif #endif
*/
int n; int n;
while((n=sendto( conn->sock, buffer, len, 0, while((n=sendto( conn->sock, buffer, len, 0,
(struct sockaddr*)&conn->addr, (struct sockaddr*)&conn->addr,

View File

@ -88,6 +88,7 @@ extern int cw_dbg_opt_level;
#endif #endif
#ifdef WITH_CW_LOG_DEBUG #ifdef WITH_CW_LOG_DEBUG
/*
#define cw_log_debug0(...) cw_log_debug_cbs[0](__VA_ARGS__) #define cw_log_debug0(...) cw_log_debug_cbs[0](__VA_ARGS__)
#define cw_log_debug1(...) cw_log_debug_cbs[1](__VA_ARGS__) #define cw_log_debug1(...) cw_log_debug_cbs[1](__VA_ARGS__)
#define cw_log_debug2(...) cw_log_debug_cbs[2](__VA_ARGS__) #define cw_log_debug2(...) cw_log_debug_cbs[2](__VA_ARGS__)
@ -96,7 +97,7 @@ extern int cw_dbg_opt_level;
#define cw_log_debug1_dump(str,len,...) cw_log_debug_dump_(1,str,len,__VA_ARGS__) #define cw_log_debug1_dump(str,len,...) cw_log_debug_dump_(1,str,len,__VA_ARGS__)
#define cw_log_debug2_dump(str,len,...) cw_log_debug_dump_(2,str,len,__VA_ARGS__) #define cw_log_debug2_dump(str,len,...) cw_log_debug_dump_(2,str,len,__VA_ARGS__)
#define cw_log_debug(level,...) cw_log_debug_cbs[level](__VA_ARGS__) #define cw_log_debug(level,...) cw_log_debug_cbs[level](__VA_ARGS__)
*/
#define cw_log_dbg(type,...) cw_log_dbg_(type,__FILE__,__LINE__,__VA_ARGS__) #define cw_log_dbg(type,...) cw_log_dbg_(type,__FILE__,__LINE__,__VA_ARGS__)
#define cw_dbg(type,...) cw_log_dbg_(type,__FILE__,__LINE__,__VA_ARGS__) #define cw_dbg(type,...) cw_log_dbg_(type,__FILE__,__LINE__,__VA_ARGS__)
@ -110,7 +111,7 @@ extern int cw_dbg_opt_level;
#define cw_dbg(...) #define cw_dbg(...)
#define cw_log_debug0(...) /* #define cw_log_debug0(...)
#define cw_log_debug1(...) #define cw_log_debug1(...)
#define cw_log_debug2(...) #define cw_log_debug2(...)
#define cw_log_debug(...) #define cw_log_debug(...)
@ -118,7 +119,7 @@ extern int cw_dbg_opt_level;
#define cw_log_debug0_dump(level,str,len) #define cw_log_debug0_dump(level,str,len)
#define cw_log_debug1_dump(level,str,len) #define cw_log_debug1_dump(level,str,len)
#define cw_log_debug2_dump(level,str,len) #define cw_log_debug2_dump(level,str,len)
*/
#define cw_dbg_missing_mand_elems(conn, msgtyoe, mand) #define cw_dbg_missing_mand_elems(conn, msgtyoe, mand)
#endif #endif

View File

@ -53,7 +53,7 @@ int cw_rand(uint8_t*dst, int len)
} }
if (l<len){ if (l<len){
cw_log_debug2("Not enough entropy reading from %s, using pseudo rand",cw_rand_dev); cw_dbg(DBG_CW_INFO,"Not enough entropy reading from %s, using pseudo rand",cw_rand_dev);
return cw_pseudo_rand(dst,len); return cw_pseudo_rand(dst,len);
} }

View File

@ -30,7 +30,7 @@ int cw_readelem_ieee80211_wtp_radio_info(void *dst,int type,uint8_t *msgelem, in
return 0; return 0;
if (len!=5){ if (len!=5){
cw_log_debug0("Discarding msgelem IEEE80211_WTP_RADIO_INFO, wrong size, len=%d\n",len); cw_dbg(DBG_CW_MSG_ERR,"Discarding msgelem IEEE80211_WTP_RADIO_INFO, wrong size, len=%d\n",len);
return 0; return 0;
} }

View File

@ -28,7 +28,7 @@
//static int cwmsg_addelem_acip(struct cwmsg * msg,ACIP *ip,int ctr) //static int cwmsg_addelem_acip(struct cwmsg * msg,ACIP *ip,int ctr)
static int cwmsg_addelem_acip(void * priv,void *data) //,int ctr) static int cwmsg_addelem_acip(void * priv,void *data) //,int ctr)
{ {
cw_log_debug2("Adding Ctrl IP %s",sock_addr2str((struct sockaddr*)data)); // cw_log_debug2("Adding Ctrl IP %s",sock_addr2str((struct sockaddr*)data));
struct cwmsg * msg = (struct cwmsg*)priv; struct cwmsg * msg = (struct cwmsg*)priv;
ACIP * acip = (ACIP*)data; ACIP * acip = (ACIP*)data;

View File

@ -26,7 +26,7 @@ static int acinfo_readelem_join_resp(void * a,int type,uint8_t* msgelem,int len)
{ {
struct ac_info * acinfo = (struct ac_info *)a; struct ac_info * acinfo = (struct ac_info *)a;
cw_log_debug1("Process join resp msgelem, type=%d, len=%d\n",type,len); // cw_log_debug1("Process join resp msgelem, type=%d, len=%d\n",type,len);
if (acinfo_readelem_ecn_support(acinfo,type,msgelem,len)) if (acinfo_readelem_ecn_support(acinfo,type,msgelem,len))
return 1; return 1;
@ -50,7 +50,7 @@ static int acinfo_readelem_join_resp(void * a,int type,uint8_t* msgelem,int len)
void cwread_join_response(struct ac_info * acinfo, uint8_t * msg, int len) void cwread_join_response(struct ac_info * acinfo, uint8_t * msg, int len)
{ {
cw_log_debug1("Reading join response"); // cw_log_debug1("Reading join response");
cw_foreach_msgelem(msg,len,acinfo_readelem_join_resp,acinfo); cw_foreach_msgelem(msg,len,acinfo_readelem_join_resp,acinfo);
} }

View File

@ -11,7 +11,7 @@ int wtpinfo_readelem_discovery_type(struct wtpinfo * wtpinfo, int type, uint8_t
return 0; return 0;
if (len!=1){ if (len!=1){
cw_log_debug0("Discarding WTP_DISCOVERY_TYPE msgelem, wrong size, type=%d,len=%d",type,len); cw_dbg(DBG_CW_MSG_ERR,"Discarding WTP_DISCOVERY_TYPE msgelem, wrong size, type=%d,len=%d",type,len);
return 1; return 1;
} }

View File

@ -41,7 +41,7 @@ static int wtpinfo_readelem_wtp_descriptor_(struct wtpinfo * wtpinfo, int type,
int i; int i;
if (ncrypt == 0 ){ if (ncrypt == 0 ){
/* non-conform */ /* non-conform */
cw_log_debug1("Non-standard-conform WTP descriptor detected (See RFC 5415)"); cw_dbg(DBG_CW_RFC,"Non-standard-conform WTP descriptor detected (See RFC 5415)");
if (!cq) if (!cq)
i=3; i=3;
else else
@ -54,7 +54,7 @@ static int wtpinfo_readelem_wtp_descriptor_(struct wtpinfo * wtpinfo, int type,
do { do {
if (i+8>len) if (i+8>len)
{ {
cw_log_debug1("WTP descriptor subelement to long, length=%d>%d",i+8,len); cw_dbg(DBG_CW_MSG_ERR,"WTP descriptor subelement to long, length=%d>%d",i+8,len);
return -1; return -1;
} }
@ -66,11 +66,11 @@ static int wtpinfo_readelem_wtp_descriptor_(struct wtpinfo * wtpinfo, int type,
i+=8; i+=8;
if (sublen+i>len){ if (sublen+i>len){
cw_log_debug1("WTP descriptor subelement too long, length = %d",sublen); cw_dbg(DBG_CW_MSG_ERR,"WTP descriptor subelement too long, length = %d",sublen);
return -1; return -1;
} }
cw_log_debug2("Reading WTP descriptor subelement, type=%d,len=%d",subtype,sublen); cw_dbg(DBG_CW_MSG,"Reading WTP descriptor subelement, type=%d,len=%d",subtype,sublen);
switch(subtype){ switch(subtype){
case CWMSGSUBELEM_WTP_DESCRIPTOR_HARDWARE_VERSION: case CWMSGSUBELEM_WTP_DESCRIPTOR_HARDWARE_VERSION:
@ -89,7 +89,7 @@ static int wtpinfo_readelem_wtp_descriptor_(struct wtpinfo * wtpinfo, int type,
wtpinfo->bootloader_version_len=sublen; wtpinfo->bootloader_version_len=sublen;
break; break;
default: default:
cw_log_debug1("Unknown WTP descriptor subelement, type = %d",subtype); cw_dbg(DBG_CW_MSG_ERR,"Unknown WTP descriptor subelement, type = %d",subtype);
break; break;
} }
i+=sublen; i+=sublen;
@ -103,7 +103,7 @@ int wtpinfo_readelem_wtp_descriptor(struct wtpinfo * wtpinfo, int type, uint8_t
{ {
int rc =wtpinfo_readelem_wtp_descriptor_(wtpinfo, type, msgelem, len,0); int rc =wtpinfo_readelem_wtp_descriptor_(wtpinfo, type, msgelem, len,0);
if (rc==-1){ if (rc==-1){
cw_log_debug2("Bad wtp descriptor, trying cisco hack"); cw_dbg(DBG_CW_RFC,"Bad wtp descriptor, trying cisco hack");
rc =wtpinfo_readelem_wtp_descriptor_(wtpinfo, type, msgelem, len,1); rc =wtpinfo_readelem_wtp_descriptor_(wtpinfo, type, msgelem, len,1);
} }

View File

@ -11,7 +11,7 @@ int wtpinfo_readelem_wtp_frame_tunnel_mode(struct wtpinfo * wtpinfo, int type, u
return 0; return 0;
if (len!=1){ if (len!=1){
cw_log_debug0("Discarding WTP_DISCOVERY_TYPE msgelem, wrong size, type=%d,len=%d",type,len); cw_dbg(DBG_CW_MSG_ERR,"Discarding WTP_DISCOVERY_TYPE msgelem, wrong size, type=%d,len=%d",type,len);
return 1; return 1;
} }
wtpinfo->frame_tunnel_mode=*msgelem; wtpinfo->frame_tunnel_mode=*msgelem;

View File

@ -10,7 +10,7 @@ int wtpinfo_readelem_wtp_mac_type(struct wtpinfo * wtpinfo, int type, uint8_t *
return 0; return 0;
if (len!=1){ if (len!=1){
cw_log_debug0("Discarding WTP_MAC_TYPE msgelem, wrong size, type=%d,len=%d",type,len); cw_dbg(DBG_CW_MSG_ERR,"Discarding WTP_MAC_TYPE msgelem, wrong size, type=%d,len=%d",type,len);
return 1; return 1;
} }

View File

@ -12,7 +12,7 @@ int wtpinfo_readelem_wtp_name(struct wtpinfo * wtpinfo, int type, uint8_t * msge
return 0; return 0;
if (len>512){ if (len>512){
cw_log_debug0("Truncating WTP_NAME msgelem to 512, wrong size, type=%d,len=%d",type,len); cw_dbg(DBG_CW_MSG_ERR,"Truncating WTP_NAME msgelem to 512, wrong size, type=%d,len=%d",type,len);
len=512; len=512;
} }

View File

@ -30,7 +30,7 @@ int wtpinfo_readelem_wtp_radio_info(struct wtpinfo * wtpinfo,int type,uint8_t *m
return 0; return 0;
if (len!=5){ if (len!=5){
cw_log_debug0("Discarding msgelem WTP_RADIO_INFO, wrong size, len=%d\n",len); cw_dbg(DBG_CW_MSG_ERR,"Discarding msgelem WTP_RADIO_INFO, wrong size, len=%d\n",len);
return -1; return -1;
} }