New message handler format

FossilOrigin-Name: bb2a1847072e2bf5e381dfdf0c4465b064c3feaab0faf51f93a7f4b8d2bcd999
This commit is contained in:
7u83@mail.ru
2018-03-09 06:44:17 +00:00
parent 06e50e8318
commit 5718781138
33 changed files with 351 additions and 261 deletions

View File

@ -6,8 +6,13 @@
extern int cisco_out_ap_timesync(struct conn *conn, struct cw_action_out *a,
uint8_t * dst);
/*
extern int cisco_in_wtp_descriptor(struct conn *conn, struct cw_action_in *a,
uint8_t * data, int len, struct sockaddr *from);
uint8_t * data, int len, struct sockaddr *from);*/
int cisco_in_wtp_descriptor(struct cw_ElemHandler *eh, struct cw_ElemHandlerParams * params, uint8_t * data,
int len);
extern int cisco_out_ac_descriptor(struct conn *conn, struct cw_action_out *a,
uint8_t * dst);
extern int cisco_out_wtp_descriptor(struct conn *conn, struct cw_action_out *a,

View File

@ -38,11 +38,13 @@
#include "cisco_items.h"
#include "include/cipwap_items.h"
#include "cw/message_set.h"
#include "cw/cw_types.h"
static struct cw_ElemHandler handlers[] = {
{
"WTP Descriptor (Draft 7)", /* name */
@ -51,7 +53,28 @@ static struct cw_ElemHandler handlers[] = {
4,128, /* min/max length */
NULL, /* type */
"wtp_descriptor", /* Key */
cisco_in_wtp_descriptor /* get */
cisco_in_wtp_descriptor /* get */
}
,
{
"RAD Name -> CAPWAP WTP Name", /* name */
CW_CISCO_RAD_NAME, /* Element ID */
CW_VENDOR_ID_CISCO,0, /* Vendor / Proto */
1,512, /* min/max length */
CW_TYPE_BSTR16, /* type */
"wtp_name", /* Key */
cw_in_generic /* handler */
}
,
{
"Board Data Options", /* name */
CW_CISCO_BOARD_DATA_OPTIONS, /* Element ID */
CW_VENDOR_ID_CISCO,0, /* Vendor / Proto */
2,2, /* min/max length */
CW_TYPE_DWORD, /* type */
"cisco_board_data_options", /* Key */
cw_in_generic /* handler */
}
,
{0,0,0,0,0,0,0,0}
@ -61,7 +84,8 @@ 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_WTP_DESCRIPTOR, 1, 0},
{0,0, CAPWAP_ELEM_WTP_DESCRIPTOR, 1, 0},
{0,CW_VENDOR_ID_CISCO, CW_CISCO_RAD_NAME, 1, 0},
{0,0,0,00}
};
@ -213,7 +237,7 @@ static cw_action_in_t actions_in[] = {
* about ECN support, so make it non-mandatory */
.capwap_state = CAPWAP_STATE_JOIN,
.msg_id = CAPWAP_MSG_JOIN_REQUEST,
.elem_id = CW_ELEM_ECN_SUPPORT,
.elem_id = CAPWAP_ELEM_ECN_SUPPORT,
.item_id = CW_ITEM_ECN_SUPPORT,
.start = cw_in_generic,
.mand = 0,
@ -418,7 +442,7 @@ static cw_action_out_t actions_out[]={
/* ECN Support - Join Response */
{
.msg_id = CAPWAP_MSG_JOIN_RESPONSE,
.elem_id = CW_ELEM_ECN_SUPPORT,
.elem_id = CAPWAP_ELEM_ECN_SUPPORT,
.item_id = CW_ITEM_ECN_SUPPORT
}
,

View File

@ -68,7 +68,7 @@ static cw_action_in_t actions_in[] = {
/* Make ECN Support non-mand */
.capwap_state = CAPWAP_STATE_JOIN,
.msg_id = CAPWAP_MSG_JOIN_RESPONSE,
.elem_id = CW_ELEM_ECN_SUPPORT,
.elem_id = CAPWAP_ELEM_ECN_SUPPORT,
.item_id = CW_ITEM_ECN_SUPPORT,
.start = cw_in_generic,
.mand = 0,
@ -345,7 +345,7 @@ static cw_action_out_t actions_out[]={
/* Cisco doesn't know ECN support, so we
define no output method */
.msg_id = CAPWAP_MSG_JOIN_REQUEST,
.elem_id = CW_ELEM_ECN_SUPPORT,
.elem_id = CAPWAP_ELEM_ECN_SUPPORT,
.item_id = CW_ITEM_ECN_SUPPORT,
.mand = 0
}

View File

@ -22,8 +22,8 @@
#include "cw/capwap_items.h"
int cisco_in_wtp_descriptor(struct conn *conn, struct cw_ElemHandler *eh, uint8_t * data,
int len, struct sockaddr *from)
int cisco_in_wtp_descriptor(struct cw_ElemHandler *eh, struct cw_ElemHandlerParams * params, uint8_t * data,
int len)
{
static struct cw_DescriptorSubelemDef allowed[] = {
@ -35,7 +35,7 @@ int cisco_in_wtp_descriptor(struct conn *conn, struct cw_ElemHandler *eh, uint8_
};
return cw_read_wtp_descriptor_7(conn->remote_cfg, conn, eh, data, len, allowed);
return cw_read_wtp_descriptor_7(params->conn->remote_cfg, params->conn, eh, data, len, allowed);
}