From cbd513792baca21dbdd43e7ad759449beb0c443e Mon Sep 17 00:00:00 2001 From: "7u83@mail.ru" <7u83@mail.ru@noemail.net> Date: Mon, 18 Apr 2016 05:40:30 +0000 Subject: [PATCH] wtp FossilOrigin-Name: 71f629df1cccad394595950c2419a3523113d36cf07c39418a075b6601d89ad8 --- src/cw/Makefile | 4 +- src/cw/capwap.h | 16 +-- src/cw/capwap_items.c | 11 +-- src/cw/capwap_items.h | 4 +- src/cw/cw_out_radio_generic.c | 6 ++ src/cw/cw_out_radio_operational_states.c | 2 +- src/cw/cw_put_radio_operational_states.c | 2 +- src/cw/radio.c | 29 +----- src/cw/send.c | 2 + src/mod/capwap/capwap_actions_ac.c | 4 +- src/mod/capwap/capwap_actions_wtp.c | 40 ++++++-- src/mod/cisco/Makefile | 3 +- src/mod/cisco/cisco.h | 1 + src/mod/cisco/cisco_actions_wtp.c | 97 +++++++++++++++++-- .../cisco_in_radio_administrative_state.c | 3 + .../cisco/cisco_in_radio_operational_state.c | 17 +++- src/mod/cisco/mod_cisco_wtp.c | 6 +- src/wtp/cfg.c | 13 ++- src/wtp/changestate.c | 2 +- src/wtp/configure.c | 3 +- src/wtp/join.c | 2 +- src/wtp/run.c | 11 ++- src/wtp/wtp_main.c | 7 +- 23 files changed, 207 insertions(+), 78 deletions(-) diff --git a/src/cw/Makefile b/src/cw/Makefile index 053a2339..bddf2dbe 100644 --- a/src/cw/Makefile +++ b/src/cw/Makefile @@ -159,8 +159,6 @@ CAPWAPOBJS= \ cw_out_wtp_reboot_statistics.o \ cw_in_wtp_reboot_statistics.o\ cw_in_cisco_image_identifier.o\ - cw_out_radio_operational_states.o\ - cw_out_radio_operational_states_7.o\ cw_put_radio_operational_states.o \ cw_put_ac_status.o \ cw_in_ac_descriptor.o\ @@ -196,6 +194,8 @@ CAPWAP80211OBJS=\ capwap80211_items.o\ capwap80211_type_rateset.o \ +# cw_out_radio_operational_states.o\ +# cw_out_radio_operational_states_7.o\ # # SSL objects diff --git a/src/cw/capwap.h b/src/cw/capwap.h index c0f39030..cb6b1cf5 100644 --- a/src/cw/capwap.h +++ b/src/cw/capwap.h @@ -302,10 +302,10 @@ CW_MSG_MAXMSG = 26 /* Frame tunnnel mode bits */ -#define WTP_FRAME_TUNNEL_MODE_R 1 /* Reserved */ -#define WTP_FRAME_TUNNEL_MODE_L 2 /* Local bridging */ -#define WTP_FRAME_TUNNEL_MODE_E 4 /* 802.3 mode */ -#define WTP_FRAME_TUNNEL_MODE_N 8 /* native mode */ +#define CW_WTP_FRAME_TUNNEL_MODE_R 1 /* Reserved */ +#define CW_WTP_FRAME_TUNNEL_MODE_L 2 /* Local bridging */ +#define CW_WTP_FRAME_TUNNEL_MODE_E 4 /* 802.3 mode */ +#define CW_WTP_FRAME_TUNNEL_MODE_N 8 /* native mode */ #include "radioinfo.h" @@ -320,9 +320,9 @@ CW_MSG_MAXMSG = 26 /* wtp mac types */ -#define WTP_MAC_TYPE_LOCAL 0 -#define WTP_MAC_TYPE_SPLIT 1 -#define WTP_MAC_TYPE_BOTH 2 +#define CW_WTP_MAC_TYPE_LOCAL 0 +#define CW_WTP_MAC_TYPE_SPLIT 1 +#define CW_WTP_MAC_TYPE_BOTH 2 @@ -745,7 +745,7 @@ int cw_in_check_chng_state_evnt_req(struct conn *conn, struct cw_action_in *a, u int len,struct sockaddr *from); -int cw_out_radio_operational_states(struct conn *conn, struct cw_action_out *a, uint8_t * dst); +//int cw_out_radio_operational_states(struct conn *conn, struct cw_action_out *a, uint8_t * dst); int cw_in_check_cfg_update_req(struct conn *conn, struct cw_action_in *a, uint8_t * data, diff --git a/src/cw/capwap_items.c b/src/cw/capwap_items.c index 058617f3..deff803d 100644 --- a/src/cw/capwap_items.c +++ b/src/cw/capwap_items.c @@ -41,7 +41,6 @@ const char CW_ITEM_WTP_OTHERSOFTWARE_VERSION, const char CW_ITEM_WTP_BOARD_DATA[]="wtp_board_data"; const char CW_ITEM_WTP_DESCRIPTOR[]="0wtp_descriptor"; const char CW_ITEM_CAPWAP_TIMERS[]="capwap_timers"; -//const char CW_ITEM_RADIO_ADMINISTRATIVE_STATE[]="radio_admin_state"; const char CW_ITEM_AC_NAME[]="ac_name"; const char CW_ITEM_AC_DESCRIPTOR[]="ac_descriptor"; @@ -69,7 +68,7 @@ const char CW_ITEM_MAXIMUM_MESSAGE_LENGTH[]="maximum_message_length"; /* CIPWAP and Cisco */ -const char CW_ITEM_WTP_GROUP_NAME[]="wtp_group_name"; +//const char CW_ITEM_WTP_GROUP_NAME[]="wtp_group_name"; /* Other Items */ @@ -102,6 +101,7 @@ struct cw_itemdef capwap_itemdefs[] = { {CW_ITEM_WTP_NAME,CW_ITEM_NONE,MBAG_STR}, {CW_ITEM_WTP_MAC_TYPE,CW_ITEM_NONE,MBAG_BYTE}, + {CW_ITEM_WTP_FRAME_TUNNEL_MODE,CW_ITEM_NONE,MBAG_BYTE}, {CW_ITEM_WTP_FALLBACK,CW_ITEM_NONE,MBAG_BYTE}, @@ -120,13 +120,12 @@ struct cw_itemdef capwap_itemdefs[] = { {CW_ITEM_CAPWAP_TRANSPORT_PROTOCOL,CW_ITEM_NONE,MBAG_BYTE}, -{CW_ITEM_WTP_FRAME_TUNNEL_MODE,CW_ITEM_NONE,MBAG_BYTE}, {CW_ITEM_LOCATION_DATA,CW_ITEM_NONE,MBAG_STR}, {CW_ITEM_WTP_HARDWARE_VERSION,CW_ITEM_NONE,MBAG_VENDORSTR}, {CW_ITEM_WTP_SOFTWARE_VERSION,CW_ITEM_NONE,MBAG_VENDORSTR}, {CW_ITEM_WTP_BOOT_VERSION,CW_ITEM_NONE,MBAG_VENDORSTR}, {CW_ITEM_WTP_OTHER_VERSION,CW_ITEM_NONE,MBAG_VENDORSTR}, -{CW_ITEM_WTP_GROUP_NAME,CW_ITEM_NONE,MBAG_STR}, +//{CW_ITEM_WTP_GROUP_NAME,CW_ITEM_NONE,MBAG_STR}, {CW_ITEM_MAXIMUM_MESSAGE_LENGTH,CW_ITEM_NONE,MBAG_WORD}, {CW_ITEM_STATISTICS_TIMER,CW_ITEM_NONE,MBAG_WORD}, {CW_ITEM_IDLE_TIMEOUT,CW_ITEM_NONE,MBAG_DWORD}, @@ -168,11 +167,11 @@ const char CW_RADIOITEM_OPER_STATE[]="oper_state"; const char CW_RADIOITEM_DECRYPTION_ERROR_REPORT_PERIOD[]="decryption_error_report_period"; -struct cw_itemdef capwap_radiodefs[] = { +struct cw_itemdef capwap_radioitemdefs[] = { {CW_RADIOITEM_ADMIN_STATE,CW_ITEM_NONE,MBAG_BYTE}, {CW_RADIOITEM_OPER_STATE,CW_ITEM_NONE,MBAG_WORD}, - {CW_RADIOITEM_DECRYPTION_ERROR_REPORT_PERIOD}, + {CW_RADIOITEM_DECRYPTION_ERROR_REPORT_PERIOD,CW_ITEM_NONE,MBAG_WORD}, {CW_ITEM_NONE} }; diff --git a/src/cw/capwap_items.h b/src/cw/capwap_items.h index 235522a0..bc4a9d0c 100644 --- a/src/cw/capwap_items.h +++ b/src/cw/capwap_items.h @@ -138,7 +138,7 @@ extern const char CW_ITEM_CAPWAP_TRANSPORT_PROTOCOL[]; /* CIPWAP and Cisco */ -extern const char CW_ITEM_WTP_GROUP_NAME[]; +//extern const char CW_ITEM_WTP_GROUP_NAME[]; /* Other Items */ @@ -199,7 +199,7 @@ extern const char CW_RADIOITEM_DECRYPTION_ERROR_REPORT_PERIOD[]; extern struct cw_itemdef capwap_itemdefs[]; -extern struct cw_itemdef capwap_radiodefs[]; +extern struct cw_itemdef capwap_radioitemdefs[]; #endif diff --git a/src/cw/cw_out_radio_generic.c b/src/cw/cw_out_radio_generic.c index 5b3aff7b..d7b612e3 100644 --- a/src/cw/cw_out_radio_generic.c +++ b/src/cw/cw_out_radio_generic.c @@ -3,10 +3,13 @@ #include "action.h" #include "cw.h" +#include "cw/dbg.h" int cw_out_radio_generic(struct conn *conn, struct cw_action_out *a, uint8_t * dst) { +cw_dbg(DBG_X,"Radio Generic out %s",a->item_id); + int l=0; MAVLITER_DEFINE(it,conn->radios_upd); mavliter_foreach(&it){ @@ -25,10 +28,13 @@ int cw_out_radio_generic(struct conn *conn, struct cw_action_out *a, uint8_t * d struct mbag_item * item = mbag_get(radio->data,a->item_id); if (!item){ +cw_dbg(DBG_X,"Not found! %s for rid %d",a->item_id,radio->iid); continue; } int len=0; len += cw_put_byte(d+start,radio->iid); + + cw_dbg(DBG_X, "Radio generic out '%s' fro rid %d",a->item_id,radio->iid); len += cw_put_mbag_item(d + start+1, item); if (a->vendor_id) diff --git a/src/cw/cw_out_radio_operational_states.c b/src/cw/cw_out_radio_operational_states.c index 8eafe5f0..ff0ed868 100644 --- a/src/cw/cw_out_radio_operational_states.c +++ b/src/cw/cw_out_radio_operational_states.c @@ -24,7 +24,7 @@ #include "radio.h" -int cw_out_radio_operational_states(struct conn *conn, struct cw_action_out *a, uint8_t * dst) +int xxcw_out_radio_operational_states(struct conn *conn, struct cw_action_out *a, uint8_t * dst) { int nerror=0; int l = cw_put_radio_operational_states(conn->radios,dst,&nerror,0); diff --git a/src/cw/cw_put_radio_operational_states.c b/src/cw/cw_put_radio_operational_states.c index 413fde05..5191f4f4 100644 --- a/src/cw/cw_put_radio_operational_states.c +++ b/src/cw/cw_put_radio_operational_states.c @@ -29,7 +29,7 @@ /** * Put all radio operational states */ -int cw_put_radio_operational_states(mbag_t radios, uint8_t * dst, int *nerror, int d7mode) +int xxcw_put_radio_operational_states(mbag_t radios, uint8_t * dst, int *nerror, int d7mode) { uint8_t *d=dst; diff --git a/src/cw/radio.c b/src/cw/radio.c index 2335a8f2..96acb72f 100644 --- a/src/cw/radio.c +++ b/src/cw/radio.c @@ -4,10 +4,6 @@ #include "radio.h" #include "dbg.h" - - -const char CW_RADIO_ADMIN_STATE[]="admin_state"; -const char CW_RADIO_OPER_STATE[]="oper_state"; const char CW_RADIO_TYPE[]="radio_type"; const char CW_RADIO_REG_DOMAIN[]="reg_domain"; const char CW_RADIO_BSSID[]="bssid"; @@ -27,8 +23,8 @@ const char CW_RADIO_CFP_PERIOD[]="cfp_period"; const char CW_RADIO_CFP_MAX_DURATION[]="cfp_max_duration"; -struct cw_itemdef capwap_radioitemdefs[] = { -{CW_RADIO_ADMIN_STATE,CW_ITEM_NONE,MBAG_BYTE}, +struct cw_itemdef xxxcapwap_radioitemdefs[] = { +//{CW_RADIO_ADMIN_STATE,CW_ITEM_NONE,MBAG_BYTE}, {CW_RADIO_TYPE,CW_ITEM_NONE,MBAG_DWORD}, {CW_RADIO_DECRYPTION_ERROR_REPORT_PERIOD,CW_ITEM_NONE,MBAG_WORD}, @@ -39,27 +35,6 @@ struct cw_itemdef capwap_radioitemdefs[] = { }; -/** - * Update all radio operational states. - * @param radios definition of radios - * @param cause cause to set - */ -int cw_radio_update_oper_states(mbag_t radios,int cause) -{ - MAVLITER_DEFINE(it,radios); - mavliter_foreach(&it){ - mbag_item_t * i = mavliter_get(&it); - - /* Get admin state of the radio, set disabled (2) if admin state is - not defined */ - int admin_state = mbag_get_byte(i->data,CW_RADIO_ADMIN_STATE,2); - mbag_set_word(i->data,CW_RADIO_OPER_STATE,(admin_state<<8) | cause ); - - } - return 1; -} - - diff --git a/src/cw/send.c b/src/cw/send.c index 45b8e384..a17cfa7b 100644 --- a/src/cw/send.c +++ b/src/cw/send.c @@ -15,6 +15,8 @@ int conn_send_msg(struct conn * conn, uint8_t *rawmsg) int packetlen = cw_get_hdr_msg_total_len(rawmsg); +cw_dbg(DBG_X,"Here is a conn_send_msg for anything"); + cw_dbg_msg(DBG_MSG_OUT, conn,rawmsg, packetlen,(struct sockaddr*)&conn->addr); diff --git a/src/mod/capwap/capwap_actions_ac.c b/src/mod/capwap/capwap_actions_ac.c index 4c4b3ea8..b3100595 100644 --- a/src/mod/capwap/capwap_actions_ac.c +++ b/src/mod/capwap/capwap_actions_ac.c @@ -172,7 +172,7 @@ static cw_action_in_t actions_in[] = { .msg_id = CW_MSG_JOIN_REQUEST, .elem_id = CW_ELEM_WTP_NAME, .start = cw_in_generic2, - .item_id = "wtp_name", + .item_id = CW_ITEM_WTP_NAME, .mand = 1, .min_len = 1, .max_len = 1024 @@ -801,7 +801,7 @@ int capwap_register_actions_ac(struct cw_actiondef *def) rc += cw_strheap_register_strings(def->strelem, capwap_strings_elem); rc += cw_itemdefheap_register(def->items, capwap_itemdefs); - rc += cw_itemdefheap_register(def->radioitems, capwap_radiodefs); + rc += cw_itemdefheap_register(def->radioitems, capwap_radioitemdefs); intavltree_add(def->wbids, 0); diff --git a/src/mod/capwap/capwap_actions_wtp.c b/src/mod/capwap/capwap_actions_wtp.c index 6a6cfd85..721df7b9 100644 --- a/src/mod/capwap/capwap_actions_wtp.c +++ b/src/mod/capwap/capwap_actions_wtp.c @@ -313,6 +313,30 @@ static cw_action_in_t actions_in[] = { } , + /* ---------------------------------------------------------------- + * Change State Event Response - IN Run State + */ + + { + .capwap_state = CW_STATE_RUN, + .msg_id = CW_MSG_CHANGE_STATE_EVENT_RESPONSE, + .end = cw_in_check_cfg_update_req + } + , + + { + .capwap_state = CW_STATE_RUN, + .msg_id = CW_MSG_CHANGE_STATE_EVENT_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 + } + , + + @@ -376,14 +400,15 @@ static cw_action_in_t actions_in[] = { , - /* Radio Admin State - Config Status Request */ + /* Radio Admin State - Config Update Request */ { .capwap_state = CW_STATE_RUN, .msg_id = CW_MSG_CONFIGURATION_UPDATE_REQUEST, .elem_id = CW_ELEM_RADIO_ADMINISTRATIVE_STATE, .item_id = CW_RADIOITEM_ADMIN_STATE, .start = cw_in_radio_generic, - // .start = cw_in_radio_administrative_state, + .min_len=2, + .max_len=2, .mand = 0 } , @@ -583,7 +608,7 @@ static cw_action_out_t actions_out[] = { * Configuration Status Request - Out */ - /* AC Name - Config Status Request */ + /* AC Name - Config Status Request - OUT */ { .msg_id = CW_MSG_CONFIGURATION_STATUS_REQUEST, .elem_id = CW_ELEM_AC_NAME, @@ -594,7 +619,7 @@ static cw_action_out_t actions_out[] = { } , - /* Radio Admin State - Config Status Request */ + /* Radio Admin State - Config Status Request - OUT */ { .msg_id = CW_MSG_CONFIGURATION_STATUS_REQUEST, .elem_id = CW_ELEM_RADIO_ADMINISTRATIVE_STATE, @@ -643,8 +668,9 @@ static cw_action_out_t actions_out[] = { { .msg_id = CW_MSG_CHANGE_STATE_EVENT_REQUEST, .elem_id = CW_ELEM_RADIO_OPERATIONAL_STATE, - // .item_id = CW_RADIO_OPERATIONAL_STATE, - .out = cw_out_radio_operational_states, + .item_id = CW_RADIOITEM_OPER_STATE, +// .out = cw_out_radio_operational_state, + .out = cw_out_radio_generic, .mand = 1 } , @@ -720,7 +746,7 @@ int capwap_register_actions_wtp(struct cw_actiondef *def) rc += cw_strheap_register_strings(def->strelem, capwap_strings_elem); rc += cw_itemdefheap_register(def->items,capwap_itemdefs); -// rc += cw_itemdefheap_register(def->radioitems,capwap_radioitemdefs); + rc += cw_itemdefheap_register(def->radioitems,capwap_radioitemdefs); return rc; } diff --git a/src/mod/cisco/Makefile b/src/mod/cisco/Makefile index a94b081e..c0732cd8 100644 --- a/src/mod/cisco/Makefile +++ b/src/mod/cisco/Makefile @@ -25,7 +25,8 @@ OBJS=\ cisco_in_add_wlan.o \ cisco_out_wtp_administrative_state.o \ cisco_out_radio_operational_state.o \ - cisco_in_radio_operational_state.o + cisco_in_radio_operational_state.o \ + cisco_out_wtp_operational_state.o # cisco_out_radio_administrative_state.o \ diff --git a/src/mod/cisco/cisco.h b/src/mod/cisco/cisco.h index 9c9e00e6..8b507e98 100644 --- a/src/mod/cisco/cisco.h +++ b/src/mod/cisco/cisco.h @@ -47,6 +47,7 @@ int cisco_in_add_wlan(struct conn *conn, struct cw_action_in *a, uint8_t * data, struct sockaddr *from); int cisco_out_wtp_administrative_state(struct conn *conn, struct cw_action_out *a, uint8_t * dst); +int cisco_out_wtp_operational_state(struct conn *conn, struct cw_action_out *a, uint8_t * dst); int cisco_out_radio_operational_state(struct conn *conn, struct cw_action_out *a, uint8_t * dst); int cisco_in_radio_operational_state(struct conn *conn, struct cw_action_in *a, uint8_t * data, int len, struct sockaddr *from); diff --git a/src/mod/cisco/cisco_actions_wtp.c b/src/mod/cisco/cisco_actions_wtp.c index b05f07ee..887c8a78 100644 --- a/src/mod/cisco/cisco_actions_wtp.c +++ b/src/mod/cisco/cisco_actions_wtp.c @@ -124,14 +124,32 @@ static cw_action_in_t actions_in[] = { } , + + /* WTP Name - Conf Update Req */ + { + .capwap_state = CW_STATE_RUN, + .vendor_id = CW_VENDOR_ID_CISCO, + .msg_id = CW_MSG_CONFIGURATION_UPDATE_REQUEST, + .elem_id = CW_CISCO_AP_GROUP_NAME, + .item_id = CIPWAP_ITEM_WTP_GROUP_NAME, + .start = cw_in_generic2, + .min_len = 0, + .max_len = 1024, + .mand = 0 + } + , + + + /* Radio Admin State - Config Update Request */ { .capwap_state = CW_STATE_RUN, .msg_id = CW_MSG_CONFIGURATION_UPDATE_REQUEST, .elem_id = CW_ELEM_RADIO_ADMINISTRATIVE_STATE, .item_id = CW_RADIOITEM_ADMIN_STATE, -// .start = cisco_in_radio_administrative_state_wtp, - .start = cw_in_radio_generic, + .start = cisco_in_radio_administrative_state, + .min_len=2, + .max_len=2, .mand = 0 } , @@ -196,11 +214,12 @@ static cw_action_in_t actions_in[] = { /* Radio Admin State - Config Status Response */ { - .capwap_state = CW_STATE_RUN, + .capwap_state = CW_STATE_CONFIGURE, .msg_id = CW_MSG_CONFIGURATION_STATUS_RESPONSE, .elem_id = CW_ELEM_RADIO_ADMINISTRATIVE_STATE, .item_id = CW_RADIOITEM_ADMIN_STATE, - .start = cw_in_radio_generic, +// .start = cw_in_radio_generic, + .start = cisco_in_radio_administrative_state, .mand = 1 } , @@ -301,7 +320,7 @@ static cw_action_out_t actions_out[]={ .msg_id = CW_MSG_JOIN_REQUEST, .vendor_id = CW_VENDOR_ID_CISCO, .elem_id = CW_CISCO_AP_GROUP_NAME, - .item_id = CW_ITEM_WTP_GROUP_NAME, + .item_id = CIPWAP_ITEM_WTP_GROUP_NAME, .out = cw_out_generic, .get = cw_out_get_config, .mand = 1 @@ -347,6 +366,54 @@ static cw_action_out_t actions_out[]={ , + /* Cisco WTP Admin state - OUT */ + { + .msg_id = CW_MSG_CONFIGURATION_STATUS_REQUEST, + .vendor_id = CW_VENDOR_ID_CISCO, + .item_id = CISCO_ITEM_WTP_ADMIN_STATE, + .out = cisco_out_wtp_administrative_state, + } + , + + + /* Cisco Admin state - OUT */ +/* { + .msg_id = CW_MSG_CONFIGURATION_STATUS_REQUEST, + .vendor_id = CW_VENDOR_ID_CISCO, +// .elem_id = CW_CISCO_AP_MODE_AND_TYPE, + .item_id = CISCO_ITEM_WTP_ADMIN_STATE, + .out = cisco_out_wtp_administrative_state, +// .get = cw_out_get_outgoming, + } + , + +*/ + + /* Cisco WTP Operational state - OUT */ + { + .msg_id = CW_MSG_CHANGE_STATE_EVENT_REQUEST, + .vendor_id = CW_VENDOR_ID_CISCO, +// .elem_id = CW_CISCO_AP_MODE_AND_TYPE, + .item_id = CISCO_ITEM_WTP_OPER_STATE, + .out = cisco_out_wtp_operational_state, +// .get = cw_out_get_outgoming, + } + , + + + + + + /* Radio Operational State - OUT */ + { + .msg_id = CW_MSG_CHANGE_STATE_EVENT_REQUEST, + .elem_id = CW_ELEM_RADIO_OPERATIONAL_STATE, + .item_id = CW_RADIOITEM_OPER_STATE, + .out = cisco_out_radio_operational_state, + .mand = 1 + } + , + @@ -357,19 +424,35 @@ static cw_action_out_t actions_out[]={ static cw_action_in_t actions80211_in[] = { - /* Radio Operational State - Change State Event Req */ + /* Radio Operational State - Status Resp */ { .capwap_state = CW_STATE_CONFIGURE, .msg_id= CW_MSG_CONFIGURATION_STATUS_RESPONSE, .elem_id = CW_ELEM_RADIO_OPERATIONAL_STATE, .item_id = CW_RADIOITEM_OPER_STATE, - .start = cw_in_radio_generic, //operational_state, +// .start = cw_in_radio_generic, //operational_state, + .start = cisco_in_radio_operational_state, //operational_state, .min_len=3, .max_len=3, .mand = 0 } , + /* Radio Operational State - Update Req */ + { + .capwap_state = CW_STATE_RUN, + .msg_id= CW_MSG_CONFIGURATION_UPDATE_REQUEST, + .elem_id = CW_ELEM_RADIO_OPERATIONAL_STATE, + .item_id = CW_RADIOITEM_OPER_STATE, +// .start = cw_in_radio_generic, //operational_state, + .start = cisco_in_radio_operational_state, //operational_state, + .min_len=3, + .max_len=3, + .mand = 0 + } + , + + }; diff --git a/src/mod/cisco/cisco_in_radio_administrative_state.c b/src/mod/cisco/cisco_in_radio_administrative_state.c index c8e78e74..50724bd2 100644 --- a/src/mod/cisco/cisco_in_radio_administrative_state.c +++ b/src/mod/cisco/cisco_in_radio_administrative_state.c @@ -1,6 +1,7 @@ #include "cw/radio.h" #include "cw/action.h" #include "cw/cw.h" +#include "cw/dbg.h" #include "cisco_items.h" @@ -8,6 +9,8 @@ int cisco_in_radio_administrative_state(struct conn *conn, struct cw_action_in * struct sockaddr *from) { + cw_dbg(DBG_X,"This is radio admin statie in for Cisco"); + int rid = cw_get_byte(data); if (rid != 255) return cw_in_radio_generic(conn,a,data,len,from); diff --git a/src/mod/cisco/cisco_in_radio_operational_state.c b/src/mod/cisco/cisco_in_radio_operational_state.c index af10fcb4..d98c3c20 100644 --- a/src/mod/cisco/cisco_in_radio_operational_state.c +++ b/src/mod/cisco/cisco_in_radio_operational_state.c @@ -7,6 +7,8 @@ #include "cw/capwap_actions.h" #include "cw/cw.h" +#include "cisco_items.h" + int cisco_in_radio_operational_state(struct conn *conn, struct cw_action_in *a, uint8_t * data, int len, struct sockaddr *from) { @@ -22,7 +24,12 @@ int cisco_in_radio_operational_state(struct conn *conn, struct cw_action_in *a, if (state == CW_RADIO_OPER_STATE_DISABLED_7) state_t = CW_RADIO_OPER_STATE_DISABLED; - cw_dbg(DBG_X,"Translated state to %d",state_t); + cw_dbg(DBG_X,"%d Translated state to %d",rid,state_t); + + if (rid==255){ + mbag_set_word(conn->incomming,CISCO_ITEM_WTP_OPER_STATE, (state_t<<8)|cause); + return 1; + } mbag_t radio = mbag_i_get_mbag(conn->radios,rid,NULL); @@ -31,9 +38,15 @@ int cisco_in_radio_operational_state(struct conn *conn, struct cw_action_in *a, return 0; } - +cw_dbg(DBG_X,"Radio settng to %d",state_t << 8); mbag_set_word(radio,CW_RADIOITEM_OPER_STATE,(state_t<<8)|cause); +// mbag_set_word(radio,"hitler_status",911); +// mbag_set_word(radio,CW_RADIOITEM_OPER_STATE,912); + +cw_dbg(DBG_X, "setting operstate %s",CW_RADIOITEM_OPER_STATE); + +// mbag_set_word(radio,CW_RADIOITEM_ADMIN_STATE,66); return 1; diff --git a/src/mod/cisco/mod_cisco_wtp.c b/src/mod/cisco/mod_cisco_wtp.c index 8edb894c..ad215d1a 100644 --- a/src/mod/cisco/mod_cisco_wtp.c +++ b/src/mod/cisco/mod_cisco_wtp.c @@ -12,6 +12,8 @@ #include "cw/vendors.h" +#include "include/cipwap_items.h" + extern int cisco_register_actions80211_wtp(struct cw_actiondef *def); extern int cisco_register_actions_wtp(struct cw_actiondef *def); @@ -86,10 +88,10 @@ static int init() static int init_config(mbag_t config) { - bstr16_t gname = mbag_get_bstr16(config,CW_ITEM_WTP_GROUP_NAME,NULL); + bstr16_t gname = mbag_get_bstr16(config,CIPWAP_ITEM_WTP_GROUP_NAME,NULL); if (!gname){ gname = bstr16_create_from_str("Entangled"); - mbag_set_bstr16(config,CW_ITEM_WTP_GROUP_NAME,gname); + mbag_set_bstr16(config,CIPWAP_ITEM_WTP_GROUP_NAME,gname); } diff --git a/src/wtp/cfg.c b/src/wtp/cfg.c index 17eed8a6..a2ac8bb2 100644 --- a/src/wtp/cfg.c +++ b/src/wtp/cfg.c @@ -17,7 +17,7 @@ #include "cw/conn.h" #include "cw/bstr.h" - +#include "cw/dbg.h" static int skip(jsmntok_t * t) @@ -191,7 +191,7 @@ static int scn_obj(char *js, jsmntok_t * t, *(js + (to + 1)->end) = 0; const char * val = js+(to+1)->start; - //printf("Key: %s Val: %s\n",key,val); + printf("Key: %s Val: %s\n",key,val); if ((to+1)->type == JSMN_OBJECT) { @@ -318,8 +318,17 @@ int mbag_tojson(char *dst, mbag_t m, cw_itemdef_t *defs, int n) d+=sprintf(d,"\""); if (i->type->to_str){ d+=i->type->to_str(i,d); + +// char bu[1000]; +// i->type->to_str(i,bu); +// cw_dbg(DBG_X,"Put: %s::: %s",i->id,bu); + } + else{ + cw_dbg(DBG_X,"Noooooooooooooooooo to_str method for %s",i->id); } d+=sprintf(d,"\""); + + } } if (n==0){ diff --git a/src/wtp/changestate.c b/src/wtp/changestate.c index fcc0d78c..6d0ddb53 100644 --- a/src/wtp/changestate.c +++ b/src/wtp/changestate.c @@ -13,7 +13,7 @@ int changestate() /* Update operational states, so they will be included in the change Change State Event Request message. */ - cw_radio_update_oper_states(conn->radios,0); +// cw_radio_update_oper_states(conn->radios,0); mbag_set_dword(conn->outgoing,CW_ITEM_RESULT_CODE,0); diff --git a/src/wtp/configure.c b/src/wtp/configure.c index 833bd1d5..b98f66e6 100644 --- a/src/wtp/configure.c +++ b/src/wtp/configure.c @@ -18,7 +18,8 @@ int configure() mbag_del(conn->incomming,CW_ITEM_RESULT_CODE); mbag_set_str(conn->local,CW_ITEM_AC_NAME,"abc"); - mbag_set_byte(conn->config,CW_ITEM_WTP_MAC_TYPE,WTP_MAC_TYPE_BOTH); +// mbag_set_byte(conn->config,CW_ITEM_WTP_MAC_TYPE,WTP_MAC_TYPE_BOTH); +// mbag_set_byte(conn->config,CW_ITEM_WTP_MAC_TYPE,CAPWAP_WTP_MAC_TYPE_SPLIT); /* for config status request send the whole config */ mbag_t radios_upd = conn->radios_upd; diff --git a/src/wtp/join.c b/src/wtp/join.c index 3b80532b..a182cd1e 100644 --- a/src/wtp/join.c +++ b/src/wtp/join.c @@ -107,7 +107,7 @@ int run_join_d(struct sockaddr *sa) cw_log(LOG_ERR, "Can't create socket: %s\n", strerror(errno)); return -1; } - sock_set_recvtimeout(sockfd, 15); + sock_set_recvtimeout(sockfd, 1); conn->sock = sockfd; sock_copyaddr(&conn->addr, sa); diff --git a/src/wtp/run.c b/src/wtp/run.c index 638feba1..2f7e79a5 100644 --- a/src/wtp/run.c +++ b/src/wtp/run.c @@ -46,6 +46,7 @@ int handle_update_req(struct conn *conn, struct cw_action_in *a, uint8_t * data, } +cw_dbg(DBG_X,"Saving configuration ..."); cfg_to_json(); return 0; @@ -58,8 +59,6 @@ int handle_update_req(struct conn *conn, struct cw_action_in *a, uint8_t * data, static void update_radio(struct conn * conn, int rid, mbag_t radio_upd, mbag_t radio,mbag_t iresult ) { -// mbag_item * admin mbag_get(radio_upd,CW_ITEM_RADIO_ADMIN_STATE, - printf("Updating radio with rid %d\n",rid); } @@ -94,6 +93,14 @@ static void do_update(struct conn * conn) update_radios(conn,result); cw_dbg(DBG_INFO, "Saving configuration ..."); cfg_to_json(); + /* Change State ... */ + int rc = cw_send_request(conn,CW_MSG_CHANGE_STATE_EVENT_REQUEST); + if ( !cw_rcok(rc) ) { + cw_strresult(rc); + return ; + } + + } diff --git a/src/wtp/wtp_main.c b/src/wtp/wtp_main.c index 31850111..30aea18a 100644 --- a/src/wtp/wtp_main.c +++ b/src/wtp/wtp_main.c @@ -141,7 +141,7 @@ int main() conn->detected = 1; conn->dtls_verify_peer=0; - conn->dtls_mtu = 2000; + conn->dtls_mtu = 12000; conn->actions = &capwap_actions; @@ -194,8 +194,8 @@ printf("Setting to 8 %p %p\n",mri,r); - mbag_set_byte(conn->local, CW_ITEM_WTP_MAC_TYPE, 0); - mbag_set_byte(conn->local, CW_ITEM_WTP_FRAME_TUNNEL_MODE, 0); + mbag_set_byte(conn->local, CW_ITEM_WTP_MAC_TYPE, CW_WTP_MAC_TYPE_SPLIT); + mbag_set_byte(conn->local, CW_ITEM_WTP_FRAME_TUNNEL_MODE, CW_WTP_FRAME_TUNNEL_MODE_E); conn->wbid=1; @@ -212,6 +212,7 @@ printf("Setting to 8 %p %p\n",mri,r); if (!configure()) return -1; + cw_dbg(DBG_X,"Saveing config 0"); cfg_to_json();