Colored debugging...

FossilOrigin-Name: 153201cffee624726d6bcd3e428c0d69d7cc9e9cba6a84a5687de94a850550dd
This commit is contained in:
7u83@mail.ru
2015-04-11 17:00:51 +00:00
parent 4460a959b9
commit 73aba62d2b
66 changed files with 890 additions and 688 deletions

View File

@ -20,7 +20,7 @@ ifndef ARCH
endif
CFLAGS += -Os -Wall -g
CFLAGS += -O0 -Wall -g
#CFLAGS += -Os -Wall
LDFLAGS += -L../../src/capwap/$(ARCH)
@ -79,6 +79,8 @@ CFLAGS += -I../../src -I /usr/local/include
OBJS += wtp_main.o
OBJS += image_update.o
#OBJS += wtp_conf.o

View File

@ -16,6 +16,7 @@
#include "wtp_conf.h"
#include "capwap/log.h"
#include "capwap/dbg.h"
#include "capwap/bstr.h"
@ -59,8 +60,9 @@ static void read_dbg_options(struct uci_context *ctx, struct uci_section *sectio
{
int i;
for (i=0; cw_dbg_cfgstrs[i].name; i++) {
set_dbg_opt(ctx,section,cw_dbg_cfgstrs[i].level,cw_dbg_cfgstrs[i].name);
for (i=0; cw_dbg_strings[i].id!=CW_STR_STOP; i++) {
set_dbg_opt(ctx,section,cw_dbg_strings[i].id,cw_dbg_strings[i].str);
}
}
@ -96,13 +98,13 @@ int read_config(const char * filename){
if (filename == NULL){
filename = "wtp_uci.conf";
}
cw_dbg(DBG_ALL,"Reading config file %s",filename);
cw_dbg(DBG_INFO,"Reading config file %s",filename);
int rc = uci_load(ctx, filename, &pkg );
if (rc == UCI_ERR_NOTFOUND){
cw_dbg(DBG_CW_INFO,"Config file '%s' not found, running without config",filename);
cw_log(LOG_INFO,"Config file '%s' not found, running without config",filename);
return 1;
}
@ -126,7 +128,7 @@ int read_config(const char * filename){
section = get_anon_section(pkg,"wtp");
if (!section) {
cw_dbg(DBG_CW_INFO,"No 'wtp' section found, running without config");
cw_dbg(DBG_INFO,"No 'wtp' section found, running without config");
return 1;
}

View File

@ -10,6 +10,7 @@
#include "capwap/dtls.h"
#include "capwap/log.h"
#include "capwap/dbg.h"
#include "capwap/sock.h"
#include "capwap/dtls.h"
#include "capwap/aciplist.h"
@ -214,92 +215,3 @@ int join()
}
/*
int join(struct sockaddr *sa)
{
int sockfd;
int rc;
// sockfd = socket(AF_INET,SOCK_DGRAM,0);
sockfd = get_sock();
if (sockfd==-1){
cw_log(LOG_ERR,"Can't create socket: %s\n",strerror(errno));
return -1;
}
sock_set_recvtimeout(sockfd,1);
rc = connect(sockfd,(struct sockaddr*)sa,sock_addrlen((struct sockaddr*)sa));
if (rc<0){
char str[100];
sock_addrtostr(sa,str,100);
cw_log(LOG_ERR,"Can't connect to %s: %s\n",str,strerror(errno));
close(sockfd);
return -1;
}
struct conn * conn = get_conn();
conn->capwap_mode = CWMODE_CISCO;
conn->seqnum=-1;
conn->sock=sockfd;
sock_copyaddr(&conn->addr,sa);
#ifdef WITH_DTLS
cw_dbg (DBG_DTLS,"Establishing DTLS session with %s",sock_addr2str(sa));
if (conf_dtls_psk){
conn->dtls_psk=conf_dtls_psk;
conn->dtls_psk_len=strlen(conn->dtls_psk);
conn->dtls_cipher=conf_dtls_cipher;
}
if (conf_sslkeyfilename && conf_sslcertfilename){
conn->dtls_key_file = conf_sslkeyfilename;
conn->dtls_cert_file = conf_sslcertfilename;
conn->dtls_key_pass = conf_sslkeypass;
conn->dtls_cipher=conf_dtls_cipher;
}
rc = dtls_connect(conn);
if (rc!=1){
dtls_shutdown(conn);
char str[100];
sock_addrtostr(sa,str,100);
cw_log(LOG_ERR,"Can't establish DTLS connection to %s",str);
close(sockfd);
return 0;
}
#endif
cw_dbg (DBG_DTLS,"DTLS session established with %s, cipher=%s",sock_addr2str(sa),dtls_get_cipher(conn));
#ifdef WITH_CW_LOG_DEBUG
{
char str[100];
sock_addrtostr(sa,str,100);
// cw_log_debug0("DTLS connection to %s established",str);
}
#endif
join_state(conn);
printf("Joined with conn %p\n",conn);
return 1;
}
*/

View File

@ -4,6 +4,7 @@
#include <netlink/msg.h>
#include "capwap/log.h"
#include "capwap/dbg.h"
#include "capwap/avltree.h"
#include "nlt.h"

View File

@ -1,14 +1,13 @@
#include <unistd.h>
#include "capwap/log.h"
#include "capwap/dbg.h"
#include "wtp.h"
#include "wtp_conf.h"
int sulking_state()
{
cw_dbg(DBG_CW_INFO,"Entering Sulking state");
cw_dbg(DBG_CW_INFO,"Sleeping for %i seconds",conf_silent_interval);
cw_dbg(DBG_INFO,"Sulking state, sleeping for %i seconds",conf_silent_interval);
sleep(conf_silent_interval);
return 1;
}

View File

@ -8,6 +8,7 @@
extern int sulking_state();
extern int join();
extern int discovery();
extern int image_update();
struct conn * get_conn();

View File

@ -13,6 +13,8 @@
#include "capwap/capwap.h"
#include "capwap/log.h"
#include "capwap/dbg.h"
#include "capwap/cw_util.h"
#include "wtp_conf.h"
@ -111,7 +113,7 @@ int wtpconf_primary_if()
return 0;
};
cw_dbg(DBG_CW_INFO, "Primary interface: %s, mac address: %s.",
cw_dbg(DBG_INFO, "Primary interface: %s, mac address: %s.",
conf_primary_if,
sock_hwaddr2str(conf_macaddress,conf_macaddress_len)
);
@ -133,7 +135,7 @@ int wtpconf_name()
if (!conf_wtpname)
return 0;
cw_dbg(DBG_CW_INFO,"Using self assigned wtp name: %s",conf_wtpname);
cw_dbg(DBG_INFO,"Using self assigned wtp name: %s",conf_wtpname);
return 1;
}
@ -190,7 +192,7 @@ int wtpconf_ac_list()
conf_ac_list_len=len;
#ifdef WITH_CW_LOG_DEBUG
for (i=0; i<conf_ac_list_len; i++){
cw_dbg(DBG_CW_INFO,"Using AC: %s\n",conf_ac_list[i]);
cw_dbg(DBG_INFO,"Using AC: %s",conf_ac_list[i]);
}
#endif

View File

@ -13,6 +13,8 @@
#include "wtp.h"
#include "wtp_conf.h"
#include "capwap/dbg.h"
/** The one and only connection object */
@ -34,7 +36,9 @@ int main()
wtpconf_init();
cw_dbg_opt_detail = DBG_DETAIL_ASC_DMP;
cw_dbg_opt_display = DBG_DISP_ASC_DMP | DBG_DISP_COLORS;
dtls_init();
@ -74,10 +78,14 @@ int main()
cw_itemstore_set_str(conn->local,CW_ITEM_LOCATION_DATA,"Berlin");
cw_itemstore_set_str(conn->local,CW_ITEM_WTP_NAME,"WTP Tube");
cw_itemstore_set_byte(conn->local,CW_ITEM_WTP_MAC_TYPE,0);
cw_itemstore_set_byte(conn->local,CW_ITEM_WTP_FRAME_TUNNEL_MODE,0);
discovery();
join();
image_update();
}

View File

@ -12,6 +12,7 @@
#include "capwap/radioinfo.h"
#include "capwap/sock.h"
#include "capwap/capwap_80211.h"
#include "capwap/dbg.h"
int wpa_printf()
{