Add function prototype for mesh saved network
authorJiwan Kim <ji-wan.kim@samsung.com>
Fri, 3 Mar 2017 05:50:34 +0000 (14:50 +0900)
committersaerome.kim <saerome.kim@samsung.com>
Mon, 17 Jul 2017 02:35:36 +0000 (11:35 +0900)
include/mesh-dhcp.h [moved from include/mesh-network.h with 85% similarity]
introspection/mesh.xml
src/mesh-dhcp.c [moved from src/mesh-network.c with 98% similarity]
src/mesh-request.c
src/mesh-service-interface.c

similarity index 85%
rename from include/mesh-network.h
rename to include/mesh-dhcp.h
index fb9bde7..08c10b0 100644 (file)
  * limitations under the License.
  *
  */
-#ifndef __MESH_NETWORK_H__
-#define __MESH_NETWORK_H__
+#ifndef __MESH_DHCP_H__
+#define __MESH_DHCP_H__
 
 typedef void (*dhcp_finished_cb)(const char* interface, const char* ip_address,
                void *user_data);
-int mesh_network_request_dhcp(const char* interface,
+int mesh_dhcp_request(const char* interface,
                dhcp_finished_cb callback, void *user_data);
 
-#endif /* __MESH_NETWORK_H__ */
+#endif /* __MESH_DHCP_H__ */
index aa949cf..082ddb9 100644 (file)
                        <arg type="s" name="bridge_interface" direction="in"/>\r
                        <arg type="u" name="result" direction="out"/>\r
                </method>\r
+               <method name="add_mesh_network">\r
+                       <arg type="s" name="mesh_id" direction="in"/>\r
+                       <arg type="i" name="channel" direction="in"/>\r
+                       <arg type="i" name="security" direction="in"/>\r
+                       <arg type="u" name="result" direction="out"/>\r
+               </method>\r
+               <method name="get_saved_mesh_network">\r
+                       <arg type="a(a{sv})" name="mpath" direction="out"/>\r
+               </method>\r
+               <method name="select_saved_mesh_network">\r
+                       <arg type="s" name="mesh_id" direction="in"/>\r
+                       <arg type="i" name="channel" direction="in"/>\r
+                       <arg type="i" name="security" direction="in"/>\r
+                       <arg type="u" name="result" direction="out"/>\r
+               </method>\r
+               <method name="forget_saved_mesh_network">\r
+                       <arg type="s" name="mesh_id" direction="in"/>\r
+                       <arg type="i" name="channel" direction="in"/>\r
+                       <arg type="i" name="security" direction="in"/>\r
+                       <arg type="u" name="result" direction="out"/>\r
+               </method>\r
 \r
 \r
                <!-- Signal (D-Bus) definitions -->\r
similarity index 98%
rename from src/mesh-network.c
rename to src/mesh-dhcp.c
index 0bda244..d0b4078 100644 (file)
@@ -29,7 +29,7 @@
 #include "mesh-log.h"
 #include "mesh-util.h"
 #include "mesh-service.h"
-#include "mesh-network.h"
+#include "mesh-dhcp.h"
 
 #define DHCP_PATH        "/usr/bin/dhcp"
 #define DHCP_RETRY_COUNT "10"
@@ -179,7 +179,7 @@ static int _internal_request_dhcp(const char *interface_name, spawn_info_s *info
        return MESHD_ERROR_NONE;
 }
 
-int mesh_network_request_dhcp(const char* interface,
+int mesh_dhcp_request(const char* interface,
                dhcp_finished_cb callback, void *user_data)
 {
        int ret = MESHD_ERROR_NONE;
index f230f61..4fabc75 100644 (file)
@@ -30,7 +30,7 @@
 #include "mesh-bridge.h"
 #include "mesh-netlink.h"
 #include "mesh-interface.h"
-#include "mesh-network.h"
+#include "mesh-dhcp.h"
 #include "mesh-request.h"
 
 static void _on_dhcp_finished(const char* interface, const char* ip_address,
@@ -58,7 +58,7 @@ int mesh_request_dhcp(const char* interface)
        }
 
        /* Request DHCP */
-       ret = mesh_network_request_dhcp(interface, _on_dhcp_finished, NULL);
+       ret = mesh_dhcp_request(interface, _on_dhcp_finished, NULL);
 
        return ret;
 }
index 32f1610..dd32e8d 100644 (file)
@@ -187,9 +187,9 @@ static gboolean _meshd_dbus_handle_enable(NetMesh *object,
                MESH_LOGE("Failed to mesh_request_specific_scan [%d]", ret);
        }
 
-       ret = mesh_request_dhcp(info->bridge_interface);
+       ret = mesh_dhcp_request(info->bridge_interface);
        if (MESHD_ERROR_NONE != ret) {
-               MESH_LOGE("Failed to mesh_request_dhcp [%d]", ret);
+               MESH_LOGE("Failed to mesh_dhcp_request [%d]", ret);
        }
 #endif
 
@@ -438,6 +438,79 @@ static gboolean _meshd_dbus_handle_stop_bridge(NetMesh *object,
        return TRUE;
 }
 
+static gboolean _meshd_dbus_handle_add_mesh_network(NetMesh *object,
+               GDBusMethodInvocation *invocation,
+               gchar *mesh_id, gint channel, gint security,
+               gpointer user_data)
+{
+       int ret = MESHD_ERROR_NONE;
+
+       NOTUSED(user_data);
+       NOTUSED(mesh_id);
+       NOTUSED(channel);
+       NOTUSED(security);
+
+       MESH_LOGD("Not implemented yet !");
+
+       net_mesh_complete_add_mesh_network(object, invocation, ret);
+
+       return TRUE;
+}
+
+static gboolean _meshd_dbus_handle_get_saved_mesh_network(NetMesh *object,
+               GDBusMethodInvocation *invocation,
+               gpointer user_data)
+{
+       GVariant *variant = NULL;
+
+       NOTUSED(user_data);
+
+       MESH_LOGD("Not implemented yet !");
+
+       net_mesh_complete_get_saved_mesh_network(object, invocation, variant);
+
+       return TRUE;
+}
+
+static gboolean _meshd_dbus_handle_select_saved_mesh_network(NetMesh *object,
+               GDBusMethodInvocation *invocation,
+               gchar *mesh_id, gint channel, gint security,
+               gpointer user_data)
+{
+       int ret = MESHD_ERROR_NONE;
+
+       NOTUSED(user_data);
+       NOTUSED(mesh_id);
+       NOTUSED(channel);
+       NOTUSED(security);
+
+       MESH_LOGD("Not implemented yet !");
+
+       net_mesh_complete_select_saved_mesh_network(object, invocation, ret);
+
+       return TRUE;
+}
+
+static gboolean _meshd_dbus_handle_forget_saved_mesh_network(NetMesh *object,
+               GDBusMethodInvocation *invocation,
+               gchar *mesh_id, gint channel, gint security,
+               gpointer user_data)
+{
+       int ret = MESHD_ERROR_NONE;
+
+       NOTUSED(user_data);
+       NOTUSED(mesh_id);
+       NOTUSED(channel);
+       NOTUSED(security);
+
+       MESH_LOGD("Not implemented yet !");
+
+       net_mesh_complete_forget_saved_mesh_network(object, invocation, ret);
+
+       return TRUE;
+}
+
+
 
 static void _meshd_dbus_on_bus_acquired(GDBusConnection *conn, const gchar *name,
                gpointer user_data)
@@ -485,6 +558,15 @@ static void _meshd_dbus_on_bus_acquired(GDBusConnection *conn, const gchar *name
        g_signal_connect(meshd_dbus_object, "handle-stop-bridge",
                        G_CALLBACK(_meshd_dbus_handle_stop_bridge), service);
 
+       g_signal_connect(meshd_dbus_object, "handle-add-mesh-network",
+                       G_CALLBACK(_meshd_dbus_handle_add_mesh_network), service);
+       g_signal_connect(meshd_dbus_object, "handle-get-saved-mesh-network",
+                       G_CALLBACK(_meshd_dbus_handle_get_saved_mesh_network), service);
+       g_signal_connect(meshd_dbus_object, "handle-select-saved-mesh-network",
+                       G_CALLBACK(_meshd_dbus_handle_select_saved_mesh_network), service);
+       g_signal_connect(meshd_dbus_object, "handle-forget-saved-mesh-network",
+                       G_CALLBACK(_meshd_dbus_handle_forget_saved_mesh_network), service);
+
        ret = g_dbus_interface_skeleton_export(G_DBUS_INTERFACE_SKELETON(meshd_dbus_object),
                        conn, MESH_DBUS_OBJPATH, &error);
        if (FALSE == ret) {