reformat some overly long code lines

This commit is contained in:
Andreas Schultz 2016-03-26 17:20:50 +01:00
parent ad27e80521
commit 067f920d81
8 changed files with 71 additions and 32 deletions

View File

@ -50,10 +50,13 @@ static int wtp_init(void) {
capwap_network_init(&g_wtp.net);
/* Standard configuration */
g_wtp.boarddata.boardsubelement = capwap_array_create(sizeof(struct capwap_wtpboarddata_board_subelement), 0, 1);
g_wtp.descriptor.encryptsubelement = capwap_array_create(sizeof(struct capwap_wtpdescriptor_encrypt_subelement), 0, 0);
g_wtp.descriptor.descsubelement = capwap_array_create(sizeof(struct capwap_wtpdescriptor_desc_subelement), 0, 1);
g_wtp.boarddata.boardsubelement =
capwap_array_create(sizeof(struct capwap_wtpboarddata_board_subelement), 0, 1);
g_wtp.descriptor.encryptsubelement =
capwap_array_create(sizeof(struct capwap_wtpdescriptor_encrypt_subelement), 0, 0);
g_wtp.descriptor.descsubelement =
capwap_array_create(sizeof(struct capwap_wtpdescriptor_desc_subelement), 0, 1);
g_wtp.binding = CAPWAP_WIRELESS_BINDING_NONE;
g_wtp.ecn.flag = CAPWAP_LIMITED_ECN_SUPPORT;

View File

@ -520,7 +520,9 @@ void wtp_free_reference_last_response(void) {
}
/* */
void wtp_dfa_retransmition_timeout(struct capwap_timeout* timeout, unsigned long index, void* context, void* param) {
void wtp_dfa_retransmition_timeout(struct capwap_timeout* timeout, unsigned long index,
void* context, void* param)
{
if (!g_wtp.requestfragmentpacket->count) {
capwap_logging_warning("Invalid retransmition request packet");
wtp_teardown_connection();

View File

@ -108,7 +108,8 @@ void wtp_send_configure(void) {
}
/* */
void wtp_dfa_state_configure(struct capwap_parsed_packet* packet) {
void wtp_dfa_state_configure(struct capwap_parsed_packet* packet)
{
unsigned short binding;
struct capwap_timers_element* timers;
struct capwap_resultcode_element* resultcode;

View File

@ -4,14 +4,17 @@
#include "wtp_dfa.h"
/* */
void wtp_send_datacheck(void) {
void wtp_send_datacheck(void)
{
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_CHANGE_STATE_EVENT_REQUEST, g_wtp.localseqnumber, g_wtp.mtu);
txmngpacket = capwap_packet_txmng_create_ctrl_message(&capwapheader,
CAPWAP_CHANGE_STATE_EVENT_REQUEST,
g_wtp.localseqnumber, g_wtp.mtu);
/* Add message element */
wtp_create_radioopsstate_element(txmngpacket);
@ -45,7 +48,8 @@ void wtp_send_datacheck(void) {
}
/* */
void wtp_dfa_state_datacheck(struct capwap_parsed_packet* packet) {
void wtp_dfa_state_datacheck(struct capwap_parsed_packet* packet)
{
unsigned short binding;
struct capwap_resultcode_element* resultcode;

View File

@ -6,12 +6,14 @@
#include "wtp_dfa.h"
/* */
void wtp_free_discovery_response_array(void) {
void wtp_free_discovery_response_array(void)
{
int i;
/* Free items */
for (i = 0; i < g_wtp.acdiscoveryresponse->count; i++) {
struct wtp_discovery_response* response = (struct wtp_discovery_response*)capwap_array_get_item_pointer(g_wtp.acdiscoveryresponse, i);
struct wtp_discovery_response* response =
(struct wtp_discovery_response*)capwap_array_get_item_pointer(g_wtp.acdiscoveryresponse, i);
capwap_array_free(response->controlipv4);
capwap_array_free(response->controlipv6);
}
@ -21,7 +23,9 @@ void wtp_free_discovery_response_array(void) {
}
/* */
void wtp_dfa_state_discovery_timeout(struct capwap_timeout* timeout, unsigned long index, void* context, void* param) {
void wtp_dfa_state_discovery_timeout(struct capwap_timeout* timeout, unsigned long index,
void* context, void* param)
{
long discoveryinterval;
if (g_wtp.acdiscoveryresponse->count > 0) {

View File

@ -58,7 +58,9 @@ void wtp_start_datachannel(void) {
}
/* */
static void wtp_dfa_state_dtlsteardown_timeout(struct capwap_timeout* timeout, unsigned long index, void* context, void* param) {
static void wtp_dfa_state_dtlsteardown_timeout(struct capwap_timeout* timeout,
unsigned long index, void* context, void* param)
{
/* Free and reset resource */
if (g_wtp.dtls.enable) {
capwap_crypt_freesession(&g_wtp.dtls);
@ -78,9 +80,11 @@ static void wtp_dfa_state_dtlsteardown_timeout(struct capwap_timeout* timeout, u
/* */
if (!g_wtp.running) {
wtp_dfa_change_state(CAPWAP_DEAD_STATE);
} else if ((g_wtp.faileddtlssessioncount >= WTP_FAILED_DTLS_SESSION_RETRY) || (g_wtp.faileddtlsauthfailcount >= WTP_FAILED_DTLS_SESSION_RETRY)) {
} else if ((g_wtp.faileddtlssessioncount >= WTP_FAILED_DTLS_SESSION_RETRY) ||
(g_wtp.faileddtlsauthfailcount >= WTP_FAILED_DTLS_SESSION_RETRY)) {
wtp_dfa_change_state(CAPWAP_SULKING_STATE);
capwap_timeout_set(g_wtp.timeout, g_wtp.idtimercontrol, WTP_SILENT_INTERVAL, wtp_dfa_state_sulking_timeout, NULL, NULL);
capwap_timeout_set(g_wtp.timeout, g_wtp.idtimercontrol, WTP_SILENT_INTERVAL,
wtp_dfa_state_sulking_timeout, NULL, NULL);
} else {
wtp_dfa_change_state(CAPWAP_IDLE_STATE);
wtp_dfa_state_idle();
@ -92,7 +96,8 @@ void wtp_dfa_state_dtlsteardown(struct capwap_parsed_packet* packet) {
}
/* Teardown connection */
void wtp_teardown_connection(void) {
void wtp_teardown_connection(void)
{
g_wtp.teardown = 1;
/* TODO: close SSID ? */
@ -108,5 +113,6 @@ void wtp_teardown_connection(void) {
/* */
wtp_dfa_change_state(CAPWAP_DTLS_TEARDOWN_STATE);
capwap_timeout_unsetall(g_wtp.timeout);
capwap_timeout_set(g_wtp.timeout, g_wtp.idtimercontrol, WTP_DTLS_SESSION_DELETE, wtp_dfa_state_dtlsteardown_timeout, NULL, NULL);
capwap_timeout_set(g_wtp.timeout, g_wtp.idtimercontrol, WTP_DTLS_SESSION_DELETE,
wtp_dfa_state_dtlsteardown_timeout, NULL, NULL);
}

View File

@ -7,7 +7,8 @@
#include "wtp_radio.h"
/* */
void wtp_send_join(void) {
void wtp_send_join(void)
{
struct capwap_header_data capwapheader;
struct capwap_packet_txmng* txmngpacket;
@ -31,7 +32,9 @@ void wtp_send_join(void) {
/* Build packet */
capwap_header_init(&capwapheader, CAPWAP_RADIOID_NONE, g_wtp.binding);
txmngpacket = capwap_packet_txmng_create_ctrl_message(&capwapheader, CAPWAP_JOIN_REQUEST, g_wtp.localseqnumber, g_wtp.mtu);
txmngpacket = capwap_packet_txmng_create_ctrl_message(&capwapheader,
CAPWAP_JOIN_REQUEST,
g_wtp.localseqnumber, g_wtp.mtu);
/* Add message element */
capwap_packet_txmng_add_message_element(txmngpacket, CAPWAP_ELEMENT_LOCATION, &g_wtp.location);
@ -89,7 +92,8 @@ void wtp_send_join(void) {
}
/* */
void wtp_dfa_state_join(struct capwap_parsed_packet* packet) {
void wtp_dfa_state_join(struct capwap_parsed_packet* packet)
{
unsigned short binding;
struct capwap_acdescriptor_element* acdescriptor;
struct capwap_acname_element* acname;

View File

@ -6,14 +6,16 @@
#include "ieee80211.h"
/* */
static int send_echo_request(void) {
static int send_echo_request(void)
{
int result = -1;
struct capwap_header_data capwapheader;
struct capwap_packet_txmng* txmngpacket;
/* Build packet */
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);
txmngpacket = capwap_packet_txmng_create_ctrl_message(&capwapheader, CAPWAP_ECHO_REQUEST,
g_wtp.localseqnumber, g_wtp.mtu);
/* Add message element */
/* CAPWAP_ELEMENT_VENDORPAYLOAD */ /* TODO */
@ -59,7 +61,8 @@ static int receive_echo_response(struct capwap_parsed_packet* packet) {
}
/* */
static void receive_reset_request(struct capwap_parsed_packet* packet) {
static void receive_reset_request(struct capwap_parsed_packet* packet)
{
unsigned short binding;
ASSERT(packet != NULL);
@ -101,7 +104,8 @@ static void receive_reset_request(struct capwap_parsed_packet* packet) {
}
/* */
static void receive_station_configuration_request(struct capwap_parsed_packet* packet) {
static void receive_station_configuration_request(struct capwap_parsed_packet* packet)
{
unsigned short binding;
ASSERT(packet != NULL);
@ -150,7 +154,8 @@ static void receive_station_configuration_request(struct capwap_parsed_packet* p
}
/* */
static void receive_ieee80211_wlan_configuration_request(struct capwap_parsed_packet* packet) {
static void receive_ieee80211_wlan_configuration_request(struct capwap_parsed_packet* packet)
{
unsigned short binding;
ASSERT(packet != NULL);
@ -210,7 +215,9 @@ static void receive_ieee80211_wlan_configuration_request(struct capwap_parsed_pa
}
/* */
void wtp_dfa_state_run_echo_timeout(struct capwap_timeout* timeout, unsigned long index, void* context, void* param) {
void wtp_dfa_state_run_echo_timeout(struct capwap_timeout* timeout, unsigned long index,
void* context, void* param)
{
capwap_logging_debug("Send Echo Request");
if (!send_echo_request()) {
g_wtp.retransmitcount = 0;
@ -222,10 +229,13 @@ void wtp_dfa_state_run_echo_timeout(struct capwap_timeout* timeout, unsigned lon
}
/* */
void wtp_dfa_state_run_keepalive_timeout(struct capwap_timeout* timeout, unsigned long index, void* context, void* param) {
void wtp_dfa_state_run_keepalive_timeout(struct capwap_timeout* timeout, unsigned long index,
void* context, void* param)
{
capwap_logging_debug("Send Keep-Alive");
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);
capwap_timeout_set(g_wtp.timeout, g_wtp.idtimerkeepalivedead, WTP_DATACHANNEL_KEEPALIVEDEAD,
wtp_dfa_state_run_keepalivedead_timeout, NULL, NULL);
if (wtp_kmod_send_keepalive()) {
capwap_logging_error("Unable to send Keep-Alive");
@ -234,7 +244,9 @@ void wtp_dfa_state_run_keepalive_timeout(struct capwap_timeout* timeout, unsigne
}
/* */
void wtp_dfa_state_run_keepalivedead_timeout(struct capwap_timeout* timeout, unsigned long index, void* context, void* param) {
void wtp_dfa_state_run_keepalivedead_timeout(struct capwap_timeout* timeout, unsigned long index,
void* context, void* param)
{
capwap_logging_info("Keep-Alive timeout, teardown");
wtp_teardown_connection();
}
@ -245,7 +257,8 @@ void wtp_recv_data_keepalive(void) {
/* 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);
capwap_timeout_set(g_wtp.timeout, g_wtp.idtimerkeepalive, WTP_DATACHANNEL_KEEPALIVE_INTERVAL,
wtp_dfa_state_run_keepalive_timeout, NULL, NULL);
}
/* */
@ -261,12 +274,14 @@ void wtp_recv_data(uint8_t* buffer, int length) {
/* */
headersize = GET_HLEN_HEADER(header) * 4;
if ((length - headersize) > 0) {
wtp_radio_receive_data_packet(GET_RID_HEADER(header), GET_WBID_HEADER(header), (buffer + headersize), (length - headersize));
wtp_radio_receive_data_packet(GET_RID_HEADER(header), GET_WBID_HEADER(header),
(buffer + headersize), (length - headersize));
}
}
/* */
void wtp_dfa_state_run(struct capwap_parsed_packet* packet) {
void wtp_dfa_state_run(struct capwap_parsed_packet* packet)
{
ASSERT(packet != NULL);
if (capwap_is_request_type(packet->rxmngpacket->ctrlmsg.type) || (g_wtp.localseqnumber == packet->rxmngpacket->ctrlmsg.seq)) {