can partially read wtp descriptor
FossilOrigin-Name: 87c986decab2956c060dc9212e5bd4d89bed829ec528477817f8ab795c396853
This commit is contained in:
@ -6,9 +6,7 @@ include ../../Config.local.mak
|
||||
|
||||
OBJS=\
|
||||
mod_capwap_ac.o \
|
||||
mod_capwap_wtp.o\
|
||||
capwap_actions_ac.o \
|
||||
capwap_actions_wtp.o \
|
||||
capwap_in_wtp_board_data.o \
|
||||
capwap_out_ac_descriptor.o \
|
||||
capwap_out_get_session_id.o \
|
||||
|
@ -25,6 +25,7 @@
|
||||
|
||||
#include "mod_capwap.h"
|
||||
|
||||
|
||||
static struct cw_ElemHandler handlers[] = {
|
||||
|
||||
{
|
||||
@ -33,7 +34,8 @@ static struct cw_ElemHandler handlers[] = {
|
||||
0,0, /* Vendor / Proto */
|
||||
1,1, /* min/max length */
|
||||
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 */
|
||||
1,1, /* min/max length */
|
||||
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}
|
||||
|
||||
};
|
||||
@ -55,8 +79,9 @@ static struct cw_ElemDef discovery_request_elements[] ={
|
||||
{0,0,CAPWAP_ELEM_DISCOVERY_TYPE, 1, 0},
|
||||
{0,0,CAPWAP_ELEM_WTP_MAC_TYPE, 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}
|
||||
|
||||
};
|
||||
|
||||
static struct cw_MsgDef messages[] = {
|
||||
|
@ -16,22 +16,16 @@
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#include <stdlib.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/cw.h"
|
||||
|
||||
|
||||
|
||||
/*
|
||||
static void readsubelems_wtp_board_data(mbag_t itemstore, uint8_t * msgelem,
|
||||
int len)
|
||||
{
|
||||
@ -89,26 +83,36 @@ static void readsubelems_wtp_board_data(mbag_t itemstore, uint8_t * msgelem,
|
||||
} while (i < len);
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
/**
|
||||
* 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)
|
||||
{
|
||||
|
||||
/*
|
||||
if (len < 4) {
|
||||
cw_dbg(DBG_ELEM_ERR,
|
||||
"Discarding WTP_BOARD_DATA msgelem, wrong size, type=%d, len=%d",
|
||||
a->elem_id, len);
|
||||
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_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;
|
||||
}
|
||||
|
||||
|
@ -17,17 +17,21 @@
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "cw/sock.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 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;
|
||||
}
|
||||
|
||||
|
@ -4,13 +4,18 @@
|
||||
struct cw_Mod *mod_capwap_ac();
|
||||
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);
|
||||
|
||||
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);
|
||||
|
||||
/*
|
||||
extern int capwap_out_wtp_descriptor(struct conn *conn, struct cw_action_out *a,
|
||||
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);
|
||||
|
||||
*/
|
||||
|
||||
struct cw_MsgSet * capwap_register_msg_set(struct cw_MsgSet * set, int mode);
|
||||
|
||||
|
@ -44,23 +44,14 @@
|
||||
#include "cw/cw_types.h"
|
||||
|
||||
static struct cw_ElemHandler handlers[] = {
|
||||
|
||||
{
|
||||
"Discovery Type", /* name */
|
||||
CAPWAP_ELEM_DISCOVERY_TYPE, /* Element ID */
|
||||
"WTP Descriptor (Draft 7)", /* name */
|
||||
CAPWAP_ELEM_WTP_DESCRIPTOR, /* Element ID */
|
||||
0,0, /* Vendor / Proto */
|
||||
1,1, /* min/max length */
|
||||
CW_TYPE_BYTE, /* type */
|
||||
"discovery_type" /* Key */
|
||||
}
|
||||
,
|
||||
{
|
||||
"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 */
|
||||
4,128, /* min/max length */
|
||||
NULL, /* type */
|
||||
"wtp_descriptor", /* Key */
|
||||
cisco_in_wtp_descriptor /* get */
|
||||
}
|
||||
,
|
||||
{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 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}
|
||||
|
||||
};
|
||||
@ -136,7 +127,7 @@ static cw_action_in_t actions_in[] = {
|
||||
.msg_id = CAPWAP_MSG_DISCOVERY_REQUEST,
|
||||
.vendor_id = CW_VENDOR_ID_CISCO,
|
||||
.elem_id = CW_CISCO_RAD_NAME,
|
||||
.start=cw_in_generic2,
|
||||
.start=cw_in_generic,
|
||||
.item_id = "wtp_name",
|
||||
.min_len=1,
|
||||
.max_len=512,
|
||||
@ -224,7 +215,7 @@ static cw_action_in_t actions_in[] = {
|
||||
.msg_id = CAPWAP_MSG_JOIN_REQUEST,
|
||||
.elem_id = CW_ELEM_ECN_SUPPORT,
|
||||
.item_id = CW_ITEM_ECN_SUPPORT,
|
||||
.start = cw_in_generic2,
|
||||
.start = cw_in_generic,
|
||||
.mand = 0,
|
||||
.min_len = 1,
|
||||
.max_len = 1
|
||||
@ -245,7 +236,7 @@ static cw_action_in_t actions_in[] = {
|
||||
.msg_id = CAPWAP_MSG_CONFIGURATION_STATUS_REQUEST,
|
||||
.elem_id = CW_ELEM_AC_NAME,
|
||||
.item_id = CW_ITEM_AC_NAME,
|
||||
.start = cw_in_generic2,
|
||||
.start = cw_in_generic,
|
||||
.min_len = 0,
|
||||
.max_len = 512,
|
||||
.mand = 1
|
||||
@ -273,7 +264,7 @@ static cw_action_in_t actions_in[] = {
|
||||
.vendor_id = CW_VENDOR_ID_CISCO,
|
||||
.elem_id = CW_CISCO_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,
|
||||
.elem_id = CW_CISCO_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,
|
||||
.elem_id = CW_CISCO_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,
|
||||
.elem_id = CW_CISCO_AP_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,
|
||||
.elem_id = CW_ELEM_ECN_SUPPORT,
|
||||
.item_id = CW_ITEM_ECN_SUPPORT,
|
||||
.start = cw_in_generic2,
|
||||
.start = cw_in_generic,
|
||||
.mand = 0,
|
||||
.min_len = 1,
|
||||
.max_len = 1
|
||||
@ -103,7 +103,7 @@ static cw_action_in_t actions_in[] = {
|
||||
.msg_id = CAPWAP_MSG_CONFIGURATION_UPDATE_REQUEST,
|
||||
.elem_id = LW_ELEM_LOCATION_DATA,
|
||||
.item_id = CW_ITEM_LOCATION_DATA,
|
||||
.start = cw_in_generic2,
|
||||
.start = cw_in_generic,
|
||||
.min_len = 0,
|
||||
.max_len = 1024,
|
||||
.mand = 0
|
||||
@ -117,7 +117,7 @@ static cw_action_in_t actions_in[] = {
|
||||
.msg_id = CAPWAP_MSG_CONFIGURATION_UPDATE_REQUEST,
|
||||
.elem_id = CW_CISCO_RAD_NAME,
|
||||
.item_id = CW_ITEM_WTP_NAME,
|
||||
.start = cw_in_generic2,
|
||||
.start = cw_in_generic,
|
||||
.min_len = 0,
|
||||
.max_len = 1024,
|
||||
.mand = 0
|
||||
@ -132,7 +132,7 @@ static cw_action_in_t actions_in[] = {
|
||||
.msg_id = CAPWAP_MSG_CONFIGURATION_UPDATE_REQUEST,
|
||||
.elem_id = CW_CISCO_AP_GROUP_NAME,
|
||||
.item_id = CIPWAP_ITEM_WTP_GROUP_NAME,
|
||||
.start = cw_in_generic2,
|
||||
.start = cw_in_generic,
|
||||
.min_len = 0,
|
||||
.max_len = 1024,
|
||||
.mand = 0
|
||||
@ -162,7 +162,7 @@ static cw_action_in_t actions_in[] = {
|
||||
.vendor_id = CW_VENDOR_ID_CISCO,
|
||||
.elem_id = CW_CISCO_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,
|
||||
.elem_id = LW_CISCO_MWAR_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,
|
||||
.elem_id = LW_CISCO_ADD_WLAN,
|
||||
// .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
|
||||
}
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
int cisco_in_ac_descriptor(struct conn *conn, struct cw_action_in *a, uint8_t * data,
|
||||
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,1, CW_ITEM_AC_SOFTWARE_VERSION, 1024,1},
|
||||
{0,0, NULL,0, 0}
|
||||
|
@ -22,11 +22,11 @@
|
||||
#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)
|
||||
{
|
||||
|
||||
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_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},
|
||||
@ -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) {
|
||||
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) {
|
||||
cw_log(LOG_ERR,
|
||||
"Can't initialize mod_cisco, failed to load base module mod_cipwap");
|
||||
return 1;
|
||||
}
|
||||
|
||||
\
|
||||
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);
|
||||
cw_dbg(DBG_INFO, "Initialized mod_cisco with %d messafe", 7);
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user