52ae3e599fc40441e09d6673ad62490c9eb5f567
[platform/core/api/wifi-mesh.git] / test / wifi-mesh-network.c
1
2 /*
3  * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */
18
19 #include <stdio.h>
20 #include <stdlib.h>
21 #include <string.h>
22 #include <sys/time.h>
23 #include <unistd.h>
24 #include <glib.h>
25 #include <gio/gio.h>
26
27 #include "menu.h"
28 #include "common.h"
29
30 extern wifi_mesh_h mesh;
31
32 static char gate_announce[MENU_DATA_SIZE + 1] = "1";
33 static char hwmp_root_mode[MENU_DATA_SIZE + 1] = "4";
34 static char stp[MENU_DATA_SIZE + 1] = "1";
35
36 static char ssid[MENU_DATA_SIZE + 1] = "meshnet";
37 static char passphrase[MENU_DATA_SIZE + 1] = "11223344";
38 static char mode[MENU_DATA_SIZE + 1] = "ac";
39 static char softap_channel[MENU_DATA_SIZE + 1] = "36";
40 static char visibility[MENU_DATA_SIZE + 1] = "1";
41 static char max_stations[MENU_DATA_SIZE + 1] = "10";
42 static char security[MENU_DATA_SIZE + 1] = "2";
43
44 static char meshid[MENU_DATA_SIZE + 1] = "meshnet";
45 static char mesh_channel[MENU_DATA_SIZE + 1] = "161";
46 static char mesh_security[MENU_DATA_SIZE + 1] = "0";
47 static char mesh_passphrase[MENU_DATA_SIZE + 1] = "";
48
49 static char network_idx[MENU_DATA_SIZE + 1] = "1";
50
51 /* Found Mesh Network */
52 static int g_scan_net_idx = 0;
53 GList *g_found_network_list = NULL;
54
55 int g_idx = 0;
56
57 static void found_mesh_network_cb(wifi_mesh_network_h network, void* user_data)
58 {
59         int ret;
60         wifi_mesh_network_h net = NULL;
61         char *meshid = NULL;
62         char *bssid = NULL;
63         int rssi;
64         int data_rate;
65         wifi_mesh_security_type_e security;
66         int channel;
67
68         ret = wifi_mesh_network_clone(&net, network);
69         if (WIFI_MESH_ERROR_NONE != ret) {
70                 msgr("Failed to clone found network: [%s(0x%X)]", wifi_mesh_error_to_string(ret), ret);
71                 return;
72         }
73
74         g_found_network_list = g_list_append(g_found_network_list, net);
75
76         wifi_mesh_network_get_meshid(net, &meshid);
77         wifi_mesh_network_get_bssid(net, &bssid);
78         wifi_mesh_network_get_channel(net, &channel);
79         wifi_mesh_network_get_rssi(net, &rssi);
80         wifi_mesh_network_get_data_rate(net, &data_rate);
81         wifi_mesh_network_get_security(net, &security);
82         msgb("  [%02d] Mesh ID[%-10s] BSSID[%s] Channel[%d] RSSI[%ddBm] Date Rate[%dMbps] Security[%4s]",
83                 g_scan_net_idx, meshid, bssid, channel, rssi == 0 ? 0 : rssi-120, data_rate,
84                 (MESH_SECURITY_SAE == security) ? "SAE" : "NONE");
85
86         g_scan_net_idx++;
87
88         if (meshid) free(meshid);
89         if (bssid) free(bssid);
90 }
91
92 static void connected_peer_cb(wifi_mesh_peer_h peer, void* user_data)
93 {
94         char *address = NULL;
95
96         wifi_mesh_peer_get_address(peer, &address);
97         msgb("  Peer Address [%s]", address);
98
99         if (address)
100                 free(address);
101 }
102
103 static void found_station_cb(wifi_mesh_station_info_h station, void* user_data)
104 {
105         int ret = WIFI_MESH_ERROR_NONE;
106         gchar *bssid = NULL; /* station bssid ex) 7c:dd:90:62:37:cf (on mesh0) */
107         guint inactive_time; /**< inactive time ex) 1685 ms */
108         guint64 rx_bytes; /**< rx bytes ex) 34174 */
109         guint rx_packets; /**< rx packet ex) 1181 */
110         guint64 tx_bytes; /**< tx bytes ex) 6877 */
111         guint tx_packets; /**< tx packets ex) 76 */
112         guint tx_retries; /**< tx retries ex) 0 */
113         guint tx_failed; /**< tx failed ex) 0 */
114         guint beacon_loss; /**< beacon loss count ex) 0 */
115         guint64 beacon_rx; /**< beacon rx ex) 0 */
116         guint64 rx_drop_misc; /**< rx drop misc ex) 0 */
117         gint signal; /**< Signal ex) -64 dBm */
118         gint signal_avg; /**< Average Signal ex) -63 dBm */
119         guint tx_bitrate; /**< tx bitrate ex) 54.0 MBit/s => 540 */
120         guint rx_bitrate; /**< rx bitrate ex) 5.5 MBit/s => 55 */
121         gushort mesh_llid; /**< mesh_llid ex) 51731 */
122         gushort mesh_plid; /**< mesh plid ex) 35432 */
123         guchar mesh_plink; /**< mesh plink ex) ESTAB */
124         guint local_ps_mode; /**< mesh local power save mode ex) ACTIVE */
125         guint peer_ps_mode;     /**< mesh peer power save mode ex) ACTIVE */
126         guint non_peer_ps_mode; /**< mesh non-peer power save mode ex) ACTIVE */
127         gboolean authorized; /**< authorized ex) yes */
128         gboolean authenticated; /**< authenticated ex) yes */
129         gboolean associated; /**< associated ex) yes */
130         gboolean preamble; /**< preamble ex) long */
131         gboolean wmm_wme; /**< WMM/WME supported ex) yes */
132         gboolean mfp; /**< MFP ex) no */
133         gboolean tdls_peer; /**< TDLS peer ex) no */
134         guchar dtim_period; /**< DTIM period ex) 0 */
135         gushort beacon_interval; /**< beacon interval ex) 1000 */
136         gboolean cts_protection; /**< CTS protection */
137         gboolean short_preamble; /**< short preamble */
138         gboolean short_slot_time; /**< short slot time supported ex) yes */
139         guint connected_time; /**< connected time : ex) 256 seconds */
140
141         msgp("[%d] Station Information Received", g_idx++);
142
143         if (NULL == station)
144                 return;
145
146         ret = wifi_mesh_get_sta_bssid(station, &bssid);
147         if (WIFI_MESH_ERROR_NONE == ret)
148                 msg("bssid = %s", bssid);
149         ret = wifi_mesh_get_sta_inactive_time(station, &inactive_time);
150         if (WIFI_MESH_ERROR_NONE == ret)
151                 msg("inactive_time = %d", inactive_time);
152         ret = wifi_mesh_get_sta_rx_bytes(station, &rx_bytes);
153         if (WIFI_MESH_ERROR_NONE == ret)
154                 msg("rx_bytes = %"G_GUINT64_FORMAT, rx_bytes);
155         ret = wifi_mesh_get_sta_rx_packets(station, &rx_packets);
156         if (WIFI_MESH_ERROR_NONE == ret)
157                 msg("rx_packets = %d", rx_packets);
158         ret = wifi_mesh_get_sta_tx_bytes(station, &tx_bytes);
159         if (WIFI_MESH_ERROR_NONE == ret)
160                 msg("tx_bytes = %"G_GUINT64_FORMAT, tx_bytes);
161         ret = wifi_mesh_get_sta_tx_packets(station, &tx_packets);
162         if (WIFI_MESH_ERROR_NONE == ret)
163                 msg("tx_packets = %d", tx_packets);
164         ret = wifi_mesh_get_sta_tx_retries(station, &tx_retries);
165         if (WIFI_MESH_ERROR_NONE == ret)
166                 msg("tx_retries = %d", tx_retries);
167         ret = wifi_mesh_get_sta_tx_failed(station, &tx_failed);
168         if (WIFI_MESH_ERROR_NONE == ret)
169                 msg("tx_failed = %d", tx_failed);
170         ret = wifi_mesh_get_sta_beacon_loss(station, &beacon_loss);
171         if (WIFI_MESH_ERROR_NONE == ret)
172                 msg("beacon_loss = %d", beacon_loss);
173         ret = wifi_mesh_get_sta_beacon_rx(station, &beacon_rx);
174         if (WIFI_MESH_ERROR_NONE == ret)
175                 msg("beacon_rx = %"G_GUINT64_FORMAT, beacon_rx);
176         ret = wifi_mesh_get_sta_rx_drop_misc(station, &rx_drop_misc);
177         if (WIFI_MESH_ERROR_NONE == ret)
178                 msg("rx_drop_misc = %"G_GUINT64_FORMAT, rx_drop_misc);
179         ret = wifi_mesh_get_sta_signal(station, &signal);
180         if (WIFI_MESH_ERROR_NONE == ret)
181                 msg("signal = %d", signal);
182         ret = wifi_mesh_get_sta_signal_avg(station, &signal_avg);
183         if (WIFI_MESH_ERROR_NONE == ret)
184                 msg("signal_avg = %d", signal_avg);
185         ret = wifi_mesh_get_sta_tx_bitrate(station, &tx_bitrate);
186         if (WIFI_MESH_ERROR_NONE == ret)
187                 msg("inactive_time = %d", inactive_time);
188         ret = wifi_mesh_get_sta_rx_bitrate(station, &rx_bitrate);
189         if (WIFI_MESH_ERROR_NONE == ret)
190                 msg("tx_bitrate = %d", tx_bitrate);
191         ret = wifi_mesh_get_sta_mesh_llid(station, &mesh_llid);
192         if (WIFI_MESH_ERROR_NONE == ret)
193                 msg("mesh_llid = %d", mesh_llid);
194         ret = wifi_mesh_get_sta_mesh_plid(station, &mesh_plid);
195         if (WIFI_MESH_ERROR_NONE == ret)
196                 msg("mesh_plid = %d", mesh_plid);
197         ret = wifi_mesh_get_sta_mesh_plink(station, &mesh_plink);
198         if (WIFI_MESH_ERROR_NONE == ret)
199                 msg("inactive_time = %d", inactive_time);
200         ret = wifi_mesh_get_sta_local_ps_mode(station, &local_ps_mode);
201         if (WIFI_MESH_ERROR_NONE == ret)
202                 msg("inactive_time = %d", inactive_time);
203         ret = wifi_mesh_get_sta_peer_ps_mode(station, &peer_ps_mode);
204         if (WIFI_MESH_ERROR_NONE == ret)
205                 msg("local_ps_mode = %d", local_ps_mode);
206         ret = wifi_mesh_get_sta_non_peer_ps_mode(station, &non_peer_ps_mode);
207         if (WIFI_MESH_ERROR_NONE == ret)
208                 msg("local_ps_mode = %d", local_ps_mode);
209         ret = wifi_mesh_get_sta_authorized(station, &authorized);
210         if (WIFI_MESH_ERROR_NONE == ret)
211                 msg("authorized = %d", authorized);
212         ret = wifi_mesh_get_sta_authenticated(station, &authenticated);
213         if (WIFI_MESH_ERROR_NONE == ret)
214                 msg("authenticated = %d", authenticated);
215         ret = wifi_mesh_get_sta_associated(station, &associated);
216         if (WIFI_MESH_ERROR_NONE == ret)
217                 msg("associated = %d", associated);
218         ret = wifi_mesh_get_sta_preamble(station, &preamble);
219         if (WIFI_MESH_ERROR_NONE == ret)
220                 msg("preamble = %d", preamble);
221         ret = wifi_mesh_get_sta_wmm_wme(station, &wmm_wme);
222         if (WIFI_MESH_ERROR_NONE == ret)
223                 msg("wmm_wme = %d", wmm_wme);
224         ret = wifi_mesh_get_sta_mfp(station, &mfp);
225         if (WIFI_MESH_ERROR_NONE == ret)
226                 msg("wmm_wme = %d", wmm_wme);
227         ret = wifi_mesh_get_sta_tdls_peer(station, &tdls_peer);
228         if (WIFI_MESH_ERROR_NONE == ret)
229                 msg("tdls_peer = %d", tdls_peer);
230         ret = wifi_mesh_get_sta_dtim_period(station, &dtim_period);
231         if (WIFI_MESH_ERROR_NONE == ret)
232                 msg("dtim_period = %d", dtim_period);
233         ret = wifi_mesh_get_sta_beacon_interval(station, &beacon_interval);
234         if (WIFI_MESH_ERROR_NONE == ret)
235                 msg("beacon_interval = %d", beacon_interval);
236         ret = wifi_mesh_get_sta_cts_protection(station, &cts_protection);
237         if (WIFI_MESH_ERROR_NONE == ret)
238                 msg("cts_protection = %d", cts_protection);
239         ret = wifi_mesh_get_sta_short_preamble(station, &short_preamble);
240         if (WIFI_MESH_ERROR_NONE == ret)
241                 msg("short_preamble = %d", short_preamble);
242         ret = wifi_mesh_get_sta_short_slot_time(station, &short_slot_time);
243         if (WIFI_MESH_ERROR_NONE == ret)
244                 msg("short_slot_time = %d", short_slot_time);
245         ret = wifi_mesh_get_sta_connected_time(station, &connected_time);
246         if (WIFI_MESH_ERROR_NONE == ret)
247                 msg("connected_time = %d", connected_time);
248
249 }
250
251 static void found_mpath_cb(wifi_mesh_mpath_info_h mpath, void* user_data)
252 {
253         int ret = WIFI_MESH_ERROR_NONE;
254
255         gchar *dest_addr = NULL; /**< destination address */
256         gchar *next_hop = NULL; /**< next hop address */
257         gchar *iface = NULL; /**< network interface for mesh */
258         guint sn; /**< sequence number */
259         guint metric; /**< metric */
260         guint qlen; /**< driver queue length */
261         guint exptime; /**< expire time */
262         guint discovery_timeout; /**< Discovery timeout */
263         guchar discovery_retries; /**< Discovery retries */
264         guchar flags; /**< Flags */
265
266         msgp("[%d] routing Information Received", g_idx++);
267
268         ret = wifi_mesh_get_mpath_dest_addr(mpath, &dest_addr);
269         if (WIFI_MESH_ERROR_NONE == ret)
270                 msg("dest_addr = %s", dest_addr);
271         ret = wifi_mesh_get_mpath_next_hop(mpath, &next_hop);
272         if (WIFI_MESH_ERROR_NONE == ret)
273                 msg("next_hop = %s", next_hop);
274         ret = wifi_mesh_get_mpath_iface(mpath, &iface);
275         if (WIFI_MESH_ERROR_NONE == ret)
276                 msg("iface = %s", iface);
277         ret = wifi_mesh_get_mpath_sn(mpath, &sn);
278         if (WIFI_MESH_ERROR_NONE == ret)
279                 msg("sn = %d", sn);
280         ret = wifi_mesh_get_mpath_metric(mpath, &metric);
281         if (WIFI_MESH_ERROR_NONE == ret)
282                 msg("metric = %d", metric);
283         ret = wifi_mesh_get_mpath_qlen(mpath, &qlen);
284         if (WIFI_MESH_ERROR_NONE == ret)
285                 msg("qlen = %d", qlen);
286         ret = wifi_mesh_get_mpath_exptime(mpath, &exptime);
287         if (WIFI_MESH_ERROR_NONE == ret)
288                 msg("exptime = %d", exptime);
289         ret = wifi_mesh_get_mpath_disc_timeout(mpath, &discovery_timeout);
290         if (WIFI_MESH_ERROR_NONE == ret)
291                 msg("discovery_timeout = %d", discovery_timeout);
292         ret = wifi_mesh_get_mpath_disc_retries(mpath, &discovery_retries);
293         if (WIFI_MESH_ERROR_NONE == ret)
294                 msg("discovery_retries = %d", discovery_retries);
295         ret = wifi_mesh_get_mpath_flags(mpath, &flags);
296         if (WIFI_MESH_ERROR_NONE == ret)
297                 msg("flags = %d", flags);
298         msg("");
299 }
300
301 #if 0
302 static int run_show_found_network(MManager *mm, struct menu_data *menu)
303 {
304         int i = 1; /* Displays from 1 */
305         char *_meshid = NULL;
306         int _channel = 1;
307         wifi_mesh_security_type_e _security = MESH_SECURITY_NONE;
308
309         GList *iter = NULL;
310
311         if (NULL == g_found_network_list) {
312                 msgp("There is not any scan result.. do scan first");
313                 return RET_FAILURE;
314         }
315
316         msg("Scan Results : ");
317         iter = g_found_network_list;
318         while (iter != NULL) {
319                 wifi_mesh_network_h _net = iter->data;
320                 wifi_mesh_network_get_meshid(_net, &_meshid);
321                 wifi_mesh_network_get_channel(_net, &_channel);
322                 wifi_mesh_network_get_security(_net, &_security);
323                 msgb("  [%02d] Mesh ID[%-10s] Channel[%d] Security[%4s]", i++,
324                         _meshid, _channel, (MESH_SECURITY_SAE == _security) ? "SAE" : "NONE");
325
326                 if (_meshid) free(_meshid);
327
328                 iter = g_list_next(iter);
329         }
330
331         return RET_SUCCESS;
332 }
333 #endif
334
335 static int run_wifi_mesh_scan(MManager *mm, struct menu_data *menu)
336 {
337         int ret;
338         msg("Scan");
339
340         ret = wifi_mesh_scan(mesh);
341         if (WIFI_MESH_ERROR_NONE != ret) {
342                 msgr("Failed to scan: [%s(0x%X)]", wifi_mesh_error_to_string(ret), ret);
343                 return RET_FAILURE;
344         }
345         msg(" - wifi_mesh_scan() ret: [0x%X] [%s]", ret, wifi_mesh_error_to_string(ret));
346
347         return RET_SUCCESS;
348 }
349
350 static int run_get_found_mesh_network(MManager *mm, struct menu_data *menu)
351 {
352         int ret;
353         msg("Get Found Mesh Network");
354
355         /* Clear previous found network list */
356         g_scan_net_idx = 1;
357         if (g_found_network_list)
358                 g_list_free_full(g_found_network_list, (void *)wifi_mesh_network_destroy);
359
360         g_found_network_list = NULL;
361
362         ret = wifi_mesh_foreach_found_network(mesh, found_mesh_network_cb, NULL);
363         if (WIFI_MESH_ERROR_NONE != ret) {
364                 msgr("Failed to wifi_mesh_foreach_found_network: [%s(0x%X)]",
365                                 wifi_mesh_error_to_string(ret), ret);
366                 return RET_FAILURE;
367         }
368         msg(" - wifi_mesh_foreach_found_network() ret: [0x%X] [%s]",
369                         ret, wifi_mesh_error_to_string(ret));
370
371         return RET_SUCCESS;
372 }
373
374 static int run_wifi_mesh_specific_scan(MManager *mm, struct menu_data *menu)
375 {
376         int ret;
377         int channel = 1;
378
379         msg("Specific scan");
380
381         if (strlen(mesh_channel))
382                 channel = (unsigned short)strtol(mesh_channel, NULL, 10);
383
384         ret = wifi_mesh_specific_scan(mesh, meshid, channel);
385         if (WIFI_MESH_ERROR_NONE != ret) {
386                 msgr("Failed to specific scan: [%s(0x%X)]",
387                         wifi_mesh_error_to_string(ret), ret);
388                 return RET_FAILURE;
389         }
390         msg(" - wifi_mesh_specific_scan() ret: [0x%X] [%s]", ret, wifi_mesh_error_to_string(ret));
391
392         return RET_SUCCESS;
393 }
394
395 static int run_wifi_mesh_cancel_scan(MManager *mm, struct menu_data *menu)
396 {
397         int ret;
398         msg("Cancel Scan");
399
400         ret = wifi_mesh_cancel_scan(mesh);
401         if (WIFI_MESH_ERROR_NONE != ret) {
402                 msgr("Failed to cancel scan: [%s(0x%X)]", wifi_mesh_error_to_string(ret), ret);
403                 return RET_FAILURE;
404         }
405         msg(" - wifi_mesh_cancel_scan() ret: [0x%X] [%s]", ret, wifi_mesh_error_to_string(ret));
406
407         return RET_SUCCESS;
408 }
409
410 static int run_wifi_mesh_enable(MManager *mm, struct menu_data *menu)
411 {
412         int ret;
413         bool is_started;
414
415         ret = wifi_mesh_is_started(mesh, &is_started);
416         if (WIFI_MESH_ERROR_NONE != ret) {
417                 msgr("Failed to check mesh started: [%s(0x%X)]",
418                         wifi_mesh_error_to_string(ret), ret);
419                 return RET_FAILURE;
420         }
421
422         if (is_started == true) {
423                 msg("Mesh is already enabled");
424                 return RET_SUCCESS;
425         }
426
427         msg("Enable Mesh");
428
429         ret = wifi_mesh_start(mesh);
430         if (WIFI_MESH_ERROR_NONE != ret) {
431                 msgr("Failed to enable mesh network: [%s(0x%X)]",
432                         wifi_mesh_error_to_string(ret), ret);
433                 return RET_FAILURE;
434         }
435         msg(" - wifi_mesh_start() ret: [0x%X] [%s]", ret, wifi_mesh_error_to_string(ret));
436
437         return RET_SUCCESS;
438 }
439
440 static int run_wifi_mesh_disable(MManager *mm, struct menu_data *menu)
441 {
442         int ret;
443         msg("Disable Mesh");
444
445         ret = wifi_mesh_stop(mesh);
446         if (WIFI_MESH_ERROR_NONE != ret) {
447                 msgr("Failed to disable mesh network: [%s(0x%X)]", wifi_mesh_error_to_string(ret), ret);
448                 return RET_FAILURE;
449         }
450         msg(" - wifi_mesh_stop() ret: [0x%X] [%s]", ret, wifi_mesh_error_to_string(ret));
451
452         return RET_SUCCESS;
453 }
454
455 static int run_get_joined_mesh_network(MManager *mm, struct menu_data *menu)
456 {
457         int ret;
458         char *_meshid = NULL;
459         char *_bssid = NULL;
460         int _channel = -1;
461         bool joined = false;
462         wifi_mesh_connection_state_e _state = WIFI_MESH_CONNECTION_STATE_DISCONNECTED;
463         wifi_mesh_security_type_e _security = MESH_SECURITY_NONE;
464         wifi_mesh_ip_config_type_e _ipv4_type = WIFI_MESH_IP_CONFIG_TYPE_UNKNOWN;
465         char *_ipv4_address = NULL;
466         char *_ipv4_netmask = NULL;
467         wifi_mesh_network_h network = NULL;
468
469         msg("Get Joined Mesh Network Information");
470
471         ret = wifi_mesh_is_joined(mesh, &joined);
472         if (WIFI_MESH_ERROR_NONE != ret) {
473                 msgr("Failed to check network join status: [%s(0x%X)]",
474                         wifi_mesh_error_to_string(ret), ret);
475                 return RET_FAILURE;
476         }
477
478         ret = wifi_mesh_get_joined_network(mesh, &network);
479         if (WIFI_MESH_ERROR_NONE != ret) {
480                 msgr("Failed to get joined mesh network: [%s(0x%X)]",
481                         wifi_mesh_error_to_string(ret), ret);
482                 return RET_FAILURE;
483         }
484
485         if (NULL != network) {
486                 wifi_mesh_network_get_meshid(network, &_meshid);
487                 msgb("  Mesh ID  = %s", _meshid);
488                 wifi_mesh_network_get_bssid(network, &_bssid);
489                 msgb("  BSSID    = %s", _bssid);
490                 wifi_mesh_network_get_channel(network, &_channel);
491                 msgb("  Channel  = %d", _channel);
492                 wifi_mesh_network_get_security(network, &_security);
493                 msgb("  Security = %s",
494                         (MESH_SECURITY_SAE == _security) ? "SAE" : "NONE");
495                 wifi_mesh_network_get_connection_state(network, &_state);
496                 msgb("  State    = %s", wifi_mesh_connection_event_to_string(_state));
497                 wifi_mesh_network_get_ip_config_type(network,
498                                                                 WIFI_MESH_ADDRESS_FAMILY_IPV4, &_ipv4_type);
499                 msgb("  IPv4 Config Type  = %d", _ipv4_type);
500                 wifi_mesh_network_get_ip_address(network, WIFI_MESH_ADDRESS_FAMILY_IPV4,
501                                                                 &_ipv4_address);
502                 msgb("  IPv4 Address  = %s", _ipv4_address);
503                 wifi_mesh_network_get_subnet_mask(network,
504                                                                 WIFI_MESH_ADDRESS_FAMILY_IPV4, &_ipv4_netmask);
505                 msgb("  IPv4 Subnet Mask  = %s", _ipv4_netmask);
506
507                 if (_meshid) free(_meshid);
508                 if (_bssid) free(_bssid);
509                 if (_ipv4_address) free(_ipv4_address);
510                 if (_ipv4_netmask) free(_ipv4_netmask);
511         }
512         msg("");
513         msg(" - wifi_mesh_get_joined_network() ret: [0x%X] [%s]",
514                         ret, wifi_mesh_error_to_string(ret));
515
516         return RET_SUCCESS;
517 }
518
519 static int run_get_connected_peers(MManager *mm, struct menu_data *menu)
520 {
521         int ret;
522         msg("Get Connected Mesh Peers");
523
524         ret = wifi_mesh_foreach_connected_peers(mesh, connected_peer_cb, NULL);
525         if (WIFI_MESH_ERROR_NONE != ret) {
526                 msgr("Failed to wifi_mesh_foreach_connected_peers: [%s(0x%X)]",
527                                 wifi_mesh_error_to_string(ret), ret);
528                 return RET_FAILURE;
529         }
530         msg(" - wifi_mesh_foreach_connected_peers() ret: [0x%X] [%s]",
531                         ret, wifi_mesh_error_to_string(ret));
532
533         return RET_SUCCESS;
534 }
535
536 static int run_set_gate(MManager *mm, struct menu_data *menu)
537 {
538         int ret;
539         bool _gate_announce = true;
540         int _hwmp_root_mode = 4;
541         bool _stp = true;
542
543         msg("Set Gate Option");
544
545         if (strlen(gate_announce))
546                 _gate_announce = (unsigned short)strtol(gate_announce, NULL, 16);
547         if (strlen(hwmp_root_mode))
548                 _hwmp_root_mode = (unsigned short)strtol(hwmp_root_mode, NULL, 10);
549         if (strlen(stp))
550                 _stp = (unsigned short)strtol(stp, NULL, 10);
551
552         ret = wifi_mesh_set_gate(mesh, _gate_announce, _hwmp_root_mode, _stp);
553         if (WIFI_MESH_ERROR_NONE != ret) {
554                 msgr("Failed to set gate options: [%s(0x%X)]",
555                         wifi_mesh_error_to_string(ret), ret);
556                 return RET_FAILURE;
557         }
558         msg(" - wifi_mesh_set_gate() ret: [0x%X] [%s]", ret, wifi_mesh_error_to_string(ret));
559
560         return RET_SUCCESS;
561 }
562
563 static int run_unset_gate(MManager *mm, struct menu_data *menu)
564 {
565         int ret;
566         msg("Disable All Gate Option");
567
568         ret = wifi_mesh_unset_gate(mesh);
569         if (WIFI_MESH_ERROR_NONE != ret) {
570                 msgr("Failed to unset gate option: [%s(0x%X)]",
571                         wifi_mesh_error_to_string(ret), ret);
572                 return RET_FAILURE;
573         }
574         msg(" - wifi_mesh_unset_gate() ret: [0x%X] [%s]", ret, wifi_mesh_error_to_string(ret));
575
576         return RET_SUCCESS;
577 }
578
579 static int run_set_softap(MManager *mm, struct menu_data *menu)
580 {
581         int ret;
582         int _channel = 1;
583         int _visibility = 1;
584         int _max_stations = 10;
585         int _security = 2;
586         msg("Set SoftAp Option");
587
588         if (strlen(softap_channel))
589                 _channel = (unsigned short)strtol(softap_channel, NULL, 10);
590         if (strlen(visibility)) {
591                 _visibility = (unsigned short)strtol(visibility, NULL, 10);
592                 if (1 != _visibility) _visibility = 0;
593         }
594         if (strlen(max_stations))
595                 _max_stations = (unsigned short)strtol(max_stations, NULL, 10);
596         if (strlen(security))
597                 _security = (unsigned short)strtol(security, NULL, 10);
598
599         ret = wifi_mesh_set_softap(mesh, ssid, passphrase,
600                         _channel, _visibility, _max_stations, _security);
601         if (WIFI_MESH_ERROR_NONE != ret) {
602                 msgr("Failed to set softap options: [%s(0x%X)]",
603                         wifi_mesh_error_to_string(ret), ret);
604                 return RET_FAILURE;
605         }
606         msg(" - wifi_mesh_set_softap() ret: [0x%X] [%s]", ret, wifi_mesh_error_to_string(ret));
607
608         msg("Get SoftAp Option");
609         char *g_ssid, *g_key;
610         int g_channel, g_max_stations, g_security;
611         bool g_visibility;
612         ret = wifi_mesh_get_softap(mesh, &g_ssid, &g_channel, &g_visibility,
613                                                            &g_max_stations, &g_security, &g_key);
614         if (WIFI_MESH_ERROR_NONE != ret) {
615                 msgr("Failed to get softap options: [%s(0x%X)]",
616                         wifi_mesh_error_to_string(ret), ret);
617                 return RET_FAILURE;
618         }
619
620         msg("SSID: %s", g_ssid);
621         msg("Channel: %d", g_channel);
622         msg("Visibility: %d", g_visibility);
623         msg("Max Stations: %d", g_max_stations);
624         msg("Security: %d", g_security);
625         msg("Key: %s", g_security ? g_key : "NULL");
626
627         g_free(g_ssid);
628         g_free(g_key);
629
630         return RET_SUCCESS;
631 }
632
633 static int run_enable_softap(MManager *mm, struct menu_data *menu)
634 {
635         int ret;
636         msg("Enable SoftAp");
637
638         ret = wifi_mesh_enable_softap(mesh);
639         if (WIFI_MESH_ERROR_NONE != ret) {
640                 msgr("Failed to enable soft ap: [%s(0x%X)]",
641                         wifi_mesh_error_to_string(ret), ret);
642                 return RET_FAILURE;
643         }
644         msg(" - wifi_mesh_enable_softap() ret: [0x%X] [%s]",
645                         ret, wifi_mesh_error_to_string(ret));
646
647         return RET_SUCCESS;
648 }
649
650 static int run_disable_softap(MManager *mm, struct menu_data *menu)
651 {
652         int ret;
653         bool status;
654         msg("Check SoftAp status");
655
656         ret = wifi_mesh_is_softap_started(mesh, &status);
657         if (WIFI_MESH_ERROR_NONE != ret) {
658                 msgr("Failed to check soft ap status: [%s(0x%X)]",
659                         wifi_mesh_error_to_string(ret), ret);
660                 return RET_FAILURE;
661         }
662
663         if (status == false) {
664                 msg("SoftAP is already disabled");
665                 return RET_SUCCESS;
666         }
667
668         msg("Disable SoftAp");
669
670         ret = wifi_mesh_disable_softap(mesh);
671         if (WIFI_MESH_ERROR_NONE != ret) {
672                 msgr("Failed to disable soft ap: [%s(0x%X)]",
673                         wifi_mesh_error_to_string(ret), ret);
674                 return RET_FAILURE;
675         }
676         msg(" - wifi_mesh_disable_softap() ret: [0x%X] [%s]",
677                         ret, wifi_mesh_error_to_string(ret));
678
679         return RET_SUCCESS;
680 }
681
682 static int run_create_network(MManager *mm, struct menu_data *menu)
683 {
684         int ret;
685         int _mesh_channel = 1;
686         wifi_mesh_security_type_e security = MESH_SECURITY_NONE;
687         wifi_mesh_network_h net = NULL;
688
689         msg("Create a new Mesh Network");
690
691         if (strlen(mesh_channel))
692                 _mesh_channel = (unsigned short)strtol(mesh_channel, NULL, 10);
693
694         if (strlen(mesh_security)) {
695                 ret = (unsigned short)strtol(mesh_security, NULL, 10);
696                 security = ((1 == ret) ? MESH_SECURITY_SAE : MESH_SECURITY_NONE);
697         }
698
699         wifi_mesh_network_new_with(&net, meshid, NULL, _mesh_channel, 0,
700                 security, security == MESH_SECURITY_SAE ? mesh_passphrase : NULL);
701         ret = wifi_mesh_create_network(mesh, net);
702         wifi_mesh_network_destroy(net);
703         if (WIFI_MESH_ERROR_NONE != ret) {
704                 msgr("Failed to wifi_mesh_create_network: [%s(0x%X)]",
705                                 wifi_mesh_error_to_string(ret), ret);
706                 return RET_FAILURE;
707         }
708         msg(" - wifi_mesh_create_network() ret: [0x%X] [%s]",
709                         ret, wifi_mesh_error_to_string(ret));
710
711         return RET_SUCCESS;
712 }
713
714 static int run_connect_network(MManager *mm, struct menu_data *menu)
715 {
716         int ret;
717         int idx = 1;
718         wifi_mesh_network_h net = NULL;
719         wifi_mesh_security_type_e security = MESH_SECURITY_NONE;
720         msg("Connect to Mesh Network");
721
722         if (strlen(network_idx)) {
723                 idx = (unsigned short)strtol(network_idx, NULL, 10);
724                 if (0 >= idx) {
725                         msgp("Invalid index. set to 1");
726                         idx = 1;
727                 }
728         }
729
730         if (g_found_network_list) {
731                 net = g_list_nth_data(g_found_network_list, idx - 1);
732                 if (NULL == net) {
733                         msgr("Failed to g_hash_table_find");
734                         return RET_FAILURE;
735                 }
736         }
737
738         /* Set passphrase */
739         wifi_mesh_network_get_security(net, &security);
740         if (MESH_SECURITY_NONE != security) {
741                 if (strlen(mesh_passphrase)) {
742                         ret = wifi_mesh_network_set_passphrase(net, mesh_passphrase);
743                         if (WIFI_MESH_ERROR_NONE != ret)
744                                 msgr("Failed to set passphrase !");
745                 } else {
746                         msgr("If security enabled, passphrase should be set !");
747                         return RET_FAILURE;
748                 }
749         }
750
751         ret = wifi_mesh_connect_network(mesh, net);
752         if (WIFI_MESH_ERROR_NONE != ret) {
753                 msgr("Failed to wifi_mesh_connect_network: [%s(0x%X)]",
754                                 wifi_mesh_error_to_string(ret), ret);
755                 return RET_FAILURE;
756         }
757         msg(" - wifi_mesh_connect_network() ret: [0x%X] [%s]",
758                         ret, wifi_mesh_error_to_string(ret));
759
760         return RET_SUCCESS;
761 }
762
763 static int run_disconnect_network(MManager *mm, struct menu_data *menu)
764 {
765         int ret;
766         int idx = 1;
767         wifi_mesh_network_h net = NULL;
768         msg("Disconnect with Mesh Network");
769
770         if (strlen(network_idx)) {
771                 idx = (unsigned short)strtol(network_idx, NULL, 10);
772                 if (0 >= idx) {
773                         msgp("Invalid index. set to 1");
774                         idx = 1;
775                 }
776         }
777
778         if (g_found_network_list) {
779                 net = g_list_nth_data(g_found_network_list, idx - 1);
780                 if (NULL == net) {
781                         msgr("Failed to g_hash_table_find");
782                         return RET_FAILURE;
783                 }
784         }
785
786         ret = wifi_mesh_disconnect_network(mesh, net);
787         if (WIFI_MESH_ERROR_NONE != ret) {
788                 msgr("Failed to wifi_mesh_disconnect_network: [%s(0x%X)]",
789                                 wifi_mesh_error_to_string(ret), ret);
790                 return RET_FAILURE;
791         }
792         msg(" - wifi_mesh_disconnect_network() ret: [0x%X] [%s]",
793                         ret, wifi_mesh_error_to_string(ret));
794
795         return RET_SUCCESS;
796 }
797
798 static int run_forget_network(MManager *mm, struct menu_data *menu)
799 {
800         int ret;
801         int idx = 1;
802         wifi_mesh_network_h net = NULL;
803         msg("Forget Mesh Network");
804
805         if (strlen(network_idx)) {
806                 idx = (unsigned short)strtol(network_idx, NULL, 10);
807                 if (0 >= idx) {
808                         msgp("Invalid index. set to 1");
809                         idx = 1;
810                 }
811         }
812
813         if (g_found_network_list) {
814                 net = g_list_nth_data(g_found_network_list, idx - 1);
815                 if (NULL == net) {
816                         msgr("Failed to g_hash_table_find");
817                         return RET_FAILURE;
818                 }
819         }
820
821         ret = wifi_mesh_forget_network(mesh, net);
822         if (WIFI_MESH_ERROR_NONE != ret) {
823                 msgr("Failed to wifi_mesh_forget_network: [%s(0x%X)]",
824                                 wifi_mesh_error_to_string(ret), ret);
825                 return RET_FAILURE;
826         }
827         msg(" - wifi_mesh_forget_network() ret: [0x%X] [%s]",
828                         ret, wifi_mesh_error_to_string(ret));
829
830         return RET_SUCCESS;
831 }
832
833 static int run_get_station_information(MManager *mm, struct menu_data *menu)
834 {
835         int ret;
836         msg("Get Mesh Station Information");
837
838         g_idx = 1;
839
840         ret = wifi_mesh_get_stations_info(mesh, MESH_STATION_TYPE_MESH_POINT,
841                                                                           found_station_cb, NULL);
842         if (WIFI_MESH_ERROR_NONE != ret) {
843                 msgr("Failed to wifi_mesh_get_stations_info: [%s(0x%X)]",
844                                 wifi_mesh_error_to_string(ret), ret);
845                 return RET_FAILURE;
846         }
847         msg(" - wifi_mesh_get_stations_info() ret: [0x%X] [%s]",
848                         ret, wifi_mesh_error_to_string(ret));
849
850         return RET_SUCCESS;
851 }
852
853 static int run_get_mpath_information(MManager *mm, struct menu_data *menu)
854 {
855         int ret;
856         msg("Get Mesh Path Information");
857
858         g_idx = 1;
859
860         ret = wifi_mesh_get_mpath_info(mesh, found_mpath_cb, NULL);
861         if (WIFI_MESH_ERROR_NONE != ret) {
862                 msgr("Failed to wifi_mesh_get_mpath_info: [%s(0x%X)]",
863                                 wifi_mesh_error_to_string(ret), ret);
864                 return RET_FAILURE;
865         }
866         msg(" - wifi_mesh_get_mpath_info() ret: [0x%X] [%s]",
867                         ret, wifi_mesh_error_to_string(ret));
868
869         return RET_SUCCESS;
870 }
871
872 static int run_get_meshconf_information(MManager *mm, struct menu_data *menu)
873 {
874         int ret;
875         wifi_mesh_meshconf_info_h meshconf;
876         gushort retry_timeout; /**< Retry Timeout */
877         guchar hwmp_max_preq_retries; /**< HWMP Max Preq Retries */
878         gushort confirm_timeout; /**< Confirm Timeout */
879         guint path_refresh_time; /**< Path Refresh Time */
880         gushort holding_timeout; /**< Holding Timeout */
881         gushort min_disc_timeout; /**< Min Discovery Timeout */
882         gushort max_peer_links; /**< Max Peer Links */
883         gushort hwmp_preq_min_interval; /**< HWMP PREQ Min Interval */
884         guchar ttl; /**< TTL */
885         guint hwmp_active_path_timeout; /**< HWMP Active Path Timeout */
886         guchar element_ttl; /**< Element TTL */
887         gushort hwmp_rann_interval; /**< HWMP RANN Interval */
888         guchar gate_announcements; /**< Gate Announcements */
889         msg("Get Mesh Conf Information");
890
891         g_idx = 1;
892
893         ret = wifi_mesh_get_meshconf_info(mesh, &meshconf);
894         if (WIFI_MESH_ERROR_NONE != ret) {
895                 msgr("Failed to wifi_mesh_get_meshconf_info: [%s(0x%X)]",
896                                 wifi_mesh_error_to_string(ret), ret);
897                 return RET_FAILURE;
898         }
899
900         msg("Mesh Configuration Informations:");
901
902         ret = wifi_mesh_get_meshconf_retry_timeout(meshconf, &retry_timeout);
903         if (WIFI_MESH_ERROR_NONE == ret)
904                 msg("retry_timeout = %u", retry_timeout);
905         ret = wifi_mesh_get_meshconf_hwmp_max_preq_retries(meshconf,
906                                                                 &hwmp_max_preq_retries);
907         if (WIFI_MESH_ERROR_NONE == ret)
908                 msg("hwmp_max_preq_retries = %u", hwmp_max_preq_retries);
909         ret = wifi_mesh_get_meshconf_confirm_timeout(meshconf, &confirm_timeout);
910         if (WIFI_MESH_ERROR_NONE == ret)
911                 msg("confirm_timeout = %u", confirm_timeout);
912         ret = wifi_mesh_get_meshconf_path_refresh_time(meshconf,
913                                                                 &path_refresh_time);
914         if (WIFI_MESH_ERROR_NONE == ret)
915                 msg("path_refresh_time = %u", path_refresh_time);
916         ret = wifi_mesh_get_meshconf_holding_timeout(meshconf, &holding_timeout);
917         if (WIFI_MESH_ERROR_NONE == ret)
918                 msg("holding_timeout = %u", holding_timeout);
919         ret = wifi_mesh_get_meshconf_min_disc_timeout(meshconf, &min_disc_timeout);
920         if (WIFI_MESH_ERROR_NONE == ret)
921                 msg("min_disc_timeout = %u", min_disc_timeout);
922         ret = wifi_mesh_get_meshconf_max_peer_links(meshconf, &max_peer_links);
923         if (WIFI_MESH_ERROR_NONE == ret)
924                 msg("max_peer_links = %u", max_peer_links);
925         ret = wifi_mesh_get_meshconf_hwmp_preq_min_interval(meshconf,
926                                                                 &hwmp_preq_min_interval);
927         if (WIFI_MESH_ERROR_NONE == ret)
928                 msg("hwmp_preq_min_interval = %u", hwmp_preq_min_interval);
929         ret = wifi_mesh_get_meshconf_ttl(meshconf, &ttl);
930         if (WIFI_MESH_ERROR_NONE == ret)
931                 msg("ttl = %u", ttl);
932         ret = wifi_mesh_get_meshconf_hwmp_active_path_timeout(meshconf,
933                                                                 &hwmp_active_path_timeout);
934         if (WIFI_MESH_ERROR_NONE == ret)
935                 msg("hwmp_active_path_timeout = %u", hwmp_active_path_timeout);
936         ret = wifi_mesh_get_meshconf_element_ttl(meshconf, &element_ttl);
937         if (WIFI_MESH_ERROR_NONE == ret)
938                 msg("element_ttl = %u", element_ttl);
939         ret = wifi_mesh_get_meshconf_hwmp_rann_interval(meshconf,
940                                                                 &hwmp_rann_interval);
941         if (WIFI_MESH_ERROR_NONE == ret)
942                 msg("hwmp_rann_interval = %u", hwmp_rann_interval);
943         ret = wifi_mesh_get_meshconf_gate_announcements(meshconf,
944                                                                 &gate_announcements);
945         if (WIFI_MESH_ERROR_NONE == ret)
946                 msg("gate_announcements = %u", gate_announcements);
947
948         ret = wifi_mesh_destroy_meshconf_info(meshconf);
949         if (WIFI_MESH_ERROR_NONE != ret) {
950                 msgr("Failed to wifi_mesh_destroy_meshconf_info: [%s(0x%X)]",
951                                 wifi_mesh_error_to_string(ret), ret);
952                 return RET_FAILURE;
953         }
954         msg("Successfully destroyed meshconf info");
955
956         return RET_SUCCESS;
957 }
958
959 static int run_get_softap_station_info(MManager *mm, struct menu_data *menu)
960 {
961         int ret;
962         msg("Get SoftAP Station Information");
963
964         g_idx = 1;
965
966         ret = wifi_mesh_get_stations_info(mesh, MESH_STATION_TYPE_SOFTAP,
967                                                                           found_station_cb, NULL);
968         if (WIFI_MESH_ERROR_NONE != ret) {
969                 msgr("Failed to wifi_mesh_get_stations_info: [%s(0x%X)]",
970                                 wifi_mesh_error_to_string(ret), ret);
971                 return RET_FAILURE;
972         }
973         msg(" - wifi_mesh_get_stations_info() ret: [0x%X] [%s]",
974                         ret, wifi_mesh_error_to_string(ret));
975
976         return RET_SUCCESS;
977 }
978
979 static struct menu_data menu_specific_scan[] = {
980         { "1", "Mesh ID", NULL, NULL, meshid },
981         { "2", "Channel", NULL, NULL, mesh_channel },
982         { "3", "Run", NULL, run_wifi_mesh_specific_scan, NULL },
983         { NULL, NULL, },
984 };
985
986 static struct menu_data menu_gate_option[] = {
987         { "1", "Gate Announcement", NULL, NULL, gate_announce },
988         { "2", "HWMP Root Mode", NULL, NULL, hwmp_root_mode },
989         { "3", "STP", NULL, NULL, stp },
990         { "4", "Run", NULL, run_set_gate, NULL },
991         { NULL, NULL, },
992 };
993
994 static struct menu_data menu_softap_option[] = {
995         { "1", "SSID", NULL, NULL, ssid },
996         { "2", "passphrase", NULL, NULL, passphrase },
997         { "3", "802.11 mode", NULL, NULL, mode },
998         { "4", "channel", NULL, NULL, softap_channel },
999         { "5", "SSID broadcast=1, hidden=0", NULL, NULL, visibility },
1000         { "6", "max. client num", NULL, NULL, max_stations },
1001         { "6", "security (wpa1=1, wpa2=2)", NULL, NULL, security },
1002         { "7", "run", NULL, run_set_softap, NULL },
1003         { NULL, NULL, },
1004 };
1005
1006 static struct menu_data menu_create_network[] = {
1007         { "1", "Mesh ID", NULL, NULL, meshid },
1008         { "2", "Channel", NULL, NULL, mesh_channel },
1009         { "3", "Security (0=None,1=SAE)", NULL, NULL, mesh_security },
1010         { "4", "Passphrase", NULL, NULL, mesh_passphrase },
1011         { "5", "Run", NULL, run_create_network, NULL },
1012         { NULL, NULL, },
1013 };
1014
1015 static struct menu_data menu_connect_network[] = {
1016         { "0", "Show found networks", NULL, run_get_found_mesh_network, NULL },
1017         { "1", "Index", NULL, NULL, network_idx },
1018         { "2", "Passphrase", NULL, NULL, mesh_passphrase },
1019         { "3", "Run", NULL, run_connect_network, NULL },
1020         { NULL, NULL, },
1021 };
1022
1023 static struct menu_data menu_disconnect_network[] = {
1024         { "0", "Show found networks", NULL, run_get_found_mesh_network, NULL },
1025         { "1", "Index", NULL, NULL, network_idx },
1026         { "2", "Run", NULL, run_disconnect_network, NULL },
1027         { NULL, NULL, },
1028 };
1029
1030 static struct menu_data menu_forget_network[] = {
1031         { "0", "Show found networks", NULL, run_get_found_mesh_network, NULL },
1032         { "1", "Index", NULL, NULL, network_idx },
1033         { "2", "Run", NULL, run_forget_network, NULL },
1034         { NULL, NULL, },
1035 };
1036
1037
1038 struct menu_data menu_mesh_network[] = {
1039         { "1", "Start", NULL, run_wifi_mesh_enable, NULL },
1040         { "2", "Stop", NULL, run_wifi_mesh_disable, NULL },
1041         { "3", "Scan", NULL, run_wifi_mesh_scan, NULL },
1042         { "4", "Specific scan", menu_specific_scan, NULL, NULL },
1043         { "5", "Cancel scan", NULL, run_wifi_mesh_cancel_scan, NULL },
1044         { "6", "Get found mesh network", NULL, run_get_found_mesh_network, NULL },
1045         { "7", "Create network", menu_create_network, NULL, NULL },
1046         { "8", "Connect network", menu_connect_network, NULL, NULL },
1047         { "9", "Disconnect network", menu_disconnect_network, NULL, NULL },
1048         { "10", "Forget network", menu_forget_network, NULL, NULL },
1049         { "11", "Get joined mesh network", NULL, run_get_joined_mesh_network, NULL },
1050         { "12", "Set softap", menu_softap_option, NULL, NULL },
1051         { "13", "Enable softap", NULL, run_enable_softap, NULL },
1052         { "14", "Disable softap", NULL, run_disable_softap, NULL },
1053         { "15", "Get connected mesh peers", NULL, run_get_connected_peers, NULL },
1054         { "16", "Set gate", menu_gate_option, NULL, NULL },
1055         { "17", "Unset gate", NULL, run_unset_gate, NULL },
1056         { "18", "Get mesh station information", NULL, run_get_station_information, NULL },
1057         { "19", "Get mesh path information", NULL, run_get_mpath_information, NULL },
1058         { "20", "Get mesh conf information", NULL, run_get_meshconf_information,
1059                                         NULL },
1060         { "21", "Get softap station information", NULL, run_get_softap_station_info,
1061                                         NULL },
1062         { NULL, NULL, },
1063 };