Mod detection via cw_mod_detect

FossilOrigin-Name: ca7afed73bf58840bb8ceabd09586b852eacc0995aff8da33a71de25afc1c043
This commit is contained in:
7u83@mail.ru 2018-02-26 13:44:27 +00:00
parent ce4913b1fd
commit e3b569f13a
5 changed files with 29 additions and 15 deletions

View File

@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<CodeLite_Workspace Name="actube" Database="">
<Project Name="ac" Path="ac.project" Active="No"/>
<Project Name="ac" Path="ac.project" Active="Yes"/>
<Project Name="wtp" Path="wtp.project" Active="No"/>
<Project Name="mod_cipwap" Path="mod_cipwap.project" Active="No"/>
<Project Name="mod_capwap" Path="mod_capwap.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="No"/>
<Project Name="mod_capwap80211" Path="mod_capwap80211.project" Active="No"/>
<Project Name="mod_fortinet" Path="mod_fortinet.project" Active="No"/>
<BuildMatrix>

View File

@ -580,16 +580,8 @@ static int conf_read_mods(cfg_t *cfg){
struct cw_Mod * mod = cw_mod_load(modname);
if (!mod)
return 0;
/* conf_mods[i] = NULL; //modload_ac(modname);
if (!conf_mods[i]){
cw_log(LOG_ERR,"Can't load mod: %s",modname);
return 0;
}
*/
cw_mod_add_to_list(mod);
}
return 1;
}

View File

@ -171,6 +171,7 @@ static int check_len(struct conn *conn, struct cw_action_in *a, uint8_t * data,
static struct cw_Mod *detect_mod(struct conn *conn, uint8_t * rawmsg, int len,
int elems_len, struct sockaddr *from, int mode)
{
cw_mod_detect(conn,rawmsg,len,elems_len,from,mode);
return MOD_NULL;
if (!conn->mods)

View File

@ -30,7 +30,7 @@
#include "mavl.h"
#include "dbg.h"
#include "log.h"
#include "file.h"
static void (*actions_registered_cb) (struct cw_Mod * capwap, struct cw_Mod * bindings,
struct cw_actiondef * actions) = NULL;
@ -144,8 +144,8 @@ struct cw_actiondef *mod_cache_add(struct conn *conn, struct cw_Mod *c, struct c
/* static mavl to store modules */
static struct mavl * mods_loaded = NULL;
static int mod_cmp(const void *e1, const void *e2){
struct cw_Mod * m1 = e1;
struct cw_Mod * m2 = e2;
const struct cw_Mod * m1 = e1;
const struct cw_Mod * m2 = e2;
return strcmp(m1->name,m2->name);
}
@ -243,5 +243,22 @@ struct cw_Mod * cw_mod_add_to_list(struct cw_Mod * mod ){
return 0;
}
}
return mlist_append(mods_list,mod);
return mlist_append(mods_list,mod)->data;
}
struct cw_Mod * cw_mod_detect(struct conn *conn,
uint8_t * rawmsg, int len,
int elems_len, struct sockaddr *from,
int mode){
cw_dbg(DBG_MOD, "Try to detect");
if (mods_list==NULL)
return MOD_NULL;
struct mlist_elem * e;
mlist_foreach(e,mods_list){
struct cw_Mod * mod = e->data;
cw_dbg(DBG_MOD,"Checking mod: %s",mod->name);
}
}

View File

@ -93,6 +93,10 @@ extern int mod_caching;
struct cw_Mod * cw_mod_load(const char * mod_name);
struct cw_Mod * cw_mod_add_to_list(struct cw_Mod * mod );
struct cw_Mod * cw_mod_detect(struct conn *conn,
uint8_t * rawmsg, int len,
int elems_len, struct sockaddr *from,
int mode);
#define CW_MOD_MAX_MOD_NAME_LEN 128
#define CW_MOD_INTERFACE_FUNCTION_NAME_SUFFIX "_get_interface"