diff --git a/src/cw/capwap_items.c b/src/cw/capwap_items.c index 561895ed..b0a75e3b 100644 --- a/src/cw/capwap_items.c +++ b/src/cw/capwap_items.c @@ -110,6 +110,7 @@ struct cw_itemdef capwap_itemdefs[] = { {CW_ITEM_AC_NAME_WITH_PRIORITY,CW_ITEM_ANY,MBAG_STR}, {CW_ITEM_AC_NAME,CW_ITEM_NONE,MBAG_STR}, +{CW_ITEM_RESULT_CODE,CW_ITEM_NONE,MBAG_DWORD}, {CW_ITEM_AP_MODE_AND_TYPE,CW_ITEM_NONE,MBAG_WORD}, diff --git a/src/cw/lw.h b/src/cw/lw.h index 41bf9743..507dff14 100644 --- a/src/cw/lw.h +++ b/src/cw/lw.h @@ -120,6 +120,9 @@ static inline int lw_put_elem_hdr(uint8_t *dst,uint8_t type,uint16_t len) +extern uint16_t lw_checksum(uint8_t *d,int len); + + /** * @} */ diff --git a/src/cw/lw_checksum.c b/src/cw/lw_checksum.c index 28f9a325..80ad2e42 100644 --- a/src/cw/lw_checksum.c +++ b/src/cw/lw_checksum.c @@ -19,7 +19,7 @@ /** *@file *@brief Implements lw_checksum. - *@addtogroup LWAPPFunctions + *@addtogroup LW *@{ */ diff --git a/src/cw/lwapp.h b/src/cw/lwapp.h index ea9987b2..1fa49cee 100644 --- a/src/cw/lwapp.h +++ b/src/cw/lwapp.h @@ -272,7 +272,7 @@ extern int lw_put_cisco_path_mtu(uint8_t *dst, uint16_t max, uint16_t padding); /* function proto types */ -extern uint16_t lw_checksum(uint8_t *d,int len); +//extern uint16_t lw_checksum(uint8_t *d,int len); //extern int lw_readelem_wtp_board_data(struct wtpinfo *wtpinfo, int type, uint8_t *msgelem, int len); extern int lw_readelem_wtp_name(bstr_t * dst, int type, uint8_t * msgelem, int len); diff --git a/src/cw/rand.h b/src/cw/rand.h index c49302c1..6785e003 100644 --- a/src/cw/rand.h +++ b/src/cw/rand.h @@ -1,7 +1,6 @@ #ifndef __CW_RAND_H #define __CW_RAND_H - extern int cw_rand(uint8_t*dst, int len); #endif diff --git a/src/mod/capwap/Makefile b/src/mod/capwap/Makefile index fcfa84ee..48b3fe9d 100644 --- a/src/mod/capwap/Makefile +++ b/src/mod/capwap/Makefile @@ -7,7 +7,8 @@ OBJS=\ capwap_in_wtp_descriptor.o \ capwap_in_wtp_board_data.o \ capwap_out_wtp_descriptor.o \ - capwap_out_ac_descriptor.o + capwap_out_ac_descriptor.o \ + capwap_out_get_session_id.o NAME=libcapwap.a diff --git a/src/mod/capwap/capwap_actions_wtp.c b/src/mod/capwap/capwap_actions_wtp.c index 16562982..0062f6f0 100644 --- a/src/mod/capwap/capwap_actions_wtp.c +++ b/src/mod/capwap/capwap_actions_wtp.c @@ -79,13 +79,35 @@ static cw_action_in_t actions_in[] = { , + /* ---------------------------------------------------------------- + * Message Join Response + */ + { + .capwap_state = CW_STATE_JOIN, + .msg_id = CW_MSG_JOIN_RESPONSE, + .end = cw_in_check_join_resp + } + , + /* Result Code - Join Response */ + { + .capwap_state = CW_STATE_JOIN, + .msg_id = CW_MSG_JOIN_RESPONSE, + .elem_id = CW_ELEM_RESULT_CODE, + .item_id = CW_ITEM_RESULT_CODE, + .start = cw_in_generic2, + .min_len = 4, + .max_len = 4, + .mand = 1 + } + , + }; static cw_action_out_t actions_out[] = { /* --------------------------------------------------------------- - * Discovery Request + * Discovery Request - Out */ /* Discovery Type - Discovery Request */ @@ -147,27 +169,95 @@ static cw_action_out_t actions_out[] = { , /* --------------------------------------------------------------- - * Join Request + * Join Request - Out */ - /* Discovery Type - Discovery Request */ + /* Location Data - Join Request */ { .msg_id = CW_MSG_JOIN_REQUEST, .elem_id = CW_ELEM_LOCATION_DATA, .item_id = CW_ITEM_LOCATION_DATA, .out = cw_out_generic, + .get = cw_out_get_config, + .mand = 1 + } + , + + /* WTP Board Data - Join Request */ + { + .msg_id = CW_MSG_JOIN_REQUEST, + .elem_id = CW_ELEM_WTP_BOARD_DATA, + .item_id = CW_ITEM_WTP_BOARD_DATA, + .out = cw_out_wtp_board_data, .get = cw_out_get_outgoing, .mand = 1 } , + /* WTP Descriptor - Join Request */ + { + .msg_id = CW_MSG_JOIN_REQUEST, + .elem_id = CW_ELEM_WTP_DESCRIPTOR, + .item_id = CW_ITEM_WTP_DESCRIPTOR, + .out = cw_out_wtp_descriptor, + .mand = 1 + } + , + + /* WTP Name - Join Request */ + { + .msg_id = CW_MSG_JOIN_REQUEST, + .elem_id = CW_ELEM_WTP_NAME, + .item_id = CW_ITEM_WTP_NAME, + .out = cw_out_generic, + .get = cw_out_get_config, + .mand = 1 + } + , + + /* WTP MAC Type - Join Request */ + { + .msg_id = CW_MSG_JOIN_REQUEST, + .elem_id = CW_ELEM_WTP_MAC_TYPE, + .item_id = CW_ITEM_WTP_MAC_TYPE, + .out = cw_out_generic, + .get = cw_out_get_local, + .mand = 1 + } + , + + /* WTP Frame Tunnel Mode - Join Request */ + { + .msg_id = CW_MSG_JOIN_REQUEST, + .elem_id = CW_ELEM_WTP_FRAME_TUNNEL_MODE, + .item_id = CW_ITEM_WTP_FRAME_TUNNEL_MODE, + .out = cw_out_generic, + .get = cw_out_get_local, + .mand = 1 + } + , + + /* Session ID - Join Request */ + { + .msg_id = CW_MSG_JOIN_REQUEST, + .elem_id = CW_ELEM_SESSION_ID, + .item_id = CW_ITEM_SESSION_ID, + .out = cw_out_generic, + .get = cw_out_get_session_id, + .mand = 1 + } + , + -// {CW_MSG_DISCOVERY_REQUEST, CW_ITEM_DISCOVERY_TYPE, 0, -// CW_ELEM_DISCOVERY_TYPE, NULL,cw_out_generic, cw_out_get_outgoing} + /* WTP Descriptor */ +// {CW_MSG_JOIN_REQUEST, CW_ITEM_WTP_DESCRIPTOR, 0, +// CW_ELEM_WTP_DESCRIPTOR, NULL,cw_out_wtp_descriptor, NULL,1} +// , + }; diff --git a/src/mod/capwap/mod_capwap.h b/src/mod/capwap/mod_capwap.h index 2ccf7f9b..f8d706b4 100644 --- a/src/mod/capwap/mod_capwap.h +++ b/src/mod/capwap/mod_capwap.h @@ -16,5 +16,7 @@ extern int capwap_out_wtp_descriptor(struct conn *conn, struct cw_action_out *a, extern int capwap_out_ac_descriptor(struct conn *conn,struct cw_action_out * a,uint8_t *dst); +extern struct mbag_item * capwap_out_get_session_id(struct conn *conn,struct cw_action_out * a); + #endif diff --git a/src/wtp/wtp_main.c b/src/wtp/wtp_main.c index 63a07c81..084c89b4 100644 --- a/src/wtp/wtp_main.c +++ b/src/wtp/wtp_main.c @@ -203,8 +203,8 @@ mavl_destroy(b); cw_acpriolist_set(acprios, "AC8new", strlen("AC8new"), 12); -// mbag_set_str(conn->local,CW_ITEM_LOCATION_DATA,"Berlin"); -// mbag_set_str(conn->local,CW_ITEM_WTP_NAME,"WTP Tube"); + mbag_set_str(conn->config,CW_ITEM_LOCATION_DATA,"Berlin"); + mbag_set_str(conn->config,CW_ITEM_WTP_NAME,"WTP Tube"); mbag_set_byte(conn->local, CW_ITEM_WTP_MAC_TYPE, 0); mbag_set_byte(conn->local, CW_ITEM_WTP_FRAME_TUNNEL_MODE, 0);