diff --git a/build/wtp/Makefile.am b/build/wtp/Makefile.am index fc5a140..5e776da 100755 --- a/build/wtp/Makefile.am +++ b/build/wtp/Makefile.am @@ -55,6 +55,7 @@ wtp_SOURCES = \ $(top_srcdir)/src/wtp/wtp_dfa_run.c \ $(top_srcdir)/src/wtp/wtp_dfa_reset.c \ $(top_srcdir)/src/wtp/wtp_dfa_imagedata.c \ + $(top_srcdir)/src/wtp/wtp_radio.c \ $(top_srcdir)/src/binding/wifi/drivers/wifi_drivers.c wtp_LDADD = \ diff --git a/src/wtp/wtp.h b/src/wtp/wtp.h index 334d1df..912b2be 100644 --- a/src/wtp/wtp.h +++ b/src/wtp/wtp.h @@ -7,6 +7,7 @@ #include "capwap_network.h" #include "capwap_protocol.h" #include "wifi_drivers.h" +#include "wtp_radio.h" /* WTP Configuration */ #define WTP_STANDARD_CONFIGURATION_FILE "/etc/capwap/wtp.conf" @@ -137,28 +138,6 @@ struct wtp_t { int teardown; }; -#define WTP_RADIO_ENABLED 0 -#define WTP_RADIO_DISABLED 1 -#define WTP_RADIO_HWFAILURE 2 -#define WTP_RADIO_SWFAILURE 3 - -struct wtp_radio { - int radioid; - char device[IFNAMSIZ]; - - int status; - struct capwap_80211_antenna_element antenna; - struct capwap_80211_directsequencecontrol_element directsequencecontrol; - struct capwap_80211_macoperation_element macoperation; - struct capwap_80211_multidomaincapability_element multidomaincapability; - struct capwap_80211_ofdmcontrol_element ofdmcontrol; - struct capwap_80211_supportedrates_element supportedrates; - struct capwap_80211_txpower_element txpower; - struct capwap_80211_txpowerlevel_element txpowerlevel; - struct capwap_80211_wtpradioconf_element radioconfig; - struct capwap_80211_wtpradioinformation_element radioinformation; -}; - extern struct wtp_t g_wtp; /* */ diff --git a/src/wtp/wtp_dfa_run.c b/src/wtp/wtp_dfa_run.c index 8de930e..33a0ed6 100644 --- a/src/wtp/wtp_dfa_run.c +++ b/src/wtp/wtp_dfa_run.c @@ -107,9 +107,23 @@ static void receive_ieee80211_wlan_configuration_request(struct capwap_parsed_pa /* */ binding = GET_WBID_HEADER(packet->rxmngpacket->header); if ((binding == g_wtp.binding) && IS_SEQUENCE_SMALLER(g_wtp.remoteseqnumber, packet->rxmngpacket->ctrlmsg.seq)) { + int action = 0; struct capwap_header_data capwapheader; struct capwap_packet_txmng* txmngpacket; - struct capwap_resultcode_element resultcode = { .code = CAPWAP_RESULTCODE_SUCCESS }; + struct capwap_80211_assignbssid_element bssid; + struct capwap_resultcode_element resultcode = { .code = CAPWAP_RESULTCODE_FAILURE }; + + /* Parsing request message */ + if (capwap_get_message_element(packet, CAPWAP_ELEMENT_80211_ADD_WLAN)) { + action = CAPWAP_ELEMENT_80211_ADD_WLAN; + resultcode.code = wtp_radio_create_wlan(packet, &bssid); + } else if (capwap_get_message_element(packet, CAPWAP_ELEMENT_80211_UPDATE_WLAN)) { + action = CAPWAP_ELEMENT_80211_UPDATE_WLAN; + resultcode.code = wtp_radio_update_wlan(packet); + } else if (capwap_get_message_element(packet, CAPWAP_ELEMENT_80211_DELETE_WLAN)) { + action = CAPWAP_ELEMENT_80211_DELETE_WLAN; + resultcode.code = wtp_radio_delete_wlan(packet); + } /* Build packet */ capwap_header_init(&capwapheader, CAPWAP_RADIOID_NONE, g_wtp.binding); @@ -117,7 +131,10 @@ static void receive_ieee80211_wlan_configuration_request(struct capwap_parsed_pa /* Add message element */ capwap_packet_txmng_add_message_element(txmngpacket, CAPWAP_ELEMENT_RESULTCODE, &resultcode); - /* CAPWAP_ELEMENT_80211_ASSIGN_BSSID */ /* TODO */ + if ((resultcode.code == CAPWAP_RESULTCODE_SUCCESS) && (action == CAPWAP_ELEMENT_80211_ADD_WLAN)) { + capwap_packet_txmng_add_message_element(txmngpacket, CAPWAP_ELEMENT_80211_ASSIGN_BSSID, &bssid); + } + /* CAPWAP_ELEMENT_VENDORPAYLOAD */ /* TODO */ /* IEEE802.11 WLAN Configuration response complete, get fragment packets */ diff --git a/src/wtp/wtp_radio.c b/src/wtp/wtp_radio.c new file mode 100644 index 0000000..ad6c23f --- /dev/null +++ b/src/wtp/wtp_radio.c @@ -0,0 +1,19 @@ +#include "wtp.h" +#include "wtp_radio.h" + +/* */ +uint32_t wtp_radio_create_wlan(struct capwap_parsed_packet* packet, struct capwap_80211_assignbssid_element* bssid) { + return CAPWAP_RESULTCODE_SUCCESS; +} + +/* */ +uint32_t wtp_radio_update_wlan(struct capwap_parsed_packet* packet) { + /* TODO */ + return CAPWAP_RESULTCODE_SUCCESS; +} + +/* */ +uint32_t wtp_radio_delete_wlan(struct capwap_parsed_packet* packet) { + /* TODO */ + return CAPWAP_RESULTCODE_SUCCESS; +} diff --git a/src/wtp/wtp_radio.h b/src/wtp/wtp_radio.h new file mode 100644 index 0000000..6701ca9 --- /dev/null +++ b/src/wtp/wtp_radio.h @@ -0,0 +1,31 @@ +#ifndef __WTP_RADIO_HEADER__ +#define __WTP_RADIO_HEADER__ + +#define WTP_RADIO_ENABLED 0 +#define WTP_RADIO_DISABLED 1 +#define WTP_RADIO_HWFAILURE 2 +#define WTP_RADIO_SWFAILURE 3 + +struct wtp_radio { + int radioid; + char device[IFNAMSIZ]; + + int status; + struct capwap_80211_antenna_element antenna; + struct capwap_80211_directsequencecontrol_element directsequencecontrol; + struct capwap_80211_macoperation_element macoperation; + struct capwap_80211_multidomaincapability_element multidomaincapability; + struct capwap_80211_ofdmcontrol_element ofdmcontrol; + struct capwap_80211_supportedrates_element supportedrates; + struct capwap_80211_txpower_element txpower; + struct capwap_80211_txpowerlevel_element txpowerlevel; + struct capwap_80211_wtpradioconf_element radioconfig; + struct capwap_80211_wtpradioinformation_element radioinformation; +}; + +/* */ +uint32_t wtp_radio_create_wlan(struct capwap_parsed_packet* packet, struct capwap_80211_assignbssid_element* bssid); +uint32_t wtp_radio_update_wlan(struct capwap_parsed_packet* packet); +uint32_t wtp_radio_delete_wlan(struct capwap_parsed_packet* packet); + +#endif /* __WTP_RADIO_HEADER__ */