Changed somethings related to 'mesh_set_gate'
authorsaerome.kim <saerome.kim@samsung.com>
Mon, 3 Jul 2017 05:08:26 +0000 (14:08 +0900)
committersaerome.kim <saerome.kim@samsung.com>
Mon, 17 Jul 2017 02:09:10 +0000 (11:09 +0900)
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
include/mesh.h
include/mesh_dbus.h
src/mesh.c
src/mesh_dbus.c
test/mesh_network.c

index a827ac2abe830657a1b3a6c4e40a70aba1b37310..1ac380c19ed5451b98105e2c5a4ab666cd6c62a5 100644 (file)
@@ -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
index 6b579fcc9e6e96427f5ebef177d4320a8dcbd18d..0293355223033342540324fe2e3b9b6d8d866b17 100644 (file)
@@ -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);
index 7d14e4213645ebec9b2b7f934b1194e9bfa8e2df..873f4f26c60b1302f6aee371f4f6d5f82960409e 100644 (file)
@@ -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;
 }
 
index 0bd95b13353f3b03278ec3253db83dba4513e974..229a66fe4be92020f4995a24b596ae66edb76dd3 100644 (file)
@@ -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);
index 866e389e1027594967d1eb946d3f5a9a7a7d9756..c8e4c9f35f691f034c54a0abcbf1f93b164d0a8e 100644 (file)
@@ -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, },
 };