Merge branch 'ansi'

FossilOrigin-Name: cc01b9d81e72d713d6739d318f5e8b022685f71ffd6c084b85da542a1e6fa34b
This commit is contained in:
7u83@mail.ru 2018-03-02 07:54:15 +00:00
commit 8f12f61dbd
141 changed files with 1451 additions and 3212 deletions

5
.gitignore vendored
View File

@ -46,5 +46,10 @@ ssl/intermediate-ca/
*.tar.xz
# other stuff
.depend
.codelite/
lib/
obj/
bin/
src/Config.local.mak

View File

@ -7,6 +7,7 @@
<Project Name="mod_cisco" Path="mod_cisco.project" Active="No"/>
<Project Name="libcw" Path="libcw.project" Active="Yes"/>
<Project Name="mod_capwap80211" Path="mod_capwap80211.project" Active="No"/>
<Project Name="mod_fortinet" Path="mod_fortinet.project" Active="No"/>
<BuildMatrix>
<WorkspaceConfiguration Name="Debug" Selected="yes">
<Environment/>
@ -17,6 +18,7 @@
<Project Name="mod_cisco" ConfigName="Debug"/>
<Project Name="libcw" ConfigName="Debug"/>
<Project Name="mod_capwap80211" ConfigName="Debug"/>
<Project Name="mod_fortinet" ConfigName="Debug"/>
</WorkspaceConfiguration>
<WorkspaceConfiguration Name="Release" Selected="yes">
<Environment/>
@ -27,6 +29,7 @@
<Project Name="mod_cisco" ConfigName="Release"/>
<Project Name="libcw" ConfigName="Release"/>
<Project Name="mod_capwap80211" ConfigName="Release"/>
<Project Name="mod_fortinet" ConfigName="Release"/>
</WorkspaceConfiguration>
</BuildMatrix>
</CodeLite_Workspace>

View File

@ -305,6 +305,8 @@
<File Name="src/cw/capwap_items.c"/>
<File Name="src/cw/message_set.c"/>
<File Name="src/cw/message_set.h"/>
<File Name="src/mod/cisco/mod_cisco.h"/>
<File Name="src/cw/cw_filename.c"/>
</VirtualDirectory>
</VirtualDirectory>
<Description/>

107
mod_capwap80211.project Normal file
View File

@ -0,0 +1,107 @@
<?xml version="1.0" encoding="UTF-8"?>
<CodeLite_Project Name="mod_capwap80211" InternalType="">
<VirtualDirectory Name="src">
<VirtualDirectory Name="mod">
<VirtualDirectory Name="capwap80211">
<File Name="src/mod/capwap80211/mod_capwap80211_wtp.c"/>
<File Name="src/mod/capwap80211/mod_capwap80211_ac.c"/>
<File Name="src/mod/capwap80211/mod_capwap80211.h"/>
<File Name="src/mod/capwap80211/capwap80211_actions_wtp.c"/>
<File Name="src/mod/capwap80211/capwap80211_out_wtp_radio_cfg.c"/>
<File Name="src/mod/capwap80211/capwap80211_actions_ac.c"/>
</VirtualDirectory>
</VirtualDirectory>
</VirtualDirectory>
<Description/>
<Dependencies/>
<Settings Type="Dynamic Library">
<GlobalSettings>
<Compiler Options="" C_Options="" Assembler="">
<IncludePath Value="."/>
</Compiler>
<Linker Options="">
<LibraryPath Value="."/>
</Linker>
<ResourceCompiler Options=""/>
</GlobalSettings>
<Configuration Name="Debug" CompilerType="GCC" DebuggerType="GNU gdb debugger" Type="Dynamic Library" BuildCmpWithGlobalSettings="append" BuildLnkWithGlobalSettings="append" BuildResWithGlobalSettings="append">
<Compiler Options="-g" C_Options="-g" Assembler="" Required="yes" PreCompiledHeader="" PCHInCommandLine="no" PCHFlags="" PCHFlagsPolicy="0">
<IncludePath Value="."/>
</Compiler>
<Linker Options="" Required="yes"/>
<ResourceCompiler Options="" Required="no"/>
<General OutputFile="" IntermediateDirectory="./Debug" Command="" CommandArguments="" UseSeparateDebugArgs="no" DebugArguments="" WorkingDirectory="$(IntermediateDirectory)" PauseExecWhenProcTerminates="yes" IsGUIProgram="no" IsEnabled="yes"/>
<Environment EnvVarSetName="&lt;Use Defaults&gt;" DbgSetName="&lt;Use Defaults&gt;">
<![CDATA[]]>
</Environment>
<Debugger IsRemote="no" RemoteHostName="" RemoteHostPort="" DebuggerPath="" IsExtended="no">
<DebuggerSearchPaths/>
<PostConnectCommands/>
<StartupCommands/>
</Debugger>
<PreBuild/>
<PostBuild/>
<CustomBuild Enabled="yes">
<RebuildCommand>make clean &amp;&amp; make
</RebuildCommand>
<CleanCommand>make clean</CleanCommand>
<BuildCommand>make</BuildCommand>
<PreprocessFileCommand/>
<SingleFileCommand/>
<MakefileGenerationCommand/>
<ThirdPartyToolName>None</ThirdPartyToolName>
<WorkingDirectory>$(WorkspacePath)/src/mod/capwap80211/</WorkingDirectory>
</CustomBuild>
<AdditionalRules>
<CustomPostBuild/>
<CustomPreBuild/>
</AdditionalRules>
<Completion EnableCpp11="no" EnableCpp14="no">
<ClangCmpFlagsC/>
<ClangCmpFlags/>
<ClangPP/>
<SearchPaths/>
</Completion>
</Configuration>
<Configuration Name="Release" CompilerType="GCC" DebuggerType="GNU gdb debugger" Type="Dynamic Library" BuildCmpWithGlobalSettings="append" BuildLnkWithGlobalSettings="append" BuildResWithGlobalSettings="append">
<Compiler Options="" C_Options="" Assembler="" Required="yes" PreCompiledHeader="" PCHInCommandLine="no" PCHFlags="" PCHFlagsPolicy="0">
<IncludePath Value="."/>
</Compiler>
<Linker Options="-O2" Required="yes"/>
<ResourceCompiler Options="" Required="no"/>
<General OutputFile="" IntermediateDirectory="./Release" Command="" CommandArguments="" UseSeparateDebugArgs="no" DebugArguments="" WorkingDirectory="$(IntermediateDirectory)" PauseExecWhenProcTerminates="yes" IsGUIProgram="no" IsEnabled="yes"/>
<Environment EnvVarSetName="&lt;Use Defaults&gt;" DbgSetName="&lt;Use Defaults&gt;">
<![CDATA[]]>
</Environment>
<Debugger IsRemote="no" RemoteHostName="" RemoteHostPort="" DebuggerPath="" IsExtended="no">
<DebuggerSearchPaths/>
<PostConnectCommands/>
<StartupCommands/>
</Debugger>
<PreBuild/>
<PostBuild/>
<CustomBuild Enabled="yes">
<RebuildCommand/>
<CleanCommand>make clean</CleanCommand>
<BuildCommand>make</BuildCommand>
<PreprocessFileCommand/>
<SingleFileCommand/>
<MakefileGenerationCommand/>
<ThirdPartyToolName>None</ThirdPartyToolName>
<WorkingDirectory>$(WorkspacePath)</WorkingDirectory>
</CustomBuild>
<AdditionalRules>
<CustomPostBuild/>
<CustomPreBuild/>
</AdditionalRules>
<Completion EnableCpp11="no" EnableCpp14="no">
<ClangCmpFlagsC/>
<ClangCmpFlags/>
<ClangPP/>
<SearchPaths/>
</Completion>
</Configuration>
</Settings>
<Dependencies Name="Debug"/>
<Dependencies Name="Release"/>
</CodeLite_Project>

