1 /*
2  * WPA Supplicant / Zephyr socket pair -based control interface
3  * Copyright (c) 2022, Jouni Malinen <j@w1.fi>
4  *
5  * This software may be distributed under the terms of the BSD license.
6  * See README for more details.
7  */
8 /* Per-interface ctrl_iface */
9 #include "utils/includes.h"
10 
11 #include "utils/common.h"
12 #include "eloop.h"
13 #include "config.h"
14 #include "eapol_supp/eapol_supp_sm.h"
15 #include "wpa_supplicant_i.h"
16 #include "ctrl_iface.h"
17 #include "common/wpa_ctrl.h"
18 
19 #define MAX_CTRL_MSG_LEN 256
20 /**
21  * struct wpa_ctrl_mon - Data structure of control interface monitors
22  *
23  * This structure is used to store information about registered control
24  * interface monitors into struct wpa_supplicant.
25  */
26 struct wpa_ctrl_mon {
27 	struct wpa_ctrl_mon *next;
28 	int sock;
29 	int debug_level;
30 	int errors;
31 };
32 
33 struct ctrl_iface_priv {
34 	struct wpa_supplicant *wpa_s;
35 	/* 0 - wpa_cli, 1 - ctrl_iface */
36 	int sock_pair[2];
37 	int mon_sock_pair[2];
38 	struct wpa_ctrl_mon *ctrl_dst;
39 };
40 
41 struct ctrl_iface_global_priv {
42 	struct wpa_global *global;
43 	/* 0 - wpa_cli, 1 - ctrl_iface */
44 	int sock_pair[2];
45 	int mon_sock_pair[2];
46 	struct wpa_ctrl_mon *ctrl_dst;
47 };
48 
49 struct conn_msg {
50 	char msg[MAX_CTRL_MSG_LEN];
51 	int msg_len;
52 };
53