Playing round with a new state machine concept.
FossilOrigin-Name: b15d1beded51369384764d634c232711fc37027a08e25ad22b5ed0e841b9e574
This commit is contained in:
parent
88aa7793a2
commit
e74e8772f8
@ -320,12 +320,15 @@ Vendor spec CAPWAP | Vedor spec LWAPP | Vendor specific LWAPP data
|
||||
Mode: An 8-bit value describing the type of information being sent.
|
||||
The following values are supported:
|
||||
|
||||
0 - Split MAC
|
||||
2 - Local MAC
|
||||
0 - Split MAC / Local Mode
|
||||
1 - Monitor
|
||||
2 - Local MAC / FlexConnect
|
||||
3 - Rogue Detector
|
||||
4 - Sniffer
|
||||
|
||||
Type: AP Type
|
||||
|
||||
4 -
|
||||
0 - ?
|
||||
|
||||
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include <stdint.h>
|
||||
#include <netinet/in.h>
|
||||
@ -36,6 +36,9 @@
|
||||
|
||||
#include "db.h"
|
||||
|
||||
|
||||
|
||||
|
||||
int ac_run();
|
||||
|
||||
void alive_thread(void *data)
|
||||
@ -46,9 +49,83 @@ void alive_thread(void *data)
|
||||
}
|
||||
}
|
||||
|
||||
#include "cw_action.h"
|
||||
|
||||
cw_actionlist_t the_tree;
|
||||
|
||||
int dstart(struct conn *conn,struct cw_action a,uint8_t *data,int len)
|
||||
{
|
||||
printf("DISCO STart Action!!\n");
|
||||
}
|
||||
|
||||
|
||||
|
||||
int main (int argc, const char * argv[])
|
||||
{
|
||||
|
||||
|
||||
cw_actionlist_t t = cw_actionlist_create();
|
||||
the_tree=t;
|
||||
|
||||
|
||||
cw_action_t discovery_actions[] = {
|
||||
{ CW_STATE_DISCOVERY,CW_MSG_DISCOVERY_REQUEST,-1,0,0,
|
||||
dstart
|
||||
},
|
||||
{CW_STATE_DISCOVERY,CW_MSG_DISCOVERY_REQUEST, CW_ELEM_DISCOVERY_TYPE},
|
||||
{CW_STATE_DISCOVERY,CW_MSG_DISCOVERY_REQUEST, CW_ELEM_WTP_BOARD_DATA},
|
||||
{CW_STATE_DISCOVERY,CW_MSG_DISCOVERY_REQUEST, CW_ELEM_WTP_DESCRIPTOR},
|
||||
{CW_STATE_DISCOVERY,CW_MSG_DISCOVERY_REQUEST, CW_ELEM_WTP_FRAME_TUNNEL_MODE},
|
||||
{CW_STATE_DISCOVERY,CW_MSG_DISCOVERY_REQUEST, CW_ELEM_WTP_MAC_TYPE},
|
||||
{0}
|
||||
};
|
||||
|
||||
|
||||
|
||||
cw_action_t join_actions[] = {
|
||||
|
||||
{CW_STATE_JOIN,CW_MSG_JOIN_REQUEST,-1,0,0},
|
||||
{CW_STATE_JOIN,CW_MSG_JOIN_REQUEST, CW_ELEM_DISCOVERY_TYPE},
|
||||
{CW_STATE_JOIN,CW_MSG_JOIN_REQUEST, CW_ELEM_WTP_BOARD_DATA},
|
||||
{CW_STATE_JOIN,CW_MSG_JOIN_REQUEST, CW_ELEM_WTP_DESCRIPTOR},
|
||||
{CW_STATE_JOIN,CW_MSG_JOIN_REQUEST, CW_ELEM_WTP_FRAME_TUNNEL_MODE},
|
||||
{CW_STATE_JOIN,CW_MSG_JOIN_REQUEST, CW_ELEM_WTP_MAC_TYPE},
|
||||
{0}
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
cw_register_actions(t,discovery_actions);
|
||||
cw_register_actions(t,join_actions);
|
||||
|
||||
|
||||
#define CW_NAME_DISCOVER_REQUEST "Discovery Request"
|
||||
|
||||
/*
|
||||
int i;
|
||||
for(i=0; discovery[i].capwap_state!=CW_STATE_MAX; i++){
|
||||
printf("State: %d MSG_ID: %d ELEM_ID: %d\n",discovery[i].capwap_state,discovery[i].msg_id,discovery[i].elem_id);
|
||||
void * rc = msgtree_add(t,&(discovery[i]));
|
||||
|
||||
printf("Added to tree %p\n",rc);
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
e.capwap_state=0;
|
||||
e.msg_id = CW_MSG_DISCOVERY_REQUEST;
|
||||
e.elem_id = CW_ELEM_AC_NAME;
|
||||
e.name = "AC Name";
|
||||
|
||||
msgtree_add(t,&e);
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
// send_image_file(0,"/home/tube/Downloads/c1130-rcvk9w8-tar.124-25e.JAP.tar");
|
||||
|
||||
|
||||
|
@ -1,2 +1,3 @@
|
||||
extern void db_ping();
|
||||
extern int db_init();
|
||||
|
||||
|
@ -357,6 +357,13 @@ static void wtpman_run_discovery(void *arg)
|
||||
struct cwrmsg * cwrmsg;
|
||||
|
||||
|
||||
extern cw_actionlist_t the_tree;
|
||||
wtpman->conn->capwap_state=CW_STATE_DISCOVERY;
|
||||
wtpman->conn->msgtr=the_tree;
|
||||
|
||||
|
||||
|
||||
|
||||
time_t timer = cw_timer_start(10);
|
||||
cwrmsg = wtpman_wait_for_message(wtpman, timer);
|
||||
|
||||
@ -559,9 +566,13 @@ static int wtpman_join(void *arg,time_t timer)
|
||||
{
|
||||
struct wtpman * wtpman = (struct wtpman *)arg;
|
||||
|
||||
extern cw_actionlist_t the_tree;
|
||||
wtpman->conn->msgtr=the_tree;
|
||||
wtpman->conn->capwap_state=CW_STATE_JOIN;
|
||||
|
||||
/* timer = cw_timer_start(wtpman->conn->wait_join); */
|
||||
|
||||
int join_msgs[] = { CWMSG_JOIN_REQUEST, -1 };
|
||||
int join_msgs[] = { CW_MSG_JOIN_REQUEST, -1 };
|
||||
struct cwrmsg * cwrmsg;
|
||||
cwrmsg = conn_wait_for_request(wtpman->conn, join_msgs, timer);
|
||||
|
||||
|
@ -239,10 +239,15 @@ BSTROBJS= bstr_create.o \
|
||||
|
||||
FRAGOBJS=fragman.o
|
||||
|
||||
CWACTION=cw_action.o \
|
||||
cw_process_msg.o
|
||||
|
||||
|
||||
OBJS=$(CONNOBJS) $(FRAGOBJS) $(SOCKOBJS) $(CAPWAPOBJS) $(WTPINFOOBJS) \
|
||||
$(LOGOBJS) $(UTILOBJS) $(DTLSOBJS) $(BSTROBJS) \
|
||||
$(LWAPPOBJS) \
|
||||
$(LWAPPCISCOOBJS)
|
||||
$(LWAPPCISCOOBJS) \
|
||||
$(CWACTION)
|
||||
|
||||
#include $(OBJS:.o=.d)
|
||||
|
||||
@ -250,8 +255,8 @@ O:=$(OBJS);
|
||||
|
||||
OBJS:=$(patsubst %.o,$(ARCH)/%.o,$(OBJS))
|
||||
|
||||
#CFLAGS = -Wall -g -O3 -D_REENTRANT -DWITH_IPV6 -DWITH_RMAC_SUPPORT
|
||||
CFLAGS = -Wall -g -O0 -D_REENTRANT -DWITH_IPV6 -DWITH_RMAC_SUPPORT -I/usr/local/include
|
||||
CFLAGS = -Wall -g -O0 -D_REENTRANT -DWITH_IPV6 -DWITH_RMAC_SUPPORT
|
||||
#CFLAGS += -Wall -g -O0 -D_REENTRANT -DWITH_IPV6 -DWITH_RMAC_SUPPORT -I/usr/local/include
|
||||
|
||||
CFLAGS += $(GNUTLS_CFLAGS) \
|
||||
-DWITH_CW_LOG \
|
||||
|
@ -16,6 +16,8 @@
|
||||
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "avltree.h"
|
||||
|
||||
|
||||
@ -31,7 +33,7 @@ void * avltree_get(struct avltree *t ,void *data)
|
||||
else
|
||||
n=n->right;
|
||||
}
|
||||
return 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
@ -55,6 +55,20 @@ enum capwapmodes {
|
||||
CWMODE_ZYXEL
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* CAWAP States
|
||||
*/
|
||||
enum capwap_states {
|
||||
CW_STATE_NONE=0,
|
||||
CW_STATE_DISCOVERY,
|
||||
CW_STATE_JOIN,
|
||||
CW_STATE_UPDATE,
|
||||
CW_STATE_RUN,
|
||||
};
|
||||
|
||||
|
||||
|
||||
/* transport header flags */
|
||||
#define CWTH_FLAGS_R1 0x01 /* bit 0 reserved 1 */
|
||||
#define CWTH_FLAGS_R2 0x02 /* bit 1 reserved 2 */
|
||||
@ -99,8 +113,8 @@ struct capwap_ctrlhdr
|
||||
|
||||
#define CW_MSG_DISCOVERY_REQUEST 1
|
||||
#define CW_MSG_DISCOVERY_RESPONSE 2
|
||||
#define CWMSG_JOIN_REQUEST 3
|
||||
#define CWMSG_JOIN_RESPONSE 4
|
||||
#define CW_MSG_JOIN_REQUEST 3
|
||||
#define CW_MSG_JOIN_RESPONSE 4
|
||||
|
||||
#define CW_MSG_CONFIGURATION_STATUS_REQUEST 5
|
||||
#define CW_MSG_CONFIGURATION_STATUS_RESPONSE 6
|
||||
@ -147,9 +161,8 @@ struct capwap_ctrlhdr
|
||||
#define CW_ELEM_AC_IPV6_LIST 3
|
||||
#define CW_ELEM_AC_NAME 4
|
||||
#define CW_ELEM_AC_NAME_WITH_PRIORITY 5
|
||||
#define CW_ELEM_AC_NAME_WITH_INDEX 5 /* Draft 7 */
|
||||
#define CW_ELEM_AC_NAME_WITH_INDEX 5 /* Draft 7 inaming */
|
||||
#define CW_ELEM_AC_TIMESTAMP 6
|
||||
|
||||
#define CW_ELEM_ADD_MAC_ACL_ENTRY 7
|
||||
#define CW_ELEM_ADD_STATION 8
|
||||
#define CW_ELEM_RESERVED_9 9
|
||||
@ -166,7 +179,7 @@ struct capwap_ctrlhdr
|
||||
#define CW_ELEM_DELETE_MAC_ACL_ENTRY 17
|
||||
#define CW_ELEM_DELETE_STATION 18
|
||||
#define CW_ELEM_RESEERVED_19 19
|
||||
#define CWMSGELEM_DISCOVERY_TYPE 20
|
||||
#define CW_ELEM_DISCOVERY_TYPE 20
|
||||
#define CW_ELEM_DUPLICATE_IPV4_ADDRESS 21
|
||||
#define CW_ELEM_DUPLICATE_IPV6_ADRESS 22
|
||||
#define CWMSGELEM_ECN_SUPPORT 53
|
||||
@ -185,10 +198,10 @@ struct capwap_ctrlhdr
|
||||
#define CW_ELEM_SESSION_ID 35
|
||||
#define CW_ELEM_STATISTICS_TIMER 36
|
||||
#define CW_ELEM_VENDOR_SPECIFIC_PAYLOAD 37
|
||||
#define CWMSGELEM_WTP_BOARD_DATA 38
|
||||
#define CWMSGELEM_WTP_DESCRIPTOR 39
|
||||
#define CW_ELEM_WTP_BOARD_DATA 38
|
||||
#define CW_ELEM_WTP_DESCRIPTOR 39
|
||||
#define CW_ELEM_WTP_FALLBACK 40
|
||||
#define CWMSGELEM_WTP_FRAME_TUNNEL_MODE 41
|
||||
#define CW_ELEM_WTP_FRAME_TUNNEL_MODE 41
|
||||
#define CW_ELEM_RESERVED_42 42
|
||||
#define CW_ELEM_RESERVED_43 43
|
||||
#define CW_ELEM_WTP_MAC_TYPE 44
|
||||
@ -502,6 +515,14 @@ extern int cw_readmsg_configuration_update_request(uint8_t *elems,int elems_len)
|
||||
#define cw_get_hdr_flag_f(th) ((ntohl( *((uint32_t*)th)) & CWTH_FLAGS_F ) ? 1:0)
|
||||
#define cw_get_hdr_flag_t(th) ((ntohl( *((uint32_t*)th)) & CWTH_FLAGS_T ) ? 1:0)
|
||||
|
||||
#define cw_get_hdr_msg_offset(th) (4*cw_get_hdr_hlen(th))
|
||||
|
||||
#define cw_get_msg_id(msgptr) (cw_get_dword(msgptr))
|
||||
#define cw_get_msg_type(msgptr) cw_get_msg_id(msgptr)
|
||||
|
||||
#define cw_get_msg_seqnum(msgptr) cw_get_byte( (msgptr) +4 )
|
||||
#define cw_get_msg_elems_len(msgptr) ( cw_get_word( (msgptr) +5 )-3)
|
||||
#define cw_get_msg_elems_ptr(msgptr) ((msgptr)+8)
|
||||
|
||||
/**
|
||||
* Get length of a CAPWAP message elemet
|
||||
|
@ -8,8 +8,8 @@
|
||||
|
||||
|
||||
|
||||
#define CWMSGELEM_80211_ADD_WLAN 1024
|
||||
#define CWMSGELEM_80211_ANTENNA 1025
|
||||
#define CW_ELEM_80211_ADD_WLAN 1024
|
||||
#define CW_ELEM_80211_ANTENNA 1025
|
||||
/*
|
||||
IEEE 802.11 Assigned WTP BSSID 1026
|
||||
IEEE 802.11 Delete WLAN 1027
|
||||
|
@ -30,11 +30,18 @@
|
||||
#include "cwrmsg.h"
|
||||
#include "wtpinfo.h"
|
||||
|
||||
|
||||
#include "cw_action.h"
|
||||
|
||||
struct conn{
|
||||
int sock;
|
||||
struct sockaddr_storage addr;
|
||||
int recv_timeout;
|
||||
|
||||
cw_actionlist_t msgtr;
|
||||
|
||||
uint8_t capwap_state;
|
||||
|
||||
FRAGMAN * fragman;
|
||||
// void (* process_message)(void *,uint8_t *,uint8_t *, int);
|
||||
|
||||
|
@ -130,7 +130,6 @@ static void cw_dbg_packet(struct conn * conn, uint8_t * packet, int len)
|
||||
if (!cw_dbg_is_level(DBG_CW_PKT_IN))
|
||||
return;
|
||||
|
||||
printf("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!Header printer\n");
|
||||
|
||||
/* print the header */
|
||||
char hdr[200];
|
||||
@ -138,13 +137,11 @@ printf("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!Header prin
|
||||
|
||||
|
||||
if (!cw_dbg_is_level(DBG_CW_PKT_DMP)){
|
||||
printf("the dumpi dumper\n");
|
||||
cw_dbg(DBG_CW_PKT_IN,"Processing capwap packet from %s, len=%d\n%s",sock_addr2str(&conn->addr),len,hdr);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
printf("The super dumper\n");
|
||||
cw_dbg_dmp(DBG_CW_PKT_DMP,packet,len,"Processing packet from %s, len=%d\n%s\n\tDump:",
|
||||
sock_addr2str(&conn->addr),len,hdr
|
||||
);
|
||||
@ -186,7 +183,6 @@ void conn_process_packet(struct conn * conn, uint8_t *packet, int len,int (*cb)(
|
||||
return;
|
||||
}
|
||||
|
||||
printf("Debug packet **************************************************************************\n");
|
||||
cw_dbg_packet(conn,packet,len);
|
||||
|
||||
|
||||
@ -229,6 +225,11 @@ printf("Debug packet ***********************************************************
|
||||
|
||||
cw_dbg_packet(conn,f+4,*(uint32_t*)f);
|
||||
|
||||
|
||||
extern int cw_process_msg(struct conn * conn,uint8_t*msg,int len);
|
||||
cw_process_msg(conn,f+4,*(uint32_t*)f);
|
||||
|
||||
|
||||
if (!cwrmsg_init_ctrlhdr(conn,&cwrmsg,f+4,*(uint32_t*)f)){
|
||||
free(f);
|
||||
return;
|
||||
@ -238,11 +239,16 @@ printf("Debug packet ***********************************************************
|
||||
return;
|
||||
}
|
||||
|
||||
extern int cw_process_msg(struct conn * conn,uint8_t*msg,int len);
|
||||
cw_process_msg(conn,packet,len);
|
||||
|
||||
|
||||
if (!cwrmsg_init_ctrlhdr(conn,&cwrmsg,packet+hlen,len-hlen) ){
|
||||
// cw_dbg(DBG_CW_PKT_ERR,"Discarding packet from %s, len=%d (too short)",sock_addr2str(&conn->addr));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
process_message(conn,&cwrmsg,cb,cbarg);
|
||||
return;
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ printf("Bumm %d %d\n",i+elen+4,len);
|
||||
|
||||
callback(arg, type, msgelems + i + 4, elen);
|
||||
i += elen + 4;
|
||||
printf("left = %d\n",len-i);
|
||||
// printf("left = %d\n",len-i);
|
||||
|
||||
} while (i < len);
|
||||
return 1;
|
||||
|
@ -65,7 +65,7 @@ const char * cw_msgelemtostr(int elem_id)
|
||||
Delete Station 18
|
||||
Reserved 19
|
||||
*/
|
||||
case CWMSGELEM_DISCOVERY_TYPE:
|
||||
case CW_ELEM_DISCOVERY_TYPE:
|
||||
return "discovery type";
|
||||
/*
|
||||
Duplicate IPv4 Address 21
|
||||
@ -116,15 +116,15 @@ const char * cw_msgelemtostr(int elem_id)
|
||||
return "Vendor Specific Payload";
|
||||
|
||||
|
||||
case CWMSGELEM_WTP_BOARD_DATA:
|
||||
case CW_ELEM_WTP_BOARD_DATA:
|
||||
return "WTP Board Data";
|
||||
|
||||
case CWMSGELEM_WTP_DESCRIPTOR:
|
||||
case CW_ELEM_WTP_DESCRIPTOR:
|
||||
return "wtp descriptor";
|
||||
|
||||
case CW_ELEM_WTP_FALLBACK:
|
||||
return "WTP Fallback";
|
||||
case CWMSGELEM_WTP_FRAME_TUNNEL_MODE:
|
||||
case CW_ELEM_WTP_FRAME_TUNNEL_MODE:
|
||||
return "Frame Tunnel Mode";
|
||||
|
||||
/* case CWMSGELEM_RESERVED_1:
|
||||
|
@ -27,10 +27,10 @@ const char * cw_msgtostr(int type)
|
||||
case CW_MSG_DISCOVERY_RESPONSE:
|
||||
return "Discovery Response";
|
||||
|
||||
case CWMSG_JOIN_REQUEST:
|
||||
case CW_MSG_JOIN_REQUEST:
|
||||
return "join request";
|
||||
|
||||
case CWMSG_JOIN_RESPONSE:
|
||||
case CW_MSG_JOIN_RESPONSE:
|
||||
return "join response";
|
||||
|
||||
case CW_MSG_CONFIGURATION_STATUS_REQUEST:
|
||||
|
@ -17,7 +17,7 @@ void cwmsg_addelem_80211_add_wlan(struct cwmsg *cwmsg,struct cwwlan *wlan)
|
||||
uint16_t capab=htons(wlan->capab);
|
||||
uint16_t keylen=htons(wlan->key_length);
|
||||
|
||||
cwmsg_vaddelem(cwmsg,CWMSGELEM_80211_ADD_WLAN,
|
||||
cwmsg_vaddelem(cwmsg,CW_ELEM_80211_ADD_WLAN,
|
||||
&wlan->rid,1,
|
||||
&wlan->wid,1,
|
||||
&capab,2,
|
||||
|
@ -52,5 +52,5 @@ void cwmsg_addelem_wtp_board_data(struct cwmsg *cwmsg, struct wtpinfo *wtpinfo)
|
||||
len += wtpinfo->macaddress_len + 4;
|
||||
}
|
||||
|
||||
cwmsg_addelem(cwmsg, CWMSGELEM_WTP_BOARD_DATA, msg, len);
|
||||
cwmsg_addelem(cwmsg, CW_ELEM_WTP_BOARD_DATA, msg, len);
|
||||
}
|
||||
|
@ -61,5 +61,5 @@ void cwmsg_addelem_wtp_descriptor(struct cwmsg * cwmsg, struct wtpinfo * wtpinfo
|
||||
len+=wtpdesc_addsubelem(d+len,CWMSGSUBELEM_WTP_DESCRIPTOR_BOOTLOADER_VERSION,
|
||||
wtpinfo->bootloader_vendor_id,wtpinfo->bootloader_version);
|
||||
|
||||
cwmsg_addelem(cwmsg,CWMSGELEM_WTP_DESCRIPTOR,d,len);
|
||||
cwmsg_addelem(cwmsg,CW_ELEM_WTP_DESCRIPTOR,d,len);
|
||||
}
|
||||
|
@ -80,10 +80,10 @@ void cwread_discovery_request(struct wtpinfo *wtpinfo, uint8_t * msg,
|
||||
int len)
|
||||
{
|
||||
int mand[] = {
|
||||
CWMSGELEM_DISCOVERY_TYPE,
|
||||
CWMSGELEM_WTP_BOARD_DATA,
|
||||
CWMSGELEM_WTP_DESCRIPTOR,
|
||||
CWMSGELEM_WTP_FRAME_TUNNEL_MODE,
|
||||
CW_ELEM_DISCOVERY_TYPE,
|
||||
CW_ELEM_WTP_BOARD_DATA,
|
||||
CW_ELEM_WTP_DESCRIPTOR,
|
||||
CW_ELEM_WTP_FRAME_TUNNEL_MODE,
|
||||
CW_ELEM_WTP_MAC_TYPE,
|
||||
CWMSGELEM_80211_WTP_RADIO_INFO,
|
||||
-1
|
||||
|
@ -25,7 +25,7 @@
|
||||
static int acinfo_readelem_join_resp(void * a,int type,uint8_t* msgelem,int len)
|
||||
{
|
||||
|
||||
cw_dbg_msgelem(CWMSG_JOIN_RESPONSE, type, msgelem, len);
|
||||
cw_dbg_msgelem(CW_MSG_JOIN_RESPONSE, type, msgelem, len);
|
||||
|
||||
struct ac_info * acinfo = (struct ac_info *)a;
|
||||
// cw_log_debug1("Process join resp msgelem, type=%d, len=%d\n",type,len);
|
||||
|
@ -42,7 +42,7 @@ int cwsend_discovery_request(struct conn *conn, struct radioinfo *radioinfo,
|
||||
/* Mandatory elements */
|
||||
|
||||
/* discovery type */
|
||||
cwmsg_addelem(&cwmsg, CWMSGELEM_DISCOVERY_TYPE, &wtpinfo->discovery_type, sizeof(uint8_t));
|
||||
cwmsg_addelem(&cwmsg, CW_ELEM_DISCOVERY_TYPE, &wtpinfo->discovery_type, sizeof(uint8_t));
|
||||
|
||||
/* wtp board data */
|
||||
cwmsg_addelem_wtp_board_data(&cwmsg, wtpinfo);
|
||||
@ -51,7 +51,7 @@ int cwsend_discovery_request(struct conn *conn, struct radioinfo *radioinfo,
|
||||
cwmsg_addelem_wtp_descriptor(&cwmsg, wtpinfo);
|
||||
|
||||
/* wtp frame tunnel mode */
|
||||
cwmsg_addelem(&cwmsg, CWMSGELEM_WTP_FRAME_TUNNEL_MODE, &wtpinfo->frame_tunnel_mode,
|
||||
cwmsg_addelem(&cwmsg, CW_ELEM_WTP_FRAME_TUNNEL_MODE, &wtpinfo->frame_tunnel_mode,
|
||||
sizeof(uint8_t));
|
||||
|
||||
/* mac type */
|
||||
|
@ -41,7 +41,7 @@ int cwsend_join_request(struct conn *conn, struct radioinfo *radioinfo, struct w
|
||||
|
||||
//radioinfo->rmac=0;
|
||||
|
||||
cwmsg_init(&cwmsg, buffer, CWMSG_JOIN_REQUEST, conn_get_next_seqnum(conn), radioinfo);
|
||||
cwmsg_init(&cwmsg, buffer, CW_MSG_JOIN_REQUEST, conn_get_next_seqnum(conn), radioinfo);
|
||||
cwmsg.capwap_mode = conn->capwap_mode;
|
||||
|
||||
// printf("Rad info rmac %s\n",sock_hwaddr2str(bstr_data(radioinfo->rmac),bstr_len(radioinfo->rmac)));
|
||||
@ -65,7 +65,7 @@ int cwsend_join_request(struct conn *conn, struct radioinfo *radioinfo, struct w
|
||||
cwmsg_addelem_session_id(&cwmsg, wtpinfo->session_id);
|
||||
|
||||
/* frame tunnel mode */
|
||||
cwmsg_addelem(&cwmsg, CWMSGELEM_WTP_FRAME_TUNNEL_MODE, &wtpinfo->frame_tunnel_mode,
|
||||
cwmsg_addelem(&cwmsg, CW_ELEM_WTP_FRAME_TUNNEL_MODE, &wtpinfo->frame_tunnel_mode,
|
||||
sizeof(uint8_t));
|
||||
|
||||
/* WTP MAC type */
|
||||
|
@ -10,7 +10,7 @@ void cwsend_join_response(struct conn *conn, int seqnum, int rc, struct radioinf
|
||||
struct ac_info *acinfo, struct wtpinfo *wtpinfo)
|
||||
{
|
||||
struct cwmsg *cwmsg = &conn->resp_msg;
|
||||
cwmsg_init(cwmsg, conn->resp_buffer, CWMSG_JOIN_RESPONSE, seqnum, NULL);
|
||||
cwmsg_init(cwmsg, conn->resp_buffer, CW_MSG_JOIN_RESPONSE, seqnum, NULL);
|
||||
cwmsg->capwap_mode = conn->capwap_mode;
|
||||
|
||||
/* mandatory messagesg elements */
|
||||
|
@ -28,7 +28,6 @@
|
||||
int hdr_print(char *str, uint8_t *packet, int len)
|
||||
{
|
||||
|
||||
printf("The readl header printer\n");
|
||||
|
||||
char *s = str;
|
||||
|
||||
|
@ -42,7 +42,7 @@ static int process_elem(void *eparm,int type,uint8_t* msgelem,int len)
|
||||
struct wtpinfo * wtpinfo = e->wtpinfo;
|
||||
|
||||
|
||||
cw_dbg_msgelem(CWMSG_JOIN_REQUEST, type, msgelem, len);
|
||||
cw_dbg_msgelem(CW_MSG_JOIN_REQUEST, type, msgelem, len);
|
||||
|
||||
|
||||
/* mandatory elements */
|
||||
@ -103,10 +103,10 @@ void process_join_request(struct wtpinfo * wtpinfo, uint8_t * msg, int len)
|
||||
{
|
||||
int mand[] = {
|
||||
CWMSGELEM_LOCATION_DATA,
|
||||
CWMSGELEM_WTP_BOARD_DATA,
|
||||
CWMSGELEM_WTP_DESCRIPTOR,
|
||||
CW_ELEM_WTP_BOARD_DATA,
|
||||
CW_ELEM_WTP_DESCRIPTOR,
|
||||
CW_ELEM_WTP_NAME,
|
||||
CWMSGELEM_WTP_FRAME_TUNNEL_MODE,
|
||||
CW_ELEM_WTP_FRAME_TUNNEL_MODE,
|
||||
CW_ELEM_WTP_MAC_TYPE,
|
||||
CWMSGELEM_ECN_SUPPORT,
|
||||
XCWMSGELEM_CAPWAP_LOCAL_IP_ADDRESS,
|
||||
@ -122,7 +122,7 @@ void process_join_request(struct wtpinfo * wtpinfo, uint8_t * msg, int len)
|
||||
cw_foreach_msgelem(msg, len, process_elem,
|
||||
&eparm);
|
||||
|
||||
cw_dbg_missing_mand_elems_(0, CWMSG_JOIN_REQUEST, eparm.mand);
|
||||
cw_dbg_missing_mand_elems_(0, CW_MSG_JOIN_REQUEST, eparm.mand);
|
||||
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
int wtpinfo_readelem_discovery_type(struct wtpinfo * wtpinfo, int type, uint8_t * msgelem, int len)
|
||||
{
|
||||
if (type != CWMSGELEM_DISCOVERY_TYPE)
|
||||
if (type != CW_ELEM_DISCOVERY_TYPE)
|
||||
return 0;
|
||||
|
||||
if (len!=1){
|
||||
|
@ -58,7 +58,7 @@ static void wtpinfo_readsubelems_wtp_board_data(struct wtpinfo * wtpinfo,uint8_t
|
||||
int wtpinfo_readelem_wtp_board_data(struct wtpinfo *wtpinfo, int type, uint8_t *msgelem, int len)
|
||||
{
|
||||
|
||||
if (type!=CWMSGELEM_WTP_BOARD_DATA)
|
||||
if (type!=CW_ELEM_WTP_BOARD_DATA)
|
||||
return 0;
|
||||
if (len<4){
|
||||
cw_dbg(DBG_ELEM,"Discarding WTP_BOARD_DATA msgelem, wrong size, type=%d, len=%d\n",type,len);
|
||||
|
@ -28,7 +28,7 @@
|
||||
|
||||
static int wtpinfo_readelem_wtp_descriptor_(struct wtpinfo * wtpinfo, int type, uint8_t *msgelem, int len, int capwap_mode)
|
||||
{
|
||||
if (type != CWMSGELEM_WTP_DESCRIPTOR)
|
||||
if (type != CW_ELEM_WTP_DESCRIPTOR)
|
||||
return 0;
|
||||
|
||||
if (len<6)
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
int wtpinfo_readelem_wtp_frame_tunnel_mode(struct wtpinfo * wtpinfo, int type, uint8_t * msgelem, int len)
|
||||
{
|
||||
if (type != CWMSGELEM_WTP_FRAME_TUNNEL_MODE)
|
||||
if (type != CW_ELEM_WTP_FRAME_TUNNEL_MODE)
|
||||
return 0;
|
||||
|
||||
if (len!=1){
|
||||
|
@ -20,7 +20,7 @@ ifndef ARCH
|
||||
endif
|
||||
|
||||
|
||||
CFLAGS += -O2 -Wall -g
|
||||
CFLAGS += -Os -Wall -g
|
||||
LDFLAGS += -L../../src/capwap/$(ARCH)
|
||||
|
||||
|
||||
|
@ -57,6 +57,9 @@ const char * interfaces[]={
|
||||
|
||||
int main()
|
||||
{
|
||||
|
||||
|
||||
|
||||
wtp_main();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user