View File

@ -13,7 +13,6 @@
<File Name="src/mod/cisco/cisco_out_wtp_descriptor.c"/>
<File Name="src/mod/cisco/cisco_out_wtp_administrative_state.c"/>
<File Name="src/mod/cisco/cisco_out_ac_descriptor.c"/>
<File Name="src/mod/cisco/mod_cisco.h"/>
<File Name="src/mod/cisco/cw_in_check_disc_req.c"/>
<File Name="src/mod/cisco/mod_cisco_ac.c"/>
<File Name="src/mod/cisco/cisco_in_ac_descriptor.c"/>
@ -36,6 +35,7 @@
<File Name="src/mod/cisco/cisco_out_ap_timesync.c"/>
<File Name="src/mod/cisco/mod_cisco_wtp.c"/>
<File Name="src/mod/cisco/cisco80211.c"/>
<File Name="src/mod/cisco/mod_cisco.h"/>
</VirtualDirectory>
</VirtualDirectory>
</VirtualDirectory>

104
mod_fortinet.project Normal file
View File

@ -0,0 +1,104 @@
<?xml version="1.0" encoding="UTF-8"?>
<CodeLite_Project Name="mod_fortinet" InternalType="">
<VirtualDirectory Name="src">
<VirtualDirectory Name="mod">
<VirtualDirectory Name="fortinet">
<File Name="src/mod/fortinet/mod_fortinet_ac.c"/>
<File Name="src/mod/fortinet/mod_fortinet_wtp.c"/>
<File Name="src/mod/fortinet/fortinet.h"/>
<File Name="src/mod/fortinet/fortinet_actions_ac.c"/>
<File Name="src/mod/fortinet/fortinet_actions_wtp.c"/>
<File Name="src/mod/fortinet/mod_fortinet.h"/>
</VirtualDirectory>
</VirtualDirectory>
</VirtualDirectory>
<Description/>
<Dependencies/>
<Settings Type="Dynamic Library">
<GlobalSettings>
<Compiler Options="" C_Options="" Assembler="">
<IncludePath Value="."/>
</Compiler>
<Linker Options="">
<LibraryPath Value="."/>
</Linker>
<ResourceCompiler Options=""/>
</GlobalSettings>
<Configuration Name="Debug" CompilerType="GCC" DebuggerType="GNU gdb debugger" Type="Dynamic Library" BuildCmpWithGlobalSettings="append" BuildLnkWithGlobalSettings="append" BuildResWithGlobalSettings="append">
<Compiler Options="-g" C_Options="-g" Assembler="" Required="yes" PreCompiledHeader="" PCHInCommandLine="no" PCHFlags="" PCHFlagsPolicy="0">
<IncludePath Value="."/>
</Compiler>
<Linker Options="" Required="yes"/>
<ResourceCompiler Options="" Required="no"/>
<General OutputFile="" IntermediateDirectory="./Debug" Command="" CommandArguments="" UseSeparateDebugArgs="no" DebugArguments="" WorkingDirectory="$(IntermediateDirectory)" PauseExecWhenProcTerminates="yes" IsGUIProgram="no" IsEnabled="yes"/>
<Environment EnvVarSetName="&lt;Use Defaults&gt;" DbgSetName="&lt;Use Defaults&gt;">
<![CDATA[]]>
</Environment>
<Debugger IsRemote="no" RemoteHostName="" RemoteHostPort="" DebuggerPath="" IsExtended="no">
<DebuggerSearchPaths/>
<PostConnectCommands/>
<StartupCommands/>
</Debugger>
<PreBuild/>
<PostBuild/>
<CustomBuild Enabled="yes">
<RebuildCommand>make clean &amp;&amp; make</RebuildCommand>
<CleanCommand>make clean</CleanCommand>
<BuildCommand>make</BuildCommand>
<PreprocessFileCommand/>
<SingleFileCommand/>
<MakefileGenerationCommand/>
<ThirdPartyToolName>None</ThirdPartyToolName>
<WorkingDirectory>$(WorkspacePath)/src/mod/fortinet</WorkingDirectory>
</CustomBuild>
<AdditionalRules>
<CustomPostBuild/>
<CustomPreBuild/>
</AdditionalRules>
<Completion EnableCpp11="no" EnableCpp14="no">
<ClangCmpFlagsC/>
<ClangCmpFlags/>
<ClangPP/>
<SearchPaths/>
</Completion>
</Configuration>
<Configuration Name="Release" CompilerType="GCC" DebuggerType="GNU gdb debugger" Type="Dynamic Library" BuildCmpWithGlobalSettings="append" BuildLnkWithGlobalSettings="append" BuildResWithGlobalSettings="append">
<Compiler Options="" C_Options="" Assembler="" Required="yes" PreCompiledHeader="" PCHInCommandLine="no" PCHFlags="" PCHFlagsPolicy="0">
<IncludePath Value="."/>
</Compiler>
<Linker Options="-O2" Required="yes"/>
<ResourceCompiler Options="" Required="no"/>
<General OutputFile="" IntermediateDirectory="./Release" Command="" CommandArguments="" UseSeparateDebugArgs="no" DebugArguments="" WorkingDirectory="$(IntermediateDirectory)" PauseExecWhenProcTerminates="yes" IsGUIProgram="no" IsEnabled="yes"/>
<Environment EnvVarSetName="&lt;Use Defaults&gt;" DbgSetName="&lt;Use Defaults&gt;">
<![CDATA[]]>
</Environment>
<Debugger IsRemote="no" RemoteHostName="" RemoteHostPort="" DebuggerPath="" IsExtended="no">
<DebuggerSearchPaths/>
<PostConnectCommands/>
<StartupCommands/>
</Debugger>
<PreBuild/>
<PostBuild/>
<CustomBuild Enabled="yes">
<RebuildCommand/>
<CleanCommand>make clean</CleanCommand>
<BuildCommand>make</BuildCommand>
<PreprocessFileCommand/>
<SingleFileCommand/>
<MakefileGenerationCommand/>
<ThirdPartyToolName>None</ThirdPartyToolName>
<WorkingDirectory>$(WorkspacePath)</WorkingDirectory>
</CustomBuild>
<AdditionalRules>
<CustomPostBuild/>
<CustomPreBuild/>
</AdditionalRules>
<Completion EnableCpp11="no" EnableCpp14="no">
<ClangCmpFlagsC/>
<ClangCmpFlags/>
<ClangPP/>
<SearchPaths/>
</Completion>
</Configuration>
</Settings>
</CodeLite_Project>

