blob: 6b6cdef15bfa7a1d17a0b26ba73e2bc25350b9a7 [file] [log] [blame]
developer2bf53a92022-06-06 12:08:58 +08001diff --git a/src/lib/target/inc/mesh/meshsync_msgs.h b/src/lib/target/inc/mesh/meshsync_msgs.h
2new file mode 100644
3index 0000000..03d5c6a
4--- /dev/null
5+++ b/src/lib/target/inc/mesh/meshsync_msgs.h
6@@ -0,0 +1,316 @@
7+/*
8+ * If not stated otherwise in this file or this component's Licenses.txt file the
9+ * following copyright and licenses apply:
10+ *
11+ * Copyright 2018 RDK Management
12+ *
13+ * Licensed under the Apache License, Version 2.0 (the "License");
14+ * you may not use this file except in compliance with the License.
15+ * You may obtain a copy of the License at
16+ *
17+ * http://www.apache.org/licenses/LICENSE-2.0
18+ *
19+ * Unless required by applicable law or agreed to in writing, software
20+ * distributed under the License is distributed on an "AS IS" BASIS,
21+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22+ * See the License for the specific language governing permissions and
23+ * limitations under the License.
24+*/
25+
26+/*
27+ * meshcfg.h
28+ *
29+ */
30+
31+#ifndef MESHCFG_H_
32+#define MESHCFG_H_
33+
34+#include <sys/types.h>
35+#include <inttypes.h>
36+
37+#define MAX_SSID_LEN 65
38+#define MAX_PASS_LEN 65
39+#define MAX_MODE_LEN 25
40+#define MAX_SUBNET_LEN 25
41+#define MAX_IP_LEN 64
42+#define MAX_URL_LEN 256
43+#define MAX_TXRATE_LEN 256
44+#define MAX_CHANNEL_MODE_LEN 32
45+#define MAX_MAC_ADDR_LEN 18
46+#define MAX_HOSTNAME_LEN 256
47+
48+#if defined(ENABLE_MESH_SOCKETS)
49+/**************************************************************************/
50+/* Unix Domain Socket Name */
51+/**************************************************************************/
52+#define MESH_SOCKET_PATH_NAME "\0/tmp/mesh-socket-queue" // MeshAgent Server message socket
53+#else
54+/**************************************************************************/
55+/* Posix Message Queue Names */
56+/**************************************************************************/
57+#define MESH_SERVER_QUEUE_NAME "/mqueue-mesh-server" // Message traffic from Mesh Application Layer to RDKB
58+#define MESH_CLIENT_QUEUE_NAME "/mqueue-mesh-client" // Message traffic from RDKB to Mesh Application Layer
59+#endif
60+
61+#define MAX_FINGERPRINT_LEN 512
62+/**************************************************************************/
63+/* Mesh sync message types */
64+/**************************************************************************/
65+typedef enum {
66+ MESH_WIFI_RESET,
67+ MESH_WIFI_RADIO_CHANNEL,
68+ MESH_WIFI_RADIO_CHANNEL_MODE,
69+ MESH_WIFI_SSID_NAME,
70+ MESH_WIFI_SSID_ADVERTISE,
71+ MESH_WIFI_AP_SECURITY,
72+ MESH_WIFI_AP_KICK_ASSOC_DEVICE,
73+ MESH_WIFI_AP_KICK_ALL_ASSOC_DEVICES,
74+ MESH_WIFI_AP_ADD_ACL_DEVICE,
75+ MESH_WIFI_AP_DEL_ACL_DEVICE,
76+ MESH_WIFI_MAC_ADDR_CONTROL_MODE,
77+ MESH_SUBNET_CHANGE,
78+ MESH_URL_CHANGE,
79+ MESH_WIFI_STATUS,
80+ MESH_WIFI_ENABLE,
81+ MESH_STATE_CHANGE,
82+ MESH_WIFI_TXRATE,
83+ MESH_CLIENT_CONNECT,
84+ MESH_DHCP_RESYNC_LEASES,
85+ MESH_DHCP_ADD_LEASE,
86+ MESH_DHCP_REMOVE_LEASE,
87+ MESH_DHCP_UPDATE_LEASE,
88+ MESH_WIFI_RADIO_CHANNEL_BW,
89+ MESH_SYNC_MSG_TOTAL
90+} eMeshSyncType;
91+
92+/**
93+ * Mesh States
94+ */
95+typedef enum {
96+ MESH_STATE_FULL = 0,
97+ MESH_STATE_MONITOR,
98+ MESH_STATE_WIFI_RESET,
99+ MESH_STATE_TOTAL
100+} eMeshStateType;
101+
102+/**
103+ * Mesh Status states
104+ */
105+typedef enum {
106+ MESH_WIFI_STATUS_OFF = 0,
107+ MESH_WIFI_STATUS_INIT,
108+ MESH_WIFI_STATUS_MONITOR,
109+ MESH_WIFI_STATUS_FULL,
110+ MESH_WIFI_STATUS_TOTAL
111+} eMeshWifiStatusType;
112+
113+/**
114+ * Mesh Connected Client Interfaces
115+ */
116+typedef enum {
117+ MESH_IFACE_NONE = 0,
118+ MESH_IFACE_ETHERNET,
119+ MESH_IFACE_MOCA,
120+ MESH_IFACE_WIFI,
121+ MESH_IFACE_OTHER,
122+ MESH_IFACE_TOTAL
123+} eMeshIfaceType;
124+
125+/**
126+ * Mesh Sync Wifi Reset/Init message
127+ */
128+typedef struct _MeshWifiReset {
129+ uint8_t reset; // boolean dummy value for structure set to true.
130+} MeshWifiReset;
131+
132+/**
133+ * Mesh Sync Wifi SSID name change message
134+ */
135+typedef struct _MeshWifiSSIDName {
136+ uint32_t index; // index [0-15]
137+ char ssid[MAX_SSID_LEN]; // SSID
138+} MeshWifiSSIDName;
139+
140+/**
141+ * Mesh Sync Wifi SSID Advertise change message
142+ */
143+typedef struct _MeshWifiSSIDAdvertise {
144+ uint32_t index; // index [0-15]
145+ uint8_t enable; // boolean enable
146+} MeshWifiSSIDAdvertise;
147+
148+/**
149+ * Mesh Sync Wifi Radio channel change
150+ */
151+typedef struct _MeshWifiRadioChannel {
152+ uint32_t index; // Radio index
153+ uint32_t channel; // Channel
154+} MeshWifiRadioChannel;
155+
156+/**
157+ * Mesh Sync Wifi Radio channel mode change
158+ */
159+typedef struct _MeshWifiRadioChannelMode {
160+ uint32_t index; // Radio index
161+ char channelMode[MAX_CHANNEL_MODE_LEN]; // ChannelMode
162+ uint8_t gOnlyFlag; // Is this g only?
163+ uint8_t nOnlyFlag; // Is this n only?
164+ uint8_t acOnlyFlag; // Is this ac only?
165+} MeshWifiRadioChannelMode;
166+
167+
168+/**
169+ * Mesh Sync Wifi configuration change message
170+ */
171+typedef struct _MeshWifiAPSecurity {
172+ uint32_t index; // AP index [0-15]
173+ char passphrase[MAX_PASS_LEN]; // AP Passphrase
174+ char secMode[MAX_MODE_LEN]; // Security mode
175+ char encryptMode[MAX_MODE_LEN]; // Encryption mode
176+} MeshWifiAPSecurity;
177+
178+
179+/**
180+ * Mesh Sync Wifi Kick AP Associated Device based on device mac
181+ */
182+typedef struct _MeshWifiAPKickAssocDevice {
183+ uint32_t index; // AP index [0-15]
184+ char mac[MAX_MAC_ADDR_LEN]; // Mac Address
185+} MeshWifiAPKickAssocDevice;
186+
187+/**
188+ * Mesh Sync Wifi Kick All AP Associated Devices
189+ */
190+typedef struct _MeshWifiAPKickAllAssocDevices {
191+ uint32_t index; // AP index [0-15]
192+} MeshWifiAPKickAllAssocDevices;
193+
194+
195+/**
196+ * Mesh Sync Wifi AP Add Acl Device
197+ */
198+typedef struct _MeshWifiAPAddAclDevice {
199+ uint32_t index; // AP index [0-15]
200+ char mac[MAX_MAC_ADDR_LEN]; // Mac Address
201+} MeshWifiAPAddAclDevice;
202+
203+
204+/**
205+ * Mesh Sync Wifi AP Delete Acl Device
206+ */
207+typedef struct _MeshWifiAPDelAclDevice {
208+ uint32_t index; // AP index [0-15]
209+ char mac[MAX_MAC_ADDR_LEN]; // Mac Address
210+} MeshWifiAPDelAclDevice;
211+
212+/**
213+ * Mesh Sync Wifi Mac Address Control Mode
214+ */
215+typedef struct _MeshWifiMacAddrControlMode {
216+ uint32_t index; // AP index [0-15]
217+ uint8_t isEnabled; // Filter Enabled bool
218+ uint8_t isBlacklist; // blacklist=1; whitelist=0
219+} MeshWifiMacAddrControlMode;
220+
221+
222+/**
223+ * Mesh Sync Subnet configuration change message
224+ */
225+typedef struct _MeshSubnetChange {
226+ char gwIP[MAX_IP_LEN]; // GW IP value
227+ char netmask[MAX_SUBNET_LEN]; // Subnet value
228+} MeshSubnetChange;
229+
230+/**
231+ * Mesh Sync URL configuration change message
232+ */
233+typedef struct _MeshUrlChange {
234+ char url[MAX_URL_LEN]; // url
235+} MeshUrlChange;
236+
237+/**
238+ * Mesh Network Status message
239+ */
240+typedef struct _MeshWifiStatus {
241+ eMeshWifiStatusType status; // Status of mesh network
242+} MeshWifiStatus;
243+
244+/**
245+ * Mesh State message
246+ */
247+typedef struct _MeshStateChange {
248+ eMeshStateType state; // State of mesh network
249+} MeshStateChange;
250+
251+/**
252+ * Mesh WiFi TxRate
253+ */
254+typedef struct _MeshWifiTxRate {
255+ uint32_t index; // AP index [0-15]
256+ char basicRates[MAX_TXRATE_LEN]; // Basic Rates
257+ char opRates [MAX_TXRATE_LEN]; // Operational Rates
258+} MeshWifiTxRate;
259+
260+/**
261+ * Mesh Client Connect
262+ */
263+typedef struct _MeshClientConnect {
264+ eMeshIfaceType iface; // Interface
265+ char mac[MAX_MAC_ADDR_LEN]; // MAC address
266+ char host[MAX_HOSTNAME_LEN]; // Hostname
267+ uint8_t isConnected; // true=connected; false=offline/disconnected
268+} MeshClientConnect;
269+
270+/**
271+ * DHCP lease notification
272+ */
273+typedef struct _MeshWifiDhcpLease {
274+ char mac[MAX_MAC_ADDR_LEN];
275+ char ipaddr[MAX_IP_LEN];
276+ char hostname[MAX_HOSTNAME_LEN];
277+ char fingerprint[MAX_FINGERPRINT_LEN];
278+} MeshWifiDhcpLease;
279+
280+/**
281+ * Channel Bandwidth change notification
282+ */
283+typedef struct _MeshWifiRadioChannelBw {
284+ int index;
285+ int bw;
286+} MeshWifiRadioChannelBw;
287+
288+/**
289+ * Mesh Sync message
290+ */
291+typedef struct _MeshSync {
292+ eMeshSyncType msgType;
293+
294+ union {
295+ MeshWifiReset wifiReset;
296+ MeshWifiRadioChannel wifiRadioChannel;
297+ MeshWifiRadioChannelMode wifiRadioChannelMode;
298+ MeshWifiSSIDName wifiSSIDName;
299+ MeshWifiSSIDAdvertise wifiSSIDAdvertise;
300+ MeshWifiAPSecurity wifiAPSecurity;
301+ MeshWifiAPKickAssocDevice wifiAPKickAssocDevice;
302+ MeshWifiAPKickAllAssocDevices wifiAPKickAllAssocDevices;
303+ MeshWifiAPAddAclDevice wifiAPAddAclDevice;
304+ MeshWifiAPDelAclDevice wifiAPDelAclDevice;
305+ MeshWifiMacAddrControlMode wifiMacAddrControlMode;
306+ MeshSubnetChange subnet;
307+ MeshUrlChange url;
308+ MeshWifiStatus wifiStatus;
309+ MeshStateChange meshState;
310+ MeshWifiTxRate wifiTxRate;
311+ MeshClientConnect meshConnect;
312+ MeshWifiDhcpLease meshLease;
313+ MeshWifiRadioChannelBw wifiRadioChannelBw;
314+ } data;
315+} MeshSync;
316+
317+typedef struct _LeaseNotify {
318+ MeshWifiDhcpLease lease;
319+ eMeshSyncType msgType;
320+} LeaseNotify;
321+
322+#endif /* MESHCFG_H_ */