Add basic function for management wlan configuration

This commit is contained in:
vemax78 2013-12-07 18:14:32 +01:00
parent 64784fb460
commit dcbf837b7a
5 changed files with 71 additions and 24 deletions

View File

@ -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 = \

View File

@ -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;
/* */

View File

@ -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 */

19
src/wtp/wtp_radio.c Normal file
View File

@ -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;
}

31
src/wtp/wtp_radio.h Normal file
View File

@ -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__ */