View File

@ -1,8 +1,7 @@
include ../Config.mak
#Define SSL Library: OPENSSL or GNUTLS
#SSL_LIBRARY=OPENSSL
SSL_LIBRARY=GNUTLS
# Define SSL Library: OPENSSL or GNUTLS
# SSL_LIBRARY=OPENSSL
SSL_LIBRARY=OPENSSL

View File

@ -1,25 +1,37 @@
#
# OpenSSL definitions
#
#OPENSSL_VERSION=openssl-1.0.1l # doesn't work
#OPENSSL_VERSION=openssl-1.0.2 # doesn't work
OPENSSL_VERSION=openssl-1.0.1i
# OPENSSL_VERSION=openssl-1.0.1i
USE_CONTRIB_OPENSSL=0
# GnuTLS definitions
GNUTLS_VERSION=3.3.9
# GNUTLS_VERSION=3.3.9
USE_CONTRIB_GNUTLS=0
# Compiler to use
CC=clang
#CC=gcc
#CC=mips-openwrt-linux-uclibc-gcc
#LD=mips-openwrt-linux-uclibc-ld
#AR=mips-openwrt-linux-uclibc-ar
# CC=clang
# CC=mips-openwrt-linux-uclibc-gcc
# LD=mips-openwrt-linux-uclibc-ld
# AR=mips-openwrt-linux-uclibc-ar
# CC=clang
COMPDEFS=-DWITH_CW_LOG
COMPDEFS+=-DWITH_CW_LOG_DEBUG
# LIBCW settings
# WITH_GNUTLS
# compile in support for GnuTLS
#
WITH_GNUTLS=1
# Compile in openssl support
WITH_OPENSSL=1
#
#
LIBDIR=lib

View File

@ -9,21 +9,42 @@ endif
ifeq ($(USE_CONTRIB_GNUTLS),1)
GNUTLS_CFLAGS=-I../contrib/gnutls-${GNUTLS_VERSION}/lib/includes
#GNUTLS_LIBS=-lnettle -lgmp ../contrib/gnutls-${GNUTLS_VERSION}/lib/.libs/libgnutls.a
GNUTLS_LIBS=-lgmp -lgnutls -lnettle
GNUTLS_LDFLAGS=-L../contrib/gnutls-${GNUTLS_VERSION}/lib/.libs/
else
GNUTLS_CFLAGS=
GNUTLS_LIBS=-lgnutls -lnettle -lgmp
GNUTLS_LDFLAGS=
#-lgnutls -lnettle -lgmp
endif
ifndef ARCH
ARCH = $(shell $(CC) -dumpmachine)
ARCH = $(shell uname -m)
endif
ifeq ($(CC),clang)
LDFLAGS += -g -L/usr/local/lib
CFLAGS += -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -fPIC -g -O0 -D_REENTRANT -I /usr/local/include -I../
LD = gcc
endif
ifeq ($(CC),gcc)
LDFLAGS += -g -L/usr/local/lib
CFLAGS += -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -fPIC -g -O0 -D_REENTRANT -I /usr/local/include -I../
LD = gcc
endif
ifeq ($(CC),tcc)
LDFLAGS += -g -L/usr/local/lib
CFLAGS += -Wall -Wunusupported -Wimplicit-function-declaration -I /usr/local/include -I../
LD = tcc
endif
CFLAGS += -DWITH_IPV6 -DWITH_RMAC_SUPPORT

