aboutsummaryrefslogtreecommitdiffstats
path: root/src/drivers/driver_common.c
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2011-11-13 17:06:37 (GMT)
committerJouni Malinen <j@w1.fi>2011-11-13 17:06:37 (GMT)
commit9d77a392c7c9c021c3b5990dce3ea369cb796b44 (patch)
tree9bbc42df43017bcfbb9cb0bed8a9ede012437007 /src/drivers/driver_common.c
parent6c3771d7d5b99cb6de389a0f28db3dfcc71694ba (diff)
downloadhostap-9d77a392c7c9c021c3b5990dce3ea369cb796b44.zip
hostap-9d77a392c7c9c021c3b5990dce3ea369cb796b44.tar.gz
hostap-9d77a392c7c9c021c3b5990dce3ea369cb796b44.tar.bz2
Use a pre-processor macro to simplify event_to_string()
Signed-hostap: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'src/drivers/driver_common.c')
-rw-r--r--src/drivers/driver_common.c98
1 files changed, 50 insertions, 48 deletions
diff --git a/src/drivers/driver_common.c b/src/drivers/driver_common.c
index d9e932d..009a983 100644
--- a/src/drivers/driver_common.c
+++ b/src/drivers/driver_common.c
@@ -32,56 +32,58 @@ void wpa_scan_results_free(struct wpa_scan_results *res)
const char * event_to_string(enum wpa_event_type event)
{
+#define E2S(n) case EVENT_ ## n: return #n
switch (event) {
- case EVENT_ASSOC: return "ASSOC";
- case EVENT_DISASSOC: return "DISASSOC";
- case EVENT_MICHAEL_MIC_FAILURE: return "MICHAEL_MIC_FAILURE";
- case EVENT_SCAN_RESULTS: return "SCAN_RESULTS";
- case EVENT_ASSOCINFO: return "ASSOCINFO";
- case EVENT_INTERFACE_STATUS: return "INTERFACE_STATUS";
- case EVENT_PMKID_CANDIDATE: return "PMKID_CANDIDATE";
- case EVENT_STKSTART: return "STKSTART";
- case EVENT_TDLS: return "TDLS";
- case EVENT_FT_RESPONSE: return "FT_RESPONSE";
- case EVENT_IBSS_RSN_START: return "IBSS_RSN_START";
- case EVENT_AUTH: return "AUTH";
- case EVENT_DEAUTH: return "DEAUTH";
- case EVENT_ASSOC_REJECT: return "ASSOC_REJECT";
- case EVENT_AUTH_TIMED_OUT: return "AUTH_TIMED_OUT";
- case EVENT_ASSOC_TIMED_OUT: return "ASSOC_TIMED_OUT";
- case EVENT_FT_RRB_RX: return "FT_RRB_RX";
- case EVENT_WPS_BUTTON_PUSHED: return "WPS_BUTTON_PUSHED";
- case EVENT_TX_STATUS: return "TX_STATUS";
- case EVENT_RX_FROM_UNKNOWN: return "RX_FROM_UNKNOWN";
- case EVENT_RX_MGMT: return "RX_MGMT";
- case EVENT_RX_ACTION: return "RX_ACTION";
- case EVENT_REMAIN_ON_CHANNEL: return "REMAIN_ON_CHANNEL";
- case EVENT_CANCEL_REMAIN_ON_CHANNEL: return "CANCEL_ROC";
- case EVENT_MLME_RX: return "MLME_RX";
- case EVENT_RX_PROBE_REQ: return "RX_PROBE_REQ";
- case EVENT_NEW_STA: return "NEW_STA";
- case EVENT_EAPOL_RX: return "EAPOL_RX";
- case EVENT_SIGNAL_CHANGE: return "SIGNAL_CHANGE";
- case EVENT_INTERFACE_ENABLED: return "IFACE_ENABLED";
- case EVENT_INTERFACE_DISABLED: return "IFACE_DISABLED";
- case EVENT_CHANNEL_LIST_CHANGED: return "CHANNEL_LIST_CHANGED";
- case EVENT_INTERFACE_UNAVAILABLE: return "INTERFACE_UNAVAILABLE";
- case EVENT_BEST_CHANNEL: return "BEST_CHANNEL";
- case EVENT_UNPROT_DEAUTH: return "UNPROT_DEAUTH";
- case EVENT_UNPROT_DISASSOC: return "UNPROT_DISASSOC";
- case EVENT_STATION_LOW_ACK: return "STA_LOW_ACK";
- case EVENT_P2P_DEV_FOUND: return "P2P_DEV_FOUND";
- case EVENT_P2P_GO_NEG_REQ_RX: return "P2P_GO_NEG_REQ_RX";
- case EVENT_P2P_GO_NEG_COMPLETED: return "P2P_GO_NEG_COMPLETED";
- case EVENT_P2P_PROV_DISC_REQUEST: return "P2P_PROV_DISC_REQUEST";
- case EVENT_P2P_PROV_DISC_RESPONSE: return "P2P_PROV_DISC_RESPONSE";
- case EVENT_P2P_SD_REQUEST: return "P2P_SD_REQUEST";
- case EVENT_P2P_SD_RESPONSE: return "P2P_SD_RESPONSE";
- case EVENT_IBSS_PEER_LOST: return "IBSS_PEER_LOST";
- case EVENT_DRIVER_GTK_REKEY: return "DRIVER_GTK_REKEY";
- case EVENT_SCHED_SCAN_STOPPED: return "SCHED_SCAN_STOPPED";
- case EVENT_DRIVER_CLIENT_POLL_OK: return "CLIENT_POLL_OK";
+ E2S(ASSOC);
+ E2S(DISASSOC);
+ E2S(MICHAEL_MIC_FAILURE);
+ E2S(SCAN_RESULTS);
+ E2S(ASSOCINFO);
+ E2S(INTERFACE_STATUS);
+ E2S(PMKID_CANDIDATE);
+ E2S(STKSTART);
+ E2S(TDLS);
+ E2S(FT_RESPONSE);
+ E2S(IBSS_RSN_START);
+ E2S(AUTH);
+ E2S(DEAUTH);
+ E2S(ASSOC_REJECT);
+ E2S(AUTH_TIMED_OUT);
+ E2S(ASSOC_TIMED_OUT);
+ E2S(FT_RRB_RX);
+ E2S(WPS_BUTTON_PUSHED);
+ E2S(TX_STATUS);
+ E2S(RX_FROM_UNKNOWN);
+ E2S(RX_MGMT);
+ E2S(RX_ACTION);
+ E2S(REMAIN_ON_CHANNEL);
+ E2S(CANCEL_REMAIN_ON_CHANNEL);
+ E2S(MLME_RX);
+ E2S(RX_PROBE_REQ);
+ E2S(NEW_STA);
+ E2S(EAPOL_RX);
+ E2S(SIGNAL_CHANGE);
+ E2S(INTERFACE_ENABLED);
+ E2S(INTERFACE_DISABLED);
+ E2S(CHANNEL_LIST_CHANGED);
+ E2S(INTERFACE_UNAVAILABLE);
+ E2S(BEST_CHANNEL);
+ E2S(UNPROT_DEAUTH);
+ E2S(UNPROT_DISASSOC);
+ E2S(STATION_LOW_ACK);
+ E2S(P2P_DEV_FOUND);
+ E2S(P2P_GO_NEG_REQ_RX);
+ E2S(P2P_GO_NEG_COMPLETED);
+ E2S(P2P_PROV_DISC_REQUEST);
+ E2S(P2P_PROV_DISC_RESPONSE);
+ E2S(P2P_SD_REQUEST);
+ E2S(P2P_SD_RESPONSE);
+ E2S(IBSS_PEER_LOST);
+ E2S(DRIVER_GTK_REKEY);
+ E2S(SCHED_SCAN_STOPPED);
+ E2S(DRIVER_CLIENT_POLL_OK);
}
return "UNKNOWN";
+#undef E2S
}