Refactoring ...
a# Please enter the commit message for your changes. Lines starting FossilOrigin-Name: c126f130f351f7103d1594a42255a1affd24061a75cf0cfeb129a92a8d2fb2a1
This commit is contained in:
parent
00b51bacf9
commit
5f5fccb14f
@ -4,8 +4,8 @@
|
||||
<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="Yes"/>
|
||||
<Project Name="libcw" Path="libcw.project" Active="No"/>
|
||||
<Project Name="mod_cisco" Path="mod_cisco.project" Active="No"/>
|
||||
<Project Name="libcw" Path="libcw.project" Active="Yes"/>
|
||||
<Project Name="mod_capwap80211" Path="mod_capwap80211.project" Active="No"/>
|
||||
<Project Name="mod_fortinet" Path="mod_fortinet.project" Active="No"/>
|
||||
<BuildMatrix>
|
||||
|
@ -3,12 +3,11 @@
|
||||
<VirtualDirectory Name="src">
|
||||
<VirtualDirectory Name="mod">
|
||||
<VirtualDirectory Name="capwap80211">
|
||||
<File Name="src/mod/capwap80211/mod_capwap80211_wtp.c"/>
|
||||
<File Name="src/mod/capwap80211/mod_capwap80211_ac.c"/>
|
||||
<File Name="src/mod/capwap80211/mod_capwap80211.h"/>
|
||||
<File Name="src/mod/capwap80211/capwap80211_actions_wtp.c"/>
|
||||
<File Name="src/mod/capwap80211/capwap80211_out_wtp_radio_cfg.c"/>
|
||||
<File Name="src/mod/capwap80211/capwap80211_actions_ac.c"/>
|
||||
<File Name="src/mod/capwap80211/mod_capwap80211.c"/>
|
||||
</VirtualDirectory>
|
||||
</VirtualDirectory>
|
||||
</VirtualDirectory>
|
||||
|
@ -84,7 +84,7 @@ enum radioelems {
|
||||
/** IEEE 802.11 WTP Radio Fail Alarm Indication */
|
||||
CW_ELEM80211_WTP_RADIO_FAIL_ALARM_IDICATION=1047,
|
||||
/** IEEE 802.11 Radio Information Message Element */
|
||||
CW_ELEM80211_WTP_RADIO_INFORMATION = 1048
|
||||
CAPWAP80211_ELEM_WTP_RADIO_INFORMATION = 1048
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -9,7 +9,7 @@ struct cw_StrListElem capwap_strings_elem80211[] = {
|
||||
{CW_ELEM80211_RATE_SET, "802.11 Rate Set"},
|
||||
{CW_ELEM80211_SUPPORTED_RATES,"802.11 Supported Rates"},
|
||||
|
||||
{CW_ELEM80211_WTP_RADIO_INFORMATION, " 802.11 WTP Radio Information"},
|
||||
{CAPWAP80211_ELEM_WTP_RADIO_INFORMATION, " 802.11 WTP Radio Information"},
|
||||
{CW_STR_STOP, " Unknown "}
|
||||
|
||||
};
|
||||
|
@ -190,7 +190,7 @@ int netconn_send_packet(struct netconn *nc, const uint8_t * buffer, int len)
|
||||
int netconn_send_capwap_msg(struct netconn * nc, uint8_t *rawmsg, int msglen)
|
||||
{
|
||||
|
||||
// int msglen = cw_get_hdr_msg_total_len(rawmsg);
|
||||
/* int msglen = cw_get_hdr_msg_total_len(rawmsg);*/
|
||||
|
||||
|
||||
uint8_t * ptr = rawmsg;
|
||||
@ -199,15 +199,15 @@ int netconn_send_capwap_msg(struct netconn * nc, uint8_t *rawmsg, int msglen)
|
||||
|
||||
int hlen = cw_get_hdr_hlen(rawmsg)*4;
|
||||
|
||||
// int mtu = nc->mtu;
|
||||
/* int mtu = nc->mtu; */
|
||||
|
||||
int mtu = 1400;
|
||||
|
||||
while (msglen>mtu){
|
||||
cw_set_hdr_flags(rawmsg,CAPWAP_FLAG_HDR_F,1);
|
||||
cw_put_dword(ptr+4, nc->fragid<<16 | fragoffset<<3 );
|
||||
cw_set_dword(ptr+4, nc->fragid<<16 | fragoffset<<3 );
|
||||
|
||||
// cw_dbg_pkt_nc(DBG_PKT_OUT,nc,ptr,mtu,(struct sockaddr*)&nc->addr);
|
||||
/*/// cw_dbg_pkt_nc(DBG_PKT_OUT,nc,ptr,mtu,(struct sockaddr*)&nc->addr);*/
|
||||
|
||||
if (nc->write(nc,ptr,mtu)<0)
|
||||
return -1;
|
||||
@ -225,9 +225,9 @@ int netconn_send_capwap_msg(struct netconn * nc, uint8_t *rawmsg, int msglen)
|
||||
else
|
||||
cw_set_hdr_flags(rawmsg,CAPWAP_FLAG_HDR_F,0);
|
||||
|
||||
cw_put_dword(ptr+4, nc->fragid<<16 | fragoffset<<3 );
|
||||
cw_set_dword(ptr+4, nc->fragid<<16 | fragoffset<<3 );
|
||||
|
||||
// cw_dbg_pkt_nc(DBG_PKT_OUT,nc,ptr,msglen,(struct sockaddr*)&nc->addr);
|
||||
/*// cw_dbg_pkt_nc(DBG_PKT_OUT,nc,ptr,msglen,(struct sockaddr*)&nc->addr);*/
|
||||
|
||||
return nc->write(nc,ptr,msglen-0);
|
||||
}
|
||||
@ -239,7 +239,7 @@ int netconn_process_packet(struct netconn *nc, uint8_t * packet, int len,
|
||||
{
|
||||
char sock_buf[SOCK_ADDR_BUFSIZE];
|
||||
|
||||
// cw_dbg_pkt_nc(DBG_PKT_IN, nc, packet, len, from);
|
||||
/*// cw_dbg_pkt_nc(DBG_PKT_IN, nc, packet, len, from);*/
|
||||
if (len < 8) {
|
||||
/* packet too short */
|
||||
cw_dbg(DBG_PKT_ERR,
|
||||
@ -309,10 +309,10 @@ int netconn_process_packet(struct netconn *nc, uint8_t * packet, int len,
|
||||
}
|
||||
|
||||
|
||||
// cw_dbg_pkt_nc(DBG_PKT_IN, nc, f + 4, *(uint32_t *) f, from);
|
||||
/*// cw_dbg_pkt_nc(DBG_PKT_IN, nc, f + 4, *(uint32_t *) f, from);
|
||||
|
||||
// XXX: Modify fragman to not throw away CAPWAP headers
|
||||
|
||||
*/
|
||||
int rc = nc->process_message(nc, f + 4, *(uint32_t *) f, from);
|
||||
|
||||
free(f);
|
||||
|
@ -47,7 +47,7 @@ static int detect(struct conn *conn, const uint8_t * rawmsg, int rawlen, int ele
|
||||
}
|
||||
|
||||
|
||||
static struct cw_Mod capwap_data = {
|
||||
struct cw_Mod mod_capwap = {
|
||||
"capwap", /* name */
|
||||
init, /* init */
|
||||
detect, /* detect */
|
||||
@ -57,7 +57,8 @@ static struct cw_Mod capwap_data = {
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*
|
||||
struct cw_Mod * mod_capwap(){
|
||||
return &capwap_data;
|
||||
}
|
||||
*/
|
@ -1,11 +1,17 @@
|
||||
include ../../Defs.mak
|
||||
|
||||
|
||||
OBJS=\
|
||||
mod_capwap80211_ac.o \
|
||||
mod_capwap80211_wtp.o \
|
||||
capwap80211_actions_ac.o \
|
||||
capwap80211_actions_wtp.o
|
||||
|
||||
NAME=libcapwap80211.a
|
||||
|
||||
LIBDIR := ../../../lib
|
||||
LIBARCHDIR := $(LIBDIR)/$(ARCH)
|
||||
OBJDIR := ../../../obj/mod_capwap80211/$(ARCH)
|
||||
SNAME := $(LIBARCHDIR)/libmod_capwap80211.a
|
||||
DNAME := $(LIBARCHDIR)/mod_capwap80211.so
|
||||
MODNAME := $(LIBDIR)/mod_capwap80211.so
|
||||
SLIBS := -lcw
|
||||
|
||||
include ../Mod.mak
|
||||
|
||||
|
@ -29,7 +29,7 @@ static cw_action_in_t actions_ac_in[] = {
|
||||
{
|
||||
.capwap_state = CAPWAP_STATE_DISCOVERY,
|
||||
.msg_id = CAPWAP_MSG_DISCOVERY_REQUEST,
|
||||
.elem_id = CW_ELEM80211_WTP_RADIO_INFORMATION,
|
||||
.elem_id = CAPWAP80211_ELEM_WTP_RADIO_INFORMATION,
|
||||
.item_id = CW_RADIOITEM80211_WTP_RADIO_INFORMATION,
|
||||
.start = cw_in_radio_generic,
|
||||
.mand = 1,
|
||||
@ -47,7 +47,7 @@ static cw_action_in_t actions_ac_in[] = {
|
||||
{
|
||||
.capwap_state = CAPWAP_STATE_JOIN,
|
||||
.msg_id = CAPWAP_MSG_JOIN_REQUEST,
|
||||
.elem_id = CW_ELEM80211_WTP_RADIO_INFORMATION,
|
||||
.elem_id = CAPWAP80211_ELEM_WTP_RADIO_INFORMATION,
|
||||
.item_id = CW_RADIOITEM80211_WTP_RADIO_INFORMATION,
|
||||
.start = cw_in_radio_generic,
|
||||
.mand = 1,
|
||||
@ -104,7 +104,7 @@ cw_action_out_t actions_ac_out[]={
|
||||
/* 802.11 Radio Information - Discovery Response */
|
||||
{
|
||||
.msg_id = CAPWAP_MSG_DISCOVERY_RESPONSE,
|
||||
.elem_id = CW_ELEM80211_WTP_RADIO_INFORMATION,
|
||||
.elem_id = CAPWAP80211_ELEM_WTP_RADIO_INFORMATION,
|
||||
.item_id = CW_RADIOITEM80211_WTP_RADIO_INFORMATION ,
|
||||
.out = cw_out_radio_infos,
|
||||
.mand = 1
|
||||
@ -119,7 +119,7 @@ cw_action_out_t actions_ac_out[]={
|
||||
/* 802.11 Radio Information - Discovery Response */
|
||||
{
|
||||
.msg_id = CAPWAP_MSG_JOIN_RESPONSE,
|
||||
.elem_id = CW_ELEM80211_WTP_RADIO_INFORMATION,
|
||||
.elem_id = CAPWAP80211_ELEM_WTP_RADIO_INFORMATION,
|
||||
.item_id = CW_RADIOITEM80211_WTP_RADIO_INFORMATION,
|
||||
.out = cw_out_radio_infos,
|
||||
.mand = 1
|
||||
|
@ -21,7 +21,7 @@ static cw_action_in_t actions_wtp_in[] = {
|
||||
{
|
||||
.capwap_state = CAPWAP_STATE_DISCOVERY,
|
||||
.msg_id = CAPWAP_MSG_DISCOVERY_RESPONSE,
|
||||
.elem_id = CW_ELEM80211_WTP_RADIO_INFORMATION,
|
||||
.elem_id = CAPWAP80211_ELEM_WTP_RADIO_INFORMATION,
|
||||
.item_id = CW_RADIOITEM80211_WTP_RADIO_INFORMATION,
|
||||
// .start = cw_in_radio_generic,
|
||||
.mand = 1,
|
||||
@ -38,7 +38,7 @@ static cw_action_in_t actions_wtp_in[] = {
|
||||
{
|
||||
.capwap_state = CAPWAP_STATE_JOIN,
|
||||
.msg_id = CAPWAP_MSG_JOIN_RESPONSE,
|
||||
.elem_id = CW_ELEM80211_WTP_RADIO_INFORMATION,
|
||||
.elem_id = CAPWAP80211_ELEM_WTP_RADIO_INFORMATION,
|
||||
.item_id = CW_RADIOITEM80211_WTP_RADIO_INFORMATION,
|
||||
// .start = cw_in_radio_generic,
|
||||
.mand = 1,
|
||||
@ -74,7 +74,7 @@ cw_action_out_t actions_out[]={
|
||||
{
|
||||
.msg_id = CAPWAP_MSG_DISCOVERY_REQUEST,
|
||||
.item_id = CW_ITEM_RADIO_INFOS ,
|
||||
.elem_id = CW_ELEM80211_WTP_RADIO_INFORMATION,
|
||||
.elem_id = CAPWAP80211_ELEM_WTP_RADIO_INFORMATION,
|
||||
.out = cw_out_radio_infos,
|
||||
.mand = 1
|
||||
}
|
||||
@ -86,7 +86,7 @@ cw_action_out_t actions_out[]={
|
||||
{
|
||||
.msg_id = CAPWAP_MSG_JOIN_REQUEST,
|
||||
.item_id = CW_ITEM_RADIO_INFOS ,
|
||||
.elem_id = CW_ELEM80211_WTP_RADIO_INFORMATION,
|
||||
.elem_id = CAPWAP80211_ELEM_WTP_RADIO_INFORMATION,
|
||||
.out = cw_out_radio_infos,
|
||||
.mand = 1
|
||||
}
|
||||
|
@ -3,7 +3,6 @@
|
||||
#include "cw/log.h"
|
||||
#include "cw/dbg.h"
|
||||
|
||||
#include "cw/action.h"
|
||||
#include "cw/cw.h"
|
||||
|
||||
#include "mod_capwap80211.h"
|
||||
@ -12,14 +11,9 @@
|
||||
|
||||
|
||||
|
||||
//extern int capwap_register_actions_ac(struct cw_actiondef *def);
|
||||
|
||||
|
||||
static int init()
|
||||
{
|
||||
cw_dbg(DBG_INFO, "Initialiazing mod_capwap80211 ...");
|
||||
// int rc = capwap_register_actions_ac(&actions);
|
||||
//cw_dbg(DBG_INFO, "Initialized mod capwap80211 with %d actions", rc);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -27,10 +21,12 @@ static int init()
|
||||
static int detect(struct conn *conn, const uint8_t * rawmsg, int rawlen, int elems_len,
|
||||
struct sockaddr *from, int mode)
|
||||
{
|
||||
int wbid;
|
||||
if (mode != CW_MOD_MODE_BINDINGS)
|
||||
return 0;
|
||||
|
||||
int wbid = cw_get_hdr_wbid(rawmsg);
|
||||
/* Check, if we can handle the Wireless Binding ID */
|
||||
wbid = cw_get_hdr_wbid(rawmsg);
|
||||
if (wbid != CAPWAP_WBID_IEEE80211 ) {
|
||||
cw_dbg(DBG_MOD,"CAPWAP80211 detected: no, my wbid=%d, remote wbid=%d",CAPWAP_WBID_IEEE80211,wbid);
|
||||
return 0;
|
||||
@ -39,6 +35,7 @@ static int detect(struct conn *conn, const uint8_t * rawmsg, int rawlen, int ele
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
static int register_actions(struct cw_actiondef *actions, int mode)
|
||||
{
|
||||
if (mode != CW_MOD_MODE_BINDINGS)
|
||||
@ -46,15 +43,17 @@ static int register_actions(struct cw_actiondef *actions, int mode)
|
||||
|
||||
return capwap80211_register_actions_ac(actions);
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
static struct cw_Mod capwap80211_ac = {
|
||||
.name = "capwap80211",
|
||||
.init = init,
|
||||
.detect = detect,
|
||||
.register_actions = register_actions
|
||||
|
||||
};
|
||||
|
||||
struct cw_Mod *mod_capwap80211_ac()
|
||||
{
|
||||
return &capwap80211_ac;
|
||||
};
|
||||
}
|
@ -1,53 +0,0 @@
|
||||
|
||||
#include "cw/mod.h"
|
||||
#include "cw/log.h"
|
||||
#include "cw/dbg.h"
|
||||
|
||||
#include "cw/action.h"
|
||||
|
||||
#include "mod_capwap80211.h"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//extern int capwap_register_actions_ac(struct cw_actiondef *def);
|
||||
|
||||
|
||||
static int init()
|
||||
{
|
||||
cw_dbg(DBG_INFO, "Initialiazing mod_capwap80211 WTP...");
|
||||
// int rc = capwap_register_actions_ac(&actions);
|
||||
//cw_dbg(DBG_INFO, "Initialized mod capwap80211 with %d actions", rc);
|
||||
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_BINDINGS)
|
||||
return 0;
|
||||
|
||||
cw_log(LOG_INFO, "Detecting WTP 80211");
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int register_actions(struct cw_actiondef *actions,int mode)
|
||||
{
|
||||
if (mode != CW_MOD_MODE_BINDINGS)
|
||||
return 0;
|
||||
return capwap80211_register_actions_wtp(actions);
|
||||
}
|
||||
|
||||
static struct cw_Mod capwap80211_wtp = {
|
||||
.name = "capwap80211",
|
||||
.init = init,
|
||||
.detect = detect,
|
||||
.register_actions = register_actions
|
||||
};
|
||||
|
||||
struct cw_Mod *mod_capwap80211_wtp()
|
||||
{
|
||||
return &capwap80211_wtp;
|
||||
};
|
@ -489,7 +489,7 @@ static cw_action_out_t actions80211_out[]={
|
||||
{
|
||||
.vendor_id = CW_VENDOR_ID_CISCO,
|
||||
.msg_id = CAPWAP_MSG_CONFIGURATION_STATUS_REQUEST,
|
||||
.elem_id = CW_ELEM80211_WTP_RADIO_INFORMATION,
|
||||
.elem_id = CAPWAP80211_ELEM_WTP_RADIO_INFORMATION,
|
||||
.item_id = CW_RADIOITEM80211_WTP_RADIO_INFORMATION,
|
||||
.out = cisco_out_80211_wtp_radio_cfg,
|
||||
/*.get = cw_out_get_config,*/
|
||||
|
@ -251,7 +251,7 @@ static cw_action_in_t actions80211_in[] = {
|
||||
|
||||
.capwap_state = CAPWAP_STATE_DISCOVERY,
|
||||
.msg_id = CAPWAP_MSG_DISCOVERY_REQUEST,
|
||||
.elem_id = CW_ELEM80211_WTP_RADIO_INFORMATION,
|
||||
.elem_id = CAPWAP80211_ELEM_WTP_RADIO_INFORMATION,
|
||||
.item_id = "radio_information",
|
||||
.start = cw_in_radio_generic,
|
||||
.mand = 0,
|
||||
|
@ -235,7 +235,7 @@ static cw_action_out_t actions_out[]={
|
||||
{
|
||||
.vendor_id = CW_VENDOR_ID_CISCO,
|
||||
.msg_id = CW_MSG_CONFIGURATION_STATUS_REQUEST,
|
||||
.elem_id = CW_ELEM80211_WTP_RADIO_INFORMATION,
|
||||
.elem_id = CAPWAP80211_ELEM_WTP_RADIO_INFORMATION,
|
||||
.item_id = CW_ITEM_RADIO_CFG,
|
||||
.out = cisco_out_80211_wtp_radio_cfg,
|
||||
.get = cw_out_get_config,
|
||||
|
Loading…
Reference in New Issue
Block a user