View File

@ -1,30 +1,28 @@
include ../Config.mak
include ../ACConfig.mak
-include ../Config.local.mak
-include ../ACConfig.local.mak
include ../Macros.mak
ifndef CC
CC=gcc
endif
#SYSARCH := $(shell uname -m)
ifndef ARCH
ARCH = $(shell $(CC) -dumpmachine)
endif
LDFLAGS+=-g -D_REENTRANT -L/usr/local/lib -L../lib/$(ARCH)
CFLAGS += -Wall -g -O0 -D_REENTRANT -DIPV6 -I/usr/local/include -I../ -DSYS_ARCH=\"${ARCH}\"
LIBARCHDIR=../../lib/$(ARCH)
LDFLAGS+=-g -L/usr/local/lib -L$(LIBARCHDIR)
CFLAGS += -W -g -O0 -D_REENTRANT -DIPV6 -I/usr/local/include -I../ -DSYS_ARCH=\"${ARCH}\"
LIBS+=-lcapwap
LIBS+=-lcapwap80211
LIBS+=-lcipwap
LIBS+=-lcisco
LIBS+=-lfortinet
LIBS+=-lzyxel
#LIBS+=-lcapwap
#LIBS+=-lcapwap80211
#LIBS+=-lcipwap
#LIBS+=-lcisco
#LIBS+=-lfortinet
#LIBS+=-lzyxel
LIBS+=-lcw
LIBS+=-lrt
LIBS+=-lpthread
LIBS+=-lconfuse
LIBS+=-lsqlite3
LIBS+=-ldl
ifeq ($(SSL_LIBRARY),GNUTLS)
@ -51,7 +49,7 @@ CFLAGS += -DWITH_IPV6
RM = /bin/rm -f
AC_MODULES = mod_cipwap.o
#AC_MODULES = mod_cipwap.o
# list of generated object files for AC.
@ -77,12 +75,13 @@ AC_NAME = actube
all: $(AC_NAME)
%.o:%.c
@echo " CC "$<
@echo " $(CC) "$<
@$(CC) -c $(CFLAGS) $< -o $@
$(AC_NAME): $(AC_OBJS)
$(CC) $(AC_OBJS) ../mod/modload_ac.o -o $(AC_NAME) $(LDFLAGS) $(LIBS)
# $(CC) $(AC_OBJS) ../mod/modload_ac.o -o $(AC_NAME) $(LDFLAGS) $(LIBS)
$(LD) $(AC_OBJS) -o $(AC_NAME) $(LDFLAGS) $(LIBS)
clean:
@ -92,6 +91,6 @@ clean_deps:
$(AC_DEPS)
deps: $(AC_SRC)
$(CC) -MD -E $(AC_SRCS) $(CFLAGS) >/dev/null
$(LD) -MD -E $(AC_SRCS) $(CFLAGS) >/dev/null
-include $(AC_DEPS)

View File

@ -87,22 +87,17 @@ static int parse_args(int argc, char *argv[])
#include "cw/mod.h"
extern struct mod_ac * cw_get_mod_ac(const char *name);
extern struct cw_Mod * cw_get_mod_ac(const char *name);
#include "cw/mlist.h"
extern void test_sets();
#include "cw/file.h"
int main(int argc, char *argv[])
{
int rc = 0;
/* parse arguments */
@ -125,6 +120,14 @@ int main(int argc, char *argv[])
developers is turned on ;) */
DBGX("Attention! %s", "DBG X is ON!");
// cw_mod_set_mod_path("../../lib/actube");
// cw_mod_load("capwap");
//test_sets();
//exit(0);
/* Initialize the database */
if (!db_init())

View File

@ -38,7 +38,7 @@ uint8_t conf_macaddress_len = 0;
long conf_strict_capwap = 1;
long conf_strict_headers = 0;
char *conf_capwap_mode_str = NULL;
//char *conf_capwap_mode_str = NULL;
int conf_capwap_mode = CW_MODE_CAPWAP;
@ -539,8 +539,8 @@ static int conf_read_dbg_level(cfg_t * cfg)
struct mod_ac ** conf_mods; //[10];
struct cw_Mod ** conf_mods; //[10];
char *conf_mods_dir = NULL;
static int init_mods()
@ -570,21 +570,22 @@ static int conf_read_mods(cfg_t *cfg){
int n, i;
n = cfg_size(cfg,CFG_ENTRY_MODS);
conf_mods = malloc(sizeof(struct mod_ac *)*(n+1));
conf_mods = malloc(sizeof(struct cw_Mod *)*(n+1));
cw_dbg(DBG_INFO,"Mods directory: %s",conf_mods_dir);
cw_mod_set_mod_path(conf_mods_dir);
for (i=0; i < n; i++){
char *modname = cfg_getnstr(cfg, CFG_ENTRY_MODS, i);
conf_mods[i] = modload_ac(modname);
if (!conf_mods[i]){
cw_log(LOG_ERR,"Can't load mod: %s",modname);
struct cw_Mod * mod = cw_mod_load(modname);
if (!mod)
return 0;
}
cw_mod_add_to_list(mod);
}
conf_mods[i]=NULL;
return 1;
}
/*
void conf_init_capwap_mode()
{
if (conf_capwap_mode_str == NULL)
@ -600,7 +601,7 @@ void conf_init_capwap_mode()
}
*/
int conf_parse_listen_addr(const char *addrstr, char *saddr, char *port, int *proto)
@ -700,6 +701,8 @@ int read_config(const char *filename)
cfg_opt_t opts[] = {
CFG_STR_LIST("mods", "{}", CFGF_NONE),
CFG_SIMPLE_STR("mods_dir", &conf_mods_dir),
CFG_STR_LIST("dbg", "{}", CFGF_NONE),
CFG_STR_LIST("listen", "{}", CFGF_NONE),
CFG_STR_LIST("mcast_groups", "{}", CFGF_NONE),
@ -710,7 +713,7 @@ int read_config(const char *filename)
CFG_SIMPLE_BOOL("strict_capwap", &conf_strict_capwap),
CFG_SIMPLE_BOOL("strict_headers", &conf_strict_headers),
CFG_SIMPLE_BOOL("use_loopback", &conf_use_loopback),
CFG_SIMPLE_STR("capwap_mode", &conf_capwap_mode_str),
// CFG_SIMPLE_STR("capwap_mode", &conf_capwap_mode_str),
#ifdef WITH_LWAPP
@ -815,16 +818,18 @@ int read_config(const char *filename)
if (!conf_image_dir)
conf_image_dir = CONF_DEFAULT_IMAGE_DIR;
init_mods();
//printf("INIT MODS\n");
// init_mods();
//printf("done init mods");
conf_init_capwap_mode();
// conf_init_capwap_mode();
init_listen_addrs();
init_mcast_groups();
init_bcast_addrs();
//printf("Yea all mods inited\n");
return 1;
}

