can partially read wtp descriptor
FossilOrigin-Name: 87c986decab2956c060dc9212e5bd4d89bed829ec528477817f8ab795c396853
This commit is contained in:
parent
8817d54d14
commit
14a9c95eb8
@ -3,9 +3,9 @@
|
|||||||
<Project Name="ac" Path="ac.project" Active="No"/>
|
<Project Name="ac" Path="ac.project" Active="No"/>
|
||||||
<Project Name="wtp" Path="wtp.project" Active="No"/>
|
<Project Name="wtp" Path="wtp.project" Active="No"/>
|
||||||
<Project Name="mod_cipwap" Path="mod_cipwap.project" Active="No"/>
|
<Project Name="mod_cipwap" Path="mod_cipwap.project" Active="No"/>
|
||||||
<Project Name="mod_capwap" Path="mod_capwap.project" Active="Yes"/>
|
<Project Name="mod_capwap" Path="mod_capwap.project" Active="No"/>
|
||||||
<Project Name="mod_cisco" Path="mod_cisco.project" Active="No"/>
|
<Project Name="mod_cisco" Path="mod_cisco.project" Active="No"/>
|
||||||
<Project Name="libcw" Path="libcw.project" Active="No"/>
|
<Project Name="libcw" Path="libcw.project" Active="Yes"/>
|
||||||
<Project Name="mod_capwap80211" Path="mod_capwap80211.project" Active="No"/>
|
<Project Name="mod_capwap80211" Path="mod_capwap80211.project" Active="No"/>
|
||||||
<Project Name="mod_fortinet" Path="mod_fortinet.project" Active="No"/>
|
<Project Name="mod_fortinet" Path="mod_fortinet.project" Active="No"/>
|
||||||
<BuildMatrix>
|
<BuildMatrix>
|
||||||
|
@ -1,48 +0,0 @@
|
|||||||
#include "cw.h"
|
|
||||||
|
|
||||||
#include "capwap.h"
|
|
||||||
#include "capwap_items.h"
|
|
||||||
#include "dbg.h"
|
|
||||||
|
|
||||||
|
|
||||||
int cw_read_wtp_descriptor(mbag_t mbag, struct conn *conn,
|
|
||||||
struct cw_action_in *a, uint8_t * data, int len,struct cw_descriptor_subelem_def *allowed)
|
|
||||||
{
|
|
||||||
|
|
||||||
mbag_set_byte(mbag, CW_ITEM_WTP_MAX_RADIOS, cw_get_byte(data));
|
|
||||||
mbag_set_byte(mbag, CW_ITEM_WTP_RADIOS_IN_USE, cw_get_byte(data + 1));
|
|
||||||
|
|
||||||
|
|
||||||
/* Get number of encryption elements */
|
|
||||||
int ncrypt = cw_get_byte(data + 2);
|
|
||||||
if (ncrypt == 0) {
|
|
||||||
if (conn->strict_capwap) {
|
|
||||||
cw_dbg(DBG_ELEM_ERR,
|
|
||||||
"Bad WTP Descriptor, number of encryption elements is 0.");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
cw_dbg(DBG_RFC,
|
|
||||||
"Non standard conform WTP Descriptor, number of encryptoin elements is 0.");
|
|
||||||
}
|
|
||||||
|
|
||||||
int pos = 3;
|
|
||||||
int i;
|
|
||||||
for (i = 0; i < ncrypt; i++) {
|
|
||||||
// It's a dummy for now
|
|
||||||
pos += 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct cw_descriptor_subelem_def allowed_default[] = {
|
|
||||||
{0,CW_SUBELEM_WTP_HARDWARE_VERSION, CW_ITEM_WTP_HARDWARE_VERSION, 1024,1},
|
|
||||||
{0,CW_SUBELEM_WTP_SOFTWARE_VERSION, CW_ITEM_WTP_SOFTWARE_VERSION, 1024,1},
|
|
||||||
{0,CW_SUBELEM_WTP_BOOTLOADER_VERSION, CW_ITEM_WTP_SOFTWARE_VERSION, 1024,1},
|
|
||||||
{0,CW_SUBELEM_WTP_OTHERSOFTWARE_VERSION, CW_ITEM_WTP_SOFTWARE_VERSION, 1024,0},
|
|
||||||
{0,0, NULL, 0,0}
|
|
||||||
};
|
|
||||||
|
|
||||||
if (!allowed) {
|
|
||||||
allowed=allowed_default;
|
|
||||||
}
|
|
||||||
|
|
||||||
return cw_read_descriptor_subelems(conn->incomming, data + pos, len - pos, allowed);
|
|
||||||
}
|
|
@ -328,7 +328,6 @@
|
|||||||
<File Name="src/cw/mavl_cmp_kv.c"/>
|
<File Name="src/cw/mavl_cmp_kv.c"/>
|
||||||
<File Name="src/cw/mavl_add_kv_byte.c"/>
|
<File Name="src/cw/mavl_add_kv_byte.c"/>
|
||||||
<File Name="src/cw/cw_types_mavl_delete.c"/>
|
<File Name="src/cw/cw_types_mavl_delete.c"/>
|
||||||
<File Name="src/cw/cw_read_elem.c"/>
|
|
||||||
</VirtualDirectory>
|
</VirtualDirectory>
|
||||||
</VirtualDirectory>
|
</VirtualDirectory>
|
||||||
<Description/>
|
<Description/>
|
||||||
|
@ -139,8 +139,9 @@ extern const char CW_ITEM_CAPWAP_TRANSPORT_PROTOCOL[];
|
|||||||
|
|
||||||
|
|
||||||
/* CIPWAP and Cisco */
|
/* CIPWAP and Cisco */
|
||||||
|
/*
|
||||||
//extern const char CW_ITEM_WTP_GROUP_NAME[];
|
//extern const char CW_ITEM_WTP_GROUP_NAME[];
|
||||||
|
*/
|
||||||
|
|
||||||
/* Other Items */
|
/* Other Items */
|
||||||
extern const char CW_ITEM_AC_IMAGE_DIR[]; /* Path where WTP images are stored */
|
extern const char CW_ITEM_AC_IMAGE_DIR[]; /* Path where WTP images are stored */
|
||||||
@ -177,10 +178,10 @@ extern const char CW_ITEM_WTP_MAX_RADIOS[];
|
|||||||
extern const char CW_ITEM_RADIO_INFOS[];
|
extern const char CW_ITEM_RADIO_INFOS[];
|
||||||
extern const char CW_ITEM_ECN_SUPPORT[];
|
extern const char CW_ITEM_ECN_SUPPORT[];
|
||||||
|
|
||||||
|
/*
|
||||||
//extern const char CW_ITEM_SSH_ENABLE[];
|
//extern const char CW_ITEM_SSH_ENABLE[];
|
||||||
//extern const char CW_ITEM_TELNET_ENABLE[];
|
//extern const char CW_ITEM_TELNET_ENABLE[];
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -399,10 +399,11 @@ static int process_elements(struct conn *conn, uint8_t * rawmsg, int len,
|
|||||||
|
|
||||||
elem_len = cw_get_elem_len(elem);
|
elem_len = cw_get_elem_len(elem);
|
||||||
|
|
||||||
|
|
||||||
cw_read_elem(handler, conn, cw_get_elem_data(elem), elem_len, from);
|
|
||||||
|
|
||||||
printf ("Would start elem processing now %d - %s\n",handler->id, handler->name);
|
printf ("Would start elem processing now %d - %s\n",handler->id, handler->name);
|
||||||
|
|
||||||
|
handler->get(conn, handler, cw_get_elem_data(elem), elem_len, from);
|
||||||
|
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
exit(0);
|
exit(0);
|
||||||
|
|
||||||
@ -476,6 +477,29 @@ exit(0);
|
|||||||
/* all message elements are processed, do now after processing
|
/* all message elements are processed, do now after processing
|
||||||
by calling the "end" function for the message */
|
by calling the "end" function for the message */
|
||||||
|
|
||||||
|
{
|
||||||
|
|
||||||
|
mavliter_t it;
|
||||||
|
const struct cw_Type * type;
|
||||||
|
printf("********** THE REMODE CFG **************\n");
|
||||||
|
mavliter_init(&it,conn->remote_cfg);
|
||||||
|
|
||||||
|
|
||||||
|
mavliter_foreach(&it){
|
||||||
|
char value[500];
|
||||||
|
mavldata_t * data;
|
||||||
|
data = mavliter_get(&it);
|
||||||
|
type = data->kv.priv;
|
||||||
|
type->to_str(data,value,0);
|
||||||
|
|
||||||
|
printf("Got %s (%s): %s\n",data->kv.key,type->name, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//int result_code = 0;
|
//int result_code = 0;
|
||||||
|
|
||||||
|
|
||||||
|
38
src/cw/cw.h
38
src/cw/cw.h
@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
#include "lw.h"
|
#include "lw.h"
|
||||||
#include "capwap.h"
|
#include "capwap.h"
|
||||||
|
#include "message_set.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @defgroup CW CW
|
* @defgroup CW CW
|
||||||
@ -275,7 +276,7 @@ extern int cw_put_mbag_item(uint8_t * dst, struct mbag_item *item);
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Put encryption capabilities as described in CAWAP
|
* Put encryption capabilities as described in CAWAP
|
||||||
* draft 7 fpr WTP Descriptor
|
* draft 7 fpr WTP DescriptorSubelemDef
|
||||||
* @param dst Destination buffer
|
* @param dst Destination buffer
|
||||||
* @param cap Capability
|
* @param cap Capability
|
||||||
* @return number of bytes put
|
* @return number of bytes put
|
||||||
@ -295,10 +296,10 @@ int cw_put_version(uint8_t * dst, uint16_t subelem_id, bstrv_t v);
|
|||||||
extern int cw_put_ac_status(uint8_t * dst, struct cw_ac_status *s, struct conn *conn);
|
extern int cw_put_ac_status(uint8_t * dst, struct cw_ac_status *s, struct conn *conn);
|
||||||
|
|
||||||
|
|
||||||
struct cw_descriptor_subelem_def {
|
struct cw_DescriptorSubelemDef {
|
||||||
int vendor_id;
|
int vendor_id;
|
||||||
int type;
|
int type;
|
||||||
const char *item_id;
|
const char *key;
|
||||||
int maxlen;
|
int maxlen;
|
||||||
int mand;
|
int mand;
|
||||||
};
|
};
|
||||||
@ -310,19 +311,26 @@ struct cw_descriptor_subelem_def {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
extern int cw_read_descriptor_subelems(mbag_t store, uint8_t * data, int len,
|
extern int cw_read_descriptor_subelems(mavl_t store, uint8_t * data, int len,
|
||||||
struct cw_descriptor_subelem_def *elems);
|
struct cw_DescriptorSubelemDef *elems);
|
||||||
|
|
||||||
extern int cw_read_wtp_descriptor(mbag_t mbag, struct conn *conn,
|
/*
|
||||||
struct cw_action_in *a, uint8_t * data, int len,
|
int cw_read_wtp_descriptor(mavl_t mbag, struct conn *conn,
|
||||||
struct cw_descriptor_subelem_def *allowed);
|
struct cw_ElemHandler *eh, uint8_t * data, int len,
|
||||||
|
struct cw_DescriptorSubelemDef *allowed);
|
||||||
|
*/
|
||||||
|
|
||||||
extern int cw_read_wtp_descriptor_7(mbag_t mbag, struct conn *conn,
|
int cw_read_wtp_descriptor(mavl_t mbag, struct conn *conn,
|
||||||
struct cw_action_in *a, uint8_t * data, int len,
|
struct cw_ElemHandler *eh, uint8_t * data, int len,
|
||||||
struct cw_descriptor_subelem_def *allowed);
|
struct cw_DescriptorSubelemDef *allowed);
|
||||||
|
|
||||||
|
|
||||||
|
extern int cw_read_wtp_descriptor_7(mavl_t mbag, struct conn *conn,
|
||||||
|
struct cw_ElemHandler *eh, uint8_t * data, int len,
|
||||||
|
struct cw_DescriptorSubelemDef *allowed);
|
||||||
|
|
||||||
extern int cw_read_ac_descriptor(mbag_t store, uint8_t * data, int len,
|
extern int cw_read_ac_descriptor(mbag_t store, uint8_t * data, int len,
|
||||||
struct cw_descriptor_subelem_def *allowed);
|
struct cw_DescriptorSubelemDef *allowed);
|
||||||
|
|
||||||
extern int cw_read_wtp_descriptor_versions(mbag_t mbag, uint8_t * data, int len);
|
extern int cw_read_wtp_descriptor_versions(mbag_t mbag, uint8_t * data, int len);
|
||||||
|
|
||||||
@ -342,11 +350,9 @@ extern int cw_in_mtu_discovery_padding(struct conn *conn, struct cw_action_in *a
|
|||||||
* @defgroup CWELEMIN Input Handlers for Message Elements
|
* @defgroup CWELEMIN Input Handlers for Message Elements
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
int cw_in_generic(struct conn * conn, struct cw_ElemHandler * handler,
|
||||||
|
uint8_t * elem_data, int elem_len, struct sockaddr * from);
|
||||||
|
|
||||||
extern int cw_in_generic(struct conn *conn, struct cw_action_in *a, uint8_t * data,
|
|
||||||
int len,struct sockaddr *from);
|
|
||||||
extern int cw_in_generic2(struct conn *conn, struct cw_action_in *a, uint8_t * data,
|
|
||||||
int len,struct sockaddr *from);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ int cw_in_ac_descriptor(struct conn *conn, struct cw_action_in *a, uint8_t * dat
|
|||||||
|
|
||||||
mbag_set_ptr(conn->incomming, CW_ITEM_AC_STATUS, status);
|
mbag_set_ptr(conn->incomming, CW_ITEM_AC_STATUS, status);
|
||||||
|
|
||||||
static struct cw_descriptor_subelem_def allowed[] = {
|
static struct cw_DescriptorSubelemDef allowed[] = {
|
||||||
{0,CW_SUBELEM_AC_HARDWARE_VERSION, CW_ITEM_WTP_HARDWARE_VERSION, 1024,1},
|
{0,CW_SUBELEM_AC_HARDWARE_VERSION, CW_ITEM_WTP_HARDWARE_VERSION, 1024,1},
|
||||||
{0,CW_SUBELEM_AC_SOFTWARE_VERSION, CW_ITEM_WTP_SOFTWARE_VERSION, 1024,1},
|
{0,CW_SUBELEM_AC_SOFTWARE_VERSION, CW_ITEM_WTP_SOFTWARE_VERSION, 1024,1},
|
||||||
{0,0, NULL,0, 0}
|
{0,0, NULL,0, 0}
|
||||||
|
@ -1,125 +1,16 @@
|
|||||||
|
#include "message_set.h"
|
||||||
|
#include "cw_types.h"
|
||||||
|
|
||||||
#include "mbag.h"
|
int cw_in_generic(struct conn * conn, struct cw_ElemHandler * handler,
|
||||||
#include "action.h"
|
uint8_t * elem_data, int elem_len, struct sockaddr * from){
|
||||||
#include "dbg.h"
|
mavldata_t data, *result;
|
||||||
#include "log.h"
|
char str[30];
|
||||||
#include "mbag.h"
|
|
||||||
#include "cw.h"
|
|
||||||
|
|
||||||
/// TODO XXXX
|
result = handler->type->get(&data,elem_data,elem_len);
|
||||||
int static check_len(struct conn *conn, struct cw_action_in *a, uint8_t * data, int len,
|
result->kv.key = strdup(handler->key);
|
||||||
struct sockaddr *from)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
if (len < a->min_len) {
|
|
||||||
cw_dbg(DBG_ELEM_ERR,
|
|
||||||
"%d (%s) message element too short, len=%d, min len=%d",
|
|
||||||
a->elem_id, cw_strelemp(conn->actions, a->elem_id), len,
|
|
||||||
a->min_len);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
if (len > a->max_len) {
|
|
||||||
cw_dbg(DBG_ELEM_ERR,
|
|
||||||
"%d (%s) message element too big, len=%d, max len=%d", a->elem_id,
|
|
||||||
cw_strelemp(conn->actions, a->elem_id), len, a->max_len);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
handler->type->to_str(result,str,30);
|
||||||
int static do_save(mbag_t itemstore, struct conn *conn, struct cw_action_in *a,
|
printf("Read %d-%s: %s %s\n", handler->id, handler->name, handler->key, str);
|
||||||
uint8_t * data, int len, struct sockaddr *from)
|
mavl_add(conn->remote_cfg, result);
|
||||||
{
|
|
||||||
|
|
||||||
if (a->itemtype == MBAG_BYTE) {
|
|
||||||
mbag_set_byte(itemstore, a->item_id, *data);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if (a->itemtype == MBAG_WORD) {
|
|
||||||
mbag_set_word(itemstore, a->item_id, cw_get_word(data));
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if (a->itemtype == MTYPE_DWORD) {
|
|
||||||
mbag_set_dword(itemstore, a->item_id, cw_get_dword(data));
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if (a->itemtype == MBAG_STR) {
|
|
||||||
mbag_set_strn(itemstore, a->item_id, (char *) data, len);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
if (a->itemtype == MBAG_BSTR) {
|
|
||||||
mbag_set_bstrn(itemstore, a->item_id, data, len);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (a->itemtype == MBAG_BSTR16) {
|
|
||||||
mbag_set_bstr16n(itemstore, a->item_id, data, len);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* if (a->itemtype == MBAG_DATA) {
|
|
||||||
mbag_set_data(itemstore, a->item_id, data, len);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
if (a->itemtype == MBAG_VENDORSTR) {
|
|
||||||
mbag_set_bstrv(itemstore, a->item_id,
|
|
||||||
cw_get_dword(data), data + 4, len - 4);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
cw_log(LOG_ERR,
|
|
||||||
"Can't handle item type %d in definition for incomming msg %d (%s) - %d, cw_in_generic.",
|
|
||||||
a->itemtype, a->msg_id, cw_strmsg(a->msg_id), a->elem_id);
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int cw_in_generic(struct conn *conn, struct cw_action_in *a, uint8_t * data, int len,
|
|
||||||
struct sockaddr *from)
|
|
||||||
{
|
|
||||||
|
|
||||||
if (!check_len(conn, a, data, len, from))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
|
|
||||||
mbag_t itemstore;
|
|
||||||
/// if (!a->target)
|
|
||||||
itemstore = conn->incomming;
|
|
||||||
// else
|
|
||||||
// itemstore = a->target(conn, a);
|
|
||||||
|
|
||||||
|
|
||||||
return do_save(itemstore, conn, a, data, len, from);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
int cw_in_radio_generic(struct conn *conn, struct cw_action_in *a, uint8_t * data,
|
|
||||||
int len, struct sockaddr *from)
|
|
||||||
{
|
|
||||||
// if (!check_len(conn, a, data, len, from))
|
|
||||||
// return 0;
|
|
||||||
|
|
||||||
int rid = cw_get_byte(data);
|
|
||||||
mbag_t radio = mbag_i_get_mbag(conn->radios, rid, NULL);
|
|
||||||
if (!radio) {
|
|
||||||
if (a->vendor_id != 0
|
|
||||||
|| ( (a->vendor_id == 0) && (a->msg_id != CW_MSG_DISCOVERY_REQUEST
|
|
||||||
&& a->msg_id != CW_MSG_JOIN_REQUEST) )) {
|
|
||||||
cw_dbg(DBG_ELEM_ERR, "Radio not found %d", rid);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
mbag_i_set_mbag(conn->radios,rid,mbag_create());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
@ -3,7 +3,8 @@
|
|||||||
#include "dbg.h"
|
#include "dbg.h"
|
||||||
#include "mbag.h"
|
#include "mbag.h"
|
||||||
|
|
||||||
int cw_read_ac_descriptor(mbag_t store, uint8_t *data, int len, struct cw_descriptor_subelem_def *allowed)
|
int cw_read_ac_descriptor(mbag_t store, uint8_t *data, int len,
|
||||||
|
struct cw_DescriptorSubelemDef *allowed)
|
||||||
{
|
{
|
||||||
struct cw_ac_status *status = malloc(sizeof(struct cw_ac_status));
|
struct cw_ac_status *status = malloc(sizeof(struct cw_ac_status));
|
||||||
if (!status)
|
if (!status)
|
||||||
@ -24,9 +25,9 @@ int cw_read_ac_descriptor(mbag_t store, uint8_t *data, int len, struct cw_descri
|
|||||||
|
|
||||||
mbag_set_ptr(store, CW_ITEM_AC_STATUS, status);
|
mbag_set_ptr(store, CW_ITEM_AC_STATUS, status);
|
||||||
|
|
||||||
static struct cw_descriptor_subelem_def allowed_default[] = {
|
static struct cw_DescriptorSubelemDef allowed_default[] = {
|
||||||
{0,CW_SUBELEM_AC_HARDWARE_VERSION, CW_ITEM_WTP_HARDWARE_VERSION, 1024,1},
|
{0,CW_SUBELEM_AC_HARDWARE_VERSION, "ac_hardware_versision", 1024,1},
|
||||||
{0,CW_SUBELEM_AC_SOFTWARE_VERSION, CW_ITEM_WTP_SOFTWARE_VERSION, 1024,1},
|
{0,CW_SUBELEM_AC_SOFTWARE_VERSION, "ac_software_version", 1024,1},
|
||||||
{0,0, NULL,0, 0}
|
{0,0, NULL,0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -19,9 +19,13 @@
|
|||||||
#include "cw.h"
|
#include "cw.h"
|
||||||
#include "dbg.h"
|
#include "dbg.h"
|
||||||
|
|
||||||
int cw_read_descriptor_subelems(mbag_t store, uint8_t * data, int len,
|
int cw_read_descriptor_subelems(mavl_t store, uint8_t * data, int len,
|
||||||
struct cw_descriptor_subelem_def *elems)
|
struct cw_DescriptorSubelemDef *elems)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
printf("sub reader\n");
|
||||||
|
|
||||||
|
|
||||||
int errors = 0;
|
int errors = 0;
|
||||||
int success = 0;
|
int success = 0;
|
||||||
int sub = 0;
|
int sub = 0;
|
||||||
@ -36,10 +40,14 @@ int cw_read_descriptor_subelems(mbag_t store, uint8_t * data, int len,
|
|||||||
|
|
||||||
bstrv_t vstr = NULL;
|
bstrv_t vstr = NULL;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
/* search sub-element */
|
||||||
for (i = 0; elems[i].maxlen; i++) {
|
for (i = 0; elems[i].maxlen; i++) {
|
||||||
if (elems[i].type == subtype && elems[i].vendor_id==vendor_id)
|
if (elems[i].type == subtype && elems[i].vendor_id==vendor_id)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!elems[i].maxlen) {
|
if (!elems[i].maxlen) {
|
||||||
vstr = bstrv_create(vendor_id, data + sub + 8, sublen);
|
vstr = bstrv_create(vendor_id, data + sub + 8, sublen);
|
||||||
if (vstr) {
|
if (vstr) {
|
||||||
@ -58,11 +66,11 @@ int cw_read_descriptor_subelems(mbag_t store, uint8_t * data, int len,
|
|||||||
}
|
}
|
||||||
|
|
||||||
vstr =
|
vstr =
|
||||||
mbag_set_bstrv(store, elems[i].item_id, vendor_id,
|
mbag_set_bstrv(store, elems[i].key, vendor_id,
|
||||||
data + sub + 8, l);
|
data + sub + 8, l);
|
||||||
|
|
||||||
char dbgstr[128];
|
char dbgstr[128];
|
||||||
sprintf(dbgstr, "Storing '%s'", elems[i].item_id);
|
sprintf(dbgstr, "Storing '%s'", elems[i].key);
|
||||||
cw_dbg_version_subelem(DBG_SUBELEM, dbgstr, subtype, vstr);
|
cw_dbg_version_subelem(DBG_SUBELEM, dbgstr, subtype, vstr);
|
||||||
success++;
|
success++;
|
||||||
}
|
}
|
||||||
|
@ -1,2 +0,0 @@
|
|||||||
|
|
||||||
|
|
@ -3,18 +3,41 @@
|
|||||||
#include "capwap.h"
|
#include "capwap.h"
|
||||||
#include "capwap_items.h"
|
#include "capwap_items.h"
|
||||||
#include "dbg.h"
|
#include "dbg.h"
|
||||||
|
#include "cw_types.h"
|
||||||
|
|
||||||
|
|
||||||
int cw_read_wtp_descriptor(mbag_t mbag, struct conn *conn,
|
static struct cw_DescriptorSubelemDef allowed_default[] = {
|
||||||
struct cw_action_in *a, uint8_t * data, int len,struct cw_descriptor_subelem_def *allowed)
|
{0,CW_SUBELEM_WTP_HARDWARE_VERSION, "hardware_version", 1024,1},
|
||||||
|
{0,CW_SUBELEM_WTP_SOFTWARE_VERSION, "software_version", 1024,1},
|
||||||
|
{0,CW_SUBELEM_WTP_BOOTLOADER_VERSION, "bootloader_version", 1024,1},
|
||||||
|
{0,CW_SUBELEM_WTP_OTHERSOFTWARE_VERSION, "other_software_version", 1024,0},
|
||||||
|
{0,0, NULL, 0,0}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
int cw_read_wtp_descriptor(mavl_t cfg, struct conn *conn,
|
||||||
|
struct cw_ElemHandler *eh, uint8_t * data, int len,
|
||||||
|
struct cw_DescriptorSubelemDef *allowed)
|
||||||
{
|
{
|
||||||
|
int ncrypt, pos,i;
|
||||||
|
mavldata_t md;
|
||||||
|
char key[64];
|
||||||
|
|
||||||
mbag_set_byte(mbag, CW_ITEM_WTP_MAX_RADIOS, cw_get_byte(data));
|
sprintf(key,"%s/%s",eh->key, "max_radios");
|
||||||
|
md.kv.key=strdup(key);
|
||||||
|
mavl_replace (cfg, cw_type_byte.get(&md,data,1));
|
||||||
|
|
||||||
|
sprintf(key,"%s/%s",eh->key, "radios_in_use");
|
||||||
|
md.kv.key=strdup(key);
|
||||||
|
mavl_replace (cfg, cw_type_byte.get(&md,data+1,1));
|
||||||
|
|
||||||
|
|
||||||
|
/* mbag_set_byte(mbag, CW_ITEM_WTP_MAX_RADIOS, cw_get_byte(data));
|
||||||
mbag_set_byte(mbag, CW_ITEM_WTP_RADIOS_IN_USE, cw_get_byte(data + 1));
|
mbag_set_byte(mbag, CW_ITEM_WTP_RADIOS_IN_USE, cw_get_byte(data + 1));
|
||||||
|
*/
|
||||||
|
|
||||||
/* Get number of encryption elements */
|
/* Get number of encryption elements */
|
||||||
int ncrypt = cw_get_byte(data + 2);
|
ncrypt = cw_get_byte(data + 2);
|
||||||
if (ncrypt == 0) {
|
if (ncrypt == 0) {
|
||||||
if (conn->strict_capwap) {
|
if (conn->strict_capwap) {
|
||||||
cw_dbg(DBG_ELEM_ERR,
|
cw_dbg(DBG_ELEM_ERR,
|
||||||
@ -25,24 +48,16 @@ int cw_read_wtp_descriptor(mbag_t mbag, struct conn *conn,
|
|||||||
"Non standard conform WTP Descriptor, number of encryptoin elements is 0.");
|
"Non standard conform WTP Descriptor, number of encryptoin elements is 0.");
|
||||||
}
|
}
|
||||||
|
|
||||||
int pos = 3;
|
pos = 3;
|
||||||
int i;
|
|
||||||
for (i = 0; i < ncrypt; i++) {
|
for (i = 0; i < ncrypt; i++) {
|
||||||
// It's a dummy for now
|
/* // It's a dummy for now */
|
||||||
pos += 3;
|
pos += 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct cw_descriptor_subelem_def allowed_default[] = {
|
|
||||||
{0,CW_SUBELEM_WTP_HARDWARE_VERSION, CW_ITEM_WTP_HARDWARE_VERSION, 1024,1},
|
|
||||||
{0,CW_SUBELEM_WTP_SOFTWARE_VERSION, CW_ITEM_WTP_SOFTWARE_VERSION, 1024,1},
|
|
||||||
{0,CW_SUBELEM_WTP_BOOTLOADER_VERSION, CW_ITEM_WTP_SOFTWARE_VERSION, 1024,1},
|
|
||||||
{0,CW_SUBELEM_WTP_OTHERSOFTWARE_VERSION, CW_ITEM_WTP_SOFTWARE_VERSION, 1024,0},
|
|
||||||
{0,0, NULL, 0,0}
|
|
||||||
};
|
|
||||||
|
|
||||||
if (!allowed) {
|
if (!allowed) {
|
||||||
allowed=allowed_default;
|
allowed=allowed_default;
|
||||||
}
|
}
|
||||||
|
printf("call read subelems\n");
|
||||||
return cw_read_descriptor_subelems(conn->incomming, data + pos, len - pos, allowed);
|
return cw_read_descriptor_subelems(cfg, data + pos, len - pos, allowed);
|
||||||
}
|
}
|
||||||
|
@ -2,27 +2,39 @@
|
|||||||
|
|
||||||
#include "capwap.h"
|
#include "capwap.h"
|
||||||
#include "capwap_items.h"
|
#include "capwap_items.h"
|
||||||
|
#include "cw_types.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read WTP Descriptor in Cisco-Style (Draft 7)
|
* Read WTP Descriptor in Cisco-Style (Draft 7)
|
||||||
*/
|
*/
|
||||||
int cw_read_wtp_descriptor_7(mbag_t mbag, struct conn *conn,
|
int cw_read_wtp_descriptor_7(mavl_t cfg, struct conn *conn,
|
||||||
struct cw_action_in *a, uint8_t * data, int len,
|
struct cw_ElemHandler *eh, uint8_t * data, int len,
|
||||||
struct cw_descriptor_subelem_def *allowed)
|
struct cw_DescriptorSubelemDef *allowed)
|
||||||
{
|
{
|
||||||
|
int ncrypt, pos,i;
|
||||||
|
mavldata_t md;
|
||||||
|
char key[64];
|
||||||
|
|
||||||
mbag_set_byte(mbag, CW_ITEM_WTP_MAX_RADIOS, cw_get_byte(data));
|
sprintf(key,"%s/%s",eh->key, "max_radios");
|
||||||
|
md.kv.key=strdup(key);
|
||||||
|
mavl_replace (cfg, cw_type_byte.get(&md,data,1));
|
||||||
|
|
||||||
|
sprintf(key,"%s/%s",eh->key, "radios_in_use");
|
||||||
|
md.kv.key=strdup(key);
|
||||||
|
mavl_replace (cfg, cw_type_byte.get(&md,data+1,1));
|
||||||
|
|
||||||
|
/* mbag_set_byte(mbag, CW_ITEM_WTP_MAX_RADIOS, cw_get_byte(data));
|
||||||
mbag_set_byte(mbag, CW_ITEM_WTP_RADIOS_IN_USE, cw_get_byte(data + 1));
|
mbag_set_byte(mbag, CW_ITEM_WTP_RADIOS_IN_USE, cw_get_byte(data + 1));
|
||||||
|
*/
|
||||||
|
|
||||||
|
pos = 2;
|
||||||
int pos = 2;
|
|
||||||
|
|
||||||
/* Encryption element, for now dumy XXX */
|
/* Encryption element, for now dumy XXX */
|
||||||
//cw_get_word(data + pos + 2);
|
//cw_get_word(data + pos + 2);
|
||||||
pos += 2;
|
pos += 2;
|
||||||
|
|
||||||
|
|
||||||
static struct cw_descriptor_subelem_def allowed_default[] = {
|
static struct cw_DescriptorSubelemDef allowed_default[] = {
|
||||||
{-1,CW_SUBELEM_WTP_HARDWARE_VERSION, CW_ITEM_WTP_HARDWARE_VERSION, 1024,0},
|
{-1,CW_SUBELEM_WTP_HARDWARE_VERSION, CW_ITEM_WTP_HARDWARE_VERSION, 1024,0},
|
||||||
{-1,CW_SUBELEM_WTP_SOFTWARE_VERSION, CW_ITEM_WTP_SOFTWARE_VERSION, 1024.0},
|
{-1,CW_SUBELEM_WTP_SOFTWARE_VERSION, CW_ITEM_WTP_SOFTWARE_VERSION, 1024.0},
|
||||||
{-1,CW_SUBELEM_WTP_BOOTLOADER_VERSION, CW_ITEM_WTP_SOFTWARE_VERSION, 1024,0},
|
{-1,CW_SUBELEM_WTP_BOOTLOADER_VERSION, CW_ITEM_WTP_SOFTWARE_VERSION, 1024,0},
|
||||||
@ -33,5 +45,5 @@ int cw_read_wtp_descriptor_7(mbag_t mbag, struct conn *conn,
|
|||||||
if (!allowed)
|
if (!allowed)
|
||||||
allowed=allowed_default;
|
allowed=allowed_default;
|
||||||
|
|
||||||
return cw_read_descriptor_subelems(mbag, data + pos, len - pos, allowed);
|
return cw_read_descriptor_subelems(cfg, data + pos, len - pos, allowed);
|
||||||
}
|
}
|
||||||
|
@ -21,24 +21,6 @@
|
|||||||
#include "cw.h"
|
#include "cw.h"
|
||||||
#include "cw_types.h"
|
#include "cw_types.h"
|
||||||
|
|
||||||
/*
|
|
||||||
static struct mdata_Elem *from_str(const char *src)
|
|
||||||
{
|
|
||||||
struct mdata_Elem *i = mdata_elem_new(&cw_type_byte);
|
|
||||||
if (!i)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
i->data.byte = atoi(src);
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static int to_str(const struct mdata_Elem *e, char *dst)
|
|
||||||
{
|
|
||||||
return sprintf(dst, "%d", e->data.byte);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
static mavldata_t *get(mavldata_t * data, const uint8_t * src, int len)
|
static mavldata_t *get(mavldata_t * data, const uint8_t * src, int len)
|
||||||
{
|
{
|
||||||
data->kv.priv = &cw_type_byte;
|
data->kv.priv = &cw_type_byte;
|
||||||
@ -56,12 +38,19 @@ static int to_str(const mavldata_t *data, char *dst, int max_len)
|
|||||||
return sprintf(dst, "%d", data->kv.val.byte);
|
return sprintf(dst, "%d", data->kv.val.byte);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static mavldata_t *from_str(mavldata_t * data, const char *src)
|
||||||
|
{
|
||||||
|
data->kv.val.byte = atoi(src);
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
const struct cw_Type cw_type_byte = {
|
const struct cw_Type cw_type_byte = {
|
||||||
"Byte", /* name */
|
"Byte", /* name */
|
||||||
NULL, /* del */
|
NULL, /* del */
|
||||||
put, /* put */
|
put, /* put */
|
||||||
get, /* get */
|
get, /* get */
|
||||||
to_str /* to_str */
|
to_str, /* to_str */
|
||||||
|
from_str /* from_str */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -18,45 +18,38 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "cw_types.h"
|
|
||||||
#include "cw.h"
|
#include "cw.h"
|
||||||
/*
|
#include "cw_types.h"
|
||||||
static struct mdata_Elem * from_str(const char *src)
|
|
||||||
{
|
|
||||||
struct mdata_Elem * e = mdata_elem_new(&cw_type_dword);
|
|
||||||
if (!e)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
e->data.word=atoi(src);
|
static mavldata_t *get(mavldata_t * data, const uint8_t * src, int len)
|
||||||
return e;
|
{
|
||||||
|
data->kv.priv = &cw_type_byte;
|
||||||
|
data->kv.val.dword = cw_get_dword(src);
|
||||||
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int put(mavldata_t *data, uint8_t * dst)
|
||||||
static int to_str(const struct mdata_Elem *e, char *dst)
|
|
||||||
{
|
{
|
||||||
return sprintf(dst, "%d", e->data.word);
|
return cw_put_dword(dst, data->kv.val.dword);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct mdata_Elem * get(const uint8_t *src,int len)
|
static int to_str(const mavldata_t *data, char *dst, int max_len)
|
||||||
{
|
{
|
||||||
struct mdata_Elem * e = mdata_elem_new(&cw_type_dword);
|
return sprintf(dst, "%d", data->kv.val.dword);
|
||||||
if (!e)
|
|
||||||
return NULL;
|
|
||||||
e->data.word=cw_get_dword(src);
|
|
||||||
return e;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int put(struct mdata_Elem * e, uint8_t *dst)
|
static mavldata_t *from_str(mavldata_t * data, const char *src)
|
||||||
{
|
{
|
||||||
return cw_put_dword(dst,e->data.word);
|
data->kv.val.dword = atoi(src);
|
||||||
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define _I_NAME "Dword"
|
const struct cw_Type cw_type_dword = {
|
||||||
#define _I_PUT put
|
"Dword", /* name */
|
||||||
#define _I_GET get
|
NULL, /* del */
|
||||||
#define _I_DEL NULL
|
put, /* put */
|
||||||
#define _I_TO_STR to_str
|
get, /* get */
|
||||||
#define _I_FROM_STR from_str
|
to_str, /* to_str */
|
||||||
|
from_str /* from_str */
|
||||||
|
};
|
||||||
|
|
||||||
const struct mdata_Type cw_type_dword = MDATA_TYPE_INIT();
|
|
||||||
*/
|
|
||||||
|
@ -23,7 +23,7 @@ struct cw_Type{
|
|||||||
|
|
||||||
/** Cereate an item of this type from a string, which was previously
|
/** Cereate an item of this type from a string, which was previously
|
||||||
created by the #del function. */
|
created by the #del function. */
|
||||||
/* struct mdata_Elem * (*from_str)(const char *src);*/
|
mavldata_t * (*from_str)(mavldata_t * data, const char *src);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
int (*def)(void *, void *);
|
int (*def)(void *, void *);
|
||||||
@ -44,4 +44,4 @@ void cw_types_mavl_delete(mavldata_t *data);
|
|||||||
#define cw_types_mavl_create()\
|
#define cw_types_mavl_create()\
|
||||||
mavl_create(mavl_cmp_kv, cw_types_mavl_delete)
|
mavl_create(mavl_cmp_kv, cw_types_mavl_delete)
|
||||||
|
|
||||||
#endif
|
#endif /* __CW_TYPES_H */
|
||||||
|
@ -4,4 +4,5 @@ void cw_types_mavl_delete(mavldata_t *data){
|
|||||||
const struct cw_Type * type = data->kv.priv;
|
const struct cw_Type * type = data->kv.priv;
|
||||||
if (type->del)
|
if (type->del)
|
||||||
type->del(data);
|
type->del(data);
|
||||||
|
free(data->kv.key);
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,8 @@
|
|||||||
union mavldata *mavl_replace(struct mavl *t,union mavldata *data){
|
union mavldata *mavl_replace(struct mavl *t,union mavldata *data){
|
||||||
struct mavlnode * node = mavl_get_node(t,data);
|
struct mavlnode * node = mavl_get_node(t,data);
|
||||||
if (node){
|
if (node){
|
||||||
t->del(&node->data);
|
if (t->del)
|
||||||
|
t->del(&node->data);
|
||||||
node->data=*data;
|
node->data=*data;
|
||||||
return &node->data;
|
return &node->data;
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,9 @@
|
|||||||
#define __MESSAGE_SET_H
|
#define __MESSAGE_SET_H
|
||||||
|
|
||||||
#include "mlist.h"
|
#include "mlist.h"
|
||||||
|
#include "sock.h"
|
||||||
|
#include "mavl.h"
|
||||||
|
#include "conn.h"
|
||||||
|
|
||||||
struct cw_MsgSet {
|
struct cw_MsgSet {
|
||||||
mavl_t messages;
|
mavl_t messages;
|
||||||
@ -34,9 +37,10 @@ struct cw_ElemHandler {
|
|||||||
int max_len;
|
int max_len;
|
||||||
const struct cw_Type * type;
|
const struct cw_Type * type;
|
||||||
const char * key;
|
const char * key;
|
||||||
|
int (*get)(struct conn *conn, struct cw_ElemHandler * handler,
|
||||||
|
uint8_t*data,int len,struct sockaddr *from);
|
||||||
/*
|
/*
|
||||||
int (*start_in)(struct conn *conn,struct cw_action_in *a,uint8_t*data,int len,struct sockaddr *from);
|
int (*end_in)(struct conn *conn,struct cw_action_in *a,uint8_t*elem,int len,struct sockaddr *from);
|
||||||
int (*end_in)(struct conn *conn,struct cw_action_in *a,uint8_t*elem,int len,struct sockaddr *from);
|
|
||||||
*/
|
*/
|
||||||
};
|
};
|
||||||
|
|
||||||
|
79
src/cw/mod.c
79
src/cw/mod.c
@ -25,8 +25,6 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
|
|
||||||
|
|
||||||
//#include "action.h"
|
|
||||||
#include "mbag.h"
|
#include "mbag.h"
|
||||||
#include "mavl.h"
|
#include "mavl.h"
|
||||||
#include "dbg.h"
|
#include "dbg.h"
|
||||||
@ -57,27 +55,32 @@ struct cache_item {
|
|||||||
};
|
};
|
||||||
static struct mavl *msgset_cache = NULL;
|
static struct mavl *msgset_cache = NULL;
|
||||||
|
|
||||||
|
/*
|
||||||
static int mod_null_register_actions(struct cw_actiondef *def, int mode)
|
static int mod_null_register_actions(struct cw_actiondef *def, int mode)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* mod_null is a dummy mod
|
* mod_null is a dummy mod
|
||||||
*/
|
*/
|
||||||
struct cw_Mod mod_null = {
|
struct cw_Mod mod_null = {
|
||||||
.name = "none",
|
"none", /* name */
|
||||||
.register_actions = mod_null_register_actions,
|
NULL, /* init */
|
||||||
|
NULL, /* init_config */
|
||||||
|
NULL, /* detect */
|
||||||
|
NULL /* data */
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static int cmp(const void *p1, const void *p2)
|
static int cmp(const mavldata_t *p1, const mavldata_t *p2)
|
||||||
{
|
{
|
||||||
struct cache_item *c1 = (struct cache_item *) p1;
|
struct cache_item *c1 = (struct cache_item *) p1->ptr;
|
||||||
struct cache_item *c2 = (struct cache_item *) p2;
|
struct cache_item *c2 = (struct cache_item *) p2->ptr;
|
||||||
|
|
||||||
int r;
|
int r;
|
||||||
r = strcmp(c1->capwap, c2->capwap);
|
r = strcmp(c1->capwap, c2->capwap);
|
||||||
@ -96,6 +99,10 @@ struct cw_actiondef *mod_cache_get(const char *capwap, const char *bindings)
|
|||||||
struct cw_MsgSet *cw_mod_get_msg_set(struct conn *conn,
|
struct cw_MsgSet *cw_mod_get_msg_set(struct conn *conn,
|
||||||
struct cw_Mod * capwap_mod, struct cw_Mod *bindings_mod)
|
struct cw_Mod * capwap_mod, struct cw_Mod *bindings_mod)
|
||||||
{
|
{
|
||||||
|
struct cache_item search;
|
||||||
|
struct cache_item * cached_set;
|
||||||
|
struct cw_MsgSet * set;
|
||||||
|
|
||||||
if (!msgset_cache) {
|
if (!msgset_cache) {
|
||||||
msgset_cache = mavl_create(cmp, NULL);
|
msgset_cache = mavl_create(cmp, NULL);
|
||||||
if (!msgset_cache) {
|
if (!msgset_cache) {
|
||||||
@ -105,11 +112,11 @@ struct cw_MsgSet *cw_mod_get_msg_set(struct conn *conn,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct cache_item search;
|
|
||||||
search.capwap = capwap_mod->name;
|
search.capwap = capwap_mod->name;
|
||||||
search.bindings = bindings_mod->name;
|
search.bindings = bindings_mod->name;
|
||||||
|
|
||||||
struct cache_item * cached_set = mavl_get(msgset_cache, &search);
|
cached_set = mavl_get_ptr(msgset_cache, &search);
|
||||||
if (cached_set) {
|
if (cached_set) {
|
||||||
cw_dbg(DBG_INFO, "Using cached message set for %s,%s", capwap_mod->name, bindings_mod->name);
|
cw_dbg(DBG_INFO, "Using cached message set for %s,%s", capwap_mod->name, bindings_mod->name);
|
||||||
return cached_set->msgset;
|
return cached_set->msgset;
|
||||||
@ -124,7 +131,7 @@ struct cw_MsgSet *cw_mod_get_msg_set(struct conn *conn,
|
|||||||
}
|
}
|
||||||
memset(cached_set, 0, sizeof(struct cache_item));
|
memset(cached_set, 0, sizeof(struct cache_item));
|
||||||
|
|
||||||
struct cw_MsgSet * set = cw_msgset_create();
|
set = cw_msgset_create();
|
||||||
if (!set) {
|
if (!set) {
|
||||||
free(cached_set);
|
free(cached_set);
|
||||||
cw_log(LOG_ERR, "Can't allocate memory for mod cache item %s",
|
cw_log(LOG_ERR, "Can't allocate memory for mod cache item %s",
|
||||||
@ -140,18 +147,16 @@ struct cw_MsgSet *cw_mod_get_msg_set(struct conn *conn,
|
|||||||
|
|
||||||
if (capwap_mod) {
|
if (capwap_mod) {
|
||||||
cached_set->capwap = capwap_mod->name;
|
cached_set->capwap = capwap_mod->name;
|
||||||
//c->register_actions(&(i->actions), CW_MOD_MODE_CAPWAP);
|
|
||||||
capwap_mod->register_messages(cached_set->msgset,CW_MOD_MODE_CAPWAP);
|
capwap_mod->register_messages(cached_set->msgset,CW_MOD_MODE_CAPWAP);
|
||||||
}
|
}
|
||||||
if (bindings_mod) {
|
if (bindings_mod) {
|
||||||
cached_set->bindings = bindings_mod->name;
|
cached_set->bindings = bindings_mod->name;
|
||||||
//b->register_actions(&(i->actions), MOD_MODE_BINDINGS);
|
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
// if (actions_registered_cb)
|
// if (actions_registered_cb)
|
||||||
// actions_registered_cb(capwap_mod, bindings_mod, &(cached_set->actions));
|
// actions_registered_cb(capwap_mod, bindings_mod, &(cached_set->actions));
|
||||||
|
*/
|
||||||
mavl_add(msgset_cache, cached_set);
|
mavl_add_ptr(msgset_cache, cached_set);
|
||||||
return cached_set->msgset;
|
return cached_set->msgset;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -159,12 +164,20 @@ struct cw_MsgSet *cw_mod_get_msg_set(struct conn *conn,
|
|||||||
|
|
||||||
/* static mavl to store modules */
|
/* static mavl to store modules */
|
||||||
static struct mavl * mods_loaded = NULL;
|
static struct mavl * mods_loaded = NULL;
|
||||||
static int mod_cmp(const void *e1, const void *e2){
|
static int mod_cmp_mavl(const mavldata_t *e1, const mavldata_t *e2){
|
||||||
|
const struct cw_Mod * m1 = e1->ptr;
|
||||||
|
const struct cw_Mod * m2 = e2->ptr;
|
||||||
|
return strcmp(m1->name,m2->name);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int mod_cmp_mlist(const void *e1, const void *e2){
|
||||||
const struct cw_Mod * m1 = e1;
|
const struct cw_Mod * m1 = e1;
|
||||||
const struct cw_Mod * m2 = e2;
|
const struct cw_Mod * m2 = e2;
|
||||||
return strcmp(m1->name,m2->name);
|
return strcmp(m1->name,m2->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static const char * mod_path="./";
|
static const char * mod_path="./";
|
||||||
|
|
||||||
void cw_mod_set_mod_path(const char * path){
|
void cw_mod_set_mod_path(const char * path){
|
||||||
@ -177,11 +190,16 @@ void cw_mod_set_mod_path(const char * path){
|
|||||||
* @return a pointer to the module interface
|
* @return a pointer to the module interface
|
||||||
*/
|
*/
|
||||||
struct cw_Mod * cw_mod_load(const char * mod_name){
|
struct cw_Mod * cw_mod_load(const char * mod_name){
|
||||||
|
struct cw_Mod search;
|
||||||
|
struct cw_Mod * mod;
|
||||||
|
char mod_filename[CW_MOD_MAX_MOD_NAME_LEN+5];
|
||||||
|
char * filename;
|
||||||
|
void * handle;
|
||||||
|
struct cw_Mod * (*mod_get_interface)();
|
||||||
|
|
||||||
/* if modlist is not initialized, initialize ... */
|
/* if modlist is not initialized, initialize ... */
|
||||||
if (mods_loaded==NULL){
|
if (mods_loaded==NULL){
|
||||||
mods_loaded=mavl_create(mod_cmp,NULL);
|
mods_loaded=mavl_create(mod_cmp_mavl,NULL);
|
||||||
if (mods_loaded==NULL){
|
if (mods_loaded==NULL){
|
||||||
cw_log(LOG_ERROR, "Can't init modlist, no memory");
|
cw_log(LOG_ERROR, "Can't init modlist, no memory");
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -190,11 +208,11 @@ struct cw_Mod * cw_mod_load(const char * mod_name){
|
|||||||
|
|
||||||
/* Search for the module in mods_loaded, to see if it is
|
/* Search for the module in mods_loaded, to see if it is
|
||||||
* already loaded or was statically linked */
|
* already loaded or was statically linked */
|
||||||
struct cw_Mod search;
|
|
||||||
memset(&search,0,sizeof(search));
|
memset(&search,0,sizeof(search));
|
||||||
search.name=mod_name;
|
search.name=mod_name;
|
||||||
struct cw_Mod * mod;
|
|
||||||
mod = mavl_find(mods_loaded,&search);
|
mod = mavl_find_ptr(mods_loaded,&search);
|
||||||
if (mod){
|
if (mod){
|
||||||
return mod;
|
return mod;
|
||||||
}
|
}
|
||||||
@ -205,17 +223,16 @@ struct cw_Mod * cw_mod_load(const char * mod_name){
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
char mod_filename[CW_MOD_MAX_MOD_NAME_LEN+5];
|
|
||||||
sprintf(mod_filename,"mod_%s",mod_name);
|
sprintf(mod_filename,"mod_%s",mod_name);
|
||||||
|
|
||||||
/* we have to load the module dynamically */
|
/* we have to load the module dynamically */
|
||||||
char * filename;
|
|
||||||
filename = cw_filename(mod_path,mod_filename,".so");
|
filename = cw_filename(mod_path,mod_filename,".so");
|
||||||
if (filename==NULL)
|
if (filename==NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
cw_log(LOG_ERROR,"DLOPEN now !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
|
||||||
/* Open the DLL */
|
/* Open the DLL */
|
||||||
void * handle;
|
|
||||||
handle = dlopen(filename,RTLD_NOW);
|
handle = dlopen(filename,RTLD_NOW);
|
||||||
|
|
||||||
if (!handle){
|
if (!handle){
|
||||||
@ -223,9 +240,8 @@ cw_log(LOG_ERROR,"DLOPEN now !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
|||||||
goto errX;
|
goto errX;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct cw_Mod * (*mod_get_interface)();
|
|
||||||
|
|
||||||
mod_get_interface = dlsym(handle,mod_filename);
|
mod_get_interface = (struct cw_Mod*(*)()) dlsym(handle,mod_filename);
|
||||||
|
|
||||||
if (!mod_get_interface){
|
if (!mod_get_interface){
|
||||||
cw_log(LOG_ERROR,"Failed to load module: %s",dlerror());
|
cw_log(LOG_ERROR,"Failed to load module: %s",dlerror());
|
||||||
@ -235,7 +251,7 @@ cw_log(LOG_ERROR,"DLOPEN now !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
|
|||||||
mod = mod_get_interface();
|
mod = mod_get_interface();
|
||||||
mod->dll_handle=handle;
|
mod->dll_handle=handle;
|
||||||
|
|
||||||
if (!mavl_add(mods_loaded,mod)){
|
if (!mavl_add_ptr(mods_loaded,mod)){
|
||||||
dlclose(handle);
|
dlclose(handle);
|
||||||
cw_log(LOG_ERR,"Can' add module %s",mod_name);
|
cw_log(LOG_ERR,"Can' add module %s",mod_name);
|
||||||
goto errX;
|
goto errX;
|
||||||
@ -253,7 +269,7 @@ static struct mlist * mods_list = NULL;
|
|||||||
|
|
||||||
struct cw_Mod * cw_mod_add_to_list(struct cw_Mod * mod ){
|
struct cw_Mod * cw_mod_add_to_list(struct cw_Mod * mod ){
|
||||||
if (!mods_list){
|
if (!mods_list){
|
||||||
mods_list = mlist_create(mod_cmp);
|
mods_list = mlist_create(mod_cmp_mlist);
|
||||||
if (!mods_list){
|
if (!mods_list){
|
||||||
cw_log(LOG_ERROR,"Can't init mods_list");
|
cw_log(LOG_ERROR,"Can't init mods_list");
|
||||||
return 0;
|
return 0;
|
||||||
@ -266,10 +282,13 @@ struct cw_Mod * cw_mod_detect(struct conn *conn,
|
|||||||
uint8_t * rawmsg, int len,
|
uint8_t * rawmsg, int len,
|
||||||
int elems_len, struct sockaddr *from,
|
int elems_len, struct sockaddr *from,
|
||||||
int mode){
|
int mode){
|
||||||
|
|
||||||
|
struct mlist_elem * e;
|
||||||
|
|
||||||
if (mods_list==NULL)
|
if (mods_list==NULL)
|
||||||
return MOD_NULL;
|
return MOD_NULL;
|
||||||
|
|
||||||
struct mlist_elem * e;
|
|
||||||
mlist_foreach(e,mods_list){
|
mlist_foreach(e,mods_list){
|
||||||
struct cw_Mod * mod = e->data;
|
struct cw_Mod * mod = e->data;
|
||||||
cw_dbg(DBG_MOD,"Checking mod: %s",mod->name);
|
cw_dbg(DBG_MOD,"Checking mod: %s",mod->name);
|
||||||
|
@ -6,9 +6,7 @@ include ../../Config.local.mak
|
|||||||
|
|
||||||
OBJS=\
|
OBJS=\
|
||||||
mod_capwap_ac.o \
|
mod_capwap_ac.o \
|
||||||
mod_capwap_wtp.o\
|
|
||||||
capwap_actions_ac.o \
|
capwap_actions_ac.o \
|
||||||
capwap_actions_wtp.o \
|
|
||||||
capwap_in_wtp_board_data.o \
|
capwap_in_wtp_board_data.o \
|
||||||
capwap_out_ac_descriptor.o \
|
capwap_out_ac_descriptor.o \
|
||||||
capwap_out_get_session_id.o \
|
capwap_out_get_session_id.o \
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
#include "mod_capwap.h"
|
#include "mod_capwap.h"
|
||||||
|
|
||||||
|
|
||||||
static struct cw_ElemHandler handlers[] = {
|
static struct cw_ElemHandler handlers[] = {
|
||||||
|
|
||||||
{
|
{
|
||||||
@ -33,7 +34,8 @@ static struct cw_ElemHandler handlers[] = {
|
|||||||
0,0, /* Vendor / Proto */
|
0,0, /* Vendor / Proto */
|
||||||
1,1, /* min/max length */
|
1,1, /* min/max length */
|
||||||
CW_TYPE_BYTE, /* type */
|
CW_TYPE_BYTE, /* type */
|
||||||
"discovery_type" /* Key */
|
"discovery_type", /* Key */
|
||||||
|
cw_in_generic /* get */
|
||||||
}
|
}
|
||||||
,
|
,
|
||||||
{
|
{
|
||||||
@ -42,9 +44,31 @@ static struct cw_ElemHandler handlers[] = {
|
|||||||
0,0, /* Vendor / Proto */
|
0,0, /* Vendor / Proto */
|
||||||
1,1, /* min/max length */
|
1,1, /* min/max length */
|
||||||
CW_TYPE_BYTE, /* type */
|
CW_TYPE_BYTE, /* type */
|
||||||
"wtp_mac_type" /* Key */
|
"wtp_mac_type", /* Key */
|
||||||
|
cw_in_generic /* get */
|
||||||
}
|
}
|
||||||
,
|
,
|
||||||
|
{
|
||||||
|
"WTP Board Data", /* name */
|
||||||
|
CAPWAP_ELEM_WTP_BOARD_DATA, /* Element ID */
|
||||||
|
0,0, /* Vendor / Proto */
|
||||||
|
4,128, /* min/max length */
|
||||||
|
NULL, /* type */
|
||||||
|
"wtp_board_data", /* Key */
|
||||||
|
capwap_in_wtp_board_data /* get */
|
||||||
|
}
|
||||||
|
,
|
||||||
|
{
|
||||||
|
"WTP Descriptor", /* name */
|
||||||
|
CAPWAP_ELEM_WTP_DESCRIPTOR, /* Element ID */
|
||||||
|
0,0, /* Vendor / Proto */
|
||||||
|
4,128, /* min/max length */
|
||||||
|
NULL, /* type */
|
||||||
|
"wtp_descriptor", /* Key */
|
||||||
|
capwap_in_wtp_descriptor /* get */
|
||||||
|
}
|
||||||
|
,
|
||||||
|
|
||||||
{0,0,0,0,0,0,0,0}
|
{0,0,0,0,0,0,0,0}
|
||||||
|
|
||||||
};
|
};
|
||||||
@ -55,7 +79,8 @@ static struct cw_ElemDef discovery_request_elements[] ={
|
|||||||
{0,0,CAPWAP_ELEM_DISCOVERY_TYPE, 1, 0},
|
{0,0,CAPWAP_ELEM_DISCOVERY_TYPE, 1, 0},
|
||||||
{0,0,CAPWAP_ELEM_WTP_MAC_TYPE, 1, 0},
|
{0,0,CAPWAP_ELEM_WTP_MAC_TYPE, 1, 0},
|
||||||
{0,0,CAPWAP_ELEM_WTP_BOARD_DATA, 1, 0},
|
{0,0,CAPWAP_ELEM_WTP_BOARD_DATA, 1, 0},
|
||||||
{0,0,0,00}
|
{0,0,CAPWAP_ELEM_WTP_DESCRIPTOR, 1, 0},
|
||||||
|
{0,0,0,0,0}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -16,22 +16,16 @@
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "mod_capwap.h"
|
||||||
|
|
||||||
|
|
||||||
#include "cw/cw.h"
|
|
||||||
#include "cw/capwap_items.h"
|
|
||||||
|
|
||||||
#include "cw/mbag.h"
|
|
||||||
|
|
||||||
#include "cw/cw_util.h"
|
|
||||||
#include "cw/dbg.h"
|
#include "cw/dbg.h"
|
||||||
|
#include "cw/cw.h"
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
static void readsubelems_wtp_board_data(mbag_t itemstore, uint8_t * msgelem,
|
static void readsubelems_wtp_board_data(mbag_t itemstore, uint8_t * msgelem,
|
||||||
int len)
|
int len)
|
||||||
{
|
{
|
||||||
@ -89,26 +83,36 @@ static void readsubelems_wtp_board_data(mbag_t itemstore, uint8_t * msgelem,
|
|||||||
} while (i < len);
|
} while (i < len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parse a WTP Board Data messag element and put results to itemstore.
|
* Parse a WTP Board Data messag element and put results to itemstore.
|
||||||
*/
|
*/
|
||||||
int capwap_in_wtp_board_data(struct conn *conn, struct cw_action_in *a, uint8_t * data,
|
int capwap_in_wtp_board_data(struct conn *conn, struct cw_ElemHandler *eh, uint8_t * data,
|
||||||
int len, struct sockaddr *from)
|
int len, struct sockaddr *from)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/*
|
||||||
if (len < 4) {
|
if (len < 4) {
|
||||||
cw_dbg(DBG_ELEM_ERR,
|
cw_dbg(DBG_ELEM_ERR,
|
||||||
"Discarding WTP_BOARD_DATA msgelem, wrong size, type=%d, len=%d",
|
"Discarding WTP_BOARD_DATA msgelem, wrong size, type=%d, len=%d",
|
||||||
a->elem_id, len);
|
a->elem_id, len);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
char vendor_key[64];
|
||||||
|
|
||||||
|
printf("Have to read WTP Board Data\n");
|
||||||
|
sprintf(vendor_key,"%s/%s",eh->key,"vendor");
|
||||||
|
|
||||||
|
/*
|
||||||
mbag_t itemstore = conn->incomming;
|
mbag_t itemstore = conn->incomming;
|
||||||
mbag_set_dword(itemstore, CW_ITEM_WTP_BOARD_VENDOR, cw_get_dword(data));
|
mbag_set_dword(itemstore, CW_ITEM_WTP_BOARD_VENDOR, cw_get_dword(data));
|
||||||
|
*/
|
||||||
|
|
||||||
readsubelems_wtp_board_data(itemstore, data + 4, len - 4);
|
/* readsubelems_wtp_board_data(itemstore, data + 4, len - 4);
|
||||||
|
*/
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,17 +17,21 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include "cw/sock.h"
|
#include "cw/sock.h"
|
||||||
#include "cw/cw.h"
|
#include "cw/cw.h"
|
||||||
|
|
||||||
int capwap_in_wtp_descriptor(struct conn *conn, struct cw_action_in *a, uint8_t * data,
|
#include "mod_capwap.h"
|
||||||
|
|
||||||
|
int capwap_in_wtp_descriptor(struct conn *conn, struct cw_ElemHandler *eh, uint8_t * data,
|
||||||
int len, struct sockaddr *from)
|
int len, struct sockaddr *from)
|
||||||
{
|
{
|
||||||
|
int rc;
|
||||||
|
printf("WTP Descriptor reader\n");
|
||||||
|
/*
|
||||||
|
// mbag_t mbag = conn->incomming;
|
||||||
|
*/
|
||||||
|
rc =cw_read_wtp_descriptor(conn->remote_cfg, conn, eh, data, len, NULL);
|
||||||
|
|
||||||
mbag_t mbag = conn->incomming;
|
|
||||||
|
|
||||||
int rc =cw_read_wtp_descriptor(mbag, conn, a, data, len, NULL);
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,13 +4,18 @@
|
|||||||
struct cw_Mod *mod_capwap_ac();
|
struct cw_Mod *mod_capwap_ac();
|
||||||
struct cw_Mod *mod_capwap_wtp();
|
struct cw_Mod *mod_capwap_wtp();
|
||||||
|
|
||||||
|
#include "cw/message_set.h"
|
||||||
|
#include "cw/conn.h"
|
||||||
|
|
||||||
extern int capwap_in_wtp_descriptor(struct conn *conn, struct cw_action_in *a,
|
|
||||||
|
extern int capwap_in_wtp_descriptor(struct conn *conn, struct cw_ElemHandler *eh,
|
||||||
uint8_t * data, int len, struct sockaddr *from);
|
uint8_t * data, int len, struct sockaddr *from);
|
||||||
|
|
||||||
extern int capwap_in_wtp_board_data(struct conn *conn, struct cw_action_in *a,
|
|
||||||
|
extern int capwap_in_wtp_board_data(struct conn *conn, struct cw_ElemHandler *a,
|
||||||
uint8_t * data, int len, struct sockaddr *from);
|
uint8_t * data, int len, struct sockaddr *from);
|
||||||
|
|
||||||
|
/*
|
||||||
extern int capwap_out_wtp_descriptor(struct conn *conn, struct cw_action_out *a,
|
extern int capwap_out_wtp_descriptor(struct conn *conn, struct cw_action_out *a,
|
||||||
uint8_t * dst);
|
uint8_t * dst);
|
||||||
|
|
||||||
@ -27,6 +32,7 @@ extern struct mbag_item * capwap_out_get_capwap_timers(struct conn *conn,struct
|
|||||||
|
|
||||||
extern int capwap_out_ac_ip_list(struct conn *conn, struct cw_action_out *a, uint8_t * dst);
|
extern int capwap_out_ac_ip_list(struct conn *conn, struct cw_action_out *a, uint8_t * dst);
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
struct cw_MsgSet * capwap_register_msg_set(struct cw_MsgSet * set, int mode);
|
struct cw_MsgSet * capwap_register_msg_set(struct cw_MsgSet * set, int mode);
|
||||||
|
|
||||||
|
@ -44,23 +44,14 @@
|
|||||||
#include "cw/cw_types.h"
|
#include "cw/cw_types.h"
|
||||||
|
|
||||||
static struct cw_ElemHandler handlers[] = {
|
static struct cw_ElemHandler handlers[] = {
|
||||||
|
|
||||||
{
|
{
|
||||||
"Discovery Type", /* name */
|
"WTP Descriptor (Draft 7)", /* name */
|
||||||
CAPWAP_ELEM_DISCOVERY_TYPE, /* Element ID */
|
CAPWAP_ELEM_WTP_DESCRIPTOR, /* Element ID */
|
||||||
0,0, /* Vendor / Proto */
|
0,0, /* Vendor / Proto */
|
||||||
1,1, /* min/max length */
|
4,128, /* min/max length */
|
||||||
CW_TYPE_BYTE, /* type */
|
NULL, /* type */
|
||||||
"discovery_type" /* Key */
|
"wtp_descriptor", /* Key */
|
||||||
}
|
cisco_in_wtp_descriptor /* get */
|
||||||
,
|
|
||||||
{
|
|
||||||
"WTP Mac Type", /* name */
|
|
||||||
CAPWAP_ELEM_WTP_MAC_TYPE, /* Element ID */
|
|
||||||
0,0, /* Vendor / Proto */
|
|
||||||
1,1, /* min/max length */
|
|
||||||
CW_TYPE_BYTE, /* type */
|
|
||||||
"wtp_mac_type" /* Key */
|
|
||||||
}
|
}
|
||||||
,
|
,
|
||||||
{0,0,0,0,0,0,0,0}
|
{0,0,0,0,0,0,0,0}
|
||||||
@ -70,7 +61,7 @@ static struct cw_ElemHandler handlers[] = {
|
|||||||
|
|
||||||
static int discovery_request_states[] = {CAPWAP_STATE_DISCOVERY,0};
|
static int discovery_request_states[] = {CAPWAP_STATE_DISCOVERY,0};
|
||||||
static struct cw_ElemDef discovery_request_elements[] ={
|
static struct cw_ElemDef discovery_request_elements[] ={
|
||||||
{0,0,CAPWAP_ELEM_DISCOVERY_TYPE, 1, 0},
|
{0,0,CAPWAP_ELEM_WTP_DESCRIPTOR, 1, 0},
|
||||||
{0,0,0,00}
|
{0,0,0,00}
|
||||||
|
|
||||||
};
|
};
|
||||||
@ -136,7 +127,7 @@ static cw_action_in_t actions_in[] = {
|
|||||||
.msg_id = CAPWAP_MSG_DISCOVERY_REQUEST,
|
.msg_id = CAPWAP_MSG_DISCOVERY_REQUEST,
|
||||||
.vendor_id = CW_VENDOR_ID_CISCO,
|
.vendor_id = CW_VENDOR_ID_CISCO,
|
||||||
.elem_id = CW_CISCO_RAD_NAME,
|
.elem_id = CW_CISCO_RAD_NAME,
|
||||||
.start=cw_in_generic2,
|
.start=cw_in_generic,
|
||||||
.item_id = "wtp_name",
|
.item_id = "wtp_name",
|
||||||
.min_len=1,
|
.min_len=1,
|
||||||
.max_len=512,
|
.max_len=512,
|
||||||
@ -224,7 +215,7 @@ static cw_action_in_t actions_in[] = {
|
|||||||
.msg_id = CAPWAP_MSG_JOIN_REQUEST,
|
.msg_id = CAPWAP_MSG_JOIN_REQUEST,
|
||||||
.elem_id = CW_ELEM_ECN_SUPPORT,
|
.elem_id = CW_ELEM_ECN_SUPPORT,
|
||||||
.item_id = CW_ITEM_ECN_SUPPORT,
|
.item_id = CW_ITEM_ECN_SUPPORT,
|
||||||
.start = cw_in_generic2,
|
.start = cw_in_generic,
|
||||||
.mand = 0,
|
.mand = 0,
|
||||||
.min_len = 1,
|
.min_len = 1,
|
||||||
.max_len = 1
|
.max_len = 1
|
||||||
@ -245,7 +236,7 @@ static cw_action_in_t actions_in[] = {
|
|||||||
.msg_id = CAPWAP_MSG_CONFIGURATION_STATUS_REQUEST,
|
.msg_id = CAPWAP_MSG_CONFIGURATION_STATUS_REQUEST,
|
||||||
.elem_id = CW_ELEM_AC_NAME,
|
.elem_id = CW_ELEM_AC_NAME,
|
||||||
.item_id = CW_ITEM_AC_NAME,
|
.item_id = CW_ITEM_AC_NAME,
|
||||||
.start = cw_in_generic2,
|
.start = cw_in_generic,
|
||||||
.min_len = 0,
|
.min_len = 0,
|
||||||
.max_len = 512,
|
.max_len = 512,
|
||||||
.mand = 1
|
.mand = 1
|
||||||
@ -273,7 +264,7 @@ static cw_action_in_t actions_in[] = {
|
|||||||
.vendor_id = CW_VENDOR_ID_CISCO,
|
.vendor_id = CW_VENDOR_ID_CISCO,
|
||||||
.elem_id = CW_CISCO_AP_LED_STATE_CONFIG,
|
.elem_id = CW_CISCO_AP_LED_STATE_CONFIG,
|
||||||
.item_id = CISCO_ITEM_AP_LED_STATE_CONFIG,
|
.item_id = CISCO_ITEM_AP_LED_STATE_CONFIG,
|
||||||
.start = cw_in_generic2
|
.start = cw_in_generic
|
||||||
|
|
||||||
}
|
}
|
||||||
,
|
,
|
||||||
@ -285,7 +276,7 @@ static cw_action_in_t actions_in[] = {
|
|||||||
.vendor_id = CW_VENDOR_ID_CISCO,
|
.vendor_id = CW_VENDOR_ID_CISCO,
|
||||||
.elem_id = CW_CISCO_AP_LED_FLASH_CONFIG,
|
.elem_id = CW_CISCO_AP_LED_FLASH_CONFIG,
|
||||||
.item_id = CISCO_ITEM_AP_LED_FLASH_CONFIG,
|
.item_id = CISCO_ITEM_AP_LED_FLASH_CONFIG,
|
||||||
.start = cw_in_generic2
|
.start = cw_in_generic
|
||||||
|
|
||||||
}
|
}
|
||||||
,
|
,
|
||||||
@ -329,7 +320,7 @@ static cw_action_in_t actions_in[] = {
|
|||||||
.vendor_id = CW_VENDOR_ID_CISCO,
|
.vendor_id = CW_VENDOR_ID_CISCO,
|
||||||
.elem_id = CW_CISCO_AP_MODE_AND_TYPE,
|
.elem_id = CW_CISCO_AP_MODE_AND_TYPE,
|
||||||
.item_id = CISCO_ITEM_AP_MODE_AND_TYPE,
|
.item_id = CISCO_ITEM_AP_MODE_AND_TYPE,
|
||||||
.start = cw_in_generic2
|
.start = cw_in_generic
|
||||||
}
|
}
|
||||||
,
|
,
|
||||||
|
|
||||||
@ -341,7 +332,7 @@ static cw_action_in_t actions_in[] = {
|
|||||||
.vendor_id = CW_VENDOR_ID_CISCO,
|
.vendor_id = CW_VENDOR_ID_CISCO,
|
||||||
.elem_id = CW_CISCO_AP_LOG_FACILITY,
|
.elem_id = CW_CISCO_AP_LOG_FACILITY,
|
||||||
.item_id = CIPWAP_ITEM_LOG_FACILITY,
|
.item_id = CIPWAP_ITEM_LOG_FACILITY,
|
||||||
.start = cw_in_generic2
|
.start = cw_in_generic
|
||||||
}
|
}
|
||||||
,
|
,
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ static cw_action_in_t actions_in[] = {
|
|||||||
.msg_id = CAPWAP_MSG_JOIN_RESPONSE,
|
.msg_id = CAPWAP_MSG_JOIN_RESPONSE,
|
||||||
.elem_id = CW_ELEM_ECN_SUPPORT,
|
.elem_id = CW_ELEM_ECN_SUPPORT,
|
||||||
.item_id = CW_ITEM_ECN_SUPPORT,
|
.item_id = CW_ITEM_ECN_SUPPORT,
|
||||||
.start = cw_in_generic2,
|
.start = cw_in_generic,
|
||||||
.mand = 0,
|
.mand = 0,
|
||||||
.min_len = 1,
|
.min_len = 1,
|
||||||
.max_len = 1
|
.max_len = 1
|
||||||
@ -103,7 +103,7 @@ static cw_action_in_t actions_in[] = {
|
|||||||
.msg_id = CAPWAP_MSG_CONFIGURATION_UPDATE_REQUEST,
|
.msg_id = CAPWAP_MSG_CONFIGURATION_UPDATE_REQUEST,
|
||||||
.elem_id = LW_ELEM_LOCATION_DATA,
|
.elem_id = LW_ELEM_LOCATION_DATA,
|
||||||
.item_id = CW_ITEM_LOCATION_DATA,
|
.item_id = CW_ITEM_LOCATION_DATA,
|
||||||
.start = cw_in_generic2,
|
.start = cw_in_generic,
|
||||||
.min_len = 0,
|
.min_len = 0,
|
||||||
.max_len = 1024,
|
.max_len = 1024,
|
||||||
.mand = 0
|
.mand = 0
|
||||||
@ -117,7 +117,7 @@ static cw_action_in_t actions_in[] = {
|
|||||||
.msg_id = CAPWAP_MSG_CONFIGURATION_UPDATE_REQUEST,
|
.msg_id = CAPWAP_MSG_CONFIGURATION_UPDATE_REQUEST,
|
||||||
.elem_id = CW_CISCO_RAD_NAME,
|
.elem_id = CW_CISCO_RAD_NAME,
|
||||||
.item_id = CW_ITEM_WTP_NAME,
|
.item_id = CW_ITEM_WTP_NAME,
|
||||||
.start = cw_in_generic2,
|
.start = cw_in_generic,
|
||||||
.min_len = 0,
|
.min_len = 0,
|
||||||
.max_len = 1024,
|
.max_len = 1024,
|
||||||
.mand = 0
|
.mand = 0
|
||||||
@ -132,7 +132,7 @@ static cw_action_in_t actions_in[] = {
|
|||||||
.msg_id = CAPWAP_MSG_CONFIGURATION_UPDATE_REQUEST,
|
.msg_id = CAPWAP_MSG_CONFIGURATION_UPDATE_REQUEST,
|
||||||
.elem_id = CW_CISCO_AP_GROUP_NAME,
|
.elem_id = CW_CISCO_AP_GROUP_NAME,
|
||||||
.item_id = CIPWAP_ITEM_WTP_GROUP_NAME,
|
.item_id = CIPWAP_ITEM_WTP_GROUP_NAME,
|
||||||
.start = cw_in_generic2,
|
.start = cw_in_generic,
|
||||||
.min_len = 0,
|
.min_len = 0,
|
||||||
.max_len = 1024,
|
.max_len = 1024,
|
||||||
.mand = 0
|
.mand = 0
|
||||||
@ -162,7 +162,7 @@ static cw_action_in_t actions_in[] = {
|
|||||||
.vendor_id = CW_VENDOR_ID_CISCO,
|
.vendor_id = CW_VENDOR_ID_CISCO,
|
||||||
.elem_id = CW_CISCO_AP_MODE_AND_TYPE,
|
.elem_id = CW_CISCO_AP_MODE_AND_TYPE,
|
||||||
.item_id = CISCO_ITEM_AP_MODE_AND_TYPE,
|
.item_id = CISCO_ITEM_AP_MODE_AND_TYPE,
|
||||||
.start = cw_in_generic2
|
.start = cw_in_generic
|
||||||
}
|
}
|
||||||
,
|
,
|
||||||
|
|
||||||
@ -250,7 +250,7 @@ static cw_action_in_t actions_in[] = {
|
|||||||
.vendor_id = LW_VENDOR_ID_CISCO,
|
.vendor_id = LW_VENDOR_ID_CISCO,
|
||||||
.elem_id = LW_CISCO_MWAR_HASH_VALUE,
|
.elem_id = LW_CISCO_MWAR_HASH_VALUE,
|
||||||
.item_id = CIPWAP_ITEM_AC_HASH_VALUE,
|
.item_id = CIPWAP_ITEM_AC_HASH_VALUE,
|
||||||
.start = cw_in_generic2, //cisco_in_telnet_ssh
|
.start = cw_in_generic, //cisco_in_telnet_ssh
|
||||||
}
|
}
|
||||||
|
|
||||||
,
|
,
|
||||||
@ -473,7 +473,7 @@ static cw_action_in_t actions80211_in[] = {
|
|||||||
.vendor_id = LW_VENDOR_ID_CISCO,
|
.vendor_id = LW_VENDOR_ID_CISCO,
|
||||||
.elem_id = LW_CISCO_ADD_WLAN,
|
.elem_id = LW_CISCO_ADD_WLAN,
|
||||||
// .item_id = CIPWAP_ITEM_AC_HASH_VALUE,
|
// .item_id = CIPWAP_ITEM_AC_HASH_VALUE,
|
||||||
// .start = cw_in_generic2, //cisco_in_telnet_ssh
|
// .start = cw_in_generic, //cisco_in_telnet_ssh
|
||||||
.start = cisco_in_add_wlan
|
.start = cisco_in_add_wlan
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
int cisco_in_ac_descriptor(struct conn *conn, struct cw_action_in *a, uint8_t * data,
|
int cisco_in_ac_descriptor(struct conn *conn, struct cw_action_in *a, uint8_t * data,
|
||||||
int len, struct sockaddr *from)
|
int len, struct sockaddr *from)
|
||||||
{
|
{
|
||||||
static struct cw_descriptor_subelem_def allowed[] = {
|
static struct cw_DescriptorSubelemDef allowed[] = {
|
||||||
{CW_VENDOR_ID_CISCO,0, CW_ITEM_AC_HARDWARE_VERSION, 1024,1},
|
{CW_VENDOR_ID_CISCO,0, CW_ITEM_AC_HARDWARE_VERSION, 1024,1},
|
||||||
{CW_VENDOR_ID_CISCO,1, CW_ITEM_AC_SOFTWARE_VERSION, 1024,1},
|
{CW_VENDOR_ID_CISCO,1, CW_ITEM_AC_SOFTWARE_VERSION, 1024,1},
|
||||||
{0,0, NULL,0, 0}
|
{0,0, NULL,0, 0}
|
||||||
|
@ -22,11 +22,11 @@
|
|||||||
#include "cw/capwap_items.h"
|
#include "cw/capwap_items.h"
|
||||||
|
|
||||||
|
|
||||||
int cisco_in_wtp_descriptor(struct conn *conn, struct cw_action_in *a, uint8_t * data,
|
int cisco_in_wtp_descriptor(struct conn *conn, struct cw_ElemHandler *eh, uint8_t * data,
|
||||||
int len, struct sockaddr *from)
|
int len, struct sockaddr *from)
|
||||||
{
|
{
|
||||||
|
|
||||||
static struct cw_descriptor_subelem_def allowed[] = {
|
static struct cw_DescriptorSubelemDef allowed[] = {
|
||||||
{CW_VENDOR_ID_CISCO,CW_SUBELEM_WTP_HARDWARE_VERSION, CW_ITEM_WTP_HARDWARE_VERSION, 1024,0},
|
{CW_VENDOR_ID_CISCO,CW_SUBELEM_WTP_HARDWARE_VERSION, CW_ITEM_WTP_HARDWARE_VERSION, 1024,0},
|
||||||
{CW_VENDOR_ID_CISCO,CW_SUBELEM_WTP_SOFTWARE_VERSION, CW_ITEM_WTP_SOFTWARE_VERSION, 1024.0},
|
{CW_VENDOR_ID_CISCO,CW_SUBELEM_WTP_SOFTWARE_VERSION, CW_ITEM_WTP_SOFTWARE_VERSION, 1024.0},
|
||||||
{CW_VENDOR_ID_CISCO,CW_SUBELEM_WTP_BOOTLOADER_VERSION, CW_ITEM_WTP_BOOTLOADER_VERSION, 1024.0},
|
{CW_VENDOR_ID_CISCO,CW_SUBELEM_WTP_BOOTLOADER_VERSION, CW_ITEM_WTP_BOOTLOADER_VERSION, 1024.0},
|
||||||
@ -35,7 +35,7 @@ int cisco_in_wtp_descriptor(struct conn *conn, struct cw_action_in *a, uint8_t *
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
return cw_read_wtp_descriptor_7(conn->incomming, conn, a, data, len, allowed);
|
return cw_read_wtp_descriptor_7(conn->incomming, conn, eh, data, len, allowed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -26,14 +26,19 @@ static struct cw_MsgSet * register_messages(struct cw_MsgSet *set, int mode)
|
|||||||
switch (mode) {
|
switch (mode) {
|
||||||
case CW_MOD_MODE_CAPWAP:
|
case CW_MOD_MODE_CAPWAP:
|
||||||
{
|
{
|
||||||
|
cw_dbg(DBG_MOD,"Cisco: loading base med capwap");
|
||||||
|
|
||||||
struct cw_Mod *cmod = cw_mod_load("capwap");// NULL; //modload_ac("cipwap");
|
struct cw_Mod *cmod = cw_mod_load("capwap");
|
||||||
if (!cmod) {
|
if (!cmod) {
|
||||||
cw_log(LOG_ERR,
|
cw_log(LOG_ERR,
|
||||||
"Can't initialize mod_cisco, failed to load base module mod_cipwap");
|
"Can't initialize mod_cisco, failed to load base module mod_cipwap");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
\
|
||||||
cmod->register_messages(set, CW_MOD_MODE_CAPWAP);
|
cmod->register_messages(set, CW_MOD_MODE_CAPWAP);
|
||||||
|
|
||||||
|
cw_dbg(DBG_MOD,"Cisco: loading cisco message set");
|
||||||
cisco_register_msg_set(set,CW_MOD_MODE_CAPWAP);
|
cisco_register_msg_set(set,CW_MOD_MODE_CAPWAP);
|
||||||
cw_dbg(DBG_INFO, "Initialized mod_cisco with %d messafe", 7);
|
cw_dbg(DBG_INFO, "Initialized mod_cisco with %d messafe", 7);
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user