Started implementing the packet management of IEEE802.11 by AC side.

Made it clear some constants.
This commit is contained in:
vemax78
2014-04-02 22:40:04 +02:00
parent 7fd2d4357a
commit ae97e96f57
24 changed files with 609 additions and 44 deletions

View File

@ -22,13 +22,13 @@ static struct capwap_packet_rxmng* wtp_get_packet_rxmng(int isctrlmsg) {
if (isctrlmsg) {
if (!g_wtp.rxmngctrlpacket) {
g_wtp.rxmngctrlpacket = capwap_packet_rxmng_create_message(1);
g_wtp.rxmngctrlpacket = capwap_packet_rxmng_create_message(CAPWAP_CONTROL_PACKET);
}
rxmngpacket = g_wtp.rxmngctrlpacket;
} else {
if (!g_wtp.rxmngdatapacket) {
g_wtp.rxmngdatapacket = capwap_packet_rxmng_create_message(0);
g_wtp.rxmngdatapacket = capwap_packet_rxmng_create_message(CAPWAP_DATA_PACKET);
}
rxmngpacket = g_wtp.rxmngdatapacket;

View File

@ -99,6 +99,47 @@ static void receive_reset_request(struct capwap_parsed_packet* packet) {
}
}
/* */
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;
/* TODO */
/* 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);
/* TODO */
/* 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");
}
}
}
/* */
static void receive_ieee80211_wlan_configuration_request(struct capwap_parsed_packet* packet) {
unsigned short binding;
@ -293,7 +334,7 @@ void wtp_dfa_state_run(struct capwap_parsed_packet* packet) {
}
case CAPWAP_STATION_CONFIGURATION_REQUEST: {
/* TODO */
receive_station_configuration_request(packet);
break;
}