View File

@ -33,7 +33,7 @@
#include "cw/vendors.h"
extern struct mod_ac ** conf_mods;
extern struct cw_Mod ** conf_mods;
#ifndef CONF_DEFAULT_ACNAME
#define CONF_DEFAULT_ACNAME "AC"

View File

@ -305,10 +305,10 @@ errX:
}
// TODO XXXX
mavl_conststr_t db_get_update_tasks(struct conn * conn,const char * wtpid)
{
/*
sqlite3_reset(get_tasks_stmt);
sqlite3_clear_bindings(get_tasks_stmt);
@ -385,14 +385,14 @@ errX:
return NULL;
*/
}
mavl_conststr_t db_get_radio_tasks(struct conn * conn,const char * wtpid)
{
/*
//cw_dbg(DBG_X,"Get Radio Tasks for %s",wtpid);
sqlite3_reset(stmt_get_radio_tasks);
@ -479,7 +479,7 @@ errX:
return NULL;
*/
}

View File

@ -91,7 +91,7 @@ static void wtpman_run_discovery(void *arg)
extern cw_actionlist_in_t the_tree;
wtpman->conn->capwap_state = CAPWAP_STATE_DISCOVERY;
wtpman->conn->actions = &capwap_actions;
// wtpman->conn->actions = &capwap_actions;
wtpman->conn->outgoing = mbag_create();
wtpman->conn->incomming = mbag_create();
@ -276,8 +276,12 @@ static void wtpman_image_data(struct wtpman *wtpman)
}
// TODO XXXX
void props_to_sql(struct conn *conn, mbag_t mb, const char *mid)
{
/*
// XXX for the now we use just the IP adress as ID
char *wtp_id = sock_addr2str(&conn->addr);
@ -327,6 +331,7 @@ void props_to_sql(struct conn *conn, mbag_t mb, const char *mid)
}
}
*/
}
@ -334,6 +339,8 @@ void props_to_sql(struct conn *conn, mbag_t mb, const char *mid)
void config_to_sql(struct conn *conn)
{
/*
// XXX for the moment we use just the IP adress as ID
char *wtp_id = sock_addr2str(&conn->addr);
@ -370,10 +377,13 @@ void config_to_sql(struct conn *conn)
}
}
*/
}
void radio_to_sql(struct conn *conn, char *wtp_id, int rid, mbag_t radio)
{
/*
MAVLITER_DEFINE(it, radio);
mavliter_foreach(&it) {
mbag_item_t *i = mavliter_get(&it);
@ -408,7 +418,7 @@ void radio_to_sql(struct conn *conn, char *wtp_id, int rid, mbag_t radio)
// int rid = ((struct mbag_item*)mavliter_get(&it))->iid;
*/
}

View File

