Work in progress

FossilOrigin-Name: 155605fd55cbb193d4f5ac8c704930c050a11cda541f1a5cdb93c57a8c51534f
This commit is contained in:
7u83@mail.ru
2018-03-17 11:32:40 +00:00
parent c4307d9e70
commit b668a8f4a9
63 changed files with 770 additions and 982 deletions

View File

@ -2,7 +2,6 @@ include ../Config.mak
all:
$(MAKE) -C capwap
$(MAKE) -C capwap80211
$(MAKE) -C cipwap
$(MAKE) -C cisco
$(MAKE) -C fortinet
$(CC) -c modload_ac.c -I../
@ -11,7 +10,6 @@ all:
clean:
$(MAKE) -C capwap clean
$(MAKE) -C capwap80211 clean
$(MAKE) -C cipwap clean
$(MAKE) -C cisco clean
$(MAKE) -C fortinet clean
rm *.o

View File

@ -8,6 +8,7 @@ OBJS=\
mod_capwap_ac.o \
capwap_actions_ac.o \
capwap_in_wtp_board_data.o \
capwap_out_wtp_board_data.o \
capwap_out_ac_descriptor.o \
capwap_out_get_session_id.o \
capwap_out_get_idle_timeout.o \

View File

@ -58,7 +58,7 @@ static struct cw_ElemHandler handlers[] = {
NULL, /* type */
CW_KEY_WTP_BOARD_DATA, /* Key */
capwap_in_wtp_board_data, /* get */
NULL /* put */
capwap_out_wtp_board_data /* put */
}
,
{
@ -69,7 +69,7 @@ static struct cw_ElemHandler handlers[] = {
NULL, /* type */
CW_KEY_WTP_DESCRIPTOR, /* Key */
capwap_in_wtp_descriptor, /* get */
NULL /* put */
capwap_out_wtp_descriptor, /* put */
}
,
{
@ -83,7 +83,6 @@ static struct cw_ElemHandler handlers[] = {
cw_out_generic /* put */
}
,
{
"Vendor Specific Payload", /* name */
CAPWAP_ELEM_VENDOR_SPECIFIC_PAYLOAD, /* Element ID */
@ -95,7 +94,6 @@ static struct cw_ElemHandler handlers[] = {
NULL /* put */
}
,
{
"MTU Discovery Padding", /* name */
CAPWAP_ELEM_MTU_DISCOVERY_PADDING, /* Element ID */
@ -108,7 +106,20 @@ static struct cw_ElemHandler handlers[] = {
}
,
{
"AC Descriptor", /* name */
CAPWAP_ELEM_AC_DESCRIPTOR, /* Element ID */
0,0, /* Vendor / Proto */
0,0, /* min/max length */
NULL, /* type */
CW_KEY_AC_DESCRIPTOR, /* Key */
NULL, /* get */
capwap_out_ac_descriptor /* put */
}
,
{0,0,0,0,0,0,0,0}
};
@ -127,6 +138,18 @@ static struct cw_ElemDef discovery_request_elements[] ={
};
static int discovery_response_states[] = {CAPWAP_STATE_DISCOVERY,0};
static struct cw_ElemDef discovery_response_elements[] ={
{0,0,CAPWAP_ELEM_AC_DESCRIPTOR, 1, 0},
{0,0,CAPWAP_ELEM_AC_NAME, 1, 0},
{0,0,CAPWAP_ELEM_AC_IPV4_LIST, 1, 0},
{0,0,CAPWAP_ELEM_AC_IPV6_LIST, 1, 0},
{0,0,CAPWAP_ELEM_VENDOR_SPECIFIC_PAYLOAD, 0, CW_IGNORE},
{0,0,0,0,0}
};
static struct cw_MsgDef messages[] = {
{
"Discovery Request",
@ -135,6 +158,19 @@ static struct cw_MsgDef messages[] = {
discovery_request_states,
discovery_request_elements
},
{
"Discovery Response",
CAPWAP_MSG_DISCOVERY_RESPONSE,
CW_RECEIVER_WTP,
discovery_response_states,
discovery_response_elements
},
/* {
"Discovery Request",
CAPWAP_MSG_DISCOVERY_REQUEST,
@ -184,6 +220,11 @@ struct cw_MsgSet * capwap_register_msg_set(struct cw_MsgSet * set, int mode){
if (mode != CW_MOD_MODE_CAPWAP)
return NULL;
cw_msgset_add(set,messages, handlers);
mavl_add_ptr(set->types_tree,CW_TYPE_BSTR16);
mavl_add_ptr(set->types_tree,CW_TYPE_BYTE);
mavl_add_ptr(set->types_tree,CW_TYPE_DWORD);
mavl_add_ptr(set->types_tree,CW_TYPE_WORD);
return set;
}
@ -196,6 +237,8 @@ void test_sets(){
}
cw_msgset_add(set,messages, handlers);
}
/*
cw_msgset_add(set,messages);

View File

@ -33,7 +33,7 @@ static cw_action_in_t actions_in[] = {
{
.capwap_state = CAPWAP_STATE_DISCOVERY,
.msg_id = CAPWAP_MSG_DISCOVERY_RESPONSE,
.elem_id = CW_ELEM_AC_NAME,
.elem_id = CAPWAP_ELEM_AC_NAME,
.item_id = CW_ITEM_AC_NAME,
.start = cw_in_generic2,
.min_len = 1,
@ -137,7 +137,7 @@ static cw_action_in_t actions_in[] = {
{
.capwap_state = CAPWAP_STATE_JOIN,
.msg_id = CAPWAP_MSG_JOIN_RESPONSE,
.elem_id = CW_ELEM_AC_NAME,
.elem_id = CAPWAP_ELEM_AC_NAME,
.item_id = CW_ITEM_AC_NAME,
.start = cw_in_generic2,
.min_len = 1,
@ -628,7 +628,7 @@ static cw_action_out_t actions_out[] = {
/* AC Name - Config Status Request - OUT */
{
.msg_id = CAPWAP_MSG_CONFIGURATION_STATUS_REQUEST,
.elem_id = CW_ELEM_AC_NAME,
.elem_id = CAPWAP_ELEM_AC_NAME,
.item_id = CW_ITEM_AC_NAME,
.out = cw_out_generic,
.get = cw_out_get_local,

View File

@ -41,9 +41,12 @@ static void readsubelems_wtp_board_data(mavl_t cfg, uint8_t * msgelem,
do {
int subtype;
int sublen;
val = ntohl(*((uint32_t *) (msgelem + i)));
int subtype = (val >> 16) & 0xffff;
int sublen = val & 0xffff;
subtype = (val >> 16) & 0xffff;
sublen = val & 0xffff;
i += 4;
if (sublen + i > len) {
cw_dbg(DBG_ELEM_ERR,
@ -96,7 +99,7 @@ static void readsubelems_wtp_board_data(mavl_t cfg, uint8_t * msgelem,
key = NULL;
break;
}
if (key){
if (key != NULL){
char add_key[256];
sprintf(add_key,"wtp_board_data/%s",key);
cw_ktv_add(cfg,add_key,CW_TYPE_BSTR16,msgelem+i,sublen);

View File

@ -26,12 +26,7 @@ int capwap_in_wtp_descriptor(struct cw_ElemHandler *eh, struct cw_ElemHandlerPar
int len)
{
int rc;
//printf("WTP Descriptor reader\n");
/*
// mbag_t mbag = conn->incomming;
*/
rc =cw_read_wtp_descriptor(params->conn->remote_cfg, params->conn, eh, data, len, NULL);
return rc;
}

View File

@ -8,48 +8,70 @@
#include "cw/cw.h"
#include "cw/ktv.h"
#include "cw/keys.h"
int capwap_out_ac_descriptor(struct conn *conn,struct cw_action_out * a,uint8_t *dst)
{
static int put_ac_status(mavl_t global, mavl_t local, uint8_t *dst, const char * parent_key){
uint8_t *d = dst+4;
struct mbag_item * i;
i = mbag_get(conn->local,CW_ITEM_AC_STATUS);
uint8_t *d = dst;
uint8_t security;
if (!i) {
cw_log(LOG_ERR,"Can't send AC Descriptor, no AC Status Item found");
return 0;
}
d+=cw_put_ac_status(d ,(struct cw_ac_status*)(i->u2.data),conn);
/*
i = mbag_get(conn->local,CW_ITEM_AC_HARDWARE_VERSION);
if ( i ) {
d += cw_put_version(d,CW_SUBELEM_AC_HARDWARE_VERSION,i->u2.data);
}
else {
cw_log(LOG_ERR, "Can't send hard version in AC descriptor, not set.");
}
char key[CW_KTV_MAX_KEY_LEN];
i = mbag_get(conn->local,CW_ITEM_AC_SOFTWARE_VERSION);
if ( i ) {
d += cw_put_version(d,CW_SUBELEM_AC_SOFTWARE_VERSION,i->u2.data);
d += cw_put_word(d,cw_ktv_get_word(global,"ac/ac-descriptor/stations",0));
d += cw_put_word(d,cw_ktv_get_word(global,"ac/ac-descriptor/station-limit",0));
d += cw_put_word(d,cw_ktv_get_word(global,"ac/ac-descriptor/active-wtps",0));
d += cw_put_word(d,cw_ktv_get_word(global,"ac/ac-descriptor/max-wtps",0));
security = 0;
if (cw_ktv_get(local,"dtls-cert-file",CW_TYPE_BSTR16))
security |= CAPWAP_FLAG_AC_SECURITY_X;
if (cw_ktv_get(local,"dtls-psk",CW_TYPE_BSTR16))
security |= CAPWAP_FLAG_AC_SECURITY_S;
if (security == 0){
cw_log(LOG_WARNING,"Attention: no AC security selected");
}
else {
cw_log(LOG_ERR, "Can't send software version in AC descriptor, not set.");
}
*/
int len = d-dst-4;
d += cw_put_byte(dst,security);
return len + cw_put_elem_hdr(dst,a->elem_id,len);
sprintf(key,"%s/%s",parent_key,CW_SKEY_RMAC_FIELD);
d += cw_put_byte(d,cw_ktv_get_byte(local,key,0));
d += cw_put_byte(d,0);
sprintf(key,"%s/%s",parent_key,CW_SKEY_DTLS_POLICY);
d += cw_put_byte(d,cw_ktv_get_byte(local,key,0));
return d - dst;
}
int capwap_out_ac_descriptor(struct cw_ElemHandler * eh,
struct cw_ElemHandlerParams * params, uint8_t * dst)
{
int len;
uint8_t *d = dst+4;
char key[CW_KTV_MAX_KEY_LEN];
d+=put_ac_status(params->conn->local_cfg,
params->conn->global_cfg,
d, eh->key);
sprintf(key,"%s/%s",eh->key,CW_SKEY_HARDWARE);
d+=cw_write_descriptor_subelem (d, params->conn->local_cfg,
CW_SUBELEM_AC_HARDWARE_VERSION, key);
sprintf(key,"%s/%s",eh->key,CW_SKEY_SOFTWARE);
d+=cw_write_descriptor_subelem (d, params->conn->local_cfg,
CW_SUBELEM_AC_HARDWARE_VERSION, key);
len = d-dst-4;
return len + cw_put_elem_hdr(dst,eh->id,len);
}

View File

@ -0,0 +1,74 @@
#include "cw/log.h"
#include "cw/ktv.h"
#include "cw/msgset.h"
#include "cw/keys.h"
#include "cw/cw.h"
static int write_boarddata_subelem(uint8_t * dst, mavl_t ktv, const char * parent_key,
const char *skey, int type){
char key[256];
cw_KTV_t * val;
uint8_t *d;
d=dst;
sprintf(key,"%s/%s",parent_key,skey);
val = cw_ktv_get(ktv,key,CW_TYPE_BSTR16);
if (val == NULL) {
cw_log(LOG_ERR,
"Error: Can't set sub-element %d from key %s in WTP Board Data. Key not found",type,key);
return 0;
}
d += cw_put_word(d, type);
d += cw_put_word(d, val->type->len(val));
d += val->type->put(val,d);
return d-dst;
}
int capwap_out_wtp_board_data(struct cw_ElemHandler * eh,
struct cw_ElemHandlerParams * params, uint8_t * dst)
{
cw_KTV_t * val;
mavl_t cfg;
uint8_t * d;
char key[256];
int l;
d=dst+4;
cfg = params->conn->local_cfg;
sprintf(key,"%s/%s",eh->key,CW_SKEY_VENDOR);
val = cw_ktv_get(cfg,key,CW_TYPE_DWORD);
if (val ==NULL) {
cw_log(LOG_ERR,
"Error: Can't send WTP Board Data element - %s not defined.", key);
return 0;
}
d += val->type->put(val,d);
/*cw_ktv_add(cfg,vendor_key,CW_TYPE_DWORD,data,len);*/
d+=write_boarddata_subelem(d,cfg,eh->key,CW_SKEY_MODELNO,CW_BOARDDATA_MODELNO);
d+=write_boarddata_subelem(d,cfg,eh->key,CW_SKEY_SERIALNO,CW_BOARDDATA_SERIALNO);
d+=write_boarddata_subelem(d,cfg,eh->key,"board-id",CW_BOARDDATA_BOARDID);
d+=write_boarddata_subelem(d,cfg,eh->key,"board-revision",CW_BOARDDATA_REVISION);
d+=write_boarddata_subelem(d,cfg,eh->key,"mac-address",CW_BOARDDATA_MACADDRESS);
l = d - dst-4;
return l + cw_put_elem_hdr(dst, CAPWAP_ELEM_WTP_BOARD_DATA, l );
}

View File

@ -1,16 +1,19 @@
#include "cw/mbag.h"
#include "cw/log.h"
#include "cw/conn.h"
#include "cw/capwap_items.h"
#include "cw/cw.h"
#include "cw/ktv.h"
#include "cw/keys.h"
#include "cw/dbg.h"
static int cw_put_encryption_subelems(uint8_t *dst,int capwap_mode)
{
int n=2;
dst+=cw_put_byte(dst,n);
int i;
dst+=cw_put_byte(dst,n);
for (i=0; i<n; i++){
dst+=cw_put_byte(dst,0);
dst+=cw_put_byte(dst,0);
@ -21,59 +24,56 @@ static int cw_put_encryption_subelems(uint8_t *dst,int capwap_mode)
}
int capwap_out_wtp_descriptor(struct conn *conn, struct cw_action_out *a, uint8_t * dst)
int capwap_out_wtp_descriptor(struct cw_ElemHandler * eh,
struct cw_ElemHandlerParams * params, uint8_t * dst)
{
char key[CW_KTV_MAX_KEY_LEN];
int len;
/* // XXX Dummy WTP Descriptor Header */
uint8_t *d;
cw_KTV_t * val;
d = dst+4;
mbag_t mbag = conn->config;
// XXX Dummy WTP Descriptor Header
uint8_t *d = dst+4;
//int n =conn->radios->count;
//printf("radio count %d\n",n);
d+=cw_put_byte(d,conn->radios->count); //max radios
d+=cw_put_byte(d,2); //radios in use
d+=cw_put_encryption_subelems(d,conn->capwap_mode);
mbag_item_t * i;
i = mbag_get(mbag,CW_ITEM_WTP_HARDWARE_VERSION);
/* if ( i ) {
d += cw_put_version(d,CW_SUBELEM_WTP_HARDWARE_VERSION,i->u2.data);
if (bstrv_get_vendor_id(i->u2.data)){
d += cw_put_dword(d, 0);
d += cw_put_word(d, CW_SUBELEM_WTP_HARDWARE_VERSION);
d += cw_put_word(d, bstrv_len(i->u2.data));
d += cw_put_data(d, bstrv_data(i->u2.data), bstrv_len(i->u2.data));
}
sprintf(key,"%s/%s",eh->key,CW_SKEY_MAX_RADIOS);
val = cw_ktv_get(params->conn->local_cfg,key, CW_TYPE_BYTE);
if (val != NULL)
d+=val->type->put(val,d);
else{
cw_dbg(DBG_WARN,"Cannot get value for %s, setting to 0", CW_SKEY_MAX_RADIOS);
d+=cw_put_byte(d,0);
}
else {
cw_log(LOG_ERR, "Can't send Hardware Version in WTP Descriptor, not set.");
sprintf(key,"%s/%s",eh->key,CW_SKEY_RADIOS_IN_USE);
val = cw_ktv_get(params->conn->local_cfg,key, CW_TYPE_BYTE);
if (val != NULL){
d+=val->type->put(val,d);
}
else{
d+=cw_put_byte(d,0); /*radios in use*/
}
*/
i = mbag_get(mbag,CW_ITEM_WTP_SOFTWARE_VERSION);
/* d+=cw_put_encryption_capabilities_7(d,1); */
d+=cw_put_encryption_subelems(d,params->conn->capwap_mode);
/* if ( i ) {
d += cw_put_version(d,CW_SUBELEM_WTP_SOFTWARE_VERSION,i->u2.data);
}
else {
cw_log(LOG_ERR, "Can't send Software Version in WTP descriptor, not set.");
}
i = mbag_get(mbag,CW_ITEM_WTP_BOOTLOADER_VERSION);
if ( i ) {
d += cw_put_version(d,CW_SUBELEM_WTP_BOOTLOADER_VERSION,i->u2.data);
}
else {
cw_log(LOG_ERR, "Can't send Bootloader Version in WTP descriptor, not set.");
}
cw_ktv_dump(params->conn->local_cfg,DBG_INFO,"*** ktv dump ***","","*** end of dump ***");
*/
int len = d-dst-4;
return len + cw_put_elem_hdr(dst,a->elem_id,len);
}
/* hardware version sub element */
sprintf(key,"%s/%s",eh->key,CW_SKEY_HARDWARE);
d+=cw_write_descriptor_subelem (d, params->conn->local_cfg,
CW_SUBELEM_WTP_HARDWARE_VERSION, key);
/* software version sub element */
sprintf(key,"%s/%s",eh->key,CW_SKEY_SOFTWARE);
d+=cw_write_descriptor_subelem (d, params->conn->local_cfg,
CW_SUBELEM_WTP_SOFTWARE_VERSION, key);
/* bootloader version sub element */
sprintf(key,"%s/%s",eh->key,CW_SKEY_BOOTLOADER);
d+=cw_write_descriptor_subelem (d, params->conn->local_cfg,
CW_SUBELEM_WTP_BOOTLOADER_VERSION, key);
len = d-dst-4;
return len + cw_put_elem_hdr(dst,eh->id,len);
}

View File

@ -11,8 +11,22 @@ struct cw_Mod *mod_capwap_wtp();
/*extern int capwap_in_wtp_descriptor(struct conn *conn, struct cw_ElemHandler *eh,
uint8_t * data, int len, struct sockaddr *from);*/
int capwap_in_wtp_descriptor(struct cw_ElemHandler *eh, struct cw_ElemHandlerParams *params, uint8_t * data,
int len);
int capwap_in_wtp_descriptor(struct cw_ElemHandler *eh,
struct cw_ElemHandlerParams *params, uint8_t * data, int len);
int capwap_out_wtp_descriptor(struct cw_ElemHandler * eh,
struct cw_ElemHandlerParams * params, uint8_t * dst);
int capwap_out_ac_descriptor(struct cw_ElemHandler * eh,
struct cw_ElemHandlerParams * params, uint8_t * dst);
/*
extern int capwap_in_wtp_board_data(struct conn *conn, struct cw_ElemHandler *a,
uint8_t * data, int len, struct sockaddr *from);
@ -20,7 +34,10 @@ extern int capwap_in_wtp_board_data(struct conn *conn, struct cw_ElemHandler *a,
int capwap_in_wtp_board_data(struct cw_ElemHandler *eh, struct cw_ElemHandlerParams *params,
uint8_t * data, int len);
int capwap_out_wtp_board_data(struct cw_ElemHandler * eh,
struct cw_ElemHandlerParams * params, uint8_t * dst);
int capwap_in_vendor_specific_payload(struct cw_ElemHandler *handler,
struct cw_ElemHandlerParams *params,
uint8_t * data, int len);

View File

@ -1,23 +1,37 @@
#include "cw/mbag.h"
#include "cw/mod.h"
#include "cw/log.h"
#include "cw/dbg.h"
#include "cw/ktv.h"
#include "cw/keys.h"
#include "cw/action.h"
#include "mod_capwap.h"
//static struct cw_actiondef actions;
extern int capwap_register_actions_ac(struct cw_actiondef *def);
static int init()
static int init(struct cw_Mod * mod, mavl_t global_cfg, int role)
{
cw_dbg(DBG_MOD, "CAPWAP: Initialiazing mod_capwap.");
switch (role){
case CW_ROLE_AC:{
cw_dbg(DBG_MOD, "CAPWAP: Initialiazing mod_capwap in AC mode");
cw_ktv_add_from_str(global_cfg,
"capwap/ac-descriptor/hardware/version",
CW_TYPE_BSTR16,"0.0.0.1");
cw_ktv_add_from_str(global_cfg,
"capwap/ac-descriptor/hardware/vendor",CW_TYPE_DWORD,"0");
cw_ktv_add_from_str(global_cfg,
"capwap/ac-descriptor/software/version",
CW_TYPE_BSTR16,"0.0.0.1");
cw_ktv_add_from_str(global_cfg,
"capwap/ac-descriptor/software/vendor",CW_TYPE_DWORD,"0");
}
break;
}
return 0;
}
@ -31,29 +45,18 @@ static int detect(struct conn *conn, const uint8_t * rawmsg, int rawlen, int ele
return 1;
}
static int register_actions(struct cw_actiondef *def, int mode)
{
if (mode != CW_MOD_MODE_CAPWAP)
return 0;
return 0; //capwap_register_actions_ac(def);
}
static struct cw_Mod capwap_ac = {
.name = "capwap",
.init = init,
.detect = detect,
.register_actions = register_actions,
.register_messages = capwap_register_msg_set
static struct cw_Mod capwap_data = {
"capwap", /* name */
init, /* init */
detect, /* detect */
capwap_register_msg_set, /* register_messages */
NULL, /* dll_handle */
NULL /* data */
};
struct cw_Mod *mod_capwap_ac()
{
return &capwap_ac;
};
struct cw_Mod * mod_capwap(){
return &capwap_ac;
}
return &capwap_data;
}

View File

@ -40,7 +40,7 @@ OBJDIR := ../../../obj/mod_cisco/$(ARCH)
SNAME := $(LIBARCHDIR)/libmod_cisco.a
DNAME := $(LIBARCHDIR)/mod_cisco.so
MODNAME := $(LIBDIR)/mod_cisco.so
SLIBS := -lcw -lmod_cipwap -lmod_capwap -lconfuse
SLIBS := -lcw -lmod_capwap -lconfuse
include ../Mod.mak

View File

@ -33,7 +33,7 @@
#include "include/capwap_actions.h"
#include "mod_cisco.h"
#include "cisco.h"
#include "cisco_items.h"
@ -134,7 +134,7 @@ static cw_action_in_t actions_in[] = {
{
.capwap_state = CAPWAP_STATE_DISCOVERY,
.msg_id = CAPWAP_MSG_DISCOVERY_REQUEST,
.end = cw_in_check_disc_req
/* .end = cw_in_check_disc_req*/
}
,
@ -262,7 +262,7 @@ static cw_action_in_t actions_in[] = {
/* We have to deal with zero-length strings */
.capwap_state = CW_STATE_CONFIGURE,
.msg_id = CAPWAP_MSG_CONFIGURATION_STATUS_REQUEST,
.elem_id = CW_ELEM_AC_NAME,
.elem_id = CAPWAP_ELEM_AC_NAME,
.item_id = CW_ITEM_AC_NAME,
.start = cw_in_generic,
.min_len = 0,
@ -507,7 +507,7 @@ static cw_action_out_t actions_out[]={
.vendor_id = CW_VENDOR_ID_CISCO,
.elem_id = CW_CISCO_RAD_NAME,
.out=cw_out_generic,
.get = cw_out_get_outgoing
/*.get = cw_out_get_outgoing*/
}
,
@ -528,7 +528,7 @@ static cw_action_out_t actions_out[]={
.elem_id = CW_CISCO_AP_LED_STATE_CONFIG,
.item_id = CISCO_ITEM_AP_LED_STATE_CONFIG,
.out = cw_out_generic,
.get = cw_out_get_outgoing,
/*.get = cw_out_get_outgoing,*/
.mand = 0
}
,
@ -541,7 +541,7 @@ static cw_action_out_t actions_out[]={
.elem_id = CW_CISCO_AP_LED_FLASH_CONFIG,
.item_id = CISCO_ITEM_AP_LED_FLASH_CONFIG,
.out = cw_out_generic,
.get = cw_out_get_outgoing,
/*.get = cw_out_get_outgoing,*/
.mand = 0
}
,
@ -553,7 +553,7 @@ static cw_action_out_t actions_out[]={
.elem_id = CW_CISCO_AP_MODE_AND_TYPE,
.item_id = CISCO_ITEM_AP_MODE_AND_TYPE,
.out = cw_out_generic,
.get = cw_out_get_outgoing,
/*.get = cw_out_get_outgoing,*/
}
,
@ -601,7 +601,7 @@ static cw_action_in_t actions80211_in[] = {
.msg_id = CAPWAP_MSG_DISCOVERY_REQUEST,
.elem_id = CW_ELEM80211_WTP_RADIO_INFORMATION,
.item_id = CW_RADIOITEM80211_WTP_RADIO_INFORMATION,
.start = cw_in_radio_generic,
/*.start = cw_in_radio_generic, */
.mand = 0,
.min_len = 5,
.max_len = 5
@ -618,7 +618,7 @@ static cw_action_in_t actions80211_in[] = {
.msg_id = CAPWAP_MSG_CONFIGURATION_STATUS_REQUEST,
.elem_id = CW_CISCO_SUPPORTED_RATES,
.item_id = CW_RADIOITEM80211_SUPPORTED_RATES,
.start = cw_in_radio_generic,
/*.start = cw_in_radio_generic, */
.mand = 0,
.min_len = 5,
.max_len = 5

View File

@ -31,7 +31,7 @@
#include "include/cipwap_items.h"
#include "mod_cisco.h"
/*#include "mod_cisco.h"*/
#include "cisco.h"
#include "cisco80211.h"
@ -284,7 +284,7 @@ static cw_action_out_t actions_out[]={
.elem_id = CW_CISCO_RAD_NAME,
.item_id = CW_ITEM_WTP_NAME,
.out = cw_out_generic,
.get = cw_out_get_config,
/* .get = cw_out_get_config,*/
.mand = 1
}
,
@ -321,7 +321,7 @@ static cw_action_out_t actions_out[]={
.elem_id = CW_CISCO_AP_GROUP_NAME,
.item_id = CIPWAP_ITEM_WTP_GROUP_NAME,
.out = cw_out_generic,
.get = cw_out_get_config,
/*.get = cw_out_get_config,*/
.mand = 1
}
,
@ -333,7 +333,7 @@ static cw_action_out_t actions_out[]={
.elem_id = CW_CISCO_BOARD_DATA_OPTIONS,
.item_id = CW_ITEM_CISCO_BOARD_DATA_OPTIONS,
.out = cisco_out_board_data_options,
.get = cw_out_get_config,
/* .get = cw_out_get_config,*/
.mand = 1
}
,
@ -359,7 +359,7 @@ static cw_action_out_t actions_out[]={
.elem_id = CW_CISCO_AP_MODE_AND_TYPE,
.item_id = CISCO_ITEM_AP_MODE_AND_TYPE,
.out = cw_out_generic,
.get = cw_out_get_config,
/* .get = cw_out_get_config,*/
.mand = 1
}
,
@ -493,7 +493,7 @@ static cw_action_out_t actions80211_out[]={
.elem_id = CW_ELEM80211_WTP_RADIO_INFORMATION,
.item_id = CW_RADIOITEM80211_WTP_RADIO_INFORMATION,
.out = cisco_out_80211_wtp_radio_cfg,
.get = cw_out_get_config,
/*.get = cw_out_get_config,*/
.mand = 1
}
,

View File

@ -1,28 +1,20 @@
#include "cw/log.h"
#include "cw/conn.h"
#include "cw/capwap_items.h"
#include "cw/cw.h"
#include "cisco.h"
#include "cw/ktv.h"
#include "cw/keys.h"
#include "cw/dbg.h"
int cisco_out_wtp_descriptor(struct cw_ElemHandler * eh, struct cw_ElemHandlerParams * params
, uint8_t * dst)
int cisco_out_wtp_descriptor(struct cw_ElemHandler * eh,
struct cw_ElemHandlerParams * params, uint8_t * dst)
{
char key[256];
char key[CW_KTV_MAX_KEY_LEN];
int len;
/* // XXX Dummy WTP Descriptor Header */
uint8_t *d;
cw_KTV_t * val;
d = dst+4;
/*cw_ktv_init_byte(&val,8);*/
sprintf(key,"%s/%s",eh->key,CW_SKEY_MAX_RADIOS);
val = cw_ktv_get(params->conn->local_cfg,key, CW_TYPE_BYTE);
if (val != NULL)
@ -32,7 +24,7 @@ int cisco_out_wtp_descriptor(struct cw_ElemHandler * eh, struct cw_ElemHandlerPa
d+=cw_put_byte(d,0);
}
sprintf(key,"%s/%s",eh->key,CW_SKEY_RADIOS_IN_USE);
sprintf(key,"%s/%s",eh->key,CW_SKEY_RADIOS_IN_USE);
val = cw_ktv_get(params->conn->local_cfg,key, CW_TYPE_BYTE);
if (val != NULL){
d+=val->type->put(val,d);
@ -41,28 +33,8 @@ int cisco_out_wtp_descriptor(struct cw_ElemHandler * eh, struct cw_ElemHandlerPa
d+=cw_put_byte(d,0); /*radios in use*/
}
/*len = handler->type->put(elem,dst+start);*/
d+=cw_put_encryption_capabilities_7(d,1);
/* d += cw_put_dword(d, bstrv_get_vendor_id(v));
d += cw_put_dword(d, (subelem_id << 16) | bstrv_len(v));
d += cw_put_data(d, bstrv_data(v), bstrv_len(v));
*/
/* sprintf(key,"%s/%s/%s",eh->key,CW_SKEY_HARDWARE,CW_SKEY_VENDOR);
vendor = cw_ktv_get(params->conn->local_cfg,key,CW_TYPE_DWORD);
sprintf(key,"%s/%s/%s",eh->key,CW_SKEY_HARDWARE,CW_SKEY_VENDOR);
version = cw_ktv_get(params->conn->local_cfg,key,CW_TYPE_BSTR16);
if (vendor == NULL){
cw_log(LOG_ERR, "Can't send %s, not found.", key);
}
*/
/* hardware version sub element */
sprintf(key,"%s/%s",eh->key,CW_SKEY_HARDWARE);
@ -74,43 +46,11 @@ int cisco_out_wtp_descriptor(struct cw_ElemHandler * eh, struct cw_ElemHandlerPa
d+=cw_write_descriptor_subelem (d, params->conn->local_cfg,
CW_SUBELEM_WTP_SOFTWARE_VERSION, key);
/* bootloader version sub element */
/* bootloader version sub element */
sprintf(key,"%s/%s",eh->key,CW_SKEY_BOOTLOADER);
d+=cw_write_descriptor_subelem (d, params->conn->local_cfg,
CW_SUBELEM_WTP_BOOTLOADER_VERSION, key);
/* mbag_item_t * i;
i = mbag_get(mbag,CW_ITEM_WTP_HARDWARE_VERSION);
*/
/* if ( i ) {
d += cw_put_version(d,CW_SUBELEM_WTP_HARDWARE_VERSION,i->u2.data);
}
else {
cw_log(LOG_ERR, "Can't send Hardware Version in WTP Descriptor, not set.");
}
*/
/*i = mbag_get(mbag,CW_ITEM_WTP_SOFTWARE_VERSION);*/
/*
if ( i ) {
d += cw_put_version(d,CW_SUBELEM_WTP_SOFTWARE_VERSION,i->u2.data);
}
else {
cw_log(LOG_ERR, "Can't send Software Version in WTP descriptor, not set.");
}
i = mbag_get(mbag,CW_ITEM_WTP_BOOTLOADER_VERSION);
if ( i ) {
d += cw_put_version(d,CW_SUBELEM_WTP_BOOTLOADER_VERSION,i->u2.data);
}
else {
cw_log(LOG_ERR, "Can't send Bootloader Version in WTP descriptor, not set.");
}
*/
len = d-dst-4;
return len + cw_put_elem_hdr(dst,eh->id,len);
}
}

View File

@ -1,9 +0,0 @@
#ifndef __MOD_CISCO_H
#define __MOD_CISCO_H
struct cw_Mod * mod_cisco_ac();
struct cw_Mod * mod_cisco_wtp();
struct cw_MsgSet * cisco_register_msg_set(struct cw_MsgSet * set, int mode);
#endif

View File

@ -7,7 +7,7 @@
#include "cw/action.h"
#include "mod_cisco.h"
/*#include "mod_cisco.h"*/
#include "../modload.h"
#include "cw/vendors.h"

View File

@ -154,7 +154,7 @@ static cw_action_in_t actions_in[] = {
/* We have to deal with zero-length strings */
.capwap_state = CW_STATE_CONFIGURE,
.msg_id = CW_MSG_CONFIGURATION_STATUS_REQUEST,
.elem_id = CW_ELEM_AC_NAME,
.elem_id = CAPWAP_ELEM_AC_NAME,
.item_id = CW_ITEM_AC_NAME,
.start = cw_in_generic2,
.min_len = 0,

View File

@ -8,12 +8,12 @@ struct cw_Mod * modload_wtp(const char *name);
#include "cipwap/mod_cipwap.h"
#include "capwap/mod_capwap.h"
#include "cisco/mod_cisco.h"
#include "fortinet/mod_fortinet.h"
#include "zyxel/mod_zyxel.h"
#include "capwap80211/mod_capwap80211.h"
#define MODS_AC { mod_capwap_ac, mod_cipwap_ac, mod_cisco_ac, /*mod_zyxel_ac,*/ mod_capwap80211_ac, mod_fortinet_ac, NULL }
#define MODS_WTP { mod_capwap_wtp, mod_cipwap_wtp, mod_cisco_wtp, mod_capwap80211_wtp, mod_fortinet_wtp, NULL }
#define MODS_AC { mod_capwap_ac, mod_cipwap_ac, /*mod_zyxel_ac,*/ mod_capwap80211_ac, mod_fortinet_ac, NULL }
#define MODS_WTP { mod_capwap_wtp, mod_cipwap_wtp, mod_capwap80211_wtp, mod_fortinet_wtp, NULL }