diff --git a/actube.workspace b/actube.workspace index e0162c79..b21adfd1 100644 --- a/actube.workspace +++ b/actube.workspace @@ -1,11 +1,11 @@ - + - + diff --git a/src/ac/conf.c b/src/ac/conf.c index 3360b8b4..4bd14aca 100644 --- a/src/ac/conf.c +++ b/src/ac/conf.c @@ -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; } diff --git a/src/cw/conn_process_packet.c b/src/cw/conn_process_packet.c index b7698300..ae616acb 100644 --- a/src/cw/conn_process_packet.c +++ b/src/cw/conn_process_packet.c @@ -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) diff --git a/src/cw/mod.c b/src/cw/mod.c index 96608bac..4356f3b5 100644 --- a/src/cw/mod.c +++ b/src/cw/mod.c @@ -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); + } } diff --git a/src/cw/mod.h b/src/cw/mod.h index b8af0292..8e957d9f 100644 --- a/src/cw/mod.h +++ b/src/cw/mod.h @@ -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"