More message set work
FossilOrigin-Name: e77c8337093cd404440cc8c2e05429178f18569d4611489fd7ff468949352954
This commit is contained in:
parent
dcbbaf28a6
commit
3f33eda837
@ -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"/>
|
||||||
<BuildMatrix>
|
<BuildMatrix>
|
||||||
<WorkspaceConfiguration Name="Debug" Selected="yes">
|
<WorkspaceConfiguration Name="Debug" Selected="yes">
|
||||||
|
@ -249,10 +249,10 @@
|
|||||||
* about the WTP */
|
* about the WTP */
|
||||||
#define CAPWAP_ELEM_WTP_DESCRIPTOR 39
|
#define CAPWAP_ELEM_WTP_DESCRIPTOR 39
|
||||||
#define CW_ELEM_WTP_FALLBACK 40
|
#define CW_ELEM_WTP_FALLBACK 40
|
||||||
#define CW_ELEM_WTP_FRAME_TUNNEL_MODE 41
|
#define CAPWAP_ELEM_WTP_FRAME_TUNNEL_MODE 41
|
||||||
#define CW_ELEM_RESERVED_42 42
|
#define CW_ELEM_RESERVED_42 42
|
||||||
#define CW_ELEM_RESERVED_43 43
|
#define CW_ELEM_RESERVED_43 43
|
||||||
#define CW_ELEM_WTP_MAC_TYPE 44
|
#define CAPWAP_ELEM_WTP_MAC_TYPE 44
|
||||||
#define CW_ELEM_WTP_NAME 45
|
#define CW_ELEM_WTP_NAME 45
|
||||||
#define CW_ELEM_RESERVED_46 46
|
#define CW_ELEM_RESERVED_46 46
|
||||||
#define CW_ELEM_WTP_RADIO_STATISTICS 47
|
#define CW_ELEM_WTP_RADIO_STATISTICS 47
|
||||||
|
@ -47,10 +47,10 @@ struct cw_strlist_elem capwap_strings_elem[] = {
|
|||||||
{CAPWAP_ELEM_WTP_BOARD_DATA, "WTP Board Data"},
|
{CAPWAP_ELEM_WTP_BOARD_DATA, "WTP Board Data"},
|
||||||
{CAPWAP_ELEM_WTP_DESCRIPTOR, "WTP Descriptor"},
|
{CAPWAP_ELEM_WTP_DESCRIPTOR, "WTP Descriptor"},
|
||||||
{CW_ELEM_WTP_FALLBACK, "WTP Fallback"},
|
{CW_ELEM_WTP_FALLBACK, "WTP Fallback"},
|
||||||
{CW_ELEM_WTP_FRAME_TUNNEL_MODE, "WTP Frame Tunnel Mode"},
|
{CAPWAP_ELEM_WTP_FRAME_TUNNEL_MODE, "WTP Frame Tunnel Mode"},
|
||||||
{CW_ELEM_RESERVED_42, "Reserved 42"},
|
{CW_ELEM_RESERVED_42, "Reserved 42"},
|
||||||
{CW_ELEM_RESERVED_43, "Reserved 43"},
|
{CW_ELEM_RESERVED_43, "Reserved 43"},
|
||||||
{CW_ELEM_WTP_MAC_TYPE, "WTP MAC Type"},
|
{CAPWAP_ELEM_WTP_MAC_TYPE, "WTP MAC Type"},
|
||||||
{CW_ELEM_WTP_NAME, "WTP Name"},
|
{CW_ELEM_WTP_NAME, "WTP Name"},
|
||||||
{CW_ELEM_RESERVED_46, "Reserved 46"},
|
{CW_ELEM_RESERVED_46, "Reserved 46"},
|
||||||
{CW_ELEM_WTP_RADIO_STATISTICS, "WTP Radio Statistics"},
|
{CW_ELEM_WTP_RADIO_STATISTICS, "WTP Radio Statistics"},
|
||||||
|
@ -4,12 +4,13 @@
|
|||||||
|
|
||||||
#include "message_set.h"
|
#include "message_set.h"
|
||||||
|
|
||||||
struct message_search_elem{
|
typedef struct {
|
||||||
cw_messagedef_t *message;
|
int type;
|
||||||
|
const char * name;
|
||||||
|
int * states;
|
||||||
mavl_t elements_tree;
|
mavl_t elements_tree;
|
||||||
mlist_t elements_list;
|
mlist_t elements_list;
|
||||||
};
|
}message2_t;
|
||||||
|
|
||||||
|
|
||||||
static inline int cmp_cw_message_element(const void *elem1, const void *elem2){
|
static inline int cmp_cw_message_element(const void *elem1, const void *elem2){
|
||||||
cw_message_element_t * e1 = (cw_message_element_t*)elem1;
|
cw_message_element_t * e1 = (cw_message_element_t*)elem1;
|
||||||
@ -30,31 +31,10 @@ static inline int cmp_cw_message_element(const void *elem1, const void *elem2){
|
|||||||
|
|
||||||
static inline int msg_cmp(const void *elem1, const void *elem2)
|
static inline int msg_cmp(const void *elem1, const void *elem2)
|
||||||
{
|
{
|
||||||
/* struct cw_action_in *e1 = (struct cw_action_in *) elem1;
|
message2_t * e1 = (message2_t*)elem1;
|
||||||
struct cw_action_in *e2 = (struct cw_action_in *) elem2;
|
message2_t * e2 = (message2_t*)elem2;
|
||||||
int r;
|
|
||||||
|
return e1->type - e2->type;
|
||||||
r = e1->capwap_state - e2->capwap_state;
|
|
||||||
if (r != 0)
|
|
||||||
return r;
|
|
||||||
|
|
||||||
r = e1->msg_id - e2->msg_id;
|
|
||||||
if (r != 0)
|
|
||||||
return r;
|
|
||||||
|
|
||||||
r = e1->elem_id - e2->elem_id;
|
|
||||||
if (r != 0)
|
|
||||||
return r;
|
|
||||||
|
|
||||||
r = e1->vendor_id - e2->vendor_id;
|
|
||||||
if (r != 0)
|
|
||||||
return r;
|
|
||||||
|
|
||||||
r = e1->proto - e2->proto;
|
|
||||||
if (r != 0)
|
|
||||||
return r;
|
|
||||||
*/
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -98,21 +78,23 @@ cw_message_set_t * cw_message_set_create(){
|
|||||||
|
|
||||||
|
|
||||||
void cw_message_set_add(cw_message_set_t * set,
|
void cw_message_set_add(cw_message_set_t * set,
|
||||||
cw_message_t * messages,
|
cw_message_t messages[],
|
||||||
cw_message_element_t * elements[]){
|
cw_message_element_t elements[]){
|
||||||
|
|
||||||
cw_message_element_t ** e;
|
cw_message_element_t * e;
|
||||||
for (e=elements; e->id!=0; e++){
|
for (e=elements; e->id!=0; e++){
|
||||||
|
mavl_replace(set->all_elems, e);
|
||||||
// mavl_add(set->all_elems, e);
|
|
||||||
|
|
||||||
printf("Add: %d %d %d %s\n",
|
|
||||||
e->proto,
|
|
||||||
e->vendor,
|
|
||||||
e->id,
|
|
||||||
e->name
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cw_message_t * m;
|
||||||
|
for (m=messages; m->type !=0; m++){
|
||||||
|
printf("MESS: %d %s",m->type, m->name);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cw_message_element_t * cw_message_set_find_element(
|
||||||
|
cw_message_set_t * set,
|
||||||
|
cw_message_element_t * element){
|
||||||
|
return mavl_find(set->all_elems,element);
|
||||||
|
}
|
@ -6,6 +6,6 @@
|
|||||||
extern void cw_message_set_destroy(cw_message_set_t * set);
|
extern void cw_message_set_destroy(cw_message_set_t * set);
|
||||||
extern cw_message_set_t * cw_message_set_create();
|
extern cw_message_set_t * cw_message_set_create();
|
||||||
extern void cw_message_set_add(cw_message_set_t * set,
|
extern void cw_message_set_add(cw_message_set_t * set,
|
||||||
cw_message_t * messages,
|
cw_message_t messages[],
|
||||||
cw_message_element_t * elements[]);
|
cw_message_element_t elements[]);
|
||||||
#endif
|
#endif
|
@ -53,7 +53,7 @@ static cw_message_element_t elements[] = {
|
|||||||
}
|
}
|
||||||
,
|
,
|
||||||
{
|
{
|
||||||
.id = CW_ELEM_WTP_FRAME_TUNNEL_MODE,
|
.id = CAPWAP_ELEM_WTP_FRAME_TUNNEL_MODE,
|
||||||
.name = "WTP Frame Tunnel Mode",
|
.name = "WTP Frame Tunnel Mode",
|
||||||
// .start = cw_in_generic2,
|
// .start = cw_in_generic2,
|
||||||
// .item_id = CW_ITEM_WTP_FRAME_TUNNEL_MODE,
|
// .item_id = CW_ITEM_WTP_FRAME_TUNNEL_MODE,
|
||||||
@ -61,6 +61,34 @@ static cw_message_element_t elements[] = {
|
|||||||
.max_len = 1
|
.max_len = 1
|
||||||
}
|
}
|
||||||
,
|
,
|
||||||
|
{
|
||||||
|
|
||||||
|
.id = CAPWAP_ELEM_WTP_MAC_TYPE,
|
||||||
|
.name = "WTP Mac Type",
|
||||||
|
// .start = cw_in_generic2,
|
||||||
|
// .item_id = CW_ITEM_WTP_MAC_TYPE,
|
||||||
|
|
||||||
|
.min_len = 1,
|
||||||
|
.max_len = 1
|
||||||
|
},
|
||||||
|
/* MTU Discovery Padding */
|
||||||
|
{
|
||||||
|
.id = CW_ELEM_MTU_DISCOVERY_PADDING,
|
||||||
|
.name = "MTU Discovery Padding"
|
||||||
|
// .start = cw_in_mtu_discovery_padding,
|
||||||
|
}
|
||||||
|
,
|
||||||
|
{
|
||||||
|
|
||||||
|
.id = CW_ELEM_VENDOR_SPECIFIC_PAYLOAD,
|
||||||
|
.name = "Vendor Specific Payload",
|
||||||
|
// .start = cw_in_vendor_specific_payload,
|
||||||
|
.min_len=7
|
||||||
|
}
|
||||||
|
,
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{.id=0}
|
{.id=0}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -68,17 +96,22 @@ static cw_message_t messages[] = {
|
|||||||
|
|
||||||
/* Discovery Request Message*/
|
/* Discovery Request Message*/
|
||||||
{
|
{
|
||||||
|
.name = "Discovery Request",
|
||||||
.type = CAPWAP_MSG_DISCOVERY_REQUEST,
|
.type = CAPWAP_MSG_DISCOVERY_REQUEST,
|
||||||
.states = (int[]){CAPWAP_STATE_DISCOVERY,0},
|
.states = (int[]){CAPWAP_STATE_DISCOVERY,0},
|
||||||
.elements = (cw_messagedef_t[]){
|
.elements = (cw_messagedef_t[]){
|
||||||
{0,0,CAPWAP_ELEM_DISCOVERY_TYPE,1},
|
{0,0,CAPWAP_ELEM_DISCOVERY_TYPE,1},
|
||||||
{0,0,CAPWAP_ELEM_WTP_BOARD_DATA,1},
|
{0,0,CAPWAP_ELEM_WTP_BOARD_DATA,1},
|
||||||
{0,0,CAPWAP_ELEM_WTP_DESCRIPTOR,1},
|
{0,0,CAPWAP_ELEM_WTP_DESCRIPTOR,1},
|
||||||
{0,0,CW_ELEM_WTP_FRAME_TUNNEL_MODE,1},
|
{0,0,CAPWAP_ELEM_WTP_FRAME_TUNNEL_MODE,1},
|
||||||
|
{0,0,CAPWAP_ELEM_WTP_MAC_TYPE,1},
|
||||||
|
{0,0,CW_ELEM_MTU_DISCOVERY_PADDING,0},
|
||||||
|
{0,0,CW_ELEM_VENDOR_SPECIFIC_PAYLOAD,0}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
void test_sets(){
|
void test_sets(){
|
||||||
|
|
||||||
cw_message_set_t * set = cw_message_set_create();
|
cw_message_set_t * set = cw_message_set_create();
|
||||||
@ -87,7 +120,24 @@ void test_sets(){
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
cw_message_set_add(set,messages,&elements);
|
cw_message_set_add(set,messages,elements);
|
||||||
|
|
||||||
|
cw_message_element_t el, *result;
|
||||||
|
memset(&el,0,sizeof(el));
|
||||||
|
el.id=CAPWAP_ELEM_DISCOVERY_TYPE;
|
||||||
|
|
||||||
|
result = mavl_find(set->all_elems,&el);
|
||||||
|
|
||||||
|
if (result!=NULL){
|
||||||
|
printf("Found: %d %s\n",
|
||||||
|
result->id,
|
||||||
|
result->name
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
printf("not found\n");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -156,7 +206,7 @@ static cw_action_in_t actions_in[] = {
|
|||||||
{
|
{
|
||||||
.capwap_state = CAPWAP_STATE_DISCOVERY,
|
.capwap_state = CAPWAP_STATE_DISCOVERY,
|
||||||
.msg_id = CAPWAP_MSG_DISCOVERY_REQUEST,
|
.msg_id = CAPWAP_MSG_DISCOVERY_REQUEST,
|
||||||
.elem_id = CW_ELEM_WTP_FRAME_TUNNEL_MODE,
|
.elem_id = CAPWAP_ELEM_WTP_FRAME_TUNNEL_MODE,
|
||||||
.start = cw_in_generic2,
|
.start = cw_in_generic2,
|
||||||
.item_id = CW_ITEM_WTP_FRAME_TUNNEL_MODE,
|
.item_id = CW_ITEM_WTP_FRAME_TUNNEL_MODE,
|
||||||
.mand = 1,
|
.mand = 1,
|
||||||
@ -169,7 +219,7 @@ static cw_action_in_t actions_in[] = {
|
|||||||
{
|
{
|
||||||
.capwap_state = CAPWAP_STATE_DISCOVERY,
|
.capwap_state = CAPWAP_STATE_DISCOVERY,
|
||||||
.msg_id = CAPWAP_MSG_DISCOVERY_REQUEST,
|
.msg_id = CAPWAP_MSG_DISCOVERY_REQUEST,
|
||||||
.elem_id = CW_ELEM_WTP_MAC_TYPE,
|
.elem_id = CAPWAP_ELEM_WTP_MAC_TYPE,
|
||||||
.start = cw_in_generic2,
|
.start = cw_in_generic2,
|
||||||
.item_id = CW_ITEM_WTP_MAC_TYPE,
|
.item_id = CW_ITEM_WTP_MAC_TYPE,
|
||||||
.mand = 1,
|
.mand = 1,
|
||||||
@ -178,6 +228,8 @@ static cw_action_in_t actions_in[] = {
|
|||||||
}
|
}
|
||||||
,
|
,
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* MTU Discovery Padding */
|
/* MTU Discovery Padding */
|
||||||
{
|
{
|
||||||
.capwap_state = CAPWAP_STATE_DISCOVERY,
|
.capwap_state = CAPWAP_STATE_DISCOVERY,
|
||||||
@ -186,7 +238,7 @@ static cw_action_in_t actions_in[] = {
|
|||||||
.start = cw_in_mtu_discovery_padding,
|
.start = cw_in_mtu_discovery_padding,
|
||||||
}
|
}
|
||||||
,
|
,
|
||||||
|
// TODO: Add them
|
||||||
/* Vendor Specific Payload */
|
/* Vendor Specific Payload */
|
||||||
{
|
{
|
||||||
.capwap_state = CAPWAP_STATE_DISCOVERY,
|
.capwap_state = CAPWAP_STATE_DISCOVERY,
|
||||||
@ -273,7 +325,7 @@ static cw_action_in_t actions_in[] = {
|
|||||||
{
|
{
|
||||||
.capwap_state = CW_STATE_JOIN,
|
.capwap_state = CW_STATE_JOIN,
|
||||||
.msg_id = CAPWAP_MSG_JOIN_REQUEST,
|
.msg_id = CAPWAP_MSG_JOIN_REQUEST,
|
||||||
.elem_id = CW_ELEM_WTP_FRAME_TUNNEL_MODE,
|
.elem_id = CAPWAP_ELEM_WTP_FRAME_TUNNEL_MODE,
|
||||||
.start = cw_in_generic2,
|
.start = cw_in_generic2,
|
||||||
.item_id = CW_ITEM_WTP_FRAME_TUNNEL_MODE,
|
.item_id = CW_ITEM_WTP_FRAME_TUNNEL_MODE,
|
||||||
.mand = 1,
|
.mand = 1,
|
||||||
@ -286,7 +338,7 @@ static cw_action_in_t actions_in[] = {
|
|||||||
{
|
{
|
||||||
.capwap_state = CW_STATE_JOIN,
|
.capwap_state = CW_STATE_JOIN,
|
||||||
.msg_id = CAPWAP_MSG_JOIN_REQUEST,
|
.msg_id = CAPWAP_MSG_JOIN_REQUEST,
|
||||||
.elem_id = CW_ELEM_WTP_MAC_TYPE,
|
.elem_id = CAPWAP_ELEM_WTP_MAC_TYPE,
|
||||||
.start = cw_in_generic2,
|
.start = cw_in_generic2,
|
||||||
.item_id = CW_ITEM_WTP_MAC_TYPE,
|
.item_id = CW_ITEM_WTP_MAC_TYPE,
|
||||||
.mand = 1,
|
.mand = 1,
|
||||||
|
@ -485,7 +485,7 @@ static cw_action_out_t actions_out[] = {
|
|||||||
/* WTP Frame TunnelMode - Discovery Request */
|
/* WTP Frame TunnelMode - Discovery Request */
|
||||||
{
|
{
|
||||||
.msg_id = CAPWAP_MSG_DISCOVERY_REQUEST,
|
.msg_id = CAPWAP_MSG_DISCOVERY_REQUEST,
|
||||||
.elem_id = CW_ELEM_WTP_FRAME_TUNNEL_MODE,
|
.elem_id = CAPWAP_ELEM_WTP_FRAME_TUNNEL_MODE,
|
||||||
.item_id = CW_ITEM_WTP_FRAME_TUNNEL_MODE,
|
.item_id = CW_ITEM_WTP_FRAME_TUNNEL_MODE,
|
||||||
.out = cw_out_generic,
|
.out = cw_out_generic,
|
||||||
.get = cw_out_get_local,
|
.get = cw_out_get_local,
|
||||||
@ -496,7 +496,7 @@ static cw_action_out_t actions_out[] = {
|
|||||||
/* WTP Mac Type - Discovery Request */
|
/* WTP Mac Type - Discovery Request */
|
||||||
{
|
{
|
||||||
.msg_id = CAPWAP_MSG_DISCOVERY_REQUEST,
|
.msg_id = CAPWAP_MSG_DISCOVERY_REQUEST,
|
||||||
.elem_id = CW_ELEM_WTP_MAC_TYPE,
|
.elem_id = CAPWAP_ELEM_WTP_MAC_TYPE,
|
||||||
.item_id = CW_ITEM_WTP_MAC_TYPE,
|
.item_id = CW_ITEM_WTP_MAC_TYPE,
|
||||||
.out = cw_out_generic,
|
.out = cw_out_generic,
|
||||||
.get = cw_out_get_local,
|
.get = cw_out_get_local,
|
||||||
@ -566,7 +566,7 @@ static cw_action_out_t actions_out[] = {
|
|||||||
/* WTP Frame Tunnel Mode - Join Request */
|
/* WTP Frame Tunnel Mode - Join Request */
|
||||||
{
|
{
|
||||||
.msg_id = CAPWAP_MSG_JOIN_REQUEST,
|
.msg_id = CAPWAP_MSG_JOIN_REQUEST,
|
||||||
.elem_id = CW_ELEM_WTP_FRAME_TUNNEL_MODE,
|
.elem_id = CAPWAP_ELEM_WTP_FRAME_TUNNEL_MODE,
|
||||||
.item_id = CW_ITEM_WTP_FRAME_TUNNEL_MODE,
|
.item_id = CW_ITEM_WTP_FRAME_TUNNEL_MODE,
|
||||||
.out = cw_out_generic,
|
.out = cw_out_generic,
|
||||||
.get = cw_out_get_local,
|
.get = cw_out_get_local,
|
||||||
@ -578,7 +578,7 @@ static cw_action_out_t actions_out[] = {
|
|||||||
/* WTP MAC Type - Join Request */
|
/* WTP MAC Type - Join Request */
|
||||||
{
|
{
|
||||||
.msg_id = CAPWAP_MSG_JOIN_REQUEST,
|
.msg_id = CAPWAP_MSG_JOIN_REQUEST,
|
||||||
.elem_id = CW_ELEM_WTP_MAC_TYPE,
|
.elem_id = CAPWAP_ELEM_WTP_MAC_TYPE,
|
||||||
.item_id = CW_ITEM_WTP_MAC_TYPE,
|
.item_id = CW_ITEM_WTP_MAC_TYPE,
|
||||||
.out = cw_out_generic,
|
.out = cw_out_generic,
|
||||||
.get = cw_out_get_local,
|
.get = cw_out_get_local,
|
||||||
|
Loading…
Reference in New Issue
Block a user