2013-05-01 14:52:55 +02:00
|
|
|
#include "wtp.h"
|
|
|
|
#include "capwap_dfa.h"
|
|
|
|
#include "capwap_element.h"
|
|
|
|
#include "wtp_dfa.h"
|
2014-02-08 18:03:38 +01:00
|
|
|
#include "wtp_radio.h"
|
2014-04-21 23:16:56 +02:00
|
|
|
#include "ieee80211.h"
|
|
|
|
|
|
|
|
/* */
|
|
|
|
#define WTP_BODY_PACKET_MAX_SIZE 8192
|
|
|
|
static uint8_t g_bodypacket[WTP_BODY_PACKET_MAX_SIZE];
|
2013-05-01 14:52:55 +02:00
|
|
|
|
|
|
|
/* */
|
2014-02-16 15:28:27 +01:00
|
|
|
static int send_echo_request(void) {
|
2013-05-01 14:52:55 +02:00
|
|
|
int result = -1;
|
2013-05-27 21:33:23 +02:00
|
|
|
struct capwap_header_data capwapheader;
|
|
|
|
struct capwap_packet_txmng* txmngpacket;
|
2013-05-01 14:52:55 +02:00
|
|
|
|
|
|
|
/* Build packet */
|
2013-05-27 21:33:23 +02:00
|
|
|
capwap_header_init(&capwapheader, CAPWAP_RADIOID_NONE, g_wtp.binding);
|
|
|
|
txmngpacket = capwap_packet_txmng_create_ctrl_message(&capwapheader, CAPWAP_ECHO_REQUEST, g_wtp.localseqnumber++, g_wtp.mtu);
|
|
|
|
|
|
|
|
/* Add message element */
|
2013-08-21 23:00:54 +02:00
|
|
|
/* CAPWAP_ELEMENT_VENDORPAYLOAD */ /* TODO */
|
2013-05-01 14:52:55 +02:00
|
|
|
|
2013-05-27 21:33:23 +02:00
|
|
|
/* Echo request complete, get fragment packets */
|
|
|
|
wtp_free_reference_last_request();
|
|
|
|
capwap_packet_txmng_get_fragment_packets(txmngpacket, g_wtp.requestfragmentpacket, g_wtp.fragmentid);
|
|
|
|
if (g_wtp.requestfragmentpacket->count > 1) {
|
|
|
|
g_wtp.fragmentid++;
|
2013-05-01 14:52:55 +02:00
|
|
|
}
|
|
|
|
|
2013-05-27 21:33:23 +02:00
|
|
|
/* Free packets manager */
|
|
|
|
capwap_packet_txmng_free(txmngpacket);
|
2013-05-01 14:52:55 +02:00
|
|
|
|
|
|
|
/* Send echo request to AC */
|
2013-05-27 21:33:23 +02:00
|
|
|
if (capwap_crypt_sendto_fragmentpacket(&g_wtp.ctrldtls, g_wtp.acctrlsock.socket[g_wtp.acctrlsock.type], g_wtp.requestfragmentpacket, &g_wtp.wtpctrladdress, &g_wtp.acctrladdress)) {
|
|
|
|
result = 0;
|
|
|
|
} else {
|
|
|
|
/* Error to send packets */
|
|
|
|
capwap_logging_debug("Warning: error to send echo request packet");
|
|
|
|
wtp_free_reference_last_request();
|
2013-05-01 14:52:55 +02:00
|
|
|
}
|
2013-05-27 21:33:23 +02:00
|
|
|
|
2013-05-01 14:52:55 +02:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* */
|
2013-05-27 21:33:23 +02:00
|
|
|
static int receive_echo_response(struct capwap_parsed_packet* packet) {
|
2013-08-11 18:38:23 +02:00
|
|
|
struct capwap_resultcode_element* resultcode;
|
|
|
|
|
2013-05-27 21:33:23 +02:00
|
|
|
ASSERT(packet != NULL);
|
2013-08-11 18:38:23 +02:00
|
|
|
|
|
|
|
/* Check the success of the Request */
|
|
|
|
resultcode = (struct capwap_resultcode_element*)capwap_get_message_element_data(packet, CAPWAP_ELEMENT_RESULTCODE);
|
|
|
|
if (resultcode && !CAPWAP_RESULTCODE_OK(resultcode->code)) {
|
|
|
|
capwap_logging_warning("Receive Echo Response with error: %d", (int)resultcode->code);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2013-05-01 14:52:55 +02:00
|
|
|
/* Valid packet, free request packet */
|
|
|
|
wtp_free_reference_last_request();
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* */
|
2013-05-27 21:33:23 +02:00
|
|
|
static void receive_reset_request(struct capwap_parsed_packet* packet) {
|
2013-05-01 14:52:55 +02:00
|
|
|
unsigned short binding;
|
|
|
|
|
2013-05-27 21:33:23 +02:00
|
|
|
ASSERT(packet != NULL);
|
2013-05-01 14:52:55 +02:00
|
|
|
|
|
|
|
/* */
|
2013-05-27 21:33:23 +02:00
|
|
|
binding = GET_WBID_HEADER(packet->rxmngpacket->header);
|
|
|
|
if ((binding == g_wtp.binding) && IS_SEQUENCE_SMALLER(g_wtp.remoteseqnumber, packet->rxmngpacket->ctrlmsg.seq)) {
|
|
|
|
struct capwap_header_data capwapheader;
|
|
|
|
struct capwap_packet_txmng* txmngpacket;
|
|
|
|
struct capwap_resultcode_element resultcode = { .code = CAPWAP_RESULTCODE_SUCCESS };
|
|
|
|
|
|
|
|
/* Build packet */
|
|
|
|
capwap_header_init(&capwapheader, CAPWAP_RADIOID_NONE, g_wtp.binding);
|
|
|
|
txmngpacket = capwap_packet_txmng_create_ctrl_message(&capwapheader, CAPWAP_RESET_RESPONSE, packet->rxmngpacket->ctrlmsg.seq, g_wtp.mtu);
|
|
|
|
|
|
|
|
/* Add message element */
|
|
|
|
capwap_packet_txmng_add_message_element(txmngpacket, CAPWAP_ELEMENT_RESULTCODE, &resultcode);
|
2013-08-21 23:00:54 +02:00
|
|
|
/* CAPWAP_ELEMENT_VENDORPAYLOAD */ /* TODO */
|
2013-05-27 21:33:23 +02:00
|
|
|
|
|
|
|
/* Reset response complete, get fragment packets */
|
|
|
|
wtp_free_reference_last_response();
|
|
|
|
capwap_packet_txmng_get_fragment_packets(txmngpacket, g_wtp.responsefragmentpacket, g_wtp.fragmentid);
|
|
|
|
if (g_wtp.responsefragmentpacket->count > 1) {
|
|
|
|
g_wtp.fragmentid++;
|
|
|
|
}
|
2013-05-01 14:52:55 +02:00
|
|
|
|
2013-05-27 21:33:23 +02:00
|
|
|
/* Free packets manager */
|
|
|
|
capwap_packet_txmng_free(txmngpacket);
|
2013-05-01 14:52:55 +02:00
|
|
|
|
2013-05-27 21:33:23 +02:00
|
|
|
/* Save remote sequence number */
|
|
|
|
g_wtp.remoteseqnumber = packet->rxmngpacket->ctrlmsg.seq;
|
|
|
|
capwap_get_packet_digest(packet->rxmngpacket, packet->connection, g_wtp.lastrecvpackethash);
|
2013-05-01 14:52:55 +02:00
|
|
|
|
2013-05-27 21:33:23 +02:00
|
|
|
/* Send Reset response to AC */
|
|
|
|
if (!capwap_crypt_sendto_fragmentpacket(&g_wtp.ctrldtls, g_wtp.acctrlsock.socket[g_wtp.acctrlsock.type], g_wtp.responsefragmentpacket, &g_wtp.wtpctrladdress, &g_wtp.acctrladdress)) {
|
|
|
|
capwap_logging_debug("Warning: error to send reset response packet");
|
|
|
|
}
|
2013-05-01 14:52:55 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-04-02 22:40:04 +02:00
|
|
|
/* */
|
|
|
|
static void receive_station_configuration_request(struct capwap_parsed_packet* packet) {
|
|
|
|
unsigned short binding;
|
|
|
|
|
|
|
|
ASSERT(packet != NULL);
|
|
|
|
|
|
|
|
/* */
|
|
|
|
binding = GET_WBID_HEADER(packet->rxmngpacket->header);
|
|
|
|
if ((binding == g_wtp.binding) && IS_SEQUENCE_SMALLER(g_wtp.remoteseqnumber, packet->rxmngpacket->ctrlmsg.seq)) {
|
|
|
|
struct capwap_header_data capwapheader;
|
|
|
|
struct capwap_packet_txmng* txmngpacket;
|
2014-04-14 22:33:12 +02:00
|
|
|
struct capwap_resultcode_element resultcode = { .code = CAPWAP_RESULTCODE_FAILURE };
|
2014-04-02 22:40:04 +02:00
|
|
|
|
2014-04-14 22:33:12 +02:00
|
|
|
/* Parsing request message */
|
|
|
|
if (capwap_get_message_element(packet, CAPWAP_ELEMENT_ADDSTATION)) {
|
|
|
|
resultcode.code = wtp_radio_add_station(packet);
|
|
|
|
} else if (capwap_get_message_element(packet, CAPWAP_ELEMENT_DELETESTATION)) {
|
|
|
|
resultcode.code = wtp_radio_delete_station(packet);
|
|
|
|
}
|
2014-04-02 22:40:04 +02:00
|
|
|
|
|
|
|
/* Build packet */
|
|
|
|
capwap_header_init(&capwapheader, CAPWAP_RADIOID_NONE, g_wtp.binding);
|
|
|
|
txmngpacket = capwap_packet_txmng_create_ctrl_message(&capwapheader, CAPWAP_STATION_CONFIGURATION_RESPONSE, packet->rxmngpacket->ctrlmsg.seq, g_wtp.mtu);
|
|
|
|
|
2014-04-14 22:33:12 +02:00
|
|
|
/* Add message element */
|
|
|
|
capwap_packet_txmng_add_message_element(txmngpacket, CAPWAP_ELEMENT_RESULTCODE, &resultcode);
|
|
|
|
/* CAPWAP_ELEMENT_VENDORPAYLOAD */ /* TODO */
|
2014-04-02 22:40:04 +02:00
|
|
|
|
|
|
|
/* Station Configuration response complete, get fragment packets */
|
|
|
|
wtp_free_reference_last_response();
|
|
|
|
capwap_packet_txmng_get_fragment_packets(txmngpacket, g_wtp.responsefragmentpacket, g_wtp.fragmentid);
|
|
|
|
if (g_wtp.responsefragmentpacket->count > 1) {
|
|
|
|
g_wtp.fragmentid++;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Free packets manager */
|
|
|
|
capwap_packet_txmng_free(txmngpacket);
|
|
|
|
|
|
|
|
/* Save remote sequence number */
|
|
|
|
g_wtp.remoteseqnumber = packet->rxmngpacket->ctrlmsg.seq;
|
|
|
|
capwap_get_packet_digest(packet->rxmngpacket, packet->connection, g_wtp.lastrecvpackethash);
|
|
|
|
|
|
|
|
/* Send Station Configuration response to AC */
|
|
|
|
if (!capwap_crypt_sendto_fragmentpacket(&g_wtp.ctrldtls, g_wtp.acctrlsock.socket[g_wtp.acctrlsock.type], g_wtp.responsefragmentpacket, &g_wtp.wtpctrladdress, &g_wtp.acctrladdress)) {
|
|
|
|
capwap_logging_debug("Warning: error to send Station Configuration response packet");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-12-04 22:25:16 +01:00
|
|
|
/* */
|
|
|
|
static void receive_ieee80211_wlan_configuration_request(struct capwap_parsed_packet* packet) {
|
|
|
|
unsigned short binding;
|
|
|
|
|
|
|
|
ASSERT(packet != NULL);
|
|
|
|
|
|
|
|
/* */
|
|
|
|
binding = GET_WBID_HEADER(packet->rxmngpacket->header);
|
|
|
|
if ((binding == g_wtp.binding) && IS_SEQUENCE_SMALLER(g_wtp.remoteseqnumber, packet->rxmngpacket->ctrlmsg.seq)) {
|
2013-12-07 18:14:32 +01:00
|
|
|
int action = 0;
|
2013-12-04 22:25:16 +01:00
|
|
|
struct capwap_header_data capwapheader;
|
|
|
|
struct capwap_packet_txmng* txmngpacket;
|
2013-12-07 18:14:32 +01:00
|
|
|
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);
|
|
|
|
}
|
2013-12-04 22:25:16 +01:00
|
|
|
|
|
|
|
/* Build packet */
|
|
|
|
capwap_header_init(&capwapheader, CAPWAP_RADIOID_NONE, g_wtp.binding);
|
|
|
|
txmngpacket = capwap_packet_txmng_create_ctrl_message(&capwapheader, CAPWAP_IEEE80211_WLAN_CONFIGURATION_RESPONSE, packet->rxmngpacket->ctrlmsg.seq, g_wtp.mtu);
|
|
|
|
|
|
|
|
/* Add message element */
|
|
|
|
capwap_packet_txmng_add_message_element(txmngpacket, CAPWAP_ELEMENT_RESULTCODE, &resultcode);
|
2013-12-07 18:14:32 +01:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2013-12-04 22:25:16 +01:00
|
|
|
/* CAPWAP_ELEMENT_VENDORPAYLOAD */ /* TODO */
|
|
|
|
|
|
|
|
/* IEEE802.11 WLAN Configuration response complete, get fragment packets */
|
|
|
|
wtp_free_reference_last_response();
|
|
|
|
capwap_packet_txmng_get_fragment_packets(txmngpacket, g_wtp.responsefragmentpacket, g_wtp.fragmentid);
|
|
|
|
if (g_wtp.responsefragmentpacket->count > 1) {
|
|
|
|
g_wtp.fragmentid++;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Free packets manager */
|
|
|
|
capwap_packet_txmng_free(txmngpacket);
|
|
|
|
|
|
|
|
/* Save remote sequence number */
|
|
|
|
g_wtp.remoteseqnumber = packet->rxmngpacket->ctrlmsg.seq;
|
|
|
|
capwap_get_packet_digest(packet->rxmngpacket, packet->connection, g_wtp.lastrecvpackethash);
|
|
|
|
|
|
|
|
/* Send IEEE802.11 WLAN Configuration response to AC */
|
|
|
|
if (!capwap_crypt_sendto_fragmentpacket(&g_wtp.ctrldtls, g_wtp.acctrlsock.socket[g_wtp.acctrlsock.type], g_wtp.responsefragmentpacket, &g_wtp.wtpctrladdress, &g_wtp.acctrladdress)) {
|
|
|
|
capwap_logging_debug("Warning: error to send IEEE802.11 WLAN Configuration response packet");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-02-16 15:28:27 +01:00
|
|
|
/* */
|
2014-02-19 19:16:33 +01:00
|
|
|
static void send_data_keepalive_request() {
|
2014-02-16 15:28:27 +01:00
|
|
|
struct capwap_list* txfragpacket;
|
|
|
|
struct capwap_header_data capwapheader;
|
|
|
|
struct capwap_packet_txmng* txmngpacket;
|
|
|
|
|
|
|
|
/* Build packet */
|
|
|
|
capwap_header_init(&capwapheader, CAPWAP_RADIOID_NONE, g_wtp.binding);
|
|
|
|
capwap_header_set_keepalive_flag(&capwapheader, 1);
|
|
|
|
txmngpacket = capwap_packet_txmng_create_data_message(&capwapheader, g_wtp.mtu); /* CAPWAP_DONT_FRAGMENT */
|
|
|
|
|
|
|
|
/* Add message element */
|
|
|
|
capwap_packet_txmng_add_message_element(txmngpacket, CAPWAP_ELEMENT_SESSIONID, &g_wtp.sessionid);
|
|
|
|
|
|
|
|
/* Data keepalive complete, get fragment packets into local list */
|
|
|
|
txfragpacket = capwap_list_create();
|
|
|
|
capwap_packet_txmng_get_fragment_packets(txmngpacket, txfragpacket, 0);
|
|
|
|
if (txfragpacket->count == 1) {
|
|
|
|
/* Send Data keepalive to AC */
|
|
|
|
if (capwap_crypt_sendto_fragmentpacket(&g_wtp.datadtls, g_wtp.acdatasock.socket[g_wtp.acdatasock.type], txfragpacket, &g_wtp.wtpdataaddress, &g_wtp.acdataaddress)) {
|
2014-03-02 19:31:27 +01:00
|
|
|
capwap_timeout_unset(g_wtp.timeout, g_wtp.idtimerkeepalive);
|
|
|
|
capwap_timeout_set(g_wtp.timeout, g_wtp.idtimerkeepalivedead, WTP_DATACHANNEL_KEEPALIVEDEAD, wtp_dfa_state_run_keepalivedead_timeout, NULL, NULL);
|
2014-02-16 15:28:27 +01:00
|
|
|
} else {
|
|
|
|
/* Error to send packets */
|
|
|
|
capwap_logging_debug("Warning: error to send data channel keepalive packet");
|
2014-02-19 19:16:33 +01:00
|
|
|
wtp_teardown_connection();
|
2014-02-16 15:28:27 +01:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
capwap_logging_debug("Warning: error to send data channel keepalive packet, fragment packet");
|
2014-02-19 19:16:33 +01:00
|
|
|
wtp_teardown_connection();
|
2014-02-16 15:28:27 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Free packets manager */
|
|
|
|
capwap_list_free(txfragpacket);
|
|
|
|
capwap_packet_txmng_free(txmngpacket);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* */
|
2014-04-14 22:33:12 +02:00
|
|
|
void wtp_send_data_packet(uint8_t radioid, uint8_t wlanid, const uint8_t* data, int length, int leavenativeframe) {
|
2014-02-16 15:28:27 +01:00
|
|
|
struct capwap_list* txfragpacket;
|
|
|
|
struct capwap_header_data capwapheader;
|
|
|
|
struct capwap_packet_txmng* txmngpacket;
|
|
|
|
|
|
|
|
/* Build packet */
|
|
|
|
capwap_header_init(&capwapheader, radioid, g_wtp.binding);
|
2014-03-16 21:34:29 +01:00
|
|
|
capwap_header_set_nativeframe_flag(&capwapheader, (leavenativeframe ? 1: 0));
|
2014-02-16 15:28:27 +01:00
|
|
|
txmngpacket = capwap_packet_txmng_create_data_message(&capwapheader, g_wtp.mtu);
|
|
|
|
|
|
|
|
/* */
|
|
|
|
if (leavenativeframe) {
|
2014-04-14 22:33:12 +02:00
|
|
|
capwap_packet_txmng_add_data(txmngpacket, data, (unsigned short)length);
|
2014-02-16 15:28:27 +01:00
|
|
|
} else {
|
|
|
|
/* TODO */
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Data message complete, get fragment packets into local list */
|
|
|
|
txfragpacket = capwap_list_create();
|
2014-04-14 22:33:12 +02:00
|
|
|
capwap_packet_txmng_get_fragment_packets(txmngpacket, txfragpacket, g_wtp.fragmentid);
|
|
|
|
if (txfragpacket->count > 1) {
|
|
|
|
g_wtp.fragmentid++;
|
|
|
|
}
|
|
|
|
|
2014-02-16 15:28:27 +01:00
|
|
|
if (!capwap_crypt_sendto_fragmentpacket(&g_wtp.datadtls, g_wtp.acdatasock.socket[g_wtp.acdatasock.type], txfragpacket, &g_wtp.wtpdataaddress, &g_wtp.acdataaddress)) {
|
|
|
|
capwap_logging_debug("Warning: error to send data packet");
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Free packets manager */
|
|
|
|
capwap_list_free(txfragpacket);
|
|
|
|
capwap_packet_txmng_free(txmngpacket);
|
|
|
|
}
|
|
|
|
|
2013-05-01 14:52:55 +02:00
|
|
|
/* */
|
2014-03-02 19:31:27 +01:00
|
|
|
void wtp_dfa_state_run_echo_timeout(struct capwap_timeout* timeout, unsigned long index, void* context, void* param) {
|
|
|
|
if (!send_echo_request()) {
|
|
|
|
g_wtp.retransmitcount = 0;
|
|
|
|
capwap_timeout_set(g_wtp.timeout, g_wtp.idtimercontrol, WTP_RETRANSMIT_INTERVAL, wtp_dfa_retransmition_timeout, NULL, NULL);
|
|
|
|
} else {
|
|
|
|
wtp_teardown_connection();
|
|
|
|
}
|
|
|
|
}
|
2013-08-13 17:53:04 +02:00
|
|
|
|
2014-03-02 19:31:27 +01:00
|
|
|
/* */
|
|
|
|
void wtp_dfa_state_run_keepalive_timeout(struct capwap_timeout* timeout, unsigned long index, void* context, void* param) {
|
|
|
|
send_data_keepalive_request();
|
|
|
|
}
|
2013-08-13 17:53:04 +02:00
|
|
|
|
2014-03-02 19:31:27 +01:00
|
|
|
/* */
|
|
|
|
void wtp_dfa_state_run_keepalivedead_timeout(struct capwap_timeout* timeout, unsigned long index, void* context, void* param) {
|
|
|
|
wtp_teardown_connection();
|
|
|
|
}
|
2013-08-13 17:53:04 +02:00
|
|
|
|
2014-03-02 19:31:27 +01:00
|
|
|
/* */
|
|
|
|
void wtp_dfa_state_run(struct capwap_parsed_packet* packet) {
|
|
|
|
ASSERT(packet != NULL);
|
2013-08-13 17:53:04 +02:00
|
|
|
|
2014-03-02 19:31:27 +01:00
|
|
|
if (packet->rxmngpacket->isctrlpacket) {
|
|
|
|
if (capwap_is_request_type(packet->rxmngpacket->ctrlmsg.type) || ((g_wtp.localseqnumber - 1) == packet->rxmngpacket->ctrlmsg.seq)) {
|
|
|
|
switch (packet->rxmngpacket->ctrlmsg.type) {
|
|
|
|
case CAPWAP_CONFIGURATION_UPDATE_REQUEST: {
|
|
|
|
/* TODO */
|
|
|
|
break;
|
|
|
|
}
|
2013-08-13 17:53:04 +02:00
|
|
|
|
2014-03-02 19:31:27 +01:00
|
|
|
case CAPWAP_CHANGE_STATE_EVENT_RESPONSE: {
|
|
|
|
/* TODO */
|
|
|
|
break;
|
|
|
|
}
|
2013-08-13 17:53:04 +02:00
|
|
|
|
2014-03-02 19:31:27 +01:00
|
|
|
case CAPWAP_ECHO_RESPONSE: {
|
|
|
|
if (!receive_echo_response(packet)) {
|
|
|
|
capwap_timeout_unset(g_wtp.timeout, g_wtp.idtimercontrol);
|
|
|
|
capwap_timeout_set(g_wtp.timeout, g_wtp.idtimerecho, g_wtp.echointerval, wtp_dfa_state_run_echo_timeout, NULL, NULL);
|
2013-05-27 21:33:23 +02:00
|
|
|
}
|
2013-08-13 17:53:04 +02:00
|
|
|
|
2014-03-02 19:31:27 +01:00
|
|
|
break;
|
|
|
|
}
|
2013-08-13 17:53:04 +02:00
|
|
|
|
2014-03-02 19:31:27 +01:00
|
|
|
case CAPWAP_CLEAR_CONFIGURATION_REQUEST: {
|
|
|
|
/* TODO */
|
|
|
|
break;
|
|
|
|
}
|
2013-08-13 17:53:04 +02:00
|
|
|
|
2014-03-02 19:31:27 +01:00
|
|
|
case CAPWAP_WTP_EVENT_RESPONSE: {
|
|
|
|
/* TODO */
|
|
|
|
break;
|
|
|
|
}
|
2013-10-20 17:33:57 +02:00
|
|
|
|
2014-03-02 19:31:27 +01:00
|
|
|
case CAPWAP_DATA_TRANSFER_REQUEST: {
|
|
|
|
/* TODO */
|
|
|
|
break;
|
2013-05-27 21:33:23 +02:00
|
|
|
}
|
2014-03-02 19:31:27 +01:00
|
|
|
|
|
|
|
case CAPWAP_DATA_TRANSFER_RESPONSE: {
|
|
|
|
/* TODO */
|
|
|
|
break;
|
2013-05-27 21:33:23 +02:00
|
|
|
}
|
|
|
|
|
2014-03-02 19:31:27 +01:00
|
|
|
case CAPWAP_STATION_CONFIGURATION_REQUEST: {
|
2014-04-02 22:40:04 +02:00
|
|
|
receive_station_configuration_request(packet);
|
2014-03-02 19:31:27 +01:00
|
|
|
break;
|
2013-05-01 14:52:55 +02:00
|
|
|
}
|
2014-03-02 19:31:27 +01:00
|
|
|
|
|
|
|
case CAPWAP_RESET_REQUEST: {
|
|
|
|
receive_reset_request(packet);
|
|
|
|
wtp_dfa_change_state(CAPWAP_RESET_STATE);
|
|
|
|
wtp_dfa_state_reset();
|
|
|
|
break;
|
2013-05-01 14:52:55 +02:00
|
|
|
}
|
2013-05-27 21:33:23 +02:00
|
|
|
|
2014-03-02 19:31:27 +01:00
|
|
|
case CAPWAP_IEEE80211_WLAN_CONFIGURATION_REQUEST: {
|
|
|
|
receive_ieee80211_wlan_configuration_request(packet);
|
|
|
|
break;
|
|
|
|
}
|
2013-05-01 14:52:55 +02:00
|
|
|
}
|
2014-03-02 19:31:27 +01:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (IS_FLAG_K_HEADER(packet->rxmngpacket->header)) {
|
|
|
|
if (!memcmp(capwap_get_message_element_data(packet, CAPWAP_ELEMENT_SESSIONID), &g_wtp.sessionid, sizeof(struct capwap_sessionid_element))) {
|
|
|
|
/* Receive Data Keep-Alive, wait for next packet */
|
|
|
|
capwap_timeout_unset(g_wtp.timeout, g_wtp.idtimerkeepalivedead);
|
|
|
|
capwap_timeout_set(g_wtp.timeout, g_wtp.idtimerkeepalive, WTP_DATACHANNEL_KEEPALIVE_INTERVAL, wtp_dfa_state_run_keepalive_timeout, NULL, NULL);
|
2013-05-01 14:52:55 +02:00
|
|
|
}
|
2014-03-02 19:31:27 +01:00
|
|
|
} else {
|
2014-04-21 23:16:56 +02:00
|
|
|
/* Get body packet */
|
|
|
|
int bodypacketlength = capwap_packet_getdata(packet->rxmngpacket, g_bodypacket, WTP_BODY_PACKET_MAX_SIZE);
|
|
|
|
if (bodypacketlength > 0) {
|
|
|
|
uint8_t radioid = GET_RID_HEADER(packet->rxmngpacket->header);
|
|
|
|
unsigned short binding = GET_WBID_HEADER(packet->rxmngpacket->header);
|
|
|
|
|
|
|
|
wtp_radio_receive_data_packet(radioid, binding, g_bodypacket, bodypacketlength);
|
|
|
|
}
|
2013-05-01 14:52:55 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|