@ -1,207 +1,16 @@
include ../CapwapConfig.mak
include ../CWConfig.mak
-include ../Config.local.mak
include ../Macros.mak
ifndef CC
CC=gcc
endif
ifndef AR
AR = ar
endif
LIBDIR := ../../lib
LIBARCHDIR := $(LIBDIR)/$(ARCH)
OBJDIR := ../../obj/cw/$(ARCH)
#ifndef ARCH
# ARCH = $(shell $(CC) -dumpmachine)
#endif
SNAME := $(LIBARCHDIR)/libcw.a
DNAME := $(LIBARCHDIR)/libcw.so
#OPENSSLINC=$(OPENSSLINC)
#../contrib/openssl-1.0.1i/include
NAME=libcw.a
LIBDIR=../lib/$(ARCH)
SOCKOBJS=\
sock_create.o\
sock_copyaddr.o\
sock_strtoaddr.o\
sock_cmpaddr.o\
sock_addrlen.o \
sock_mwait.o\
sock_addrtostr.o \
sock_setport.o \
sock_getport.o \
sock_getifaddr.o \
sock_getifhwaddr.o \
sock_hwaddrtostr.o \
sock_set_recvtimeout.o \
sock_getbroadcastaddr.o \
sock_addrinit.o \
sock_set_dontfrag.o \
sock_get_primary_if.o \
sock_receive.o \
sock_getifinfo.o \
LOGOBJS=log.o \
log_syslog.o \
log_file.o \
dbg_strings.o\
dbg.o \
WTPINFOOBJS =\
#wtpinfo_print.o
#wtpinfo_set_location.o \
wtpinfo_lwreadelem_wtp_descriptor.o \
UTILOBJS= \
cw_setstr.o \
cw_is_printable.o \
cw_rand.o \
stravltree.o \
intavltree.o \
cw_util.o \
send.o \
cw_read_wtp_descriptor.o \
cw_read_wtp_descriptor_7.o \
cw_read_wtp_descriptor_versions.o \
cw_read_descriptor_subelems.o \
cw_out_80211_supported_rates.o
MAVLOBJS= \
mavl_del.o \
mavl_add.o \
mavl_create.o\
mavl_get.o\
mavl_del_all.o\
mavliter_seek.o \
mavliter_next.o \
mavl_get_node.o \
mavl_foreach.o \
mavl_foreach_lr.o \
mavl_merge.o \
mavl_create_conststr.o \
mlist.o \
cw_load_file.o \
cw_save_file.o \
message_set.o
FORMATOBJS = \
format_is_utf8.o \
format_dot11_fc.o \
# lw_readelem_vendor_specific.o \
# LWAPP objs
LWAPPOBJS = \
lw_checksum.o \
lw_put_ac_descriptor.o \
lw_put_cisco_path_mtu.o \
lw_elem_id_to_str.o \
lw_msg_id_to_str.o \
lw_cisco_id_to_str.o \
lw_put_sockaddr.o \
lw_put_image_data.o \
lw_in_vendor_specific.o
#lw_put_80211_wtp_wlan_radio_configuration.o \
# lw_readelem_wtp_name.o \
lw_readelem_wtp_board_data.o \
cw_log_debug.o \
lw_vendor_id_to_str.o \
# LWAPP cisco vendor specific objs
#//#LWAPPCISCOOBJS = \
# lw_addelem.o
# cw_tohex.o\
#capwap_parse_ctrlhdr.o \
# hdr_print.o \
CAPWAPOBJS= \
cw_iplist.o \
aciplist.o \
lwmsg_init.o \
cw_cisco_id_to_str.o\
cw_strlist_get_str.o \
cw_strlist_get_id.o \
capwap_strings_msg.o \
capwap_strings_elem80211.o\
acpriolist.o\
capwap_strings_state.o \
capwap_strings_vendor.o \
capwap_strings_elem.o \
cw_in_vendor_specific_payload.o \
cw_in_mtu_discovery_padding.o\
cw_in_wtp_board_data.o \
cw_in_check_disc_req.o \
cw_in_check_chng_state_evnt_req.o\
cw_in_check_disc_resp.o\
cw_in_check_cfg_update_req.o\
cw_in_check_join_req.o \
cw_in_check_cipwap_join_req.o \
cw_in_check_join_resp.o \
cw_in_check_img_data_req_ac.o \
cw_in_check_img_data_req_wtp.o \
cw_in_check_img_data_resp.o \
cw_in_check_generic_resp.o \
cw_in_check_generic_req.o \
cw_in_80211_mac_operation.o \
cw_read_80211_mac_operation.o \
cw_out_generic.o \
cw_out_wtp_descriptor.o \
cw_out_wtp_reboot_statistics.o \
cw_in_wtp_reboot_statistics.o\
cw_in_cisco_image_identifier.o\
cw_put_radio_operational_states.o \
cw_put_ac_status.o \
cw_in_ac_descriptor.o\
cw_read_ac_descriptor.o\
cw_out_capwap_local_ip_address.o\
cw_out_wtp_ip_address.o\
cw_out_capwap_control_ip_addr_list.o \
cw_in_capwap_control_ip_address.o\
cw_in_capwap_local_ipv4_address.o \
cw_in_capwap_local_ipv6_address.o \
cw_in_radio_administrative_state.o \
cw_in_radio_administrative_state_wtp.o \
cw_radio_set_admin_state.o \
cw_put_elem_radio_administrative_state.o\
cw_put_elem_radio_operational_state.o \
cw_out_radio_administrative_states.o\
strheap.o \
cw_check_missing_mand.o \
md5sum.o \
format.o \
# action_sources.o \
# cw_in_cisco_add_wlan.o
# cw_in_radio_operational_state.o\
DOT11OBJS = \
dot11.o \
dot11_beacon.o
# cw_out_ac_descriptor.o \
CAPWAP80211OBJS=\
capwap80211_items.o\
capwap80211_type_rateset.o \
# cw_out_radio_operational_states.o\
# cw_out_radio_operational_states_7.o\
#
# SSL objects
#
LIBS=
ifeq ($(WITH_OPENSSL),1)
CFLAGS+=$(OPENSSL_CFLAGS)
@ -211,6 +20,7 @@ DTLSOBJS += dtls_openssl.o \
dtls_openssl_connect.o \
dtls_openssl_get_cipher.o \
dtls_openssl_bio.o
LIBS+=-lssl
endif
ifeq ($(WITH_GNUTLS),1)
@ -222,145 +32,38 @@ DTLSOBJS+= dtls_gnutls.o \
dtls_gnutls_bio.o \
dtls_gnutls_get_cipher.o \
dtls_gnutls_get_peers_cert.o
LIBS+=-lgnutls
endif
DTLSOBJS+=dtls_bio.o
CONNOBJS= conn_create.o \
conn_process_packet.o \
conn_q_add_packet.o \
conn_q_get_packet.o \
conn_q_recv_packet.o \
conn_recv_packet.o \
conn_destroy.o \
connlist.o \
conn_create_noq.o \
conn_init.o \
conn_send_packet.o \
conn_send_data_packet.o \
netconn.o \
cw_init_data_keep_alive_msg.o \
conn_clear_upd.o
SRC=$(wildcard *.c)
OBJS=$(patsubst %.c,%.o,$(SRC))
OBJS:=$(patsubst %.o,$(OBJDIR)/%.o,$(OBJS))
# conn_send_msg.o
#conn_get_message.o \
# conn_send_response.o \
# cw_prepare_configuration_status_request.o \
# cw_prepare_change_state_event_request.o \
conn_prepare_configuration_update_request.o \
all: $(SNAME) $(DNAME)
#bstr_to_str.o \
BSTROBJS= bstr_create.o \
bstr_create_from_cfgstr.o \
bstr16_create_from_cfgstr.o \
bstr_replace.o \
bstr16cfgstr.o \
bstr16_create_from_str.o \
bstr_create_from_str.o \
bstrv_create_from_str.o
FRAGOBJS=fragman.o
CWACTION=action.o \
cw_in_generic.o \
cw_in_generic2.o \
cw_out_wtp_board_data.o \
cw_out_ac_name_with_priority.o \
cw_in_ac_name_with_priority.o \
cw_out_image_data.o \
cipwap_strings_elem.o \
capwap_strings_result.o\
capwap_strings_board.o \
cw_put_msg.o \
cw_put_mbag_item.o \
cw_put_local_ip_address.o \
capwap_action_helpers.o \
cw_put_image_data.o \
cisco.o \
radio.o \
cw_in_radio_generic.o\
cw_out_radio_generic.o \
cw_out_radio_info.o \
capwap_items.o \
item.o \
mod.o
# cw_process_msg.o \
# item_strings.o \
#
MBAGOBJS = \
mbag.o\
mbag_type_word.o\
mbag_type_byte.o\
mbag_type_vendorstr.o\
mbag_type_sockaddr.o\
mbag_type_dword.o\
mbag_type_bstr16.o\
mbag_type_mbag.o\
mbag_set_from_buf.o\
mbag_type_str.o \
mbag_type_ptr.o \
mbag_type_data.o \
mbag_get_upd.o
OBJS=$(CONNOBJS) $(FRAGOBJS) $(SOCKOBJS) $(CAPWAPOBJS) $(WTPINFOOBJS) \
$(LOGOBJS) $(UTILOBJS) $(DTLSOBJS) $(BSTROBJS) \
$(LWAPPOBJS) \
$(LWAPPCISCOOBJS) \
$(CWACTION) \
$(MAVLOBJS) \
$(FORMATOBJS) \
$(DOT11OBJS) \
$(MBAGOBJS) \
$(CAPWAP80211OBJS)
#include $(OBJS:.o=.d)
O:=$(OBJS);
OBJS:=$(patsubst %.o,$(ARCH)/%.o,$(OBJS))
CFLAGS = -Wall -g -O0 -D_REENTRANT -DWITH_IPV6 -DWITH_RMAC_SUPPORT -I /usr/local/include -I../
#CFLAGS = -Wall -Os -D_REENTRANT -DWITH_IPV6 -DWITH_RMAC_SUPPORT -I/usr/local/include
CFLAGS += $(GNUTLS_CFLAGS) \
-DWITH_CW_LOG \
-DWITH_CW_LOG_DEBUG \
-DWITH_DTLS \
$(XINCLUDE)\
-I $(OPENSSLINC)\
-Werror
-DWITH_DTLS
#SRCS = $(OBJS:.o=.c)
#MODOBJS=$(wildcard ./mod/cipwap/$(ARCH)/*.o)
#MODOBJS+=$(wildcard ./mod/capwap/$(ARCH)/*.o)
$(ARCH)/%.o:%.c
@mkdir -p $(ARCH)
@echo " CC "$<
$(OBJDIR)/%.o:%.c
@mkdir -p $(OBJDIR)
@echo " $(CC) "$<
@$(CC) -c $(CFLAGS) $< -o $@
# @$(CC) -MM $(CFLAGS) $< > $*.d
$(LIBDIR)/$(NAME) : $(OBJS) $(MODOBJS)
@mkdir -p $(LIBDIR)
@echo " AR $(LIBDIR)/$(NAME)"
@$(AR) rcs $(LIBDIR)/$(NAME) $(OBJS) $(MODOBJS)
$(SNAME) : $(OBJS)
@mkdir -p $(LIBARCHDIR)
@echo " $(AR) $(SNAME)"
@$(AR) rcs $(SNAME) $(OBJS)
$(DNAME) : $(OBJS)
@mkdir -p $(LIBARCHDIR)
@echo " $(LD) $(DNAME)"
@$(LD) $(LDFLAGS) -shared -o $(DNAME) $(OBJS) $(LIBS)
SRCS = $(OBJS:.o=.c)
@ -370,19 +73,11 @@ DEPS := $(OBJS:.o=.d)
.PHONY: deps clean clean_libs libs
# top-level rule, to compile everything.
all: $(ARCH)/$(NAME)
clean:
$(RM) $(ARCH)/*
$(RM) $(LIBDIR)/$(NAME)
# $(RM) $(OBJS)
# $(RM) $(DEPS)
# $(RM) $(ARCH)/$(NAME)
$(RM) $(OBJDIR)/*
$(RM) $(DNAME)
$(RM) $(SNAME)
clean_deps:

View File

@ -1,78 +0,0 @@
/**
* @file
* @breif defines acinfo_print function
*/
#include <string.h>
#include <stdio.h>
#include "capwap.h"
#include "sock.h"
#include "acinfo.h"
#include "cw_util.h"
/**
* Formats an acinfo object.
*
*/
int acinfo_print(char *str,const struct ac_info *acinfo)
{
char *s = str;
s+=sprintf(s,"\tAC name: %s\n",acinfo->ac_name);
s+=sprintf(s,"\tHardware version: ");
s+=cw_format_version(s,acinfo->hardware_version,0,"-");
s+=sprintf(s,"\n");
s+=sprintf(s,"\tSoftware version: ");
s+=cw_format_version(s,acinfo->software_version,0,"-");
s+=sprintf(s,"\n");
s+=sprintf(s,"\tStations: %i\n",acinfo->stations);
s+=sprintf(s,"\tSation limit: %i\n",acinfo->limit);
s+=sprintf(s,"\tActive WTPs: %i\n",acinfo->active_wtps);
s+=sprintf(s,"\tMax WTPs: %i\n",acinfo->max_wtps);
char help[64];
sock_addrtostr((struct sockaddr*)&acinfo->local_ip,help,64);
s+=sprintf(s,"\tLocal IP: %s\n",help);
s+=sprintf(s,"\tECN support: %s\n",acinfo->ecn_support==0 ? "limited" : "full");
s+=sprintf(s,"\tRMAC support: %s\n",acinfo->rmac==1 ? "supported" : "not supported");
help[0]=0;
if (acinfo->security & AC_SECURITY_S)
strcpy(help,"psk");
if (acinfo->security & AC_SECURITY_X){
if (strlen(help))
strcat(help,"/");
strcat(help,"X.509");
}
if (!strlen(help))
strcpy(help,"None");
s+=sprintf(s,"\tSecurity: %s\n",help);
help[0]=0;
/* if (acinfo->dtls_policy & AC_DTLS_POLICY_D){
strcpy(help,"dtls");
}
if (acinfo->dtls_policy & AC_DTLS_POLICY_C){
if(strlen(help))
strcat(help,"/");
strcat(help,"clear");
}
*/ if (!strlen(help))
strcpy(help,"Not set");
s+=sprintf(s,"\tDTLS policy: %s\n",help);
return s-str;
}

