xref: /wlan-dirver/utils/sigma-dut/wpa_ctrl.h (revision 831b54979c57b3b6d605f9f395c718caac28bf32)
1cd4e3c3eSJouni Malinen /*
2cd4e3c3eSJouni Malinen  * wpa_supplicant/hostapd control interface library
3cd4e3c3eSJouni Malinen  * Copyright (c) 2004-2006, Jouni Malinen <j@w1.fi>
4cd4e3c3eSJouni Malinen  *
5cd4e3c3eSJouni Malinen  * This software may be distributed under the terms of the BSD license.
6cd4e3c3eSJouni Malinen  * See README for more details.
7cd4e3c3eSJouni Malinen  */
8cd4e3c3eSJouni Malinen 
9cd4e3c3eSJouni Malinen #ifndef WPA_CTRL_H
10cd4e3c3eSJouni Malinen #define WPA_CTRL_H
11cd4e3c3eSJouni Malinen 
12cd4e3c3eSJouni Malinen #ifdef  __cplusplus
13cd4e3c3eSJouni Malinen extern "C" {
14cd4e3c3eSJouni Malinen #endif
15cd4e3c3eSJouni Malinen 
16cd4e3c3eSJouni Malinen /* wpa_supplicant control interface - fixed message prefixes */
17cd4e3c3eSJouni Malinen 
18cd4e3c3eSJouni Malinen /** Interactive request for identity/password/pin */
19cd4e3c3eSJouni Malinen #define WPA_CTRL_REQ "CTRL-REQ-"
20cd4e3c3eSJouni Malinen 
21cd4e3c3eSJouni Malinen /** Response to identity/password/pin request */
22cd4e3c3eSJouni Malinen #define WPA_CTRL_RSP "CTRL-RSP-"
23cd4e3c3eSJouni Malinen 
24cd4e3c3eSJouni Malinen /* Event messages with fixed prefix */
25cd4e3c3eSJouni Malinen /** Authentication completed successfully and data connection enabled */
26cd4e3c3eSJouni Malinen #define WPA_EVENT_CONNECTED "CTRL-EVENT-CONNECTED "
27cd4e3c3eSJouni Malinen /** Disconnected, data connection is not available */
28cd4e3c3eSJouni Malinen #define WPA_EVENT_DISCONNECTED "CTRL-EVENT-DISCONNECTED "
29cd4e3c3eSJouni Malinen /** Association rejected during connection attempt */
30cd4e3c3eSJouni Malinen #define WPA_EVENT_ASSOC_REJECT "CTRL-EVENT-ASSOC-REJECT "
31cd4e3c3eSJouni Malinen /** wpa_supplicant is exiting */
32cd4e3c3eSJouni Malinen #define WPA_EVENT_TERMINATING "CTRL-EVENT-TERMINATING "
33cd4e3c3eSJouni Malinen /** Password change was completed successfully */
34cd4e3c3eSJouni Malinen #define WPA_EVENT_PASSWORD_CHANGED "CTRL-EVENT-PASSWORD-CHANGED "
35cd4e3c3eSJouni Malinen /** EAP-Request/Notification received */
36cd4e3c3eSJouni Malinen #define WPA_EVENT_EAP_NOTIFICATION "CTRL-EVENT-EAP-NOTIFICATION "
37cd4e3c3eSJouni Malinen /** EAP authentication started (EAP-Request/Identity received) */
38cd4e3c3eSJouni Malinen #define WPA_EVENT_EAP_STARTED "CTRL-EVENT-EAP-STARTED "
39cd4e3c3eSJouni Malinen /** EAP method proposed by the server */
40cd4e3c3eSJouni Malinen #define WPA_EVENT_EAP_PROPOSED_METHOD "CTRL-EVENT-EAP-PROPOSED-METHOD "
41cd4e3c3eSJouni Malinen /** EAP method selected */
42cd4e3c3eSJouni Malinen #define WPA_EVENT_EAP_METHOD "CTRL-EVENT-EAP-METHOD "
43cd4e3c3eSJouni Malinen /** EAP peer certificate from TLS */
44cd4e3c3eSJouni Malinen #define WPA_EVENT_EAP_PEER_CERT "CTRL-EVENT-EAP-PEER-CERT "
45cd4e3c3eSJouni Malinen /** EAP TLS certificate chain validation error */
46cd4e3c3eSJouni Malinen #define WPA_EVENT_EAP_TLS_CERT_ERROR "CTRL-EVENT-EAP-TLS-CERT-ERROR "
47cd4e3c3eSJouni Malinen /** EAP authentication completed successfully */
48cd4e3c3eSJouni Malinen #define WPA_EVENT_EAP_SUCCESS "CTRL-EVENT-EAP-SUCCESS "
49cd4e3c3eSJouni Malinen /** EAP authentication failed (EAP-Failure received) */
50cd4e3c3eSJouni Malinen #define WPA_EVENT_EAP_FAILURE "CTRL-EVENT-EAP-FAILURE "
51cd4e3c3eSJouni Malinen /** New scan results available */
52cd4e3c3eSJouni Malinen #define WPA_EVENT_SCAN_RESULTS "CTRL-EVENT-SCAN-RESULTS "
53cd4e3c3eSJouni Malinen /** wpa_supplicant state change */
54cd4e3c3eSJouni Malinen #define WPA_EVENT_STATE_CHANGE "CTRL-EVENT-STATE-CHANGE "
55cd4e3c3eSJouni Malinen /** A new BSS entry was added (followed by BSS entry id and BSSID) */
56cd4e3c3eSJouni Malinen #define WPA_EVENT_BSS_ADDED "CTRL-EVENT-BSS-ADDED "
57cd4e3c3eSJouni Malinen /** A BSS entry was removed (followed by BSS entry id and BSSID) */
58cd4e3c3eSJouni Malinen #define WPA_EVENT_BSS_REMOVED "CTRL-EVENT-BSS-REMOVED "
59cd4e3c3eSJouni Malinen 
60cd4e3c3eSJouni Malinen /** WPS overlap detected in PBC mode */
61cd4e3c3eSJouni Malinen #define WPS_EVENT_OVERLAP "WPS-OVERLAP-DETECTED "
62cd4e3c3eSJouni Malinen /** Available WPS AP with active PBC found in scan results */
63cd4e3c3eSJouni Malinen #define WPS_EVENT_AP_AVAILABLE_PBC "WPS-AP-AVAILABLE-PBC "
64cd4e3c3eSJouni Malinen /** Available WPS AP with our address as authorized in scan results */
65cd4e3c3eSJouni Malinen #define WPS_EVENT_AP_AVAILABLE_AUTH "WPS-AP-AVAILABLE-AUTH "
66cd4e3c3eSJouni Malinen /** Available WPS AP with recently selected PIN registrar found in scan results
67cd4e3c3eSJouni Malinen  */
68cd4e3c3eSJouni Malinen #define WPS_EVENT_AP_AVAILABLE_PIN "WPS-AP-AVAILABLE-PIN "
69cd4e3c3eSJouni Malinen /** Available WPS AP found in scan results */
70cd4e3c3eSJouni Malinen #define WPS_EVENT_AP_AVAILABLE "WPS-AP-AVAILABLE "
71cd4e3c3eSJouni Malinen /** A new credential received */
72cd4e3c3eSJouni Malinen #define WPS_EVENT_CRED_RECEIVED "WPS-CRED-RECEIVED "
73cd4e3c3eSJouni Malinen /** M2D received */
74cd4e3c3eSJouni Malinen #define WPS_EVENT_M2D "WPS-M2D "
75cd4e3c3eSJouni Malinen /** WPS registration failed after M2/M2D */
76cd4e3c3eSJouni Malinen #define WPS_EVENT_FAIL "WPS-FAIL "
77cd4e3c3eSJouni Malinen /** WPS registration completed successfully */
78cd4e3c3eSJouni Malinen #define WPS_EVENT_SUCCESS "WPS-SUCCESS "
79cd4e3c3eSJouni Malinen /** WPS enrollment attempt timed out and was terminated */
80cd4e3c3eSJouni Malinen #define WPS_EVENT_TIMEOUT "WPS-TIMEOUT "
81cd4e3c3eSJouni Malinen 
82cd4e3c3eSJouni Malinen #define WPS_EVENT_ENROLLEE_SEEN "WPS-ENROLLEE-SEEN "
83cd4e3c3eSJouni Malinen 
84cd4e3c3eSJouni Malinen #define WPS_EVENT_OPEN_NETWORK "WPS-OPEN-NETWORK "
85cd4e3c3eSJouni Malinen 
86cd4e3c3eSJouni Malinen /* WPS ER events */
87cd4e3c3eSJouni Malinen #define WPS_EVENT_ER_AP_ADD "WPS-ER-AP-ADD "
88cd4e3c3eSJouni Malinen #define WPS_EVENT_ER_AP_REMOVE "WPS-ER-AP-REMOVE "
89cd4e3c3eSJouni Malinen #define WPS_EVENT_ER_ENROLLEE_ADD "WPS-ER-ENROLLEE-ADD "
90cd4e3c3eSJouni Malinen #define WPS_EVENT_ER_ENROLLEE_REMOVE "WPS-ER-ENROLLEE-REMOVE "
91cd4e3c3eSJouni Malinen #define WPS_EVENT_ER_AP_SETTINGS "WPS-ER-AP-SETTINGS "
92cd4e3c3eSJouni Malinen #define WPS_EVENT_ER_SET_SEL_REG "WPS-ER-AP-SET-SEL-REG "
93cd4e3c3eSJouni Malinen 
94cd4e3c3eSJouni Malinen /** P2P device found */
95cd4e3c3eSJouni Malinen #define P2P_EVENT_DEVICE_FOUND "P2P-DEVICE-FOUND "
96cd4e3c3eSJouni Malinen 
97cd4e3c3eSJouni Malinen /** P2P device lost */
98cd4e3c3eSJouni Malinen #define P2P_EVENT_DEVICE_LOST "P2P-DEVICE-LOST "
99cd4e3c3eSJouni Malinen 
100cd4e3c3eSJouni Malinen /** A P2P device requested GO negotiation, but we were not ready to start the
101cd4e3c3eSJouni Malinen  * negotiation */
102cd4e3c3eSJouni Malinen #define P2P_EVENT_GO_NEG_REQUEST "P2P-GO-NEG-REQUEST "
103cd4e3c3eSJouni Malinen #define P2P_EVENT_GO_NEG_SUCCESS "P2P-GO-NEG-SUCCESS "
104cd4e3c3eSJouni Malinen #define P2P_EVENT_GO_NEG_FAILURE "P2P-GO-NEG-FAILURE "
105cd4e3c3eSJouni Malinen #define P2P_EVENT_GROUP_FORMATION_SUCCESS "P2P-GROUP-FORMATION-SUCCESS "
106cd4e3c3eSJouni Malinen #define P2P_EVENT_GROUP_FORMATION_FAILURE "P2P-GROUP-FORMATION-FAILURE "
107cd4e3c3eSJouni Malinen #define P2P_EVENT_GROUP_STARTED "P2P-GROUP-STARTED "
108cd4e3c3eSJouni Malinen #define P2P_EVENT_GROUP_REMOVED "P2P-GROUP-REMOVED "
109cd4e3c3eSJouni Malinen #define P2P_EVENT_CROSS_CONNECT_ENABLE "P2P-CROSS-CONNECT-ENABLE "
110cd4e3c3eSJouni Malinen #define P2P_EVENT_CROSS_CONNECT_DISABLE "P2P-CROSS-CONNECT-DISABLE "
111cd4e3c3eSJouni Malinen /* parameters: <peer address> <PIN> */
112cd4e3c3eSJouni Malinen #define P2P_EVENT_PROV_DISC_SHOW_PIN "P2P-PROV-DISC-SHOW-PIN "
113cd4e3c3eSJouni Malinen /* parameters: <peer address> */
114cd4e3c3eSJouni Malinen #define P2P_EVENT_PROV_DISC_ENTER_PIN "P2P-PROV-DISC-ENTER-PIN "
115cd4e3c3eSJouni Malinen /* parameters: <peer address> */
116cd4e3c3eSJouni Malinen #define P2P_EVENT_PROV_DISC_PBC_REQ "P2P-PROV-DISC-PBC-REQ "
117cd4e3c3eSJouni Malinen /* parameters: <peer address> */
118cd4e3c3eSJouni Malinen #define P2P_EVENT_PROV_DISC_PBC_RESP "P2P-PROV-DISC-PBC-RESP "
119cd4e3c3eSJouni Malinen /* parameters: <freq> <src addr> <dialog token> <update indicator> <TLVs> */
120cd4e3c3eSJouni Malinen #define P2P_EVENT_SERV_DISC_REQ "P2P-SERV-DISC-REQ "
121cd4e3c3eSJouni Malinen /* parameters: <src addr> <update indicator> <TLVs> */
122cd4e3c3eSJouni Malinen #define P2P_EVENT_SERV_DISC_RESP "P2P-SERV-DISC-RESP "
123cd4e3c3eSJouni Malinen #define P2P_EVENT_INVITATION_RECEIVED "P2P-INVITATION-RECEIVED "
124cd4e3c3eSJouni Malinen #define P2P_EVENT_INVITATION_RESULT "P2P-INVITATION-RESULT "
125cd4e3c3eSJouni Malinen #define P2P_EVENT_FIND_STOPPED "P2P-FIND-STOPPED "
126cd4e3c3eSJouni Malinen 
127cd4e3c3eSJouni Malinen #define INTERWORKING_AP "INTERWORKING-AP "
128cd4e3c3eSJouni Malinen #define INTERWORKING_NO_MATCH "INTERWORKING-NO-MATCH "
129cd4e3c3eSJouni Malinen 
130cd4e3c3eSJouni Malinen /* hostapd control interface - fixed message prefixes */
131cd4e3c3eSJouni Malinen #define WPS_EVENT_PIN_NEEDED "WPS-PIN-NEEDED "
132cd4e3c3eSJouni Malinen #define WPS_EVENT_NEW_AP_SETTINGS "WPS-NEW-AP-SETTINGS "
133cd4e3c3eSJouni Malinen #define WPS_EVENT_REG_SUCCESS "WPS-REG-SUCCESS "
134cd4e3c3eSJouni Malinen #define WPS_EVENT_AP_SETUP_LOCKED "WPS-AP-SETUP-LOCKED "
135cd4e3c3eSJouni Malinen #define WPS_EVENT_AP_SETUP_UNLOCKED "WPS-AP-SETUP-UNLOCKED "
136cd4e3c3eSJouni Malinen #define WPS_EVENT_AP_PIN_ENABLED "WPS-AP-PIN-ENABLED "
137cd4e3c3eSJouni Malinen #define WPS_EVENT_AP_PIN_DISABLED "WPS-AP-PIN-DISABLED "
138cd4e3c3eSJouni Malinen #define AP_STA_CONNECTED "AP-STA-CONNECTED "
139cd4e3c3eSJouni Malinen #define AP_STA_DISCONNECTED "AP-STA-DISCONNECTED "
140cd4e3c3eSJouni Malinen 
141cd4e3c3eSJouni Malinen 
142cd4e3c3eSJouni Malinen /* wpa_supplicant/hostapd control interface access */
143cd4e3c3eSJouni Malinen 
144cd4e3c3eSJouni Malinen /**
145cd4e3c3eSJouni Malinen  * wpa_ctrl_open - Open a control interface to wpa_supplicant/hostapd
146cd4e3c3eSJouni Malinen  * @ctrl_path: Path for UNIX domain sockets; ignored if UDP sockets are used.
147cd4e3c3eSJouni Malinen  * Returns: Pointer to abstract control interface data or %NULL on failure
148cd4e3c3eSJouni Malinen  *
149cd4e3c3eSJouni Malinen  * This function is used to open a control interface to wpa_supplicant/hostapd.
150cd4e3c3eSJouni Malinen  * ctrl_path is usually /var/run/wpa_supplicant or /var/run/hostapd. This path
151cd4e3c3eSJouni Malinen  * is configured in wpa_supplicant/hostapd and other programs using the control
152cd4e3c3eSJouni Malinen  * interface need to use matching path configuration.
153cd4e3c3eSJouni Malinen  */
154cd4e3c3eSJouni Malinen struct wpa_ctrl * wpa_ctrl_open(const char *ctrl_path);
155cd4e3c3eSJouni Malinen 
156*831b5497SRajiv Ranjan /**
157*831b5497SRajiv Ranjan  * wpa_ctrl_open2 - Open a control interface to wpa_supplicant/hostapd
158*831b5497SRajiv Ranjan  * @ctrl_path: Path for UNIX domain sockets; ignored if UDP sockets are used.
159*831b5497SRajiv Ranjan  * @cli_path: Path for client UNIX domain sockets; ignored if UDP socket
160*831b5497SRajiv Ranjan  *            is used.
161*831b5497SRajiv Ranjan  * Returns: Pointer to abstract control interface data or %NULL on failure
162*831b5497SRajiv Ranjan  *
163*831b5497SRajiv Ranjan  * This function is used to open a control interface to wpa_supplicant/hostapd
164*831b5497SRajiv Ranjan  * when the socket path for client need to be specified explicitly. Default
165*831b5497SRajiv Ranjan  * ctrl_path is usually /var/run/wpa_supplicant or /var/run/hostapd and client
166*831b5497SRajiv Ranjan  * socket path is /tmp.
167*831b5497SRajiv Ranjan  */
168*831b5497SRajiv Ranjan struct wpa_ctrl * wpa_ctrl_open2(const char *ctrl_path, const char *cli_path);
169*831b5497SRajiv Ranjan 
170cd4e3c3eSJouni Malinen 
171cd4e3c3eSJouni Malinen /**
172cd4e3c3eSJouni Malinen  * wpa_ctrl_close - Close a control interface to wpa_supplicant/hostapd
173cd4e3c3eSJouni Malinen  * @ctrl: Control interface data from wpa_ctrl_open()
174cd4e3c3eSJouni Malinen  *
175cd4e3c3eSJouni Malinen  * This function is used to close a control interface.
176cd4e3c3eSJouni Malinen  */
177cd4e3c3eSJouni Malinen void wpa_ctrl_close(struct wpa_ctrl *ctrl);
178cd4e3c3eSJouni Malinen 
179cd4e3c3eSJouni Malinen 
180cd4e3c3eSJouni Malinen /**
181cd4e3c3eSJouni Malinen  * wpa_ctrl_request - Send a command to wpa_supplicant/hostapd
182cd4e3c3eSJouni Malinen  * @ctrl: Control interface data from wpa_ctrl_open()
183cd4e3c3eSJouni Malinen  * @cmd: Command; usually, ASCII text, e.g., "PING"
184cd4e3c3eSJouni Malinen  * @cmd_len: Length of the cmd in bytes
185cd4e3c3eSJouni Malinen  * @reply: Buffer for the response
186cd4e3c3eSJouni Malinen  * @reply_len: Reply buffer length
187cd4e3c3eSJouni Malinen  * @msg_cb: Callback function for unsolicited messages or %NULL if not used
188cd4e3c3eSJouni Malinen  * Returns: 0 on success, -1 on error (send or receive failed), -2 on timeout
189cd4e3c3eSJouni Malinen  *
190cd4e3c3eSJouni Malinen  * This function is used to send commands to wpa_supplicant/hostapd. Received
191cd4e3c3eSJouni Malinen  * response will be written to reply and reply_len is set to the actual length
192cd4e3c3eSJouni Malinen  * of the reply. This function will block for up to two seconds while waiting
193cd4e3c3eSJouni Malinen  * for the reply. If unsolicited messages are received, the blocking time may
194cd4e3c3eSJouni Malinen  * be longer.
195cd4e3c3eSJouni Malinen  *
196cd4e3c3eSJouni Malinen  * msg_cb can be used to register a callback function that will be called for
197cd4e3c3eSJouni Malinen  * unsolicited messages received while waiting for the command response. These
198cd4e3c3eSJouni Malinen  * messages may be received if wpa_ctrl_request() is called at the same time as
199cd4e3c3eSJouni Malinen  * wpa_supplicant/hostapd is sending such a message. This can happen only if
200cd4e3c3eSJouni Malinen  * the program has used wpa_ctrl_attach() to register itself as a monitor for
201cd4e3c3eSJouni Malinen  * event messages. Alternatively to msg_cb, programs can register two control
202cd4e3c3eSJouni Malinen  * interface connections and use one of them for commands and the other one for
203cd4e3c3eSJouni Malinen  * receiving event messages, in other words, call wpa_ctrl_attach() only for
204cd4e3c3eSJouni Malinen  * the control interface connection that will be used for event messages.
205cd4e3c3eSJouni Malinen  */
206cd4e3c3eSJouni Malinen int wpa_ctrl_request(struct wpa_ctrl *ctrl, const char *cmd, size_t cmd_len,
207cd4e3c3eSJouni Malinen 		     char *reply, size_t *reply_len,
208cd4e3c3eSJouni Malinen 		     void (*msg_cb)(char *msg, size_t len));
209cd4e3c3eSJouni Malinen 
210cd4e3c3eSJouni Malinen 
211cd4e3c3eSJouni Malinen /**
212cd4e3c3eSJouni Malinen  * wpa_ctrl_attach - Register as an event monitor for the control interface
213cd4e3c3eSJouni Malinen  * @ctrl: Control interface data from wpa_ctrl_open()
214cd4e3c3eSJouni Malinen  * Returns: 0 on success, -1 on failure, -2 on timeout
215cd4e3c3eSJouni Malinen  *
216cd4e3c3eSJouni Malinen  * This function registers the control interface connection as a monitor for
217cd4e3c3eSJouni Malinen  * wpa_supplicant/hostapd events. After a success wpa_ctrl_attach() call, the
218cd4e3c3eSJouni Malinen  * control interface connection starts receiving event messages that can be
219cd4e3c3eSJouni Malinen  * read with wpa_ctrl_recv().
220cd4e3c3eSJouni Malinen  */
221cd4e3c3eSJouni Malinen int wpa_ctrl_attach(struct wpa_ctrl *ctrl);
222cd4e3c3eSJouni Malinen 
223cd4e3c3eSJouni Malinen 
224cd4e3c3eSJouni Malinen /**
225cd4e3c3eSJouni Malinen  * wpa_ctrl_detach - Unregister event monitor from the control interface
226cd4e3c3eSJouni Malinen  * @ctrl: Control interface data from wpa_ctrl_open()
227cd4e3c3eSJouni Malinen  * Returns: 0 on success, -1 on failure, -2 on timeout
228cd4e3c3eSJouni Malinen  *
229cd4e3c3eSJouni Malinen  * This function unregisters the control interface connection as a monitor for
230cd4e3c3eSJouni Malinen  * wpa_supplicant/hostapd events, i.e., cancels the registration done with
231cd4e3c3eSJouni Malinen  * wpa_ctrl_attach().
232cd4e3c3eSJouni Malinen  */
233cd4e3c3eSJouni Malinen int wpa_ctrl_detach(struct wpa_ctrl *ctrl);
234cd4e3c3eSJouni Malinen 
235cd4e3c3eSJouni Malinen 
236cd4e3c3eSJouni Malinen /**
237cd4e3c3eSJouni Malinen  * wpa_ctrl_recv - Receive a pending control interface message
238cd4e3c3eSJouni Malinen  * @ctrl: Control interface data from wpa_ctrl_open()
239cd4e3c3eSJouni Malinen  * @reply: Buffer for the message data
240cd4e3c3eSJouni Malinen  * @reply_len: Length of the reply buffer
241cd4e3c3eSJouni Malinen  * Returns: 0 on success, -1 on failure
242cd4e3c3eSJouni Malinen  *
243cd4e3c3eSJouni Malinen  * This function will receive a pending control interface message. This
244cd4e3c3eSJouni Malinen  * function will block if no messages are available. The received response will
245cd4e3c3eSJouni Malinen  * be written to reply and reply_len is set to the actual length of the reply.
246cd4e3c3eSJouni Malinen  * wpa_ctrl_recv() is only used for event messages, i.e., wpa_ctrl_attach()
247cd4e3c3eSJouni Malinen  * must have been used to register the control interface as an event monitor.
248cd4e3c3eSJouni Malinen  */
249cd4e3c3eSJouni Malinen int wpa_ctrl_recv(struct wpa_ctrl *ctrl, char *reply, size_t *reply_len);
250cd4e3c3eSJouni Malinen 
251cd4e3c3eSJouni Malinen 
252cd4e3c3eSJouni Malinen /**
253cd4e3c3eSJouni Malinen  * wpa_ctrl_pending - Check whether there are pending event messages
254cd4e3c3eSJouni Malinen  * @ctrl: Control interface data from wpa_ctrl_open()
255cd4e3c3eSJouni Malinen  * Returns: 1 if there are pending messages, 0 if no, or -1 on error
256cd4e3c3eSJouni Malinen  *
257cd4e3c3eSJouni Malinen  * This function will check whether there are any pending control interface
258cd4e3c3eSJouni Malinen  * message available to be received with wpa_ctrl_recv(). wpa_ctrl_pending() is
259cd4e3c3eSJouni Malinen  * only used for event messages, i.e., wpa_ctrl_attach() must have been used to
260cd4e3c3eSJouni Malinen  * register the control interface as an event monitor.
261cd4e3c3eSJouni Malinen  */
262cd4e3c3eSJouni Malinen int wpa_ctrl_pending(struct wpa_ctrl *ctrl);
263cd4e3c3eSJouni Malinen 
264cd4e3c3eSJouni Malinen 
265cd4e3c3eSJouni Malinen /**
266cd4e3c3eSJouni Malinen  * wpa_ctrl_get_fd - Get file descriptor used by the control interface
267cd4e3c3eSJouni Malinen  * @ctrl: Control interface data from wpa_ctrl_open()
268cd4e3c3eSJouni Malinen  * Returns: File descriptor used for the connection
269cd4e3c3eSJouni Malinen  *
270cd4e3c3eSJouni Malinen  * This function can be used to get the file descriptor that is used for the
271cd4e3c3eSJouni Malinen  * control interface connection. The returned value can be used, e.g., with
272cd4e3c3eSJouni Malinen  * select() while waiting for multiple events.
273cd4e3c3eSJouni Malinen  *
274cd4e3c3eSJouni Malinen  * The returned file descriptor must not be used directly for sending or
275cd4e3c3eSJouni Malinen  * receiving packets; instead, the library functions wpa_ctrl_request() and
276cd4e3c3eSJouni Malinen  * wpa_ctrl_recv() must be used for this.
277cd4e3c3eSJouni Malinen  */
278cd4e3c3eSJouni Malinen int wpa_ctrl_get_fd(struct wpa_ctrl *ctrl);
279cd4e3c3eSJouni Malinen 
280cd4e3c3eSJouni Malinen 
281cd4e3c3eSJouni Malinen #ifdef CONFIG_CTRL_IFACE_UDP
282cd4e3c3eSJouni Malinen #define WPA_CTRL_IFACE_PORT 9877
283cd4e3c3eSJouni Malinen #define WPA_GLOBAL_CTRL_IFACE_PORT 9878
284cd4e3c3eSJouni Malinen #endif /* CONFIG_CTRL_IFACE_UDP */
285cd4e3c3eSJouni Malinen 
286cd4e3c3eSJouni Malinen 
287cd4e3c3eSJouni Malinen #ifdef  __cplusplus
288cd4e3c3eSJouni Malinen }
289cd4e3c3eSJouni Malinen #endif
290cd4e3c3eSJouni Malinen 
291cd4e3c3eSJouni Malinen #endif /* WPA_CTRL_H */
292