rename mod_wtp and mod_ac to cw_Mod
FossilOrigin-Name: 4a8f9578a5fc384f0dad291114ac9470ea8561817e87760946277ec9ddd0db79
This commit is contained in:
parent
f0519f5057
commit
f95505c0bd
@ -7,6 +7,7 @@
|
|||||||
<Project Name="mod_cisco" Path="mod_cisco.project" Active="No"/>
|
<Project Name="mod_cisco" Path="mod_cisco.project" Active="No"/>
|
||||||
<Project Name="libcw" Path="libcw.project" Active="Yes"/>
|
<Project Name="libcw" Path="libcw.project" Active="Yes"/>
|
||||||
<Project Name="mod_capwap80211" Path="mod_capwap80211.project" Active="No"/>
|
<Project Name="mod_capwap80211" Path="mod_capwap80211.project" Active="No"/>
|
||||||
|
<Project Name="mod_fortinet" Path="mod_fortinet.project" Active="No"/>
|
||||||
<BuildMatrix>
|
<BuildMatrix>
|
||||||
<WorkspaceConfiguration Name="Debug" Selected="yes">
|
<WorkspaceConfiguration Name="Debug" Selected="yes">
|
||||||
<Environment/>
|
<Environment/>
|
||||||
@ -17,6 +18,7 @@
|
|||||||
<Project Name="mod_cisco" ConfigName="Debug"/>
|
<Project Name="mod_cisco" ConfigName="Debug"/>
|
||||||
<Project Name="libcw" ConfigName="Debug"/>
|
<Project Name="libcw" ConfigName="Debug"/>
|
||||||
<Project Name="mod_capwap80211" ConfigName="Debug"/>
|
<Project Name="mod_capwap80211" ConfigName="Debug"/>
|
||||||
|
<Project Name="mod_fortinet" ConfigName="Debug"/>
|
||||||
</WorkspaceConfiguration>
|
</WorkspaceConfiguration>
|
||||||
<WorkspaceConfiguration Name="Release" Selected="yes">
|
<WorkspaceConfiguration Name="Release" Selected="yes">
|
||||||
<Environment/>
|
<Environment/>
|
||||||
@ -27,6 +29,7 @@
|
|||||||
<Project Name="mod_cisco" ConfigName="Release"/>
|
<Project Name="mod_cisco" ConfigName="Release"/>
|
||||||
<Project Name="libcw" ConfigName="Release"/>
|
<Project Name="libcw" ConfigName="Release"/>
|
||||||
<Project Name="mod_capwap80211" ConfigName="Release"/>
|
<Project Name="mod_capwap80211" ConfigName="Release"/>
|
||||||
|
<Project Name="mod_fortinet" ConfigName="Release"/>
|
||||||
</WorkspaceConfiguration>
|
</WorkspaceConfiguration>
|
||||||
</BuildMatrix>
|
</BuildMatrix>
|
||||||
</CodeLite_Workspace>
|
</CodeLite_Workspace>
|
||||||
|
@ -305,6 +305,7 @@
|
|||||||
<File Name="src/cw/capwap_items.c"/>
|
<File Name="src/cw/capwap_items.c"/>
|
||||||
<File Name="src/cw/message_set.c"/>
|
<File Name="src/cw/message_set.c"/>
|
||||||
<File Name="src/cw/message_set.h"/>
|
<File Name="src/cw/message_set.h"/>
|
||||||
|
<File Name="src/mod/cisco/mod_cisco.h"/>
|
||||||
</VirtualDirectory>
|
</VirtualDirectory>
|
||||||
</VirtualDirectory>
|
</VirtualDirectory>
|
||||||
<Description/>
|
<Description/>
|
||||||
|
@ -13,7 +13,6 @@
|
|||||||
<File Name="src/mod/cisco/cisco_out_wtp_descriptor.c"/>
|
<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_wtp_administrative_state.c"/>
|
||||||
<File Name="src/mod/cisco/cisco_out_ac_descriptor.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/cw_in_check_disc_req.c"/>
|
||||||
<File Name="src/mod/cisco/mod_cisco_ac.c"/>
|
<File Name="src/mod/cisco/mod_cisco_ac.c"/>
|
||||||
<File Name="src/mod/cisco/cisco_in_ac_descriptor.c"/>
|
<File Name="src/mod/cisco/cisco_in_ac_descriptor.c"/>
|
||||||
|
@ -25,6 +25,7 @@ LIBS+=-lrt
|
|||||||
LIBS+=-lpthread
|
LIBS+=-lpthread
|
||||||
LIBS+=-lconfuse
|
LIBS+=-lconfuse
|
||||||
LIBS+=-lsqlite3
|
LIBS+=-lsqlite3
|
||||||
|
LIBS+=-ldl
|
||||||
|
|
||||||
|
|
||||||
ifeq ($(SSL_LIBRARY),GNUTLS)
|
ifeq ($(SSL_LIBRARY),GNUTLS)
|
||||||
|
@ -87,7 +87,7 @@ static int parse_args(int argc, char *argv[])
|
|||||||
|
|
||||||
|
|
||||||
#include "cw/mod.h"
|
#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"
|
#include "cw/mlist.h"
|
||||||
|
|
||||||
@ -99,6 +99,9 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
cw_mod_add_dynamic("../../lib/actube/capwap.so" );
|
||||||
|
|
||||||
|
exit(0);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -539,7 +539,7 @@ static int conf_read_dbg_level(cfg_t * cfg)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
struct mod_ac ** conf_mods; //[10];
|
struct cw_Mod ** conf_mods; //[10];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -570,7 +570,7 @@ static int conf_read_mods(cfg_t *cfg){
|
|||||||
int n, i;
|
int n, i;
|
||||||
n = cfg_size(cfg,CFG_ENTRY_MODS);
|
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));
|
||||||
|
|
||||||
for (i=0; i < n; i++){
|
for (i=0; i < n; i++){
|
||||||
char *modname = cfg_getnstr(cfg, CFG_ENTRY_MODS, i);
|
char *modname = cfg_getnstr(cfg, CFG_ENTRY_MODS, i);
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
#include "cw/vendors.h"
|
#include "cw/vendors.h"
|
||||||
|
|
||||||
|
|
||||||
extern struct mod_ac ** conf_mods;
|
extern struct cw_Mod ** conf_mods;
|
||||||
|
|
||||||
#ifndef CONF_DEFAULT_ACNAME
|
#ifndef CONF_DEFAULT_ACNAME
|
||||||
#define CONF_DEFAULT_ACNAME "AC"
|
#define CONF_DEFAULT_ACNAME "AC"
|
||||||
|
@ -333,7 +333,7 @@ OBJS:=$(patsubst %.o,$(ARCH)/%.o,$(OBJS))
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
CFLAGS = -Wall -g -O0 -D_REENTRANT -DWITH_IPV6 -DWITH_RMAC_SUPPORT -I /usr/local/include -I../
|
CFLAGS = -Wall -fPIC -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 = -Wall -Os -D_REENTRANT -DWITH_IPV6 -DWITH_RMAC_SUPPORT -I/usr/local/include
|
||||||
|
|
||||||
CFLAGS += $(GNUTLS_CFLAGS) \
|
CFLAGS += $(GNUTLS_CFLAGS) \
|
||||||
|
@ -168,21 +168,19 @@ static int check_len(struct conn *conn, struct cw_action_in *a, uint8_t * data,
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct mod_ac *detect_mod(struct conn *conn, uint8_t * rawmsg, int len,
|
static struct cw_Mod *detect_mod(struct conn *conn, uint8_t * rawmsg, int len,
|
||||||
int elems_len, struct sockaddr *from, int mode)
|
int elems_len, struct sockaddr *from, int mode)
|
||||||
{
|
{
|
||||||
if (conn->mods) {
|
if (!conn->mods)
|
||||||
struct mod_ac **mods = (struct mod_ac **) conn->mods;
|
return MOD_NULL;
|
||||||
|
|
||||||
|
struct cw_Mod **mods = (struct cw_Mod **) conn->mods;
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; mods[i]; i++) {
|
for (i = 0; mods[i]; i++) {
|
||||||
if (mods[i]->detect) {
|
if (!mods[i]->detect)
|
||||||
if (mods[i]->detect
|
continue;
|
||||||
(conn, rawmsg, len, elems_len, from, mode)) {
|
if (mods[i]->detect (conn, rawmsg, len, elems_len, from, mode))
|
||||||
return mods[i];
|
return mods[i];
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return MOD_NULL;
|
return MOD_NULL;
|
||||||
@ -192,16 +190,16 @@ static struct cw_actiondef *load_mods(struct conn *conn, uint8_t * rawmsg, int l
|
|||||||
int elems_len, struct sockaddr *from)
|
int elems_len, struct sockaddr *from)
|
||||||
{
|
{
|
||||||
|
|
||||||
struct mod_ac *cmod =
|
struct cw_Mod *cmod =
|
||||||
detect_mod(conn, rawmsg, len, elems_len, from, MOD_MODE_CAPWAP);
|
detect_mod(conn, rawmsg, len, elems_len, from, MOD_MODE_CAPWAP);
|
||||||
if (cmod == MOD_NULL) {
|
if (cmod == MOD_NULL) {
|
||||||
cw_dbg(DBG_MSG_ERR,
|
cw_dbg(DBG_MSG_ERR,
|
||||||
"Can't find mod to handle connection from %s , discarding message",
|
"Can't find mod to handle connection from %s, discarding message",
|
||||||
sock_addr2str_p(from));
|
sock_addr2str_p(from));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct mod_ac *bmod =
|
struct cw_Mod *bmod =
|
||||||
detect_mod(conn, rawmsg, len, elems_len, from, MOD_MODE_BINDINGS);
|
detect_mod(conn, rawmsg, len, elems_len, from, MOD_MODE_BINDINGS);
|
||||||
|
|
||||||
cw_dbg(DBG_INFO, "Mods deteced: %s,%s", cmod->name, bmod->name);
|
cw_dbg(DBG_INFO, "Mods deteced: %s,%s", cmod->name, bmod->name);
|
||||||
|
@ -120,10 +120,11 @@ typedef struct {
|
|||||||
|
|
||||||
}cw_elem_handler_t;
|
}cw_elem_handler_t;
|
||||||
|
|
||||||
typedef struct {
|
struct cw_MsgSet {
|
||||||
mavl_t messages;
|
mavl_t messages;
|
||||||
mavl_t all_elems;
|
mavl_t all_elems;
|
||||||
}cw_message_set_t;
|
};
|
||||||
|
typedef struct cw_MsgSet cw_MsgSet_t;
|
||||||
|
|
||||||
typedef struct{
|
typedef struct{
|
||||||
cw_elem_handler_t * elem;
|
cw_elem_handler_t * elem;
|
||||||
|
@ -7,15 +7,15 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
|
||||||
struct mod_ac *(*mods_ac[])() = MODS_AC;
|
struct cw_Mod *(*mods_ac[])() = MODS_AC;
|
||||||
|
|
||||||
|
|
||||||
struct mod_ac * cw_get_mod_ac(const char *name)
|
struct cw_Mod * cw_get_mod_ac(const char *name)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i=0; mods_ac[i];i++){
|
for (i=0; mods_ac[i];i++){
|
||||||
|
|
||||||
struct mod_ac * m = mods_ac[i]();
|
struct cw_Mod * m = mods_ac[i]();
|
||||||
if (strcmp(m->name,name)==0)
|
if (strcmp(m->name,name)==0)
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ static inline int msg_cmp(const void *elem1, const void *elem2)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void cw_message_set_destroy(cw_message_set_t * set){
|
void cw_message_set_destroy(cw_MsgSet_t * set){
|
||||||
if (set->messages){
|
if (set->messages){
|
||||||
mavl_destroy(set->messages);
|
mavl_destroy(set->messages);
|
||||||
}
|
}
|
||||||
@ -49,14 +49,14 @@ void cw_message_set_destroy(cw_message_set_t * set){
|
|||||||
free(set);
|
free(set);
|
||||||
}
|
}
|
||||||
|
|
||||||
cw_message_set_t * cw_message_set_create(){
|
cw_MsgSet_t * cw_message_set_create(){
|
||||||
|
|
||||||
/* allocate memory for a message_set */
|
/* allocate memory for a message_set */
|
||||||
cw_message_set_t * set = malloc(sizeof(cw_message_set_t));
|
cw_MsgSet_t * set = malloc(sizeof(cw_MsgSet_t));
|
||||||
if (set==NULL)
|
if (set==NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
memset(set,0,sizeof(cw_message_set_t));
|
memset(set,0,sizeof(cw_MsgSet_t));
|
||||||
|
|
||||||
/* create mavl for all_elems */
|
/* create mavl for all_elems */
|
||||||
set->all_elems = mavl_create(cmp_cw_msgelemprops,NULL);
|
set->all_elems = mavl_create(cmp_cw_msgelemprops,NULL);
|
||||||
@ -77,7 +77,7 @@ cw_message_set_t * cw_message_set_create(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void update_message(message2_t * msg, cw_msgdef_t * src, cw_message_set_t * set){
|
static void update_message(message2_t * msg, cw_msgdef_t * src, cw_MsgSet_t * set){
|
||||||
|
|
||||||
cw_msgelemprops_t *md;
|
cw_msgelemprops_t *md;
|
||||||
|
|
||||||
@ -95,7 +95,7 @@ static void update_message(message2_t * msg, cw_msgdef_t * src, cw_message_set_t
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void cw_message_set_add(cw_message_set_t * set,
|
void cw_msgset_add(cw_MsgSet_t * set,
|
||||||
cw_msgdef_t messages[]){
|
cw_msgdef_t messages[]){
|
||||||
|
|
||||||
cw_msgdef_t * m;
|
cw_msgdef_t * m;
|
||||||
@ -136,19 +136,17 @@ void cw_message_set_add(cw_message_set_t * set,
|
|||||||
next->states=m->states;
|
next->states=m->states;
|
||||||
|
|
||||||
update_message(next,m, set);
|
update_message(next,m, set);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cw_elem_handler_t * cw_message_set_find_element(
|
cw_elem_handler_t * cw_message_set_find_element(
|
||||||
cw_message_set_t * set,
|
cw_MsgSet_t * set,
|
||||||
cw_elem_handler_t * element){
|
cw_elem_handler_t * element){
|
||||||
return mavl_find(set->all_elems,element);
|
return mavl_find(set->all_elems,element);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
mlist_t cw_msgset_get_msg(cw_message_set_t * set, int type){
|
mlist_t cw_msgset_get_msg(cw_MsgSet_t * set, int type){
|
||||||
message2_t search;
|
message2_t search;
|
||||||
search.type = type;
|
search.type = type;
|
||||||
message2_t * result = mavl_find(set->messages,&search);
|
message2_t * result = mavl_find(set->messages,&search);
|
||||||
|
@ -3,9 +3,9 @@
|
|||||||
|
|
||||||
#include "cw.h"
|
#include "cw.h"
|
||||||
|
|
||||||
extern void cw_message_set_destroy(cw_message_set_t * set);
|
extern void cw_message_set_destroy(cw_MsgSet_t * set);
|
||||||
extern cw_message_set_t * cw_message_set_create();
|
extern cw_MsgSet_t * cw_message_set_create();
|
||||||
extern void cw_message_set_add(cw_message_set_t * set,
|
extern void cw_msgset_add(cw_MsgSet_t * set,
|
||||||
cw_msgdef_t messages[]);
|
cw_msgdef_t messages[]);
|
||||||
mlist_t cw_msgset_get_msg(cw_message_set_t * set, int type);
|
mlist_t cw_msgset_get_msg(cw_MsgSet_t * set, int type);
|
||||||
#endif
|
#endif
|
78
src/cw/mod.c
78
src/cw/mod.c
@ -18,11 +18,12 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @file
|
* @file
|
||||||
* @brief Functions for mods
|
* @brief Functions for modules (mods) management.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <dlfcn.h>
|
||||||
|
|
||||||
|
|
||||||
#include "action.h"
|
#include "action.h"
|
||||||
@ -31,15 +32,16 @@
|
|||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
||||||
|
|
||||||
static void (*actions_registered_cb) (struct mod_ac * capwap, struct mod_ac * bindings,
|
static void (*actions_registered_cb) (struct cw_Mod * capwap, struct cw_Mod * bindings,
|
||||||
struct cw_actiondef * actions) = NULL;
|
struct cw_actiondef * actions) = NULL;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int mod_caching = 1;
|
|
||||||
|
|
||||||
void mod_set_actions_registered_cb(void (*fun)
|
void mod_set_actions_registered_cb(void (*fun)
|
||||||
(struct mod_ac *, struct mod_ac *, struct cw_actiondef *))
|
(struct cw_Mod *, struct cw_Mod *,
|
||||||
|
struct cw_actiondef *))
|
||||||
{
|
{
|
||||||
actions_registered_cb = fun;
|
actions_registered_cb = fun;
|
||||||
}
|
}
|
||||||
@ -49,7 +51,7 @@ struct cache_item {
|
|||||||
const char *capwap;
|
const char *capwap;
|
||||||
const char *bindings;
|
const char *bindings;
|
||||||
struct cw_actiondef actions;
|
struct cw_actiondef actions;
|
||||||
|
struct cw_MsgSet * msgset;
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct mavl *cache = NULL;
|
static struct mavl *cache = NULL;
|
||||||
@ -62,9 +64,10 @@ static int mod_null_register_actions(struct cw_actiondef *def, int mode)
|
|||||||
/**
|
/**
|
||||||
* mod_null is a dummy mod
|
* mod_null is a dummy mod
|
||||||
*/
|
*/
|
||||||
struct mod_ac mod_null = {
|
struct cw_Mod mod_null = {
|
||||||
.name = "none",
|
.name = "none",
|
||||||
.register_actions = mod_null_register_actions
|
.register_actions = mod_null_register_actions,
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -89,7 +92,7 @@ struct cw_actiondef *mod_cache_get(const char *capwap, const char *bindings)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
struct cw_actiondef *mod_cache_add(struct conn *conn, struct mod_ac *c, struct mod_ac *b)
|
struct cw_actiondef *mod_cache_add(struct conn *conn, struct cw_Mod *c, struct cw_Mod *b)
|
||||||
{
|
{
|
||||||
if (!cache) {
|
if (!cache) {
|
||||||
cache = mavl_create(cmp, NULL);
|
cache = mavl_create(cmp, NULL);
|
||||||
@ -130,8 +133,65 @@ struct cw_actiondef *mod_cache_add(struct conn *conn, struct mod_ac *c, struct m
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (actions_registered_cb)
|
if (actions_registered_cb)
|
||||||
actions_registered_cb(c,b,&(i->actions));
|
actions_registered_cb(c, b, &(i->actions));
|
||||||
|
|
||||||
mavl_add(cache, i);
|
mavl_add(cache, i);
|
||||||
return &(i->actions);
|
return &(i->actions);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* static mavl to store modules */
|
||||||
|
static struct mavl * modlist = NULL;
|
||||||
|
static int mod_cmp(const void *e1, const void *e2){
|
||||||
|
struct cw_Mod * (*m1fn)() = e1;
|
||||||
|
struct cw_Mod * (*m2fn)() = e2;
|
||||||
|
return strcmp(m1fn()->name,m2fn()->name);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Load a module
|
||||||
|
* @param name Name of the module
|
||||||
|
* @return pointer to the module structure or NULL if the
|
||||||
|
* module cannot be loaded.
|
||||||
|
*/
|
||||||
|
struct cw_Mod * cw_mod_get(const char *name)
|
||||||
|
{
|
||||||
|
|
||||||
|
/*int i;
|
||||||
|
for (i=0; modlist[i];i++){
|
||||||
|
|
||||||
|
struct cw_Mod * m = modlist[i]();
|
||||||
|
if (strcmp(m->name,name)==0)
|
||||||
|
return m;
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
int cw_mod_add(struct cw_Mod * (*modfn)() ){
|
||||||
|
if (modlist == NULL){
|
||||||
|
modlist = mavl_create(mod_cmp,NULL);
|
||||||
|
if (modlist==NULL){
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mavl_add(modlist,modfn);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int cw_mod_add_dynamic(const char * filename){
|
||||||
|
void * handle;
|
||||||
|
handle = dlopen(filename,RTLD_NOW);
|
||||||
|
if (!handle){
|
||||||
|
printf("Error: %s",dlerror());
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("Load DLL %p\n",handle);
|
||||||
|
|
||||||
|
void * ifu = dlsym(handle,"bstr_create");
|
||||||
|
|
||||||
|
printf("IFU DLL %p\n",ifu);
|
||||||
|
}
|
31
src/cw/mod.h
31
src/cw/mod.h
@ -16,6 +16,11 @@
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @file
|
||||||
|
* @brief module definitions
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef __MOD_H
|
#ifndef __MOD_H
|
||||||
#define __MOD_H
|
#define __MOD_H
|
||||||
|
|
||||||
@ -28,15 +33,14 @@
|
|||||||
|
|
||||||
struct cw_actiondef;
|
struct cw_actiondef;
|
||||||
|
|
||||||
#define MOD_MAXMODS 8
|
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
MOD_MODE_CAPWAP,
|
MOD_MODE_CAPWAP,
|
||||||
MOD_MODE_BINDINGS
|
MOD_MODE_BINDINGS
|
||||||
};
|
};
|
||||||
|
|
||||||
struct mod_ac {
|
struct cw_Mod {
|
||||||
/** Name of the mod */
|
/** Name of the module */
|
||||||
const char *name;
|
const char *name;
|
||||||
/** Initializion method */
|
/** Initializion method */
|
||||||
int (*init) ();
|
int (*init) ();
|
||||||
@ -45,8 +49,10 @@ struct mod_ac {
|
|||||||
int (*init_config) (mbag_t config);
|
int (*init_config) (mbag_t config);
|
||||||
|
|
||||||
/** Detect capwap
|
/** Detect capwap
|
||||||
This function is called after receiving and disassembling a complete
|
* This function is called after receiving and disassembling a complete
|
||||||
CAPWAP message. Either on Discovery Request or Join Request
|
* CAPWAP message. Either on Discovery Request or Join Request.
|
||||||
|
* @param conn current connection
|
||||||
|
* @return 0 if notdetected
|
||||||
**/
|
**/
|
||||||
int (*detect) (struct conn * conn, const uint8_t * rawmsg, int rawlen,
|
int (*detect) (struct conn * conn, const uint8_t * rawmsg, int rawlen,
|
||||||
int elems_len, struct sockaddr * from, int mode);
|
int elems_len, struct sockaddr * from, int mode);
|
||||||
@ -56,31 +62,28 @@ struct mod_ac {
|
|||||||
|
|
||||||
/** Register actions */
|
/** Register actions */
|
||||||
int (*register_actions) (struct cw_actiondef * def,int mode);
|
int (*register_actions) (struct cw_actiondef * def,int mode);
|
||||||
|
|
||||||
|
struct cw_MsgSet * (*register_messages)(struct cw_MsgSet set, int mode);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
extern struct cw_Mod mod_null;
|
||||||
* We define here struct mod_wtp in case we need
|
|
||||||
* different methods for WTP and AC later
|
|
||||||
*/
|
|
||||||
#define mod_wtp mod_ac
|
|
||||||
|
|
||||||
extern struct mod_ac mod_null;
|
|
||||||
|
|
||||||
|
|
||||||
#define MOD_NULL (&mod_null)
|
#define MOD_NULL (&mod_null)
|
||||||
|
|
||||||
struct cw_actiondef * mod_cache_add(struct conn *conn,struct mod_ac *c, struct mod_ac *b);
|
struct cw_actiondef * mod_cache_add(struct conn *conn,struct cw_Mod *c, struct cw_Mod *b);
|
||||||
|
|
||||||
|
|
||||||
#define mod_init_config(mod,cfg) (mod->init_config ? mod->init_config(cfg):1)
|
#define mod_init_config(mod,cfg) (mod->init_config ? mod->init_config(cfg):1)
|
||||||
|
|
||||||
void mod_set_actions_registered_cb(void (*fun) (struct mod_ac *, struct mod_ac *, struct cw_actiondef *));
|
void mod_set_actions_registered_cb(void (*fun) (struct cw_Mod *, struct cw_Mod *, struct cw_actiondef *));
|
||||||
|
|
||||||
extern int mod_caching;
|
extern int mod_caching;
|
||||||
|
|
||||||
#define mod_set_caching(var) (mod_caching=var)
|
#define mod_set_caching(var) (mod_caching=var)
|
||||||
#define mod_get_caching() (mod_caching)
|
#define mod_get_caching() (mod_caching)
|
||||||
|
|
||||||
|
extern int cw_mod_add_dynamic(const char * filename);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -5,7 +5,7 @@ include ../../Config.mak
|
|||||||
OBJS:=$(patsubst %.o,$(ARCH)/%.o,$(OBJS))
|
OBJS:=$(patsubst %.o,$(ARCH)/%.o,$(OBJS))
|
||||||
|
|
||||||
|
|
||||||
CFLAGS = -Wall -g -O0 -D_REENTRANT -DWITH_IPV6 $(COMPDEFS) -DWITH_RMAC_SUPPORT -I ../../ -I../ -I../../include
|
CFLAGS = -fPIC -Wall -g -O0 -D_REENTRANT -DWITH_IPV6 $(COMPDEFS) -DWITH_RMAC_SUPPORT -I ../../ -I../ -I../../include
|
||||||
|
|
||||||
LIBDIR=../../lib/$(ARCH)
|
LIBDIR=../../lib/$(ARCH)
|
||||||
|
|
||||||
@ -21,6 +21,7 @@ $(LIBDIR)/$(NAME) : $(OBJS) $(MODOBJS)
|
|||||||
@mkdir -p $(LIBDIR)
|
@mkdir -p $(LIBDIR)
|
||||||
@echo " AR $(LIBDIR)/$(NAME)"
|
@echo " AR $(LIBDIR)/$(NAME)"
|
||||||
@$(AR) rcs $(LIBDIR)/$(NAME) $(OBJS) $(MODOBJS)
|
@$(AR) rcs $(LIBDIR)/$(NAME) $(OBJS) $(MODOBJS)
|
||||||
|
$(CC) -L$(LIBDIR) $(OBJS) $(MODOBJS) $(SLIBS) -v -shared -o ../../../lib/actube/capwap.so
|
||||||
|
|
||||||
|
|
||||||
all: $(LIBDIR)/$(NAME)
|
all: $(LIBDIR)/$(NAME)
|
||||||
|
@ -16,6 +16,7 @@ OBJS=\
|
|||||||
|
|
||||||
|
|
||||||
NAME=libcapwap.a
|
NAME=libcapwap.a
|
||||||
|
SLIBS=-lcw
|
||||||
|
|
||||||
include ../Mod.mak
|
include ../Mod.mak
|
||||||
|
|
||||||
|
@ -127,15 +127,20 @@ static cw_msgdef_t messages[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
int capwap_register_msg_set(struct cw_MsgSet * set){
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void test_sets(){
|
void test_sets(){
|
||||||
|
|
||||||
cw_message_set_t * set = cw_message_set_create();
|
cw_MsgSet_t * set = cw_message_set_create();
|
||||||
if (set==NULL){
|
if (set==NULL){
|
||||||
cw_log(LOG_ERR,"No mem");
|
cw_log(LOG_ERR,"No mem");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
cw_message_set_add(set,messages);
|
cw_msgset_add(set,messages);
|
||||||
|
|
||||||
cw_elem_handler_t el;
|
cw_elem_handler_t el;
|
||||||
memset(&el,0,sizeof(el));
|
memset(&el,0,sizeof(el));
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#ifndef __MOD_CAPWAP_H
|
#ifndef __MOD_CAPWAP_H
|
||||||
#define __MOD_CAPWAP_H
|
#define __MOD_CAPWAP_H
|
||||||
|
|
||||||
struct mod_ac *mod_capwap_ac();
|
struct cw_Mod *mod_capwap_ac();
|
||||||
struct mod_wtp *mod_capwap_wtp();
|
struct cw_Mod *mod_capwap_wtp();
|
||||||
|
|
||||||
|
|
||||||
extern int capwap_in_wtp_descriptor(struct conn *conn, struct cw_action_in *a,
|
extern int capwap_in_wtp_descriptor(struct conn *conn, struct cw_action_in *a,
|
||||||
|
@ -42,14 +42,14 @@ static int register_actions(struct cw_actiondef *def, int mode)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
static struct mod_ac capwap_ac = {
|
static struct cw_Mod capwap_ac = {
|
||||||
.name = "capwap",
|
.name = "capwap",
|
||||||
.init = init,
|
.init = init,
|
||||||
.detect = detect,
|
.detect = detect,
|
||||||
.register_actions = register_actions
|
.register_actions = register_actions
|
||||||
};
|
};
|
||||||
|
|
||||||
struct mod_ac *mod_capwap_ac()
|
struct cw_Mod *mod_capwap_ac()
|
||||||
{
|
{
|
||||||
return &capwap_ac;
|
return &capwap_ac;
|
||||||
};
|
};
|
||||||
|
@ -41,14 +41,14 @@ static int register_actions(struct cw_actiondef *def, int mode)
|
|||||||
return capwap_register_actions_wtp(def);
|
return capwap_register_actions_wtp(def);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct mod_wtp capwap_wtp = {
|
static struct cw_Mod capwap_wtp = {
|
||||||
.name = "capwap",
|
.name = "capwap",
|
||||||
.init = init,
|
.init = init,
|
||||||
.detect = detect,
|
.detect = detect,
|
||||||
.register_actions=register_actions
|
.register_actions=register_actions
|
||||||
};
|
};
|
||||||
|
|
||||||
struct mod_wtp *mod_capwap_wtp()
|
struct cw_Mod *mod_capwap_wtp()
|
||||||
{
|
{
|
||||||
return &capwap_wtp;
|
return &capwap_wtp;
|
||||||
};
|
};
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#ifndef __MOD_CAPWAP80211_H
|
#ifndef __MOD_CAPWAP80211_H
|
||||||
#define __MOD_CAPWAP80211_H
|
#define __MOD_CAPWAP80211_H
|
||||||
|
|
||||||
struct mod_ac *mod_capwap80211_ac();
|
struct cw_Mod *mod_capwap80211_ac();
|
||||||
struct mod_wtp *mod_capwap80211_wtp();
|
struct cw_Mod *mod_capwap80211_wtp();
|
||||||
|
|
||||||
extern int capwap80211_register_actions_ac(struct cw_actiondef *def);
|
extern int capwap80211_register_actions_ac(struct cw_actiondef *def);
|
||||||
extern int capwap80211_register_actions_wtp(struct cw_actiondef *def);
|
extern int capwap80211_register_actions_wtp(struct cw_actiondef *def);
|
||||||
|
@ -47,14 +47,14 @@ static int register_actions(struct cw_actiondef *actions, int mode)
|
|||||||
return capwap80211_register_actions_ac(actions);
|
return capwap80211_register_actions_ac(actions);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct mod_ac capwap80211_ac = {
|
static struct cw_Mod capwap80211_ac = {
|
||||||
.name = "capwap80211",
|
.name = "capwap80211",
|
||||||
.init = init,
|
.init = init,
|
||||||
.detect = detect,
|
.detect = detect,
|
||||||
.register_actions = register_actions
|
.register_actions = register_actions
|
||||||
};
|
};
|
||||||
|
|
||||||
struct mod_ac *mod_capwap80211_ac()
|
struct cw_Mod *mod_capwap80211_ac()
|
||||||
{
|
{
|
||||||
return &capwap80211_ac;
|
return &capwap80211_ac;
|
||||||
};
|
};
|
||||||
|
@ -40,14 +40,14 @@ static int register_actions(struct cw_actiondef *actions,int mode)
|
|||||||
return capwap80211_register_actions_wtp(actions);
|
return capwap80211_register_actions_wtp(actions);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct mod_ac capwap80211_wtp = {
|
static struct cw_Mod capwap80211_wtp = {
|
||||||
.name = "capwap80211",
|
.name = "capwap80211",
|
||||||
.init = init,
|
.init = init,
|
||||||
.detect = detect,
|
.detect = detect,
|
||||||
.register_actions = register_actions
|
.register_actions = register_actions
|
||||||
};
|
};
|
||||||
|
|
||||||
struct mod_ac *mod_capwap80211_wtp()
|
struct cw_Mod *mod_capwap80211_wtp()
|
||||||
{
|
{
|
||||||
return &capwap80211_wtp;
|
return &capwap80211_wtp;
|
||||||
};
|
};
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#ifndef __MOD_CIPWAP_H
|
#ifndef __MOD_CIPWAP_H
|
||||||
#define __MOD_CIPWAP_H
|
#define __MOD_CIPWAP_H
|
||||||
|
|
||||||
struct mod_ac * mod_cipwap_ac();
|
struct cw_Mod * mod_cipwap_ac();
|
||||||
struct mod_wtp * mod_cipwap_wtp();
|
struct cw_Mod * mod_cipwap_wtp();
|
||||||
|
|
||||||
extern int cipwap_register_actions_ac(struct cw_actiondef *def);
|
extern int cipwap_register_actions_ac(struct cw_actiondef *def);
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ static int register_actions(struct cw_actiondef *actions, int mode)
|
|||||||
case MOD_MODE_CAPWAP:
|
case MOD_MODE_CAPWAP:
|
||||||
{
|
{
|
||||||
|
|
||||||
struct mod_ac *cmod = modload_ac("capwap");
|
struct cw_Mod *cmod = modload_ac("capwap");
|
||||||
if (!cmod) {
|
if (!cmod) {
|
||||||
cw_log(LOG_ERR,
|
cw_log(LOG_ERR,
|
||||||
"Can't initialize mod_cisco, failed to load base mod mod_capwap");
|
"Can't initialize mod_cisco, failed to load base mod mod_capwap");
|
||||||
@ -69,7 +69,7 @@ static int register_actions(struct cw_actiondef *actions, int mode)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
static struct mod_ac cipwap_ac = {
|
static struct cw_Mod cipwap_ac = {
|
||||||
.name ="cipwap",
|
.name ="cipwap",
|
||||||
.init = cipwap_init,
|
.init = cipwap_init,
|
||||||
.detect = detect,
|
.detect = detect,
|
||||||
@ -79,7 +79,7 @@ static struct mod_ac cipwap_ac = {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
struct mod_ac * mod_cipwap_ac(){
|
struct cw_Mod * mod_cipwap_ac(){
|
||||||
return &cipwap_ac;
|
return &cipwap_ac;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ static int register_actions(struct cw_actiondef *actions, int mode)
|
|||||||
case MOD_MODE_CAPWAP:
|
case MOD_MODE_CAPWAP:
|
||||||
{
|
{
|
||||||
|
|
||||||
struct mod_ac *cmod = modload_wtp("capwap");
|
struct cw_Mod *cmod = modload_wtp("capwap");
|
||||||
if (!cmod) {
|
if (!cmod) {
|
||||||
cw_log(LOG_ERR,
|
cw_log(LOG_ERR,
|
||||||
"Can't initialize mod_cisco, failed to load base mod mod_capwap");
|
"Can't initialize mod_cisco, failed to load base mod mod_capwap");
|
||||||
@ -69,7 +69,7 @@ static int register_actions(struct cw_actiondef *actions, int mode)
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
static struct mod_ac cipwap_wtp = {
|
static struct cw_Mod cipwap_wtp = {
|
||||||
.name ="cipwap",
|
.name ="cipwap",
|
||||||
.init = cipwap_init,
|
.init = cipwap_init,
|
||||||
.detect = detect,
|
.detect = detect,
|
||||||
@ -79,7 +79,7 @@ static struct mod_ac cipwap_wtp = {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
struct mod_ac * mod_cipwap_wtp(){
|
struct cw_Mod * mod_cipwap_wtp(){
|
||||||
return &cipwap_wtp;
|
return &cipwap_wtp;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#ifndef __MOD_CISCO_H
|
#ifndef __MOD_CISCO_H
|
||||||
#define __MOD_CISCO_H
|
#define __MOD_CISCO_H
|
||||||
|
|
||||||
struct mod_ac * mod_cisco_ac();
|
struct cw_Mod * mod_cisco_ac();
|
||||||
struct mod_ac * mod_cisco_wtp();
|
struct cw_Mod * mod_cisco_wtp();
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -27,7 +27,7 @@ static int register_actions(struct cw_actiondef *actions, int mode)
|
|||||||
case MOD_MODE_CAPWAP:
|
case MOD_MODE_CAPWAP:
|
||||||
{
|
{
|
||||||
|
|
||||||
struct mod_ac *cmod = modload_ac("cipwap");
|
struct cw_Mod *cmod = modload_ac("cipwap");
|
||||||
if (!cmod) {
|
if (!cmod) {
|
||||||
cw_log(LOG_ERR,
|
cw_log(LOG_ERR,
|
||||||
"Can't initialize mod_cisco, failed to load base mod mod_cipwap");
|
"Can't initialize mod_cisco, failed to load base mod mod_cipwap");
|
||||||
@ -40,7 +40,7 @@ static int register_actions(struct cw_actiondef *actions, int mode)
|
|||||||
}
|
}
|
||||||
case MOD_MODE_BINDINGS:
|
case MOD_MODE_BINDINGS:
|
||||||
{
|
{
|
||||||
struct mod_ac *cmod = modload_ac("capwap80211");
|
struct cw_Mod *cmod = modload_ac("capwap80211");
|
||||||
if (!cmod) {
|
if (!cmod) {
|
||||||
cw_log(LOG_ERR,
|
cw_log(LOG_ERR,
|
||||||
"Can't initialize mod_cisco, failed to load base mod mod_capwap80211");
|
"Can't initialize mod_cisco, failed to load base mod mod_capwap80211");
|
||||||
@ -167,14 +167,14 @@ static int detect(struct conn *conn, const uint8_t * rawmsg, int rawlen, int ele
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct mod_ac capwap_ac = {
|
static struct cw_Mod capwap_ac = {
|
||||||
.name = "cisco",
|
.name = "cisco",
|
||||||
.init = init,
|
.init = init,
|
||||||
.detect = detect,
|
.detect = detect,
|
||||||
.register_actions = register_actions,
|
.register_actions = register_actions,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct mod_ac *mod_cisco_ac()
|
struct cw_Mod *mod_cisco_ac()
|
||||||
{
|
{
|
||||||
return &capwap_ac;
|
return &capwap_ac;
|
||||||
};
|
};
|
||||||
|
@ -19,11 +19,12 @@ extern int cisco_register_actions_wtp(struct cw_actiondef *def);
|
|||||||
|
|
||||||
static int register_actions(struct cw_actiondef *actions, int mode)
|
static int register_actions(struct cw_actiondef *actions, int mode)
|
||||||
{
|
{
|
||||||
|
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case MOD_MODE_CAPWAP:
|
case MOD_MODE_CAPWAP:
|
||||||
{
|
{
|
||||||
|
|
||||||
struct mod_wtp *cmod = modload_wtp("cipwap");
|
struct cw_Mod *cmod = modload_wtp("cipwap");
|
||||||
if (!cmod) {
|
if (!cmod) {
|
||||||
cw_log(LOG_ERR,
|
cw_log(LOG_ERR,
|
||||||
"Can't initzialize mod_cisco, failed to load base mod mod_cipwap");
|
"Can't initzialize mod_cisco, failed to load base mod mod_cipwap");
|
||||||
@ -40,7 +41,7 @@ static int register_actions(struct cw_actiondef *actions, int mode)
|
|||||||
}
|
}
|
||||||
case MOD_MODE_BINDINGS:
|
case MOD_MODE_BINDINGS:
|
||||||
{
|
{
|
||||||
struct mod_ac *cmod = modload_wtp("capwap80211");
|
struct cw_Mod *cmod = modload_wtp("capwap80211");
|
||||||
if (!cmod) {
|
if (!cmod) {
|
||||||
cw_log(LOG_ERR,
|
cw_log(LOG_ERR,
|
||||||
"Can't initzialize mod_cisco, failed to load base mod mod_capwap80211");
|
"Can't initzialize mod_cisco, failed to load base mod mod_capwap80211");
|
||||||
@ -154,7 +155,7 @@ static int detect(struct conn *conn, const uint8_t * rawmsg, int rawlen, int ele
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct mod_ac cisco_wtp = {
|
static struct cw_Mod cisco_wtp = {
|
||||||
.name = "cisco",
|
.name = "cisco",
|
||||||
.init = init,
|
.init = init,
|
||||||
.init_config = init_config,
|
.init_config = init_config,
|
||||||
@ -162,7 +163,7 @@ static struct mod_ac cisco_wtp = {
|
|||||||
.register_actions = register_actions
|
.register_actions = register_actions
|
||||||
};
|
};
|
||||||
|
|
||||||
struct mod_ac *mod_cisco_wtp()
|
struct cw_Mod *mod_cisco_wtp()
|
||||||
{
|
{
|
||||||
return &cisco_wtp;
|
return &cisco_wtp;
|
||||||
};
|
};
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
#ifndef __MOD_FORTINET_H
|
#ifndef __MOD_FORTINET_H
|
||||||
#define __MOD_FORTINET_H
|
#define __MOD_FORTINET_H
|
||||||
|
|
||||||
struct mod_ac * mod_fortinet_ac();
|
struct cw_Mod * mod_fortinet_ac();
|
||||||
struct mod_ac * mod_fortinet_wtp();
|
struct cw_Mod * mod_fortinet_wtp();
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -21,7 +21,7 @@ static int register_actions(struct cw_actiondef *actions, int mode)
|
|||||||
case MOD_MODE_CAPWAP:
|
case MOD_MODE_CAPWAP:
|
||||||
{
|
{
|
||||||
|
|
||||||
struct mod_ac *cmod = modload_ac("capwap");
|
struct cw_Mod *cmod = modload_ac("capwap");
|
||||||
if (!cmod) {
|
if (!cmod) {
|
||||||
cw_log(LOG_ERR,
|
cw_log(LOG_ERR,
|
||||||
"Can't initialize mod_fortinet, failed to load base mod mod_capwap");
|
"Can't initialize mod_fortinet, failed to load base mod mod_capwap");
|
||||||
@ -34,7 +34,7 @@ static int register_actions(struct cw_actiondef *actions, int mode)
|
|||||||
}
|
}
|
||||||
case MOD_MODE_BINDINGS:
|
case MOD_MODE_BINDINGS:
|
||||||
{
|
{
|
||||||
struct mod_ac *cmod = modload_ac("capwap80211");
|
struct cw_Mod *cmod = modload_ac("capwap80211");
|
||||||
if (!cmod) {
|
if (!cmod) {
|
||||||
cw_log(LOG_ERR,
|
cw_log(LOG_ERR,
|
||||||
"Can't initialize mod_fortinet, failed to load base mod mod_capwap80211");
|
"Can't initialize mod_fortinet, failed to load base mod mod_capwap80211");
|
||||||
@ -60,7 +60,7 @@ static int register_actions(struct cw_actiondef *actions, int mode)
|
|||||||
static int init()
|
static int init()
|
||||||
{
|
{
|
||||||
cw_dbg(DBG_INFO, "Initialiazing mod_fortineto ...");
|
cw_dbg(DBG_INFO, "Initialiazing mod_fortineto ...");
|
||||||
// struct mod_ac *cmod = modload_ac("capwap");
|
// struct cw_Mod *cmod = modload_ac("capwap");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -108,14 +108,14 @@ static int detect(struct conn *conn, const uint8_t * rawmsg, int rawlen, int ele
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct mod_ac capwap_ac = {
|
static struct cw_Mod capwap_ac = {
|
||||||
.name = "fortinet",
|
.name = "fortinet",
|
||||||
.init = init,
|
.init = init,
|
||||||
.detect = detect,
|
.detect = detect,
|
||||||
.register_actions = register_actions
|
.register_actions = register_actions
|
||||||
};
|
};
|
||||||
|
|
||||||
struct mod_ac *mod_fortinet_ac()
|
struct cw_Mod *mod_fortinet_ac()
|
||||||
{
|
{
|
||||||
return &capwap_ac;
|
return &capwap_ac;
|
||||||
};
|
};
|
||||||
|
@ -21,7 +21,7 @@ static int register_actions(struct cw_actiondef *actions, int mode)
|
|||||||
case MOD_MODE_CAPWAP:
|
case MOD_MODE_CAPWAP:
|
||||||
{
|
{
|
||||||
|
|
||||||
struct mod_wtp *cmod = modload_wtp("capwap");
|
struct cw_Mod *cmod = modload_wtp("capwap");
|
||||||
if (!cmod) {
|
if (!cmod) {
|
||||||
cw_log(LOG_ERR,
|
cw_log(LOG_ERR,
|
||||||
"Can't initialize mod_fortinet, failed to load base mod mod_capwap");
|
"Can't initialize mod_fortinet, failed to load base mod mod_capwap");
|
||||||
@ -38,7 +38,7 @@ static int register_actions(struct cw_actiondef *actions, int mode)
|
|||||||
}
|
}
|
||||||
case MOD_MODE_BINDINGS:
|
case MOD_MODE_BINDINGS:
|
||||||
{
|
{
|
||||||
struct mod_ac *cmod = modload_wtp("capwap80211");
|
struct cw_Mod *cmod = modload_wtp("capwap80211");
|
||||||
if (!cmod) {
|
if (!cmod) {
|
||||||
cw_log(LOG_ERR,
|
cw_log(LOG_ERR,
|
||||||
"Can't initialize mod_fortinet, failed to load base mod mod_capwap80211");
|
"Can't initialize mod_fortinet, failed to load base mod mod_capwap80211");
|
||||||
@ -82,7 +82,7 @@ static int init()
|
|||||||
mbag_set_bstr16(cisco_config_wtp,CW_ITEM_WTP_BOOTLOADER_VERSION,v);
|
mbag_set_bstr16(cisco_config_wtp,CW_ITEM_WTP_BOOTLOADER_VERSION,v);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
// struct mod_ac *cmod = modload_ac("capwap");
|
// struct cw_Mod *cmod = modload_ac("capwap");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -153,7 +153,7 @@ static int detect(struct conn *conn, const uint8_t * rawmsg, int rawlen, int ele
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct mod_ac fortinet_wtp = {
|
static struct cw_Mod fortinet_wtp = {
|
||||||
.name = "fortinet",
|
.name = "fortinet",
|
||||||
.init = init,
|
.init = init,
|
||||||
.init_config = init_config,
|
.init_config = init_config,
|
||||||
@ -161,7 +161,7 @@ static struct mod_ac fortinet_wtp = {
|
|||||||
.register_actions = register_actions
|
.register_actions = register_actions
|
||||||
};
|
};
|
||||||
|
|
||||||
struct mod_ac *mod_fortinet_wtp()
|
struct cw_Mod *mod_fortinet_wtp()
|
||||||
{
|
{
|
||||||
return &fortinet_wtp;
|
return &fortinet_wtp;
|
||||||
};
|
};
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
|
|
||||||
#include "cw/mod.h"
|
#include "cw/mod.h"
|
||||||
|
|
||||||
struct mod_ac * modload_ac(const char *name);
|
struct cw_Mod * modload_ac(const char *name);
|
||||||
struct mod_wtp * modload_wtp(const char *name);
|
struct cw_Mod * modload_wtp(const char *name);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -14,14 +14,14 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
struct mod_ac *(*mods_ac[])() = MODS_AC;
|
struct cw_Mod *(*mods_ac[])() = MODS_AC;
|
||||||
|
|
||||||
struct mod_ac * modload_ac(const char *name)
|
struct cw_Mod * modload_ac(const char *name)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i=0; mods_ac[i];i++){
|
for (i=0; mods_ac[i];i++){
|
||||||
|
|
||||||
struct mod_ac * m = mods_ac[i]();
|
struct cw_Mod * m = mods_ac[i]();
|
||||||
if (strcmp(m->name,name)==0)
|
if (strcmp(m->name,name)==0)
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
@ -12,14 +12,14 @@
|
|||||||
|
|
||||||
#include "modload.h"
|
#include "modload.h"
|
||||||
|
|
||||||
struct mod_wtp *(*mods_wtp[])() = MODS_WTP;
|
struct cw_Mod *(*mods_wtp[])() = MODS_WTP;
|
||||||
|
|
||||||
struct mod_wtp * modload_wtp(const char *name)
|
struct cw_Mod * modload_wtp(const char *name)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i=0; mods_wtp[i];i++){
|
for (i=0; mods_wtp[i];i++){
|
||||||
|
|
||||||
struct mod_wtp * m = mods_wtp[i]();
|
struct cw_Mod * m = mods_wtp[i]();
|
||||||
if (strcmp(m->name,name)==0)
|
if (strcmp(m->name,name)==0)
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef __MOD_ZYXEL_H
|
#ifndef __MOD_ZYXEL_H
|
||||||
#define __MOD_ZYXEL_H
|
#define __MOD_ZYXEL_H
|
||||||
|
|
||||||
struct mod_ac * mod_zyxel_ac();
|
struct cw_Mod * mod_zyxel_ac();
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -123,7 +123,7 @@ int main()
|
|||||||
//#define CWBIND "capwap80211"
|
//#define CWBIND "capwap80211"
|
||||||
|
|
||||||
|
|
||||||
struct mod_wtp *mod = modload_wtp(CWMOD);
|
struct cw_Mod *mod = modload_wtp(CWMOD);
|
||||||
if (!mod) {
|
if (!mod) {
|
||||||
printf("Can't load mod capwap\n");
|
printf("Can't load mod capwap\n");
|
||||||
exit(0);
|
exit(0);
|
||||||
|
Loading…
Reference in New Issue
Block a user