View File

@ -1,69 +0,0 @@
/*
This file is part of libcapwap.
libcapwap is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
libcapwap is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Foobar. If not, see <http://www.gnu.org/licenses/>.
*/
/**
*@file
*@brief Implementation of avliter_next
*/
#include "avltree.h"
/**
* Get the next element within an AVL Tree.
* @param i pointer to AVL Iterator
* @return the element or NULL if there is no next elemeent.
*/
void * avliter_next(avliter_t *i)
{
while ( i->stack_ptr) {
i->stack_ptr--;
i->cur=i->stack[i->stack_ptr];
if (!i->cur)
continue;
if ((i->stack_ptr)&1) {
return i->cur->data;
}
break;
}
if (!i->cur){
return NULL;
}
while(i->cur->left) {
/* push right branch */
i->stack[i->stack_ptr++]=i->cur->right;
/* push node */
i->stack[i->stack_ptr++]=i->cur;
i->cur=i->cur->left;
}
i->stack[i->stack_ptr++]=i->cur->right;
return i->cur->data;
}

View File

@ -1,66 +0,0 @@
/*
This file is part of libcapwap.
libcapwap is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
libcapwap is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Foobar. If not, see <http://www.gnu.org/licenses/>.
*/
/**
*@file
*@brief Implementation of avliter_seek
*/
#include "avltree.h"
/**
* Set an AVL Iterator to a specific position.
* @param i AVL Iterator
* @param d element to search for
* @return element found or NULL if not found
*/
void * avliter_seek(avliter_t *i,void *d)
{
if (!i->root)
return NULL;
i->cur=i->root;
i->stack_ptr=0;
int rc;
while(i->cur) {
rc = i->cmp(d,i->cur->data);
if (rc==0){
i->stack[i->stack_ptr++]=i->cur->right;
i->stack[i->stack_ptr++]=i->cur;
return avliter_next(i);
}
if (rc<0) {
i->stack[i->stack_ptr++]=i->cur->right;
i->stack[i->stack_ptr++]=i->cur;
i->cur=i->cur->left;
}
if (rc>0) {
i->cur=i->cur->right;
}
}
return NULL;
}

