can partially read wtp descriptor

FossilOrigin-Name: 87c986decab2956c060dc9212e5bd4d89bed829ec528477817f8ab795c396853
This commit is contained in:
7u83@mail.ru
2018-03-06 02:08:14 +00:00
parent 8817d54d14
commit 14a9c95eb8
30 changed files with 329 additions and 382 deletions

View File

@ -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 \

View File

@ -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[] = {

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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);