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