Shorter debug constant names.

FossilOrigin-Name: 128431970612dcfe591b149adc472ee48a035ad2e1d5c190a4d1f9b49bc969ed
This commit is contained in:
7u83@mail.ru
2015-03-28 11:51:34 +00:00
parent 16fd710394
commit f85da197a2
21 changed files with 94 additions and 46 deletions

View File

@ -21,7 +21,7 @@ endif
NAME=libcapwap.a
SOCKOBJS=sock_create.o sock_copyaddr.o sock_strtoaddr.o sock_cmpaddr.o sock_addrlen.o \
sock_receive.o sock_mwait.o sock_addrtostr.o \
sock_mwait.o sock_addrtostr.o \
sock_setport.o \
sock_getport.o \
sock_getifaddr.o \
@ -32,6 +32,7 @@ SOCKOBJS=sock_create.o sock_copyaddr.o sock_strtoaddr.o sock_cmpaddr.o sock_addr
sock_addrinit.o \
sock_set_dontfrag.o \
sock_get_primary_if.o
#sock_receive.o
LOGOBJS=cw_log.o \
cw_log_debug.o \
@ -150,7 +151,10 @@ CAPWAPOBJS= \
cw_readelem_capwap_local_ip_addr.o \
cw_readelem_wtp_reboot_statistics.o\
cwmsg_addelem_vendor_cisco_mwar_addr.o \
lw_readelem_wtp_board_data.o
lw_readelem_wtp_board_data.o \
cw_readmsg_configuration_status_response.o \
# cwmsg_addelem_vendor_cisco_ap_timesync.o \
# cwmsg_addelem_vendor_specific_payload.o \
@ -227,6 +231,8 @@ OBJS=$(CONNOBJS) $(FRAGOBJS) $(SOCKOBJS) $(CAPWAPOBJS) $(WTPINFOOBJS) \
$(LWAPPOBJS) \
$(LWAPPCISCOOBJS)
#include $(OBJS:.o=.d)
O:=$(OBJS);
OBJS:=$(patsubst %.o,$(ARCH)/%.o,$(OBJS))
@ -249,7 +255,7 @@ $(ARCH)/%.o:%.c
@mkdir -p $(ARCH)
@echo " CC "$<
@$(CC) -c $(CFLAGS) $< -o $@
@$(CC) -MM $(CFLAGS) $< > $*.d
$(ARCH)/$(NAME) : $(OBJS)
@echo " AR $(ARCH)/$(NAME)"

View File

