LMS 2012
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
wpa_ctrl.h
Go to the documentation of this file.
1 /*
2  * wpa_supplicant/hostapd control interface library
3  * Copyright (c) 2004-2006, Jouni Malinen <j@w1.fi>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License version 2 as
7  * published by the Free Software Foundation.
8  *
9  * Alternatively, this software may be distributed under the terms of BSD
10  * license.
11  *
12  * See README and COPYING for more details.
13  */
14 
15 #ifndef WPA_CTRL_H
16 #define WPA_CTRL_H
17 
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21 
22 /* wpa_supplicant control interface - fixed message prefixes */
23 
25 #define WPA_CTRL_REQ "CTRL-REQ-"
26 
28 #define WPA_CTRL_RSP "CTRL-RSP-"
29 
30 /* Event messages with fixed prefix */
32 #define WPA_EVENT_CONNECTED "CTRL-EVENT-CONNECTED "
33 
34 #define WPA_EVENT_DISCONNECTED "CTRL-EVENT-DISCONNECTED "
35 
36 #define WPA_EVENT_TERMINATING "CTRL-EVENT-TERMINATING "
37 
38 #define WPA_EVENT_PASSWORD_CHANGED "CTRL-EVENT-PASSWORD-CHANGED "
39 
40 #define WPA_EVENT_EAP_NOTIFICATION "CTRL-EVENT-EAP-NOTIFICATION "
41 
42 #define WPA_EVENT_EAP_STARTED "CTRL-EVENT-EAP-STARTED "
43 
44 #define WPA_EVENT_EAP_PROPOSED_METHOD "CTRL-EVENT-EAP-PROPOSED-METHOD "
45 
46 #define WPA_EVENT_EAP_METHOD "CTRL-EVENT-EAP-METHOD "
47 
48 #define WPA_EVENT_EAP_PEER_CERT "CTRL-EVENT-EAP-PEER-CERT "
49 
50 #define WPA_EVENT_EAP_TLS_CERT_ERROR "CTRL-EVENT-EAP-TLS-CERT-ERROR "
51 
52 #define WPA_EVENT_EAP_SUCCESS "CTRL-EVENT-EAP-SUCCESS "
53 
54 #define WPA_EVENT_EAP_FAILURE "CTRL-EVENT-EAP-FAILURE "
55 
56 #define WPA_EVENT_SCAN_RESULTS "CTRL-EVENT-SCAN-RESULTS "
57 
58 #define WPA_EVENT_BSS_ADDED "CTRL-EVENT-BSS-ADDED "
59 
60 #define WPA_EVENT_BSS_REMOVED "CTRL-EVENT-BSS-REMOVED "
61 
63 #define WPS_EVENT_OVERLAP "WPS-OVERLAP-DETECTED "
64 
65 #define WPS_EVENT_AP_AVAILABLE_PBC "WPS-AP-AVAILABLE-PBC "
66 
68 #define WPS_EVENT_AP_AVAILABLE_PIN "WPS-AP-AVAILABLE-PIN "
69 
70 #define WPS_EVENT_AP_AVAILABLE "WPS-AP-AVAILABLE "
71 
72 #define WPS_EVENT_CRED_RECEIVED "WPS-CRED-RECEIVED "
73 
74 #define WPS_EVENT_M2D "WPS-M2D "
75 
76 #define WPS_EVENT_FAIL "WPS-FAIL "
77 
78 #define WPS_EVENT_SUCCESS "WPS-SUCCESS "
79 
80 #define WPS_EVENT_TIMEOUT "WPS-TIMEOUT "
81 
82 #define WPS_EVENT_ENROLLEE_SEEN "WPS-ENROLLEE-SEEN "
83 
84 /* WPS ER events */
85 #define WPS_EVENT_ER_AP_ADD "WPS-ER-AP-ADD "
86 #define WPS_EVENT_ER_AP_REMOVE "WPS-ER-AP-REMOVE "
87 #define WPS_EVENT_ER_ENROLLEE_ADD "WPS-ER-ENROLLEE-ADD "
88 #define WPS_EVENT_ER_ENROLLEE_REMOVE "WPS-ER-ENROLLEE-REMOVE "
89 
90 /* hostapd control interface - fixed message prefixes */
91 #define WPS_EVENT_PIN_NEEDED "WPS-PIN-NEEDED "
92 #define WPS_EVENT_NEW_AP_SETTINGS "WPS-NEW-AP-SETTINGS "
93 #define WPS_EVENT_REG_SUCCESS "WPS-REG-SUCCESS "
94 #define WPS_EVENT_AP_SETUP_LOCKED "WPS-AP-SETUP-LOCKED "
95 #define WPS_EVENT_AP_SETUP_UNLOCKED "WPS-AP-SETUP-UNLOCKED "
96 #define WPS_EVENT_AP_PIN_ENABLED "WPS-AP-PIN-ENABLED "
97 #define WPS_EVENT_AP_PIN_DISABLED "WPS-AP-PIN-DISABLED "
98 #define AP_STA_CONNECTED "AP-STA-CONNECTED "
99 #define AP_STA_DISCONNECTED "AP-STA-DISCONNECTED "
100 
101 
102 /* wpa_supplicant/hostapd control interface access */
103 
114 struct wpa_ctrl * wpa_ctrl_open(const char *ctrl_path);
115 
116 
123 void wpa_ctrl_close(struct wpa_ctrl *ctrl);
124 
125 
152 int wpa_ctrl_request(struct wpa_ctrl *ctrl, const char *cmd, size_t cmd_len,
153  char *reply, size_t *reply_len,
154  void (*msg_cb)(char *msg, size_t len));
155 
156 
167 int wpa_ctrl_attach(struct wpa_ctrl *ctrl);
168 
169 
179 int wpa_ctrl_detach(struct wpa_ctrl *ctrl);
180 
181 
195 int wpa_ctrl_recv(struct wpa_ctrl *ctrl, char *reply, size_t *reply_len);
196 
197 
208 int wpa_ctrl_pending(struct wpa_ctrl *ctrl);
209 
210 
224 int wpa_ctrl_get_fd(struct wpa_ctrl *ctrl);
225 
226 #ifdef CONFIG_CTRL_IFACE_UDP
227 #define WPA_CTRL_IFACE_PORT 9877
228 #define WPA_GLOBAL_CTRL_IFACE_PORT 9878
229 #endif /* CONFIG_CTRL_IFACE_UDP */
230 
231 
232 #ifdef __cplusplus
233 }
234 #endif
235 
236 #endif /* WPA_CTRL_H */
int wpa_ctrl_pending(struct wpa_ctrl *ctrl)
Definition: wpa_ctrl.c:323
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))
Definition: wpa_ctrl.c:208
void wpa_ctrl_close(struct wpa_ctrl *ctrl)
Definition: wpa_ctrl.c:137
int wpa_ctrl_attach(struct wpa_ctrl *ctrl)
Definition: wpa_ctrl.c:297
struct wpa_ctrl * wpa_ctrl_open(const char *ctrl_path)
Definition: wpa_ctrl.c:65
int wpa_ctrl_recv(struct wpa_ctrl *ctrl, char *reply, size_t *reply_len)
Definition: wpa_ctrl.c:311
int wpa_ctrl_detach(struct wpa_ctrl *ctrl)
Definition: wpa_ctrl.c:303
int wpa_ctrl_get_fd(struct wpa_ctrl *ctrl)
Definition: wpa_ctrl.c:336