xref: /freebsd/contrib/wpa/src/common/ctrl_iface_common.h (revision 67350cb56a69468c118bd4ccf6e361b7ebfa9eb4)
1780fb4a2SCy Schubert /*
2780fb4a2SCy Schubert  * Common hostapd/wpa_supplicant ctrl iface code.
3780fb4a2SCy Schubert  * Copyright (c) 2002-2013, Jouni Malinen <j@w1.fi>
4780fb4a2SCy Schubert  * Copyright (c) 2015, Qualcomm Atheros, Inc.
5780fb4a2SCy Schubert  *
6780fb4a2SCy Schubert  * This software may be distributed under the terms of the BSD license.
7780fb4a2SCy Schubert  * See README for more details.
8780fb4a2SCy Schubert  */
9780fb4a2SCy Schubert #ifndef CONTROL_IFACE_COMMON_H
10780fb4a2SCy Schubert #define CONTROL_IFACE_COMMON_H
11780fb4a2SCy Schubert 
12780fb4a2SCy Schubert #include "utils/list.h"
13780fb4a2SCy Schubert 
14*85732ac8SCy Schubert /* Events enable bits (wpa_ctrl_dst::events) */
15*85732ac8SCy Schubert #define WPA_EVENT_RX_PROBE_REQUEST BIT(0)
16*85732ac8SCy Schubert 
17780fb4a2SCy Schubert /**
18780fb4a2SCy Schubert  * struct wpa_ctrl_dst - Data structure of control interface monitors
19780fb4a2SCy Schubert  *
20780fb4a2SCy Schubert  * This structure is used to store information about registered control
21780fb4a2SCy Schubert  * interface monitors into struct wpa_supplicant.
22780fb4a2SCy Schubert  */
23780fb4a2SCy Schubert struct wpa_ctrl_dst {
24780fb4a2SCy Schubert 	struct dl_list list;
25780fb4a2SCy Schubert 	struct sockaddr_storage addr;
26780fb4a2SCy Schubert 	socklen_t addrlen;
27780fb4a2SCy Schubert 	int debug_level;
28780fb4a2SCy Schubert 	int errors;
29*85732ac8SCy Schubert 	u32 events; /* WPA_EVENT_* bitmap */
30780fb4a2SCy Schubert };
31780fb4a2SCy Schubert 
32780fb4a2SCy Schubert void sockaddr_print(int level, const char *msg, struct sockaddr_storage *sock,
33780fb4a2SCy Schubert 		    socklen_t socklen);
34780fb4a2SCy Schubert 
35780fb4a2SCy Schubert int ctrl_iface_attach(struct dl_list *ctrl_dst, struct sockaddr_storage *from,
36*85732ac8SCy Schubert 		       socklen_t fromlen, const char *input);
37780fb4a2SCy Schubert int ctrl_iface_detach(struct dl_list *ctrl_dst, struct sockaddr_storage *from,
38780fb4a2SCy Schubert 		      socklen_t fromlen);
39780fb4a2SCy Schubert int ctrl_iface_level(struct dl_list *ctrl_dst, struct sockaddr_storage *from,
40780fb4a2SCy Schubert 		     socklen_t fromlen, const char *level);
41780fb4a2SCy Schubert 
42780fb4a2SCy Schubert #endif /* CONTROL_IFACE_COMMON_H */
43