View File

@ -1,39 +0,0 @@
/*
This file is part of libcapwap.
libcapwap is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
libcapwap is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Foobar. If not, see <http://www.gnu.org/licenses/>.
*/
#include "avltree.h"
int avltree_foreach_rl(struct avlnode *n, int (*callback)(void *,void *),void *cbpriv)
{
if (!n)
return 1;
if (!avltree_foreach_rl(n->right,callback,cbpriv))
return 0;
if (!callback(cbpriv,n->data))
return 0;
return avltree_foreach_rl(n->left,callback,cbpriv);
}
void avltree_foreach(struct avltree *t, int (*callback)(void *,void *),void * cbpriv,int dir)
{
if (dir)
avltree_foreach_lr(t->root,callback,cbpriv);
else
avltree_foreach_rl(t->root,callback,cbpriv);
}

View File

@ -1,31 +0,0 @@
#include "avltree.h"
// XXX Function is buggy
int avltree_foreach_from_lr(struct avltree *t, struct avlnode *n, void *data,int (*callback)(void *,void *),void *cbpriv)
{
if (!n)
return 1;
int rc=t->cmp(data,n->data);
if (rc<0){
if(!avltree_foreach_from_lr(t,n->left,data,callback,cbpriv))
return 0;
if (!callback(cbpriv,n->data))
return 0;
return avltree_foreach_lr(n->right,callback,cbpriv);
}
if (rc>0) {
avltree_foreach_from_lr(t,n->right,data,callback,cbpriv);
return 0;
}
if (!callback(cbpriv,n->data))
return 0;
return avltree_foreach_lr(n->right,callback,cbpriv);
}

View File

@ -1,17 +0,0 @@
#include "avltree.h"
int avltree_foreach_lr(struct avlnode *n, int (*callback)(void *,void *),void *cbpriv)
{
if (!n)
return 1;
if (!avltree_foreach_lr(n->left,callback,cbpriv))
return 0;
if (!callback(cbpriv,n->data))
return 0;
return avltree_foreach_lr(n->right,callback,cbpriv);
}

View File

@ -1,33 +0,0 @@
int avltree_foreach_lr_node(struct avltree *t, struct avlnode *n, void *data,int (*callback)(void *,void *),void *cbpriv)
{
if (!n)
return 1;
int rc=t->cmp(data,n->data);
if (rc<0){
avltree_foreach_lr_node(t,n->left,data,callback,cbpriv);
callback(cbpriv,n->data);
avltree_foreach_lr(n->right,
return 0;
}
<