Refactoring ...
FossilOrigin-Name: 0e582e687c5fe1fc78b2f5a0545c6be8633bbbe011d8ac04dae76866e3347c48
This commit is contained in:
parent
8ec78cea1b
commit
864da8a92f
15
src/cw/cw.h
15
src/cw/cw.h
@ -114,7 +114,11 @@ typedef struct {
|
||||
int id;
|
||||
int min_len;
|
||||
int max_len;
|
||||
}cw_msgelemdef_t;
|
||||
|
||||
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);
|
||||
|
||||
}cw_elem_handler_t;
|
||||
|
||||
typedef struct {
|
||||
mavl_t messages;
|
||||
@ -122,8 +126,9 @@ typedef struct {
|
||||
}cw_message_set_t;
|
||||
|
||||
typedef struct{
|
||||
cw_msgelemdef_t * elem;
|
||||
cw_elem_handler_t * elem;
|
||||
int mand;
|
||||
int op;
|
||||
}cw_msgelemprops_t;
|
||||
|
||||
typedef struct {
|
||||
@ -467,6 +472,12 @@ struct cw_descriptor_subelem_def {
|
||||
int mand;
|
||||
};
|
||||
|
||||
#define CW_DELETE 1
|
||||
#define CW_APPEND 2
|
||||
#define CW_PREPEND 3
|
||||
#define CW_REPLACE 4
|
||||
|
||||
|
||||
|
||||
extern int cw_read_descriptor_subelems(mbag_t store, uint8_t * data, int len,
|
||||
struct cw_descriptor_subelem_def *elems);
|
||||
|
@ -14,8 +14,8 @@ typedef struct {
|
||||
}message2_t;
|
||||
|
||||
static inline int cmp_cw_msgelemprops(const void *elem1, const void *elem2){
|
||||
cw_msgelemdef_t * e1 = ((cw_msgelemprops_t*)elem1)->elem;
|
||||
cw_msgelemdef_t * e2 = ((cw_msgelemprops_t*)elem2)->elem;
|
||||
cw_elem_handler_t * e1 = ((cw_msgelemprops_t*)elem1)->elem;
|
||||
cw_elem_handler_t * e2 = ((cw_msgelemprops_t*)elem2)->elem;
|
||||
int r;
|
||||
r = e1->id - e2->id;
|
||||
if (r!=0)
|
||||
@ -141,9 +141,9 @@ void cw_message_set_add(cw_message_set_t * set,
|
||||
|
||||
}
|
||||
|
||||
cw_msgelemdef_t * cw_message_set_find_element(
|
||||
cw_elem_handler_t * cw_message_set_find_element(
|
||||
cw_message_set_t * set,
|
||||
cw_msgelemdef_t * element){
|
||||
cw_elem_handler_t * element){
|
||||
return mavl_find(set->all_elems,element);
|
||||
}
|
||||
|
||||
|
@ -29,6 +29,13 @@ struct mlist_elem * mlist_append(mlist_t l, void *data)
|
||||
return *n;
|
||||
}
|
||||
|
||||
struct mlist_elem * mlist_prepend(mlist_t l, void *data){
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
struct mlist_elem *mlist_find(mlist_t l, struct mlist_elem *start, void *data)
|
||||
{
|
||||
struct mlist_elem *e;
|
||||
|
@ -29,7 +29,7 @@
|
||||
|
||||
#include "mod_capwap.h"
|
||||
|
||||
static cw_msgelemdef_t _DISCOVERY_TYPE = {
|
||||
static cw_elem_handler_t _DISCOVERY_TYPE = {
|
||||
.name = "Discovery Type",
|
||||
.id = CAPWAP_ELEM_DISCOVERY_TYPE,
|
||||
//.start = cw_in_generic2,
|
||||
@ -37,21 +37,21 @@ static cw_msgelemdef_t _DISCOVERY_TYPE = {
|
||||
.min_len = 1,
|
||||
.max_len = 1
|
||||
};
|
||||
static cw_msgelemdef_t _WTP_BOARD_DATA = {
|
||||
static cw_elem_handler_t _WTP_BOARD_DATA = {
|
||||
.name = "WTP Board Data",
|
||||
.id = CAPWAP_ELEM_WTP_BOARD_DATA,
|
||||
// .start = cw_in_wtp_board_data,
|
||||
// .item_id = CW_ITEM_WTP_BOARD_DATA,
|
||||
};
|
||||
|
||||
static cw_msgelemdef_t _WTP_DESCRIPTOR = {
|
||||
static cw_elem_handler_t _WTP_DESCRIPTOR = {
|
||||
.id = CAPWAP_ELEM_WTP_DESCRIPTOR,
|
||||
.name = "WTP Descriptor",
|
||||
//.start = capwap_in_wtp_descriptor,
|
||||
//.item_id = "wtp_descriptor",
|
||||
};
|
||||
|
||||
static cw_msgelemdef_t _WTP_FRAME_TUNNEL_MODE = {
|
||||
static cw_elem_handler_t _WTP_FRAME_TUNNEL_MODE = {
|
||||
.id = CAPWAP_ELEM_WTP_FRAME_TUNNEL_MODE,
|
||||
.name = "WTP Frame Tunnel Mode",
|
||||
// .start = cw_in_generic2,
|
||||
@ -60,7 +60,7 @@ static cw_msgelemdef_t _WTP_FRAME_TUNNEL_MODE = {
|
||||
.max_len = 1
|
||||
};
|
||||
|
||||
static cw_msgelemdef_t _WTP_MAC_TYPE = {
|
||||
static cw_elem_handler_t _WTP_MAC_TYPE = {
|
||||
.id = CAPWAP_ELEM_WTP_MAC_TYPE,
|
||||
.name = "WTP Mac Type",
|
||||
// .start = cw_in_generic2,
|
||||
@ -70,13 +70,13 @@ static cw_msgelemdef_t _WTP_MAC_TYPE = {
|
||||
};
|
||||
|
||||
/* MTU Discovery Padding */
|
||||
static cw_msgelemdef_t _MTU_DISCOVERY_PADDING = {
|
||||
static cw_elem_handler_t _MTU_DISCOVERY_PADDING = {
|
||||
.id = CW_ELEM_MTU_DISCOVERY_PADDING,
|
||||
.name = "MTU Discovery Padding"
|
||||
// .start = cw_in_mtu_discovery_padding,
|
||||
};
|
||||
|
||||
static cw_msgelemdef_t _VENDOR_SPECIFIC_PAYLOAD = {
|
||||
static cw_elem_handler_t _VENDOR_SPECIFIC_PAYLOAD = {
|
||||
.name = "Vendor Specific Payload",
|
||||
.id = CAPWAP_ELEM_VENDOR_SPECIFIC_PAYLOAD,
|
||||
|
||||
@ -84,8 +84,8 @@ static cw_msgelemdef_t _VENDOR_SPECIFIC_PAYLOAD = {
|
||||
.min_len=7
|
||||
};
|
||||
|
||||
/* AC Descriptor - Discovery Response */
|
||||
static cw_msgelemdef_t _AC_DESCRIPTOR = {
|
||||
/* AC Descriptor - Discovery Response */
|
||||
static cw_elem_handler_t _AC_DESCRIPTOR = {
|
||||
.name = "AC Descriptor",
|
||||
.id = CAPWAP_ELEM_AC_DESCRIPTOR,
|
||||
//.item_id = CW_ITEM_AC_DESCRIPTOR,
|
||||
@ -137,7 +137,7 @@ void test_sets(){
|
||||
|
||||
cw_message_set_add(set,messages);
|
||||
|
||||
cw_msgelemdef_t el;
|
||||
cw_elem_handler_t el;
|
||||
memset(&el,0,sizeof(el));
|
||||
el.id=CAPWAP_ELEM_DISCOVERY_TYPE;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user