@ -49,7 +49,7 @@ struct cwrmsg *conn_get_message(struct conn *conn)
if (args.cwrmsg) {
cw_dbg(DBG_CW_MSG,
cw_dbg(DBG_MSG,
"Received message from %s, type=%d - %s, seq=%d",
sock_addr2str(&conn->addr), args.cwrmsg->type,
cw_msgtostr(args.cwrmsg->type),

View File

@ -23,7 +23,7 @@ struct cwrmsg * conn_get_response(struct conn * conn)
while(!cw_timer_timeout(r_timer)){
cwrmsg = conn_get_message(conn);
if (cwrmsg){
cw_dbg(DBG_CW_MSG,"Received message from %s, type=%d - %s"
cw_dbg(DBG_MSG,"Received message from %s, type=%d - %s"
,sock_addr2str(&conn->addr),cwrmsg->type,cw_msgtostr(cwrmsg->type));
if (cwrmsg->type == type){
return cwrmsg;

View File

@ -260,7 +260,7 @@ cw_log_debug0_, cw_log_debug1_, cw_log_debug2_};
void cw_dbg_msgelem_(int msg, int msgelem, const uint8_t * msgbuf, int len)
{
if (!cw_dbg_is_level(DBG_CW_MSGELEM))
if (!cw_dbg_is_level(DBG_ELEM))
return;
const char *elemname;
@ -277,13 +277,13 @@ void cw_dbg_msgelem_(int msg, int msgelem, const uint8_t * msgbuf, int len)
}
if (!cw_dbg_is_level(DBG_CW_MSGELEM_DMP))
cw_dbg(DBG_CW_MSGELEM,
if (!cw_dbg_is_level(DBG_ELEM_DMP))
cw_dbg(DBG_ELEM,
"Reading %s msgelem, type=%d (%s), len=%d",
cw_msgtostr(msg), msgelem, elemname, len);
else
cw_dbg_dmp(DBG_CW_MSGELEM, msgbuf, len,
cw_dbg_dmp(DBG_ELEM, msgbuf, len,
"Reading %s msgelem, type=%d (%s), len=%d\n\t Dump ...",
cw_msgtostr(msg), msgelem, elemname, len);
}

View File

@ -25,9 +25,9 @@
struct cw_dbg_cfgstrs cw_dbg_cfgstrs[] = {
{"info",DBG_CW_INFO},
{"msg",DBG_CW_MSG},
{"msgelem",DBG_CW_MSGELEM},
{"msgelem_dmp",DBG_CW_MSGELEM_DMP},
{"msg",DBG_MSG},
{"msgelem",DBG_ELEM},
{"msgelem_dmp",DBG_ELEM_DMP},
{"rfc",DBG_CW_RFC},
{"pkt_in",DBG_CW_PKT_IN},
{"pkt_out",DBG_CW_PKT_OUT},

View File

@ -25,13 +25,13 @@ const char * cw_msgelemtostr(int elem)
{
switch (elem){
case CW_ELEM_AC_DESCRIPTOR:
return "AC descriptor";
/* AC IPv4 List 2
AC IPv6 List 3
*/
return "AC Descriptor";
case CW_ELEM_AC_IPV4_LIST:
return "AC IPv4 List";
case CW_ELEM_AC_IPV6_LIST:
return "AC IPv6 List";
case CW_ELEM_AC_NAME:
return "AC name";
return "AC Name";
/*
AC Name with Priority 5
AC Timestamp 6
@ -48,11 +48,18 @@ const char * cw_msgelemtostr(int elem)
return "CAPWAP local IPv4 addr";
case CWMSGELEM_CAPWAP_LOCAL_IPV6_ADDRESS:
return "CAPWAP local IPv6 addr";
/* CAPWAP Timers 12
CAPWAP Transport Protocol 51
case CW_ELEM_CAPWAP_TIMERS:
return "CAWPAP Timers";
/* CAPWAP Transport Protocol 51
Data Transfer Data 13
Data Transfer Mode 14
Decryption Error Report 15
*/
case CW_ELEM_DECRYPTION_ERROR_REPORT_PERIOD:
return "Decryption Error Report Period";
/*
Decryption Error Report Period 16
Delete MAC ACL Entry 17
Delete Station 18
@ -66,8 +73,10 @@ const char * cw_msgelemtostr(int elem)
*/
case CWMSGELEM_ECN_SUPPORT:
return "ECN support";
/* Idle Timeout 23
*/
case CW_ELEM_IDLE_TIMEOUT:
return "Idle Timeout";
case CWMSGELEM_IMAGE_DATA:
return "image data";
@ -90,17 +99,17 @@ const char * cw_msgelemtostr(int elem)
return "radio administrative state";
case CWMSGELEM_RADIO_OPERATIONAL_STATE:
return "radio operational state";
return "Radio Operational State";
/* Radio Operational State 32
*/
case CWMSGELEM_RESULT_CODE:
return "result code";
return "Result Code";
/* Returned Message Element 34
*/
case CW_ELEM_SESSION_ID:
return "session id";
return "Session ID";
case CWMSGELEM_STATISTICS_TIMER:
return "Statistics Timer";
@ -114,10 +123,11 @@ const char * cw_msgelemtostr(int elem)
case CWMSGELEM_WTP_DESCRIPTOR:
return "wtp descriptor";
/* WTP Fallback 40
*/
case CW_ELEM_WTP_FALLBACK:
return "WTP Fallback";
case CWMSGELEM_WTP_FRAME_TUNNEL_MODE:
return "frame tunnel mode";
return "Frame Tunnel Mode";
/* case CWMSGELEM_RESERVED_1:
return "reserved (42)";

View File

@ -66,7 +66,7 @@ static int read_subelem(struct ac_info* acinfo,int subtype,uint8_t *elem, int le
}
/**
* Read message elment ac descriptor
* Read CAPWAP message elment: AC Descriptor
* @param acinfo pointer to acinfo where the result is stored
* @param type message element type
* @param msgelem pointer to message element
@ -116,7 +116,7 @@ int cw_readelem_ac_descriptor(struct ac_info * acinfo,int type, uint8_t *msgelem
sub+=8;
int subtype = val>>16;
cw_dbg(DBG_CW_MSGELEM,"ac descriptor sub-element vendor: %d, type:%d, len: %d",vendor,subtype,sublen);
cw_dbg(DBG_ELEM,"AC Descriptor sub-element vendor: %d, type:%d, len: %d",vendor,subtype,sublen);
switch (vendor) {
case 0:
read_subelem(acinfo,subtype,msgelem+sub,sublen);

View File

@ -29,7 +29,7 @@
void cw_send_image_data_response(struct conn * conn,int seqnum, int rc)
{
cw_dbg(DBG_CW_MSG,"Sending image data response to %s, seq = %d",sock_addr2str(&conn->addr),seqnum);
cw_dbg(DBG_MSG,"Sending image data response to %s, seq = %d",sock_addr2str(&conn->addr),seqnum);
struct cwmsg * cwmsg = &conn->resp_msg;
cwmsg_init(cwmsg,conn->resp_buffer,CWMSG_IMAGE_DATA_RESPONSE,seqnum,NULL);

View File

@ -72,7 +72,7 @@ int cwread_change_state_event_request(struct wtpinfo * wtpinfo, uint8_t * msg, i
eparm.wtpinfo = wtpinfo;
eparm.mand=mand;
cw_dbg(DBG_CW_MSGELEM,"Reading change state event request, len=%d",len);
cw_dbg(DBG_ELEM,"Reading change state event request, len=%d",len);
cw_foreach_msgelem(msg,len,readelem,&eparm);

View File

@ -83,7 +83,7 @@ void cwread_configuration_status_request(struct wtpinfo * wtpinfo, uint8_t * msg
eparm.wtpinfo = wtpinfo;
eparm.mand=mand;
cw_dbg(DBG_CW_MSGELEM,"Reading configuration status request, len=%d",len);
cw_dbg(DBG_ELEM,"Reading configuration status request, len=%d",len);
cw_foreach_msgelem(msg,len,readelem,&eparm);
if (cw_is_missing_mand_elems(mand)){

View File

@ -34,7 +34,7 @@ int cwread_wtp_event_request(struct wtpinfo * wtpinfo, uint8_t * msg, int len)
eparm.wtpinfo = wtpinfo;
eparm.mand=mand;
cw_dbg(DBG_CW_MSGELEM,"Reading wtp event request, len=%d",len);
cw_dbg(DBG_ELEM,"Reading wtp event request, len=%d",len);
cw_foreach_msgelem(msg,len,readelem,&eparm);

View File

@ -17,7 +17,7 @@
void cwsend_change_state_event_response(struct conn * conn,int seqnum, struct radioinfo * radioinfo)
{
cw_dbg(DBG_CW_MSG,"Sending change state response to %s, seq = %d",sock_addr2str(&conn->addr),seqnum);
cw_dbg(DBG_MSG,"Sending change state response to %s, seq = %d",sock_addr2str(&conn->addr),seqnum);
struct cwmsg * cwmsg = &conn->resp_msg;
cwmsg_init(cwmsg,conn->resp_buffer,CWMSG_CHANGE_STATE_EVENT_RESPONSE,seqnum,NULL);

View File

@ -8,7 +8,7 @@ void cwmsg_addelem_capwap_timers(struct cwmsg *msg,int discovery,int echo_reques
uint8_t timers[2];
timers[0]=discovery;
timers[1]=echo_request;
cwmsg_addelem(msg,CWMSGELEM_CAPWAP_TIMERS,timers,sizeof(timers));
cwmsg_addelem(msg,CW_ELEM_CAPWAP_TIMERS,timers,sizeof(timers));
}
void cwsend_conf_status_response(struct conn * conn,int seqnum, int rc, struct radioinfo * radioinfo, struct ac_info * acinfo, struct wtpinfo * wtpinfo)

View File

@ -32,7 +32,7 @@
void cwsend_discovery_response(struct conn *conn, int seqnum, struct radioinfo *radioinfo,
struct ac_info *acinfo, struct wtpinfo *wtpinfo)
{
cw_dbg(DBG_CW_MSG, "Sending discovery response to %s, seq = %d", sock_addr2str(&conn->addr),
cw_dbg(DBG_MSG, "Sending discovery response to %s, seq = %d", sock_addr2str(&conn->addr),
seqnum);
struct cwmsg *cwmsg = &conn->resp_msg;

View File

@ -34,7 +34,7 @@ int lw_addelem_vendor_specific(uint8_t *dst,uint32_t vendor_id,uint16_t elem_id,
int lw_addelem_cisco_padding(uint8_t *dst, int len)
{
lw_put_dword(dst+3,LW_VENDOR_CISCO);
lw_put_word(dst+7,LW_ELEM_CISCO_PATH_MTU);
lw_put_word(dst+7,LW_CISCO_PATH_MTU);
lw_put_word(dst+9,len);
memset(dst+11,0,len);
return lw_put_elem_hdr(dst,LW_ELEM_VENDOR_SPECIFIC,11+len);

View File

@ -33,8 +33,9 @@
static int process_elem(void *w,int type,uint8_t* msgelem,int len)
{
struct wtpinfo * wtpinfo = (struct wtpinfo*)w;
cw_dbg(DBG_CW_MSGELEM,"Process conf status req msgelem, type=%d (%s), len=%d",type,cw_msgelemtostr(type),len);
cw_dbg_dmp(DBG_CW_MSGELEM_DMP,msgelem,len,"Dump for msgelem ...");
cw_dbg(DBG_ELEM,"Process conf status req msgelem, type=%d (%s), len=%d",type,cw_msgelemtostr(type),len);
cw_dbg_dmp(DBG_ELEM_DMP,msgelem,len,"Dump for msgelem ...");
if (wtpinfo_readelem_ac_name(wtpinfo,type,msgelem,len))

View File

@ -22,11 +22,11 @@ static void wtpinfo_readsubelems_wtp_board_data(struct wtpinfo * wtpinfo,uint8_t
int sublen = val&0xffff;
i+=4;
if (sublen+i>len){
cw_dbg(DBG_CW_MSGELEM,"WTP Board data sub-element too long, type=%d,len=%d",subtype,sublen);
cw_dbg(DBG_ELEM,"WTP Board data sub-element too long, type=%d,len=%d",subtype,sublen);
return;
}
cw_dbg(DBG_CW_MSGELEM,"Reading WTP board data sub-element, type=%d, len=%d",subtype,sublen);
cw_dbg(DBG_ELEM,"Reading WTP board data sub-element, type=%d, len=%d",subtype,sublen);
switch(subtype){
case CWBOARDDATA_MODELNO:
@ -61,7 +61,7 @@ int wtpinfo_readelem_wtp_board_data(struct wtpinfo *wtpinfo, int type, uint8_t *
if (type!=CWMSGELEM_WTP_BOARD_DATA)
return 0;
if (len<4){
cw_dbg(DBG_CW_MSGELEM,"Discarding WTP_BOARD_DATA msgelem, wrong size, type=%d, len=%d\n",type,len);
cw_dbg(DBG_ELEM,"Discarding WTP_BOARD_DATA msgelem, wrong size, type=%d, len=%d\n",type,len);
return 1;
}

View File

@ -82,7 +82,7 @@ static int wtpinfo_readelem_wtp_descriptor_(struct wtpinfo * wtpinfo, int type,
return -1;
}
cw_dbg(DBG_CW_MSG,"Reading WTP descriptor subelement, type=%d,len=%d",subtype,sublen);
cw_dbg(DBG_MSG,"Reading WTP descriptor subelement, type=%d,len=%d",subtype,sublen);
switch(subtype){
case CWMSGSUBELEM_WTP_DESCRIPTOR_HARDWARE_VERSION:

View File

@ -1,3 +1,5 @@
#include <stdlib.h> //Tube
#include "capwap/capwap.h"
#include "capwap/conn.h"
#include "wtp_interface.h"
@ -10,7 +12,9 @@ int configure()
struct radioinfo *rip = &(wtpinfo->radioinfo[0]);
cw_prepare_configuration_status_request(conn,rip,wtpinfo);
conn_send_request(conn);
struct cwrmsg * cwrmsg = conn_send_request(conn);
int rc = cw_readmsg_configuration_status_response(cwrmsg->msgelems,cwrmsg->msgelems_len);
exit(0);
}

View File

@ -120,6 +120,7 @@ int wtp_main(const char *ad)
wtpconf_init();
cw_dbg_opt_detail=DBG_DETAIL_ASC_DMP;