From: saerome.kim Date: Mon, 3 Jul 2017 05:08:26 +0000 (+0900) Subject: Changed somethings related to 'mesh_set_gate' X-Git-Tag: submit/tizen/20170828.225740~20 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8ff3abe0d28a18dd4242ff018b637bc6ba5cb759;p=platform%2Fcore%2Fapi%2Fwifi-mesh.git Changed somethings related to 'mesh_set_gate' Signed-off-by: saerome.kim --- diff --git a/include/mesh.h b/include/mesh.h index a827ac2..1ac380c 100644 --- a/include/mesh.h +++ b/include/mesh.h @@ -127,6 +127,17 @@ typedef enum { MESH_STATION_LEFT_EVENT = 0x04, /**< This event takes place when existing station left */ } mesh_event_e; + +typedef enum { + MESH_HWMP_ROOT_REACTIVE_MODE = 0, /**< Disable Proative Mode */ + MESH_HWMP_ROOT_SIMPLE_PROACTIVE_MODE = 2, /**< Enable the Proactive PREQ with no PREP */ + MESH_HWMP_ROOT_FORCED_PROACTIVE_MODE = 3, /**< Enable the Proactive PREQ with PREP. + Once you do this, all the nodes in your mesh will proactively create paths to your gate. + Mesh nodes will send to gate(s) all traffic to those destinations that could not be resolved in the mesh. */ + MESH_HWMP_ROOT_PROACTIVE_WITH_RANN_MODE = 4, /**< If we use HWMP_ROOTMODE as 4, every 5 sec, + our DUT sends action_frame with root announce. */ +} mesh_hwmp_root_mode_e; + /** * @brief The structure type for the MESH_MESH_ENABLED_EVENT callback data. * @details The result of creating or joining mesh network. @@ -920,8 +931,13 @@ int mesh_get_joined_network(mesh_h handle, mesh_network_h* network); * @since_tizen 4.0 * * @param[in] handle The mesh handle - * @param[in] stp Eanble / Disable STP (Spanning Tree Protocol) * @param[in] gate_announce Enable / Disable Gate Announce to peers + * @param[in] hwmp_root_mode HWMP (Hybrid Wireless Mesh Protocol) Root Mode \n + * #MESH_HWMP_ROOT_REACTIVE_MODE \n + * #MESH_HWMP_ROOT_SIMPLE_PROACTIVE_MODE \n + * #MESH_HWMP_ROOT_FORCED_PROACTIVE_MODE \n + * #MESH_HWMP_ROOT_PROACTIVE_WITH_RANN_MODE \n + * @param[in] stp Enable / Disable Gate Announce to peers * * * @return 0 on success, otherwise a negative error value. @@ -932,7 +948,7 @@ int mesh_get_joined_network(mesh_h handle, mesh_network_h* network); * @see mesh_unset_gate() * */ -int mesh_set_gate(mesh_h handle, bool stp, bool gate_announce); +int mesh_set_gate(mesh_h handle, int gate_announce, int hwmp_root_mode, bool stp); /** * @brief Unsets gate options diff --git a/include/mesh_dbus.h b/include/mesh_dbus.h index 6b579fc..0293355 100644 --- a/include/mesh_dbus.h +++ b/include/mesh_dbus.h @@ -52,7 +52,7 @@ int _mesh_enable_mesh(mesh_h handle); int _mesh_disable_mesh(mesh_h handle); int _mesh_is_joined(mesh_h handle, bool* is_joined); int _mesh_get_joined_mesh_network(mesh_h handle, mesh_network_h* _network); -int _mesh_set_gate(mesh_h handle, bool stp, bool gate_announce); +int _mesh_set_gate(mesh_h handle, bool gate_announce, int hwmp_root_mode, bool stp); int _mesh_unset_gate(mesh_h handle); int _mesh_set_softap(mesh_h handle, const char* ssid, const char* key, const char* mode, int channel, int visibility, int max_stations, int security); diff --git a/src/mesh.c b/src/mesh.c index 7d14e42..873f4f2 100644 --- a/src/mesh.c +++ b/src/mesh.c @@ -608,14 +608,15 @@ EXPORT_API int mesh_get_joined_network(mesh_h handle, mesh_network_h *network) return rv; } -EXPORT_API int mesh_set_gate(mesh_h handle, bool stp, bool gate_announce) +EXPORT_API int mesh_set_gate(mesh_h handle, int gate_announce, int hwmp_root_mode, bool stp) { int rv = 0; + int _stp = stp ? 1 : 0; CHECK_FEATURE_SUPPORTED(MESH_FEATURE); RETV_IF(NULL == handle, MESH_ERROR_INVALID_PARAMETER); - rv = _mesh_set_gate(handle, stp, gate_announce); + rv = _mesh_set_gate(handle, gate_announce, hwmp_root_mode, _stp); return rv; } diff --git a/src/mesh_dbus.c b/src/mesh_dbus.c index 0bd95b1..229a66f 100644 --- a/src/mesh_dbus.c +++ b/src/mesh_dbus.c @@ -898,7 +898,7 @@ int _mesh_get_joined_mesh_network(mesh_h handle, mesh_network_h* _network) return result; } -int _mesh_set_gate(mesh_h handle, bool stp, bool gate_announce) +int _mesh_set_gate(mesh_h handle, bool gate_announce, int hwmp_root_mode, bool stp) { GVariant *variant = NULL; int result = MESH_ERROR_NONE; @@ -909,7 +909,7 @@ int _mesh_set_gate(mesh_h handle, bool stp, bool gate_announce) RETV_IF(NULL == _gproxy_mesh_service, MESH_ERROR_IO_ERROR); variant = g_dbus_proxy_call_sync(_gproxy_mesh_service, "set_gate", - g_variant_new("(bb)", stp, gate_announce), + g_variant_new("(bqq)", gate_announce, hwmp_root_mode, stp), G_DBUS_CALL_FLAGS_NONE, -1, NULL, &error); diff --git a/test/mesh_network.c b/test/mesh_network.c index 866e389..c8e4c9f 100644 --- a/test/mesh_network.c +++ b/test/mesh_network.c @@ -29,8 +29,9 @@ extern mesh_h mesh; -static char stp[MENU_DATA_SIZE + 1] = "1"; static char gate_announce[MENU_DATA_SIZE + 1] = "1"; +static char hwmp_root_mode[MENU_DATA_SIZE + 1] = "4"; +static char stp[MENU_DATA_SIZE + 1] = "1"; static char ssid[MENU_DATA_SIZE + 1] = "meshnet"; static char passphrase[MENU_DATA_SIZE + 1] = "11223344"; @@ -313,17 +314,20 @@ static int run_get_connected_peers(MManager *mm, struct menu_data *menu) static int run_set_gate(MManager *mm, struct menu_data *menu) { int ret; - bool _stp = true; bool _gate_announce = true; + int _hwmp_root_mode = 4; + bool _stp = true; msg("Set Gate Option"); - if (strlen(stp)) - _stp = (unsigned short)strtol(stp, NULL, 16); if (strlen(gate_announce)) - _gate_announce = (unsigned short)strtol(gate_announce, NULL, 10); + _gate_announce = (unsigned short)strtol(gate_announce, NULL, 16); + if (strlen(hwmp_root_mode)) + _hwmp_root_mode = (unsigned short)strtol(hwmp_root_mode, NULL, 10); + if (strlen(stp)) + _stp = (unsigned short)strtol(stp, NULL, 10); - ret = mesh_set_gate(mesh, _stp, _gate_announce); + ret = mesh_set_gate(mesh, _gate_announce, _hwmp_root_mode, _stp); if (MESH_ERROR_NONE != ret) { msgr("Failed to set gate options: [%s(0x%X)]", mesh_error_to_string(ret), ret); @@ -608,9 +612,10 @@ static struct menu_data menu_specific_scan[] = { }; static struct menu_data menu_gate_option[] = { - { "1", "STP", NULL, NULL, stp }, - { "2", "Gate Announcement", NULL, NULL, gate_announce }, - { "3", "Run", NULL, run_set_gate, NULL }, + { "1", "Gate Announcement", NULL, NULL, gate_announce }, + { "2", "HWMP Root Mode", NULL, NULL, hwmp_root_mode }, + { "3", "STP", NULL, NULL, stp }, + { "4", "Run", NULL, run_set_gate, NULL }, { NULL, NULL, }, };