From 5a4146252b9000d1167ec2b19f7a2031f9391e6a Mon Sep 17 00:00:00 2001 From: "7u83@mail.ru" <7u83@mail.ru@noemail.net> Date: Sat, 2 Apr 2016 14:47:17 +0000 Subject: [PATCH] wtp stuff for cipwap FossilOrigin-Name: bff73082d335b2e1a318fc1ce99695d32383cb6b5dc696736ce2a07c30e73902 --- src/mod/cipwap/cipwap_actions_wtp.c | 62 +++++++++++++++++++++ src/mod/cipwap/mod_cipwap_wtp.c | 85 +++++++++++++++++++++++++++++ 2 files changed, 147 insertions(+) create mode 100644 src/mod/cipwap/cipwap_actions_wtp.c create mode 100644 src/mod/cipwap/mod_cipwap_wtp.c diff --git a/src/mod/cipwap/cipwap_actions_wtp.c b/src/mod/cipwap/cipwap_actions_wtp.c new file mode 100644 index 00000000..43eba62c --- /dev/null +++ b/src/mod/cipwap/cipwap_actions_wtp.c @@ -0,0 +1,62 @@ +/* + 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 . + +*/ + + +#include "cw/cw.h" +#include "cw/action.h" +#include "cw/cipwap_items.h" +#include "cw/strheap.h" +#include "cw/radio.h" + + +#include "mod_cipwap.h" + +static cw_action_in_t actions_in[] = { + + /* End of list */ + {0, 0} +}; + +static cw_action_out_t actions_out[]={ + + /* End of list */ + {0,0} +}; + + + + +int cipwap_register_actions_wtp(struct cw_actiondef *def) +{ + int rc; + + rc = cw_actionlist_in_register_actions(def->in, actions_in); + rc += cw_actionlist_out_register_actions(def->out, actions_out); +/* + rc += cw_strheap_register_strings(def->strmsg, capwap_strings_msg); + rc += cw_strheap_register_strings(def->strelem, capwap_strings_elem); +*/ + rc += cw_itemdefheap_register(def->items, cipwap_itemdefs); + +/* rc += cw_itemdefheap_register(def->radioitems, capwap_radiodefs); + intavltree_add(def->wbids, 0); +*/ + + + return rc; +} diff --git a/src/mod/cipwap/mod_cipwap_wtp.c b/src/mod/cipwap/mod_cipwap_wtp.c new file mode 100644 index 00000000..cac0e6b9 --- /dev/null +++ b/src/mod/cipwap/mod_cipwap_wtp.c @@ -0,0 +1,85 @@ + + +#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 == MOD_MODE_CAPWAP) + return 1; + + return 0; +} + +static int register_actions(struct cw_actiondef *actions, int mode) +{ + switch (mode) { + case MOD_MODE_CAPWAP: + { + + struct mod_ac *cmod = modload_wtp("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, 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 mod_ac cipwap_wtp = { + .name ="cipwap", + .init = cipwap_init, + .detect = detect, + .register_actions=register_actions + +}; + + + +struct mod_ac * mod_cipwap_wtp(){ + return &cipwap_wtp; +}; +