]>
git.ipfire.org Git - thirdparty/hostap.git/blob - wpa_supplicant/ctrl_iface.h
2 * WPA Supplicant / UNIX domain socket -based control interface
3 * Copyright (c) 2004-2005, Jouni Malinen <j@w1.fi>
5 * This software may be distributed under the terms of the BSD license.
6 * See README for more details.
12 #ifdef CONFIG_CTRL_IFACE
14 /* Shared functions from ctrl_iface.c; to be called by ctrl_iface backends */
17 * wpa_supplicant_ctrl_iface_process - Process ctrl_iface command
18 * @wpa_s: Pointer to wpa_supplicant data
19 * @buf: Received command buffer (nul terminated string)
20 * @resp_len: Variable to be set to the response length
21 * Returns: Response (*resp_len bytes) or %NULL on failure
23 * Control interface backends call this function when receiving a message that
24 * they do not process internally, i.e., anything else than ATTACH, DETACH,
25 * and LEVEL. The return response value is then sent to the external program
26 * that sent the command. Caller is responsible for freeing the buffer after
27 * this. If %NULL is returned, *resp_len can be set to two special values:
28 * 1 = send "FAIL\n" response, 2 = send "OK\n" response. If *resp_len has any
29 * other value, no response is sent.
31 char * wpa_supplicant_ctrl_iface_process(struct wpa_supplicant
*wpa_s
,
32 char *buf
, size_t *resp_len
);
35 * wpa_supplicant_global_ctrl_iface_process - Process global ctrl_iface command
36 * @global: Pointer to global data from wpa_supplicant_init()
37 * @buf: Received command buffer (nul terminated string)
38 * @resp_len: Variable to be set to the response length
39 * Returns: Response (*resp_len bytes) or %NULL on failure
41 * Control interface backends call this function when receiving a message from
42 * the global ctrl_iface connection. The return response value is then sent to
43 * the external program that sent the command. Caller is responsible for
44 * freeing the buffer after this. If %NULL is returned, *resp_len can be set to
45 * two special values: 1 = send "FAIL\n" response, 2 = send "OK\n" response. If
46 * *resp_len has any other value, no response is sent.
48 char * wpa_supplicant_global_ctrl_iface_process(struct wpa_global
*global
,
49 char *buf
, size_t *resp_len
);
52 /* Functions that each ctrl_iface backend must implement */
55 * wpa_supplicant_ctrl_iface_init - Initialize control interface
56 * @wpa_s: Pointer to wpa_supplicant data
57 * Returns: Pointer to private data on success, %NULL on failure
59 * Initialize the control interface and start receiving commands from external
62 * Required to be implemented in each control interface backend.
64 struct ctrl_iface_priv
*
65 wpa_supplicant_ctrl_iface_init(struct wpa_supplicant
*wpa_s
);
68 * wpa_supplicant_ctrl_iface_deinit - Deinitialize control interface
69 * @priv: Pointer to private data from wpa_supplicant_ctrl_iface_init()
71 * Deinitialize the control interface that was initialized with
72 * wpa_supplicant_ctrl_iface_init().
74 * Required to be implemented in each control interface backend.
76 void wpa_supplicant_ctrl_iface_deinit(struct ctrl_iface_priv
*priv
);
79 * wpa_supplicant_ctrl_iface_wait - Wait for ctrl_iface monitor
80 * @priv: Pointer to private data from wpa_supplicant_ctrl_iface_init()
82 * Wait until the first message from an external program using the control
83 * interface is received. This function can be used to delay normal startup
84 * processing to allow control interface programs to attach with
85 * %wpa_supplicant before normal operations are started.
87 * Required to be implemented in each control interface backend.
89 void wpa_supplicant_ctrl_iface_wait(struct ctrl_iface_priv
*priv
);
92 * wpa_supplicant_global_ctrl_iface_init - Initialize global control interface
93 * @global: Pointer to global data from wpa_supplicant_init()
94 * Returns: Pointer to private data on success, %NULL on failure
96 * Initialize the global control interface and start receiving commands from
99 * Required to be implemented in each control interface backend.
101 struct ctrl_iface_global_priv
*
102 wpa_supplicant_global_ctrl_iface_init(struct wpa_global
*global
);
105 * wpa_supplicant_global_ctrl_iface_deinit - Deinitialize global ctrl interface
106 * @priv: Pointer to private data from wpa_supplicant_global_ctrl_iface_init()
108 * Deinitialize the global control interface that was initialized with
109 * wpa_supplicant_global_ctrl_iface_init().
111 * Required to be implemented in each control interface backend.
113 void wpa_supplicant_global_ctrl_iface_deinit(
114 struct ctrl_iface_global_priv
*priv
);
116 void wpas_ctrl_radio_work_flush(struct wpa_supplicant
*wpa_s
);
118 #else /* CONFIG_CTRL_IFACE */
120 static inline struct ctrl_iface_priv
*
121 wpa_supplicant_ctrl_iface_init(struct wpa_supplicant
*wpa_s
)
127 wpa_supplicant_ctrl_iface_deinit(struct ctrl_iface_priv
*priv
)
132 wpa_supplicant_ctrl_iface_send(struct ctrl_iface_priv
*priv
, int level
,
133 char *buf
, size_t len
)
138 wpa_supplicant_ctrl_iface_wait(struct ctrl_iface_priv
*priv
)
142 static inline struct ctrl_iface_global_priv
*
143 wpa_supplicant_global_ctrl_iface_init(struct wpa_global
*global
)
149 wpa_supplicant_global_ctrl_iface_deinit(struct ctrl_iface_global_priv
*priv
)
153 static inline void wpas_ctrl_radio_work_flush(struct wpa_supplicant
*wpa_s
)
157 #endif /* CONFIG_CTRL_IFACE */
159 #endif /* CTRL_IFACE_H */