1 /* 2 * Common driver-related functions 3 * Copyright (c) 2003-2011, Jouni Malinen <j (at) w1.fi> 4 * 5 * This software may be distributed under the terms of the BSD license. 6 * See README for more details. 7 */ 8 9 #include "includes.h" 10 #include "utils/common.h" 11 #include "driver.h" 12 13 void wpa_scan_results_free(struct wpa_scan_results *res) 14 { 15 size_t i; 16 17 if (res == NULL) 18 return; 19 20 for (i = 0; i < res->num; i++) 21 os_free(res->res[i]); 22 os_free(res->res); 23 os_free(res); 24 } 25 26 27 const char * event_to_string(enum wpa_event_type event) 28 { 29 #define E2S(n) case EVENT_ ## n: return #n 30 switch (event) { 31 E2S(ASSOC); 32 E2S(DISASSOC); 33 E2S(MICHAEL_MIC_FAILURE); 34 E2S(SCAN_RESULTS); 35 E2S(ASSOCINFO); 36 E2S(INTERFACE_STATUS); 37 E2S(PMKID_CANDIDATE); 38 E2S(STKSTART); 39 E2S(TDLS); 40 E2S(FT_RESPONSE); 41 E2S(IBSS_RSN_START); 42 E2S(AUTH); 43 E2S(DEAUTH); 44 E2S(ASSOC_REJECT); 45 E2S(AUTH_TIMED_OUT); 46 E2S(ASSOC_TIMED_OUT); 47 E2S(FT_RRB_RX); 48 E2S(WPS_BUTTON_PUSHED); 49 E2S(TX_STATUS); 50 E2S(RX_FROM_UNKNOWN); 51 E2S(RX_MGMT); 52 E2S(RX_ACTION); 53 E2S(REMAIN_ON_CHANNEL); 54 E2S(CANCEL_REMAIN_ON_CHANNEL); 55 E2S(MLME_RX); 56 E2S(RX_PROBE_REQ); 57 E2S(NEW_STA); 58 E2S(EAPOL_RX); 59 E2S(SIGNAL_CHANGE); 60 E2S(INTERFACE_ENABLED); 61 E2S(INTERFACE_DISABLED); 62 E2S(CHANNEL_LIST_CHANGED); 63 E2S(INTERFACE_UNAVAILABLE); 64 E2S(BEST_CHANNEL); 65 E2S(UNPROT_DEAUTH); 66 E2S(UNPROT_DISASSOC); 67 E2S(STATION_LOW_ACK); 68 E2S(P2P_DEV_FOUND); 69 E2S(P2P_GO_NEG_REQ_RX); 70 E2S(P2P_GO_NEG_COMPLETED); 71 E2S(P2P_PROV_DISC_REQUEST); 72 E2S(P2P_PROV_DISC_RESPONSE); 73 E2S(P2P_SD_REQUEST); 74 E2S(P2P_SD_RESPONSE); 75 E2S(IBSS_PEER_LOST); 76 E2S(DRIVER_GTK_REKEY); 77 E2S(SCHED_SCAN_STOPPED); 78 E2S(DRIVER_CLIENT_POLL_OK); 79 E2S(EAPOL_TX_STATUS); 80 E2S(CH_SWITCH); 81 E2S(WNM); 82 E2S(CONNECT_FAILED_REASON); 83 E2S(DFS_RADAR_DETECTED); 84 E2S(DFS_CAC_FINISHED); 85 E2S(DFS_CAC_ABORTED); 86 E2S(DFS_NOP_FINISHED); 87 E2S(SURVEY); 88 } 89 90 return "UNKNOWN"; 91 #undef E2S 92 } 93