$search
Go to the source code of this file.
Defines | |
#define | AP_STA_CONNECTED "AP-STA-CONNECTED " |
#define | AP_STA_DISCONNECTED "AP-STA-DISCONNECTED " |
#define | WPA_CTRL_REQ "CTRL-REQ-" |
#define | WPA_CTRL_RSP "CTRL-RSP-" |
#define | WPA_EVENT_BSS_ADDED "CTRL-EVENT-BSS-ADDED " |
#define | WPA_EVENT_BSS_REMOVED "CTRL-EVENT-BSS-REMOVED " |
#define | WPA_EVENT_CONNECTED "CTRL-EVENT-CONNECTED " |
#define | WPA_EVENT_DISCONNECTED "CTRL-EVENT-DISCONNECTED " |
#define | WPA_EVENT_EAP_FAILURE "CTRL-EVENT-EAP-FAILURE " |
#define | WPA_EVENT_EAP_METHOD "CTRL-EVENT-EAP-METHOD " |
#define | WPA_EVENT_EAP_NOTIFICATION "CTRL-EVENT-EAP-NOTIFICATION " |
#define | WPA_EVENT_EAP_PEER_CERT "CTRL-EVENT-EAP-PEER-CERT " |
#define | WPA_EVENT_EAP_PROPOSED_METHOD "CTRL-EVENT-EAP-PROPOSED-METHOD " |
#define | WPA_EVENT_EAP_STARTED "CTRL-EVENT-EAP-STARTED " |
#define | WPA_EVENT_EAP_SUCCESS "CTRL-EVENT-EAP-SUCCESS " |
#define | WPA_EVENT_EAP_TLS_CERT_ERROR "CTRL-EVENT-EAP-TLS-CERT-ERROR " |
#define | WPA_EVENT_PASSWORD_CHANGED "CTRL-EVENT-PASSWORD-CHANGED " |
#define | WPA_EVENT_SCAN_RESULTS "CTRL-EVENT-SCAN-RESULTS " |
#define | WPA_EVENT_TERMINATING "CTRL-EVENT-TERMINATING " |
#define | WPS_EVENT_AP_AVAILABLE "WPS-AP-AVAILABLE " |
#define | WPS_EVENT_AP_AVAILABLE_PBC "WPS-AP-AVAILABLE-PBC " |
#define | WPS_EVENT_AP_AVAILABLE_PIN "WPS-AP-AVAILABLE-PIN " |
#define | WPS_EVENT_AP_SETUP_LOCKED "WPS-AP-SETUP-LOCKED " |
#define | WPS_EVENT_CRED_RECEIVED "WPS-CRED-RECEIVED " |
#define | WPS_EVENT_ENROLLEE_SEEN "WPS-ENROLLEE-SEEN " |
#define | WPS_EVENT_ER_AP_ADD "WPS-ER-AP-ADD " |
#define | WPS_EVENT_ER_AP_REMOVE "WPS-ER-AP-REMOVE " |
#define | WPS_EVENT_ER_ENROLLEE_ADD "WPS-ER-ENROLLEE-ADD " |
#define | WPS_EVENT_ER_ENROLLEE_REMOVE "WPS-ER-ENROLLEE-REMOVE " |
#define | WPS_EVENT_FAIL "WPS-FAIL " |
#define | WPS_EVENT_M2D "WPS-M2D " |
#define | WPS_EVENT_NEW_AP_SETTINGS "WPS-NEW-AP-SETTINGS " |
#define | WPS_EVENT_OVERLAP "WPS-OVERLAP-DETECTED " |
#define | WPS_EVENT_PIN_NEEDED "WPS-PIN-NEEDED " |
#define | WPS_EVENT_REG_SUCCESS "WPS-REG-SUCCESS " |
#define | WPS_EVENT_SUCCESS "WPS-SUCCESS " |
#define | WPS_EVENT_TIMEOUT "WPS-TIMEOUT " |
Functions | |
int | wpa_ctrl_attach (struct wpa_ctrl *ctrl) |
void | wpa_ctrl_close (struct wpa_ctrl *ctrl) |
int | wpa_ctrl_detach (struct wpa_ctrl *ctrl) |
int | wpa_ctrl_get_fd (struct wpa_ctrl *ctrl) |
struct wpa_ctrl * | wpa_ctrl_open (const char *ctrl_path) |
int | wpa_ctrl_pending (struct wpa_ctrl *ctrl) |
int | wpa_ctrl_recv (struct wpa_ctrl *ctrl, char *reply, size_t *reply_len) |
int | wpa_ctrl_request (struct wpa_ctrl *ctrl, const char *cmd, size_t cmd_len, char *reply, size_t *reply_len, void(*msg_cb)(char *msg, size_t len)) |
#define AP_STA_CONNECTED "AP-STA-CONNECTED " |
Definition at line 95 of file wpa_ctrl.h.
#define AP_STA_DISCONNECTED "AP-STA-DISCONNECTED " |
Definition at line 96 of file wpa_ctrl.h.
#define WPA_CTRL_REQ "CTRL-REQ-" |
Interactive request for identity/password/pin
Definition at line 25 of file wpa_ctrl.h.
#define WPA_CTRL_RSP "CTRL-RSP-" |
Response to identity/password/pin request
Definition at line 28 of file wpa_ctrl.h.
#define WPA_EVENT_BSS_ADDED "CTRL-EVENT-BSS-ADDED " |
A new BSS entry was added (followed by BSS entry id and BSSID)
Definition at line 58 of file wpa_ctrl.h.
#define WPA_EVENT_BSS_REMOVED "CTRL-EVENT-BSS-REMOVED " |
A BSS entry was removed (followed by BSS entry id and BSSID)
Definition at line 60 of file wpa_ctrl.h.
#define WPA_EVENT_CONNECTED "CTRL-EVENT-CONNECTED " |
Authentication completed successfully and data connection enabled
Definition at line 32 of file wpa_ctrl.h.
#define WPA_EVENT_DISCONNECTED "CTRL-EVENT-DISCONNECTED " |
Disconnected, data connection is not available
Definition at line 34 of file wpa_ctrl.h.
#define WPA_EVENT_EAP_FAILURE "CTRL-EVENT-EAP-FAILURE " |
EAP authentication failed (EAP-Failure received)
Definition at line 54 of file wpa_ctrl.h.
#define WPA_EVENT_EAP_METHOD "CTRL-EVENT-EAP-METHOD " |
EAP method selected
Definition at line 46 of file wpa_ctrl.h.
#define WPA_EVENT_EAP_NOTIFICATION "CTRL-EVENT-EAP-NOTIFICATION " |
EAP-Request/Notification received
Definition at line 40 of file wpa_ctrl.h.
#define WPA_EVENT_EAP_PEER_CERT "CTRL-EVENT-EAP-PEER-CERT " |
EAP peer certificate from TLS
Definition at line 48 of file wpa_ctrl.h.
#define WPA_EVENT_EAP_PROPOSED_METHOD "CTRL-EVENT-EAP-PROPOSED-METHOD " |
EAP method proposed by the server
Definition at line 44 of file wpa_ctrl.h.
#define WPA_EVENT_EAP_STARTED "CTRL-EVENT-EAP-STARTED " |
EAP authentication started (EAP-Request/Identity received)
Definition at line 42 of file wpa_ctrl.h.
#define WPA_EVENT_EAP_SUCCESS "CTRL-EVENT-EAP-SUCCESS " |
EAP authentication completed successfully
Definition at line 52 of file wpa_ctrl.h.
#define WPA_EVENT_EAP_TLS_CERT_ERROR "CTRL-EVENT-EAP-TLS-CERT-ERROR " |
EAP TLS certificate chain validation error
Definition at line 50 of file wpa_ctrl.h.
#define WPA_EVENT_PASSWORD_CHANGED "CTRL-EVENT-PASSWORD-CHANGED " |
Password change was completed successfully
Definition at line 38 of file wpa_ctrl.h.
#define WPA_EVENT_SCAN_RESULTS "CTRL-EVENT-SCAN-RESULTS " |
New scan results available
Definition at line 56 of file wpa_ctrl.h.
#define WPA_EVENT_TERMINATING "CTRL-EVENT-TERMINATING " |
wpa_supplicant is exiting
Definition at line 36 of file wpa_ctrl.h.
#define WPS_EVENT_AP_AVAILABLE "WPS-AP-AVAILABLE " |
Available WPS AP found in scan results
Definition at line 70 of file wpa_ctrl.h.
#define WPS_EVENT_AP_AVAILABLE_PBC "WPS-AP-AVAILABLE-PBC " |
Available WPS AP with active PBC found in scan results
Definition at line 65 of file wpa_ctrl.h.
#define WPS_EVENT_AP_AVAILABLE_PIN "WPS-AP-AVAILABLE-PIN " |
Available WPS AP with recently selected PIN registrar found in scan results
Definition at line 68 of file wpa_ctrl.h.
#define WPS_EVENT_AP_SETUP_LOCKED "WPS-AP-SETUP-LOCKED " |
Definition at line 94 of file wpa_ctrl.h.
#define WPS_EVENT_CRED_RECEIVED "WPS-CRED-RECEIVED " |
A new credential received
Definition at line 72 of file wpa_ctrl.h.
#define WPS_EVENT_ENROLLEE_SEEN "WPS-ENROLLEE-SEEN " |
Definition at line 82 of file wpa_ctrl.h.
#define WPS_EVENT_ER_AP_ADD "WPS-ER-AP-ADD " |
Definition at line 85 of file wpa_ctrl.h.
#define WPS_EVENT_ER_AP_REMOVE "WPS-ER-AP-REMOVE " |
Definition at line 86 of file wpa_ctrl.h.
#define WPS_EVENT_ER_ENROLLEE_ADD "WPS-ER-ENROLLEE-ADD " |
Definition at line 87 of file wpa_ctrl.h.
#define WPS_EVENT_ER_ENROLLEE_REMOVE "WPS-ER-ENROLLEE-REMOVE " |
Definition at line 88 of file wpa_ctrl.h.
#define WPS_EVENT_FAIL "WPS-FAIL " |
WPS registration failed after M2/M2D
Definition at line 76 of file wpa_ctrl.h.
#define WPS_EVENT_M2D "WPS-M2D " |
M2D received
Definition at line 74 of file wpa_ctrl.h.
#define WPS_EVENT_NEW_AP_SETTINGS "WPS-NEW-AP-SETTINGS " |
Definition at line 92 of file wpa_ctrl.h.
#define WPS_EVENT_OVERLAP "WPS-OVERLAP-DETECTED " |
WPS overlap detected in PBC mode
Definition at line 63 of file wpa_ctrl.h.
#define WPS_EVENT_PIN_NEEDED "WPS-PIN-NEEDED " |
Definition at line 91 of file wpa_ctrl.h.
#define WPS_EVENT_REG_SUCCESS "WPS-REG-SUCCESS " |
Definition at line 93 of file wpa_ctrl.h.
#define WPS_EVENT_SUCCESS "WPS-SUCCESS " |
WPS registration completed successfully
Definition at line 78 of file wpa_ctrl.h.
#define WPS_EVENT_TIMEOUT "WPS-TIMEOUT " |
WPS enrollment attempt timed out and was terminated
Definition at line 80 of file wpa_ctrl.h.
int wpa_ctrl_attach | ( | struct wpa_ctrl * | ctrl | ) |
wpa_ctrl_attach - Register as an event monitor for the control interface : Control interface data from wpa_ctrl_open() Returns: 0 on success, -1 on failure, -2 on timeout
This function registers the control interface connection as a monitor for wpa_supplicant/hostapd events. After a success wpa_ctrl_attach() call, the control interface connection starts receiving event messages that can be read with wpa_ctrl_recv().
void wpa_ctrl_close | ( | struct wpa_ctrl * | ctrl | ) |
wpa_ctrl_close - Close a control interface to wpa_supplicant/hostapd : Control interface data from wpa_ctrl_open()
This function is used to close a control interface.
int wpa_ctrl_detach | ( | struct wpa_ctrl * | ctrl | ) |
wpa_ctrl_detach - Unregister event monitor from the control interface : Control interface data from wpa_ctrl_open() Returns: 0 on success, -1 on failure, -2 on timeout
This function unregisters the control interface connection as a monitor for wpa_supplicant/hostapd events, i.e., cancels the registration done with wpa_ctrl_attach().
int wpa_ctrl_get_fd | ( | struct wpa_ctrl * | ctrl | ) |
wpa_ctrl_get_fd - Get file descriptor used by the control interface : Control interface data from wpa_ctrl_open() Returns: File descriptor used for the connection
This function can be used to get the file descriptor that is used for the control interface connection. The returned value can be used, e.g., with select() while waiting for multiple events.
The returned file descriptor must not be used directly for sending or receiving packets; instead, the library functions wpa_ctrl_request() and wpa_ctrl_recv() must be used for this.
struct wpa_ctrl* wpa_ctrl_open | ( | const char * | ctrl_path | ) | [read] |
wpa_ctrl_open - Open a control interface to wpa_supplicant/hostapd : Path for UNIX domain sockets; ignored if UDP sockets are used. Returns: Pointer to abstract control interface data or NULL on failure
This function is used to open a control interface to wpa_supplicant/hostapd. ctrl_path is usually /var/run/wpa_supplicant or /var/run/hostapd. This path is configured in wpa_supplicant/hostapd and other programs using the control interface need to use matching path configuration.
int wpa_ctrl_pending | ( | struct wpa_ctrl * | ctrl | ) |
wpa_ctrl_pending - Check whether there are pending event messages : Control interface data from wpa_ctrl_open() Returns: 1 if there are pending messages, 0 if no, or -1 on error
This function will check whether there are any pending control interface message available to be received with wpa_ctrl_recv(). wpa_ctrl_pending() is only used for event messages, i.e., wpa_ctrl_attach() must have been used to register the control interface as an event monitor.
int wpa_ctrl_recv | ( | struct wpa_ctrl * | ctrl, | |
char * | reply, | |||
size_t * | reply_len | |||
) |
wpa_ctrl_recv - Receive a pending control interface message : Control interface data from wpa_ctrl_open() : Buffer for the message data : Length of the reply buffer Returns: 0 on success, -1 on failure
This function will receive a pending control interface message. This function will block if no messages are available. The received response will be written to reply and reply_len is set to the actual length of the reply. wpa_ctrl_recv() is only used for event messages, i.e., wpa_ctrl_attach() must have been used to register the control interface as an event monitor.
int wpa_ctrl_request | ( | struct wpa_ctrl * | ctrl, | |
const char * | cmd, | |||
size_t | cmd_len, | |||
char * | reply, | |||
size_t * | reply_len, | |||
void(*)(char *msg, size_t len) | msg_cb | |||
) |
wpa_ctrl_request - Send a command to wpa_supplicant/hostapd : Control interface data from wpa_ctrl_open() : Command; usually, ASCII text, e.g., "PING" : Length of the cmd in bytes : Buffer for the response : Reply buffer length : Callback function for unsolicited messages or NULL if not used Returns: 0 on success, -1 on error (send or receive failed), -2 on timeout
This function is used to send commands to wpa_supplicant/hostapd. Received response will be written to reply and reply_len is set to the actual length of the reply. This function will block for up to two seconds while waiting for the reply. If unsolicited messages are received, the blocking time may be longer.
msg_cb can be used to register a callback function that will be called for unsolicited messages received while waiting for the command response. These messages may be received if wpa_ctrl_request() is called at the same time as wpa_supplicant/hostapd is sending such a message. This can happen only if the program has used wpa_ctrl_attach() to register itself as a monitor for event messages. Alternatively to msg_cb, programs can register two control interface connections and use one of them for commands and the other one for receiving event messages, in other words, call wpa_ctrl_attach() only for the control interface connection that will be used for event messages.