actube/src/mod/cipwap/mod_cipwap_ac.c
7u83@mail.ru 7ecca3ef1f Refactoring, work on mod_load
FossilOrigin-Name: ae3ed889283aac53bbbe900b6859605b153f90b91430d231767343bcf05447a8
2018-02-26 11:21:50 +00:00

86 lines
1.4 KiB
C

#include "../modload.h"
#include "cw/mod.h"
#include "cw/log.h"
#include "cw/dbg.h"
#include "mod_cipwap.h"
int cipwap_init()
{
return 0;
}
static int detect(struct conn *conn,const uint8_t *rawmsg, int rawlen,int elems_len, struct sockaddr *from, int mode)
{
if (mode == CW_MOD_MODE_CAPWAP)
return 1;
return 0;
}
static int register_actions(struct cw_actiondef *actions, int mode)
{
switch (mode) {
case CW_MOD_MODE_CAPWAP:
{
struct cw_Mod *cmod = modload_ac("capwap");
if (!cmod) {
cw_log(LOG_ERR,
"Can't initialize mod_cisco, failed to load base mod mod_capwap");
return 1;
}
cmod->register_actions(actions, CW_MOD_MODE_CAPWAP);
int rc = cipwap_register_actions_ac(actions);
cw_dbg(DBG_INFO, "Initialized mod_cisco with %d actions", rc);
return rc;
}
/*
case MOD_MODE_BINDINGS:
{
struct mod_ac *cmod = modload_ac("capwap80211");
if (!cmod) {
cw_log(LOG_ERR,
"Can't initialize mod_cisco, failed to load base mod mod_capwap80211");
return 1;
}
cmod->register_actions(actions, MOD_MODE_BINDINGS);
int rc = cipwap_register_actions80211_ac(actions);
cw_dbg(DBG_INFO, "Initialized mod_cisco 80211 with %d actions", rc);
return 0;
}
*/
}
return 0;
}
static struct cw_Mod cipwap_ac = {
.name ="cipwap",
.init = cipwap_init,
.detect = detect,
.register_actions=register_actions
};
struct cw_Mod * mod_cipwap_ac(){
return &cipwap_ac;
};