xref: /freebsd/contrib/wpa/src/common/ctrl_iface_common.h (revision cfd6422a5217410fbd66f7a7a8a64d9d85e61229)
1 /*
2  * Common hostapd/wpa_supplicant ctrl iface code.
3  * Copyright (c) 2002-2013, Jouni Malinen <j@w1.fi>
4  * Copyright (c) 2015, Qualcomm Atheros, Inc.
5  *
6  * This software may be distributed under the terms of the BSD license.
7  * See README for more details.
8  */
9 #ifndef CONTROL_IFACE_COMMON_H
10 #define CONTROL_IFACE_COMMON_H
11 
12 #include "utils/list.h"
13 
14 /* Events enable bits (wpa_ctrl_dst::events) */
15 #define WPA_EVENT_RX_PROBE_REQUEST BIT(0)
16 
17 /**
18  * struct wpa_ctrl_dst - Data structure of control interface monitors
19  *
20  * This structure is used to store information about registered control
21  * interface monitors into struct wpa_supplicant.
22  */
23 struct wpa_ctrl_dst {
24 	struct dl_list list;
25 	struct sockaddr_storage addr;
26 	socklen_t addrlen;
27 	int debug_level;
28 	int errors;
29 	u32 events; /* WPA_EVENT_* bitmap */
30 };
31 
32 void sockaddr_print(int level, const char *msg, struct sockaddr_storage *sock,
33 		    socklen_t socklen);
34 
35 int ctrl_iface_attach(struct dl_list *ctrl_dst, struct sockaddr_storage *from,
36 		       socklen_t fromlen, const char *input);
37 int ctrl_iface_detach(struct dl_list *ctrl_dst, struct sockaddr_storage *from,
38 		      socklen_t fromlen);
39 int ctrl_iface_level(struct dl_list *ctrl_dst, struct sockaddr_storage *from,
40 		     socklen_t fromlen, const char *level);
41 
42 #endif /* CONTROL_IFACE_COMMON_H */
43