wpa_ctrl.h revision 5460547a121207cf7a99eac45e05fcdd83be3161
18d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/*
28d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * wpa_supplicant/hostapd control interface library
38d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Copyright (c) 2004-2006, Jouni Malinen <j@w1.fi>
48d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt *
5c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt * This software may be distributed under the terms of the BSD license.
6c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt * See README for more details.
78d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */
88d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
98d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#ifndef WPA_CTRL_H
108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define WPA_CTRL_H
118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#ifdef  __cplusplus
138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtextern "C" {
148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#endif
158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/* wpa_supplicant control interface - fixed message prefixes */
178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
188d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** Interactive request for identity/password/pin */
198d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define WPA_CTRL_REQ "CTRL-REQ-"
208d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** Response to identity/password/pin request */
228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define WPA_CTRL_RSP "CTRL-RSP-"
238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/* Event messages with fixed prefix */
258d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** Authentication completed successfully and data connection enabled */
268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define WPA_EVENT_CONNECTED "CTRL-EVENT-CONNECTED "
278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** Disconnected, data connection is not available */
288d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define WPA_EVENT_DISCONNECTED "CTRL-EVENT-DISCONNECTED "
298d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** Association rejected during connection attempt */
308d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define WPA_EVENT_ASSOC_REJECT "CTRL-EVENT-ASSOC-REJECT "
318d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** wpa_supplicant is exiting */
328d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define WPA_EVENT_TERMINATING "CTRL-EVENT-TERMINATING "
338d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** Password change was completed successfully */
348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define WPA_EVENT_PASSWORD_CHANGED "CTRL-EVENT-PASSWORD-CHANGED "
358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** EAP-Request/Notification received */
368d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define WPA_EVENT_EAP_NOTIFICATION "CTRL-EVENT-EAP-NOTIFICATION "
378d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** EAP authentication started (EAP-Request/Identity received) */
388d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define WPA_EVENT_EAP_STARTED "CTRL-EVENT-EAP-STARTED "
398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** EAP method proposed by the server */
408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define WPA_EVENT_EAP_PROPOSED_METHOD "CTRL-EVENT-EAP-PROPOSED-METHOD "
418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** EAP method selected */
428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define WPA_EVENT_EAP_METHOD "CTRL-EVENT-EAP-METHOD "
438d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** EAP peer certificate from TLS */
448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define WPA_EVENT_EAP_PEER_CERT "CTRL-EVENT-EAP-PEER-CERT "
458d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** EAP TLS certificate chain validation error */
468d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define WPA_EVENT_EAP_TLS_CERT_ERROR "CTRL-EVENT-EAP-TLS-CERT-ERROR "
478da800a193fb6f8832218715f82a7b4e2d2ad338Dmitry Shmidt/** EAP status */
488da800a193fb6f8832218715f82a7b4e2d2ad338Dmitry Shmidt#define WPA_EVENT_EAP_STATUS "CTRL-EVENT-EAP-STATUS "
498d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** EAP authentication completed successfully */
508d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define WPA_EVENT_EAP_SUCCESS "CTRL-EVENT-EAP-SUCCESS "
518d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** EAP authentication failed (EAP-Failure received) */
528d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define WPA_EVENT_EAP_FAILURE "CTRL-EVENT-EAP-FAILURE "
5361d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt/** Network block temporarily disabled (e.g., due to authentication failure) */
5461d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt#define WPA_EVENT_TEMP_DISABLED "CTRL-EVENT-SSID-TEMP-DISABLED "
5561d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt/** Temporarily disabled network block re-enabled */
5661d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt#define WPA_EVENT_REENABLED "CTRL-EVENT-SSID-REENABLED "
578d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** New scan results available */
588d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define WPA_EVENT_SCAN_RESULTS "CTRL-EVENT-SCAN-RESULTS "
598d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** wpa_supplicant state change */
608d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define WPA_EVENT_STATE_CHANGE "CTRL-EVENT-STATE-CHANGE "
618d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** A new BSS entry was added (followed by BSS entry id and BSSID) */
628d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define WPA_EVENT_BSS_ADDED "CTRL-EVENT-BSS-ADDED "
638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** A BSS entry was removed (followed by BSS entry id and BSSID) */
648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define WPA_EVENT_BSS_REMOVED "CTRL-EVENT-BSS-REMOVED "
65c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt#ifdef ANDROID_P2P
66c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt/** Notify the Userspace about the freq conflict */
67c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt#define WPA_EVENT_FREQ_CONFLICT "CTRL-EVENT-FREQ-CONFLICT "
68c5ec7f57ead87efa365800228aa0b09a12d9e6c4Dmitry Shmidt#endif
698d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
70b7b4d0ec07161a6d76c40ba7ef1306e82fbb7e15Dmitry Shmidt/** RSN IBSS 4-way handshakes completed with specified peer */
71b7b4d0ec07161a6d76c40ba7ef1306e82fbb7e15Dmitry Shmidt#define IBSS_RSN_COMPLETED "IBSS-RSN-COMPLETED "
72b7b4d0ec07161a6d76c40ba7ef1306e82fbb7e15Dmitry Shmidt
738d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** WPS overlap detected in PBC mode */
748d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define WPS_EVENT_OVERLAP "WPS-OVERLAP-DETECTED "
758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** Available WPS AP with active PBC found in scan results */
768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define WPS_EVENT_AP_AVAILABLE_PBC "WPS-AP-AVAILABLE-PBC "
778d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** Available WPS AP with our address as authorized in scan results */
788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define WPS_EVENT_AP_AVAILABLE_AUTH "WPS-AP-AVAILABLE-AUTH "
798d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** Available WPS AP with recently selected PIN registrar found in scan results
808d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */
818d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define WPS_EVENT_AP_AVAILABLE_PIN "WPS-AP-AVAILABLE-PIN "
828d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** Available WPS AP found in scan results */
838d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define WPS_EVENT_AP_AVAILABLE "WPS-AP-AVAILABLE "
848d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** A new credential received */
858d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define WPS_EVENT_CRED_RECEIVED "WPS-CRED-RECEIVED "
868d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** M2D received */
878d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define WPS_EVENT_M2D "WPS-M2D "
888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** WPS registration failed after M2/M2D */
898d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define WPS_EVENT_FAIL "WPS-FAIL "
908d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** WPS registration completed successfully */
918d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define WPS_EVENT_SUCCESS "WPS-SUCCESS "
928d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** WPS enrollment attempt timed out and was terminated */
938d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define WPS_EVENT_TIMEOUT "WPS-TIMEOUT "
94b7b4d0ec07161a6d76c40ba7ef1306e82fbb7e15Dmitry Shmidt/* PBC mode was activated */
95b7b4d0ec07161a6d76c40ba7ef1306e82fbb7e15Dmitry Shmidt#define WPS_EVENT_ACTIVE "WPS-PBC-ACTIVE "
96b7b4d0ec07161a6d76c40ba7ef1306e82fbb7e15Dmitry Shmidt/* PBC mode was disabled */
97b7b4d0ec07161a6d76c40ba7ef1306e82fbb7e15Dmitry Shmidt#define WPS_EVENT_DISABLE "WPS-PBC-DISABLE "
988d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
998d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define WPS_EVENT_ENROLLEE_SEEN "WPS-ENROLLEE-SEEN "
1008d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
1018d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define WPS_EVENT_OPEN_NETWORK "WPS-OPEN-NETWORK "
1028d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
1038d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/* WPS ER events */
1048d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define WPS_EVENT_ER_AP_ADD "WPS-ER-AP-ADD "
1058d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define WPS_EVENT_ER_AP_REMOVE "WPS-ER-AP-REMOVE "
1068d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define WPS_EVENT_ER_ENROLLEE_ADD "WPS-ER-ENROLLEE-ADD "
1078d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define WPS_EVENT_ER_ENROLLEE_REMOVE "WPS-ER-ENROLLEE-REMOVE "
1088d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define WPS_EVENT_ER_AP_SETTINGS "WPS-ER-AP-SETTINGS "
1098d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define WPS_EVENT_ER_SET_SEL_REG "WPS-ER-AP-SET-SEL-REG "
1108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
1118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** P2P device found */
1128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define P2P_EVENT_DEVICE_FOUND "P2P-DEVICE-FOUND "
113497c1d5e50162d6b3c1cce5dbd9c5fd9da69aaefDmitry Shmidt
114497c1d5e50162d6b3c1cce5dbd9c5fd9da69aaefDmitry Shmidt/** P2P device lost */
115497c1d5e50162d6b3c1cce5dbd9c5fd9da69aaefDmitry Shmidt#define P2P_EVENT_DEVICE_LOST "P2P-DEVICE-LOST "
116497c1d5e50162d6b3c1cce5dbd9c5fd9da69aaefDmitry Shmidt
1178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/** A P2P device requested GO negotiation, but we were not ready to start the
1188d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * negotiation */
1198d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define P2P_EVENT_GO_NEG_REQUEST "P2P-GO-NEG-REQUEST "
1208d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define P2P_EVENT_GO_NEG_SUCCESS "P2P-GO-NEG-SUCCESS "
1218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define P2P_EVENT_GO_NEG_FAILURE "P2P-GO-NEG-FAILURE "
1228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define P2P_EVENT_GROUP_FORMATION_SUCCESS "P2P-GROUP-FORMATION-SUCCESS "
1238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define P2P_EVENT_GROUP_FORMATION_FAILURE "P2P-GROUP-FORMATION-FAILURE "
1248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define P2P_EVENT_GROUP_STARTED "P2P-GROUP-STARTED "
1258d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define P2P_EVENT_GROUP_REMOVED "P2P-GROUP-REMOVED "
1268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define P2P_EVENT_CROSS_CONNECT_ENABLE "P2P-CROSS-CONNECT-ENABLE "
1278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define P2P_EVENT_CROSS_CONNECT_DISABLE "P2P-CROSS-CONNECT-DISABLE "
1288d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/* parameters: <peer address> <PIN> */
1298d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define P2P_EVENT_PROV_DISC_SHOW_PIN "P2P-PROV-DISC-SHOW-PIN "
1308d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/* parameters: <peer address> */
1318d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define P2P_EVENT_PROV_DISC_ENTER_PIN "P2P-PROV-DISC-ENTER-PIN "
1328d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/* parameters: <peer address> */
1338d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define P2P_EVENT_PROV_DISC_PBC_REQ "P2P-PROV-DISC-PBC-REQ "
1348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/* parameters: <peer address> */
1358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define P2P_EVENT_PROV_DISC_PBC_RESP "P2P-PROV-DISC-PBC-RESP "
13604949598a23f501be6eec21697465fd46a28840aDmitry Shmidt/* parameters: <peer address> <status> */
13704949598a23f501be6eec21697465fd46a28840aDmitry Shmidt#define P2P_EVENT_PROV_DISC_FAILURE "P2P-PROV-DISC-FAILURE"
1388d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/* parameters: <freq> <src addr> <dialog token> <update indicator> <TLVs> */
1398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define P2P_EVENT_SERV_DISC_REQ "P2P-SERV-DISC-REQ "
1408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/* parameters: <src addr> <update indicator> <TLVs> */
1418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define P2P_EVENT_SERV_DISC_RESP "P2P-SERV-DISC-RESP "
1428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define P2P_EVENT_INVITATION_RECEIVED "P2P-INVITATION-RECEIVED "
1438d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define P2P_EVENT_INVITATION_RESULT "P2P-INVITATION-RESULT "
1441f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt#define P2P_EVENT_FIND_STOPPED "P2P-FIND-STOPPED "
145391c59f0632df8db1c325da1d31d479b2eedce45Dmitry Shmidt#define P2P_EVENT_PERSISTENT_PSK_FAIL "P2P-PERSISTENT-PSK-FAIL id="
1461f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt
147f7e0a9905988e62e4f70fed8b795722abeab719bDmitry Shmidt/* parameters: <PMF enabled> <timeout in ms> <Session Information URL> */
148f7e0a9905988e62e4f70fed8b795722abeab719bDmitry Shmidt#define ESS_DISASSOC_IMMINENT "ESS-DISASSOC-IMMINENT "
149f7e0a9905988e62e4f70fed8b795722abeab719bDmitry Shmidt
1501f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt#define INTERWORKING_AP "INTERWORKING-AP "
1511f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt#define INTERWORKING_NO_MATCH "INTERWORKING-NO-MATCH "
1525460547a121207cf7a99eac45e05fcdd83be3161Dmitry Shmidt#define INTERWORKING_ALREADY_CONNECTED "INTERWORKING-ALREADY-CONNECTED "
1538d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
15461d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt#define GAS_RESPONSE_INFO "GAS-RESPONSE-INFO "
15561d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt
1568d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/* hostapd control interface - fixed message prefixes */
1578d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define WPS_EVENT_PIN_NEEDED "WPS-PIN-NEEDED "
1588d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define WPS_EVENT_NEW_AP_SETTINGS "WPS-NEW-AP-SETTINGS "
1598d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define WPS_EVENT_REG_SUCCESS "WPS-REG-SUCCESS "
1608d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define WPS_EVENT_AP_SETUP_LOCKED "WPS-AP-SETUP-LOCKED "
1618d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define WPS_EVENT_AP_SETUP_UNLOCKED "WPS-AP-SETUP-UNLOCKED "
1628d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define WPS_EVENT_AP_PIN_ENABLED "WPS-AP-PIN-ENABLED "
1638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define WPS_EVENT_AP_PIN_DISABLED "WPS-AP-PIN-DISABLED "
1648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define AP_STA_CONNECTED "AP-STA-CONNECTED "
1658d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define AP_STA_DISCONNECTED "AP-STA-DISCONNECTED "
1668d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
167f86232838cf712377867cb42417c1613ab5dc425Dmitry Shmidt#define AP_REJECTED_MAX_STA "AP-REJECTED-MAX-STA "
168f86232838cf712377867cb42417c1613ab5dc425Dmitry Shmidt#define AP_REJECTED_BLOCKED_STA "AP-REJECTED-BLOCKED-STA "
1698d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
170cce06667447b5aec83452adb0c15100ada531095Dmitry Shmidt#define AP_EVENT_ENABLED "AP-ENABLED "
171cce06667447b5aec83452adb0c15100ada531095Dmitry Shmidt#define AP_EVENT_DISABLED "AP-DISABLED "
172cce06667447b5aec83452adb0c15100ada531095Dmitry Shmidt
173cce06667447b5aec83452adb0c15100ada531095Dmitry Shmidt#define ACS_EVENT_STARTED "ACS-STARTED "
174cce06667447b5aec83452adb0c15100ada531095Dmitry Shmidt#define ACS_EVENT_COMPLETED "ACS-COMPLETED "
175cce06667447b5aec83452adb0c15100ada531095Dmitry Shmidt#define ACS_EVENT_FAILED "ACS-FAILED "
176cce06667447b5aec83452adb0c15100ada531095Dmitry Shmidt
177cce06667447b5aec83452adb0c15100ada531095Dmitry Shmidt#define DFS_EVENT_RADAR_DETECTED "DFS-RADAR-DETECTED "
178cce06667447b5aec83452adb0c15100ada531095Dmitry Shmidt#define DFS_EVENT_NEW_CHANNEL "DFS-NEW-CHANNEL "
179cce06667447b5aec83452adb0c15100ada531095Dmitry Shmidt#define DFS_EVENT_CAC_START "DFS-CAC-START "
180cce06667447b5aec83452adb0c15100ada531095Dmitry Shmidt#define DFS_EVENT_CAC_COMPLETED "DFS-CAC-COMPLETED "
181cce06667447b5aec83452adb0c15100ada531095Dmitry Shmidt#define DFS_EVENT_NOP_FINISHED "DFS-NOP-FINISHED "
182cce06667447b5aec83452adb0c15100ada531095Dmitry Shmidt
18304949598a23f501be6eec21697465fd46a28840aDmitry Shmidt/* BSS command information masks */
18404949598a23f501be6eec21697465fd46a28840aDmitry Shmidt
1852f3b8dec59373945c5feef8a78ced8967a80cc66Dmitry Shmidt#define WPA_BSS_MASK_ALL		0xFFFDFFFF
18604949598a23f501be6eec21697465fd46a28840aDmitry Shmidt#define WPA_BSS_MASK_ID			BIT(0)
18704949598a23f501be6eec21697465fd46a28840aDmitry Shmidt#define WPA_BSS_MASK_BSSID		BIT(1)
18804949598a23f501be6eec21697465fd46a28840aDmitry Shmidt#define WPA_BSS_MASK_FREQ		BIT(2)
18904949598a23f501be6eec21697465fd46a28840aDmitry Shmidt#define WPA_BSS_MASK_BEACON_INT		BIT(3)
19004949598a23f501be6eec21697465fd46a28840aDmitry Shmidt#define WPA_BSS_MASK_CAPABILITIES	BIT(4)
19104949598a23f501be6eec21697465fd46a28840aDmitry Shmidt#define WPA_BSS_MASK_QUAL		BIT(5)
19204949598a23f501be6eec21697465fd46a28840aDmitry Shmidt#define WPA_BSS_MASK_NOISE		BIT(6)
19304949598a23f501be6eec21697465fd46a28840aDmitry Shmidt#define WPA_BSS_MASK_LEVEL		BIT(7)
19404949598a23f501be6eec21697465fd46a28840aDmitry Shmidt#define WPA_BSS_MASK_TSF		BIT(8)
19504949598a23f501be6eec21697465fd46a28840aDmitry Shmidt#define WPA_BSS_MASK_AGE		BIT(9)
19604949598a23f501be6eec21697465fd46a28840aDmitry Shmidt#define WPA_BSS_MASK_IE			BIT(10)
19704949598a23f501be6eec21697465fd46a28840aDmitry Shmidt#define WPA_BSS_MASK_FLAGS		BIT(11)
19804949598a23f501be6eec21697465fd46a28840aDmitry Shmidt#define WPA_BSS_MASK_SSID		BIT(12)
19904949598a23f501be6eec21697465fd46a28840aDmitry Shmidt#define WPA_BSS_MASK_WPS_SCAN		BIT(13)
20004949598a23f501be6eec21697465fd46a28840aDmitry Shmidt#define WPA_BSS_MASK_P2P_SCAN		BIT(14)
20104949598a23f501be6eec21697465fd46a28840aDmitry Shmidt#define WPA_BSS_MASK_INTERNETW		BIT(15)
20261d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt#define WPA_BSS_MASK_WIFI_DISPLAY	BIT(16)
2032f3b8dec59373945c5feef8a78ced8967a80cc66Dmitry Shmidt#define WPA_BSS_MASK_DELIM		BIT(17)
20404949598a23f501be6eec21697465fd46a28840aDmitry Shmidt
20504949598a23f501be6eec21697465fd46a28840aDmitry Shmidt
2068d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/* wpa_supplicant/hostapd control interface access */
2078d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
2088d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/**
2098d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * wpa_ctrl_open - Open a control interface to wpa_supplicant/hostapd
2108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ctrl_path: Path for UNIX domain sockets; ignored if UDP sockets are used.
2118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: Pointer to abstract control interface data or %NULL on failure
2128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt *
2138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This function is used to open a control interface to wpa_supplicant/hostapd.
2148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * ctrl_path is usually /var/run/wpa_supplicant or /var/run/hostapd. This path
2158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * is configured in wpa_supplicant/hostapd and other programs using the control
2168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * interface need to use matching path configuration.
2178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */
2188d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtstruct wpa_ctrl * wpa_ctrl_open(const char *ctrl_path);
2198d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
2208d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
2218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/**
2228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * wpa_ctrl_close - Close a control interface to wpa_supplicant/hostapd
2238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ctrl: Control interface data from wpa_ctrl_open()
2248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt *
2258d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This function is used to close a control interface.
2268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */
2278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtvoid wpa_ctrl_close(struct wpa_ctrl *ctrl);
2288d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
2298d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
2308d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/**
2318d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * wpa_ctrl_request - Send a command to wpa_supplicant/hostapd
2328d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ctrl: Control interface data from wpa_ctrl_open()
2338d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @cmd: Command; usually, ASCII text, e.g., "PING"
2348d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @cmd_len: Length of the cmd in bytes
2358d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @reply: Buffer for the response
2368d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @reply_len: Reply buffer length
2378d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @msg_cb: Callback function for unsolicited messages or %NULL if not used
2388d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 on success, -1 on error (send or receive failed), -2 on timeout
2398d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt *
2408d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This function is used to send commands to wpa_supplicant/hostapd. Received
2418d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * response will be written to reply and reply_len is set to the actual length
2428d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * of the reply. This function will block for up to two seconds while waiting
2438d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * for the reply. If unsolicited messages are received, the blocking time may
2448d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * be longer.
2458d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt *
2468d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * msg_cb can be used to register a callback function that will be called for
2478d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * unsolicited messages received while waiting for the command response. These
2488d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * messages may be received if wpa_ctrl_request() is called at the same time as
2498d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * wpa_supplicant/hostapd is sending such a message. This can happen only if
2508d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * the program has used wpa_ctrl_attach() to register itself as a monitor for
2518d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * event messages. Alternatively to msg_cb, programs can register two control
2528d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * interface connections and use one of them for commands and the other one for
2538d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * receiving event messages, in other words, call wpa_ctrl_attach() only for
2548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * the control interface connection that will be used for event messages.
2558d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */
2568d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint wpa_ctrl_request(struct wpa_ctrl *ctrl, const char *cmd, size_t cmd_len,
2578d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		     char *reply, size_t *reply_len,
2588d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt		     void (*msg_cb)(char *msg, size_t len));
2598d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
2608d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
2618d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/**
2628d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * wpa_ctrl_attach - Register as an event monitor for the control interface
2638d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ctrl: Control interface data from wpa_ctrl_open()
2648d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 on success, -1 on failure, -2 on timeout
2658d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt *
2668d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This function registers the control interface connection as a monitor for
2678d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * wpa_supplicant/hostapd events. After a success wpa_ctrl_attach() call, the
2688d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * control interface connection starts receiving event messages that can be
2698d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * read with wpa_ctrl_recv().
2708d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */
2718d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint wpa_ctrl_attach(struct wpa_ctrl *ctrl);
2728d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
2738d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
2748d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/**
2758d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * wpa_ctrl_detach - Unregister event monitor from the control interface
2768d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ctrl: Control interface data from wpa_ctrl_open()
2778d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 on success, -1 on failure, -2 on timeout
2788d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt *
2798d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This function unregisters the control interface connection as a monitor for
2808d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * wpa_supplicant/hostapd events, i.e., cancels the registration done with
2818d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * wpa_ctrl_attach().
2828d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */
2838d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint wpa_ctrl_detach(struct wpa_ctrl *ctrl);
2848d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
2858d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
2868d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/**
2878d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * wpa_ctrl_recv - Receive a pending control interface message
2888d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ctrl: Control interface data from wpa_ctrl_open()
2898d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @reply: Buffer for the message data
2908d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @reply_len: Length of the reply buffer
2918d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 0 on success, -1 on failure
2928d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt *
2938d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This function will receive a pending control interface message. This
2948d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * function will block if no messages are available. The received response will
2958d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * be written to reply and reply_len is set to the actual length of the reply.
2968d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * wpa_ctrl_recv() is only used for event messages, i.e., wpa_ctrl_attach()
2978d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * must have been used to register the control interface as an event monitor.
2988d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */
2998d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint wpa_ctrl_recv(struct wpa_ctrl *ctrl, char *reply, size_t *reply_len);
3008d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
3018d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
3028d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/**
3038d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * wpa_ctrl_pending - Check whether there are pending event messages
3048d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ctrl: Control interface data from wpa_ctrl_open()
3058d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: 1 if there are pending messages, 0 if no, or -1 on error
3068d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt *
3078d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This function will check whether there are any pending control interface
3088d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * message available to be received with wpa_ctrl_recv(). wpa_ctrl_pending() is
3098d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * only used for event messages, i.e., wpa_ctrl_attach() must have been used to
3108d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * register the control interface as an event monitor.
3118d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */
3128d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint wpa_ctrl_pending(struct wpa_ctrl *ctrl);
3138d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
3148d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
3158d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt/**
3168d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * wpa_ctrl_get_fd - Get file descriptor used by the control interface
3178d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * @ctrl: Control interface data from wpa_ctrl_open()
3188d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * Returns: File descriptor used for the connection
3198d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt *
3208d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * This function can be used to get the file descriptor that is used for the
3218d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * control interface connection. The returned value can be used, e.g., with
3228d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * select() while waiting for multiple events.
3238d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt *
3248d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * The returned file descriptor must not be used directly for sending or
3258d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * receiving packets; instead, the library functions wpa_ctrl_request() and
3268d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt * wpa_ctrl_recv() must be used for this.
3278d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt */
3288d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidtint wpa_ctrl_get_fd(struct wpa_ctrl *ctrl);
3298d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
33061d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidtchar * wpa_ctrl_get_remote_ifname(struct wpa_ctrl *ctrl);
33161d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt
3321f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt#ifdef ANDROID
3331f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt/**
3341f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * wpa_ctrl_cleanup() - Delete any local UNIX domain socket files that
3351f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * may be left over from clients that were previously connected to
3361f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * wpa_supplicant. This keeps these files from being orphaned in the
3371f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * event of crashes that prevented them from being removed as part
3381f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt * of the normal orderly shutdown.
3391f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt */
3401f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidtvoid wpa_ctrl_cleanup(void);
3411f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt#endif /* ANDROID */
3421f69aa52ea2e0a73ac502565df8c666ee49cab6aDmitry Shmidt
3438d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#ifdef CONFIG_CTRL_IFACE_UDP
34461d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt/* Port range for multiple wpa_supplicant instances and multiple VIFs */
3458d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define WPA_CTRL_IFACE_PORT 9877
34661d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt#define WPA_CTRL_IFACE_PORT_LIMIT 50 /* decremented from start */
3478d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#define WPA_GLOBAL_CTRL_IFACE_PORT 9878
34861d9df3e62aaa0e87ad05452fcb95142159a17b6Dmitry Shmidt#define WPA_GLOBAL_CTRL_IFACE_PORT_LIMIT 20 /* incremented from start */
3498d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#endif /* CONFIG_CTRL_IFACE_UDP */
3508d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
3518d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
3528d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#ifdef  __cplusplus
3538d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt}
3548d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#endif
3558d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt
3568d520ff1dc2da35cdca849e982051b86468016d8Dmitry Shmidt#endif /* WPA_CTRL_H */
357