Add Multipath TCP 79/169179/1
authorchleun.moon <chleun.moon@samsung.com>
Mon, 5 Feb 2018 02:08:50 +0000 (11:08 +0900)
committerchleun.moon <chleun.moon@samsung.com>
Mon, 5 Feb 2018 02:08:55 +0000 (11:08 +0900)
Change-Id: I61919386f39245ab748aa00576db6a9c7af50991
Signed-off-by: Cheoleun Moon <chleun.moon@samsung.com>
Makefile.am
include/mptcp/network-mptcp-intf.h [new file with mode: 0644]
packaging/libnet-client.spec
src/include/network-dbus-request.h
src/include/network-internal.h
src/network-dbus-request.c
src/network-mptcp-intf.c [new file with mode: 0644]

index 224e419..4119252 100755 (executable)
@@ -19,13 +19,15 @@ libnetwork_la_SOURCES = \
                        src/network-profile-intf.c \
                        src/network-dbus-request.c \
                        src/network-internal.c \
-                       src/network-signal-handler.c
+                       src/network-signal-handler.c \
+                       src/network-mptcp-intf.c
 
 libnetwork_la_CFLAGS = \
               -I$(srcdir)/include \
               -I$(srcdir)/include/wifi \
               -I$(srcdir)/include/profile \
               -I$(srcdir)/include/common \
+              -I$(srcdir)/include/mptcp \
               -I$(srcdir)/src/include
 
 libnetwork_la_CFLAGS += $(CPPFLAGS)
@@ -41,7 +43,8 @@ includelibnetwork_HEADERS =  include/common/network-cm-intf.h \
                        include/profile/network-pm-intf.h \
                        include/profile/network-pm-wlan.h \
                        include/profile/network-pm-config.h \
-                       include/wifi/network-wifi-intf.h
+                       include/wifi/network-wifi-intf.h \
+                       include/mptcp/network-mptcp-intf.h
 
 libnetwork_la_CFLAGS += $(AM_FLAGS)
 
diff --git a/include/mptcp/network-mptcp-intf.h b/include/mptcp/network-mptcp-intf.h
new file mode 100644 (file)
index 0000000..9219042
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ * Network Client Library
+ *
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.tizenopensource.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifndef __NETWORK_MPTCP_INTF_H__
+#define __NETWORK_MPTCP_INTF_H__
+
+#include <glib.h>
+
+#include "network-cm-intf.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int net_mptcp_supported(gboolean* support);
+
+int net_mptcp_set_enable(int enable);
+int net_mptcp_get_enabled(int* enable);
+
+int net_mptcp_set_path_manager(const char *pm);
+int net_mptcp_get_path_manager(char **pm);
+
+int net_mptcp_set_scheduler(const char *scheduler);
+int net_mptcp_get_scheduler(char **scheduler);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /** __NETWORK_WIFI_INTF_H__ */
index 0d4d8d2..9b92816 100755 (executable)
@@ -1,6 +1,6 @@
 Name:          libnet-client
 Summary:       Network Client library (Shared library)
-Version:       1.1.65
+Version:       1.1.66
 Release:       1
 Group:         System/Network
 License:       Flora-1.1
index 9102fdd..103990c 100755 (executable)
@@ -144,6 +144,13 @@ int _net_dbus_tdls_connected_peer(char** peer_mac_addr);
 int _net_dbus_device_policy_get_wifi(int *state);
 int _net_dbus_device_policy_get_wifi_profile(int *state);
 
+int _net_dbus_mptcp_supported(gboolean* support);
+int _net_dbus_mptcp_set_enable(int enable);
+int _net_dbus_mptcp_get_enabled(int* enable);
+int _net_dbus_mptcp_set_path_manager(const char *pm);
+int _net_dbus_mptcp_get_path_manager(char **pm);
+int _net_dbus_mptcp_set_scheduler(const char *scheduler);
+int _net_dbus_mptcp_get_scheduler(char **scheduler);
 #ifdef __cplusplus
 }
 #endif
index 7cf72d5..33e838a 100755 (executable)
@@ -66,10 +66,12 @@ extern "C" {
 #define NETCONFIG_TCPDUMP_INTERFACE            NETCONFIG_SERVICE ".tcpdump"
 #define NETCONFIG_WIFI_INTERFACE               NETCONFIG_SERVICE ".wifi"
 #define NETCONFIG_STATISTICS_INTERFACE NETCONFIG_SERVICE ".network_statistics"
+#define NETCONFIG_MPTCP_INTERFACE              NETCONFIG_SERVICE ".mptcp"
 
 #define NETCONFIG_NETWORK_PATH                 "/net/netconfig/network"
 #define NETCONFIG_WIFI_PATH                            "/net/netconfig/wifi"
 #define NETCONFIG_STATISTICS_PATH              "/net/netconfig/network_statistics"
+#define NETCONFIG_MPTCP_PATH                   "/net/netconfig/mptcp"
 
 #define NETCONFIG_TV_PROFILE_INTERFACE NETCONFIG_SERVICE ".tv_profile"
 
index 9d82da0..1158dea 100755 (executable)
@@ -2781,3 +2781,156 @@ int _net_dbus_device_policy_get_wifi_profile(int *state)
        __NETWORK_FUNC_EXIT__;
        return Error;
 }
+
+int _net_dbus_mptcp_supported(gboolean* support)
+{
+       __NETWORK_FUNC_ENTER__;
+       net_err_t Error = NET_ERR_NONE;
+       GVariant *message = NULL;
+
+       message = _net_invoke_dbus_method(NETCONFIG_SERVICE, NETCONFIG_MPTCP_PATH,
+                       NETCONFIG_MPTCP_INTERFACE, "MptcpSupported", NULL, &Error);
+
+       if (message == NULL) {
+               NETWORK_LOG(NETWORK_ERROR, "Failed to get MPTCP enabled");
+               __NETWORK_FUNC_EXIT__;
+               return Error;
+       }
+
+       g_variant_get(message, "(b)", support);
+       g_variant_unref(message);
+
+       __NETWORK_FUNC_EXIT__;
+       return Error;
+}
+
+int _net_dbus_mptcp_set_enable(int enable)
+{
+       __NETWORK_FUNC_ENTER__;
+       net_err_t Error = NET_ERR_NONE;
+       GVariant *message = NULL;
+       GVariant *params;
+
+       params = g_variant_new("(i)", enable);
+
+       message = _net_invoke_dbus_method(NETCONFIG_SERVICE, NETCONFIG_MPTCP_PATH,
+                       NETCONFIG_MPTCP_INTERFACE, "MptcpSetEnable", params, &Error);
+
+       if (Error != NET_ERR_NONE)
+               NETWORK_LOG(NETWORK_ERROR, "_net_invoke_dbus_method failed");
+
+       if (message != NULL)
+               g_variant_unref(message);
+
+       __NETWORK_FUNC_EXIT__;
+       return Error;
+}
+
+int _net_dbus_mptcp_get_enabled(int* enable)
+{
+       __NETWORK_FUNC_ENTER__;
+       net_err_t Error = NET_ERR_NONE;
+       GVariant *message = NULL;
+
+       message = _net_invoke_dbus_method(NETCONFIG_SERVICE, NETCONFIG_MPTCP_PATH,
+                       NETCONFIG_MPTCP_INTERFACE, "MptcpGetEnabled", NULL, &Error);
+
+       if (message == NULL) {
+               NETWORK_LOG(NETWORK_ERROR, "Failed to get MPTCP enabled");
+               __NETWORK_FUNC_EXIT__;
+               return Error;
+       }
+
+       g_variant_get(message, "(i)", enable);
+       g_variant_unref(message);
+
+       __NETWORK_FUNC_EXIT__;
+       return Error;
+}
+
+int _net_dbus_mptcp_set_path_manager(const char *pm)
+{
+       __NETWORK_FUNC_ENTER__;
+       net_err_t Error = NET_ERR_NONE;
+       GVariant *message = NULL;
+       GVariant *params;
+
+       params = g_variant_new("(s)", pm);
+
+       message = _net_invoke_dbus_method(NETCONFIG_SERVICE, NETCONFIG_MPTCP_PATH,
+                       NETCONFIG_MPTCP_INTERFACE, "MptcpSetPathManager", params, &Error);
+       if (Error != NET_ERR_NONE)
+               NETWORK_LOG(NETWORK_ERROR, "_net_invoke_dbus_method failed");
+
+       if (message != NULL)
+               g_variant_unref(message);
+
+       __NETWORK_FUNC_EXIT__;
+       return Error;
+}
+
+int _net_dbus_mptcp_get_path_manager(char **pm)
+{
+       __NETWORK_FUNC_ENTER__;
+       net_err_t Error = NET_ERR_NONE;
+       GVariant *message = NULL;
+
+       message = _net_invoke_dbus_method(NETCONFIG_SERVICE, NETCONFIG_MPTCP_PATH,
+                       NETCONFIG_MPTCP_INTERFACE, "MptcpGetPathManager", NULL, &Error);
+
+       if (message == NULL) {
+               NETWORK_LOG(NETWORK_ERROR, "Failed to get MPTCP path manager");
+               __NETWORK_FUNC_EXIT__;
+               return Error;
+       }
+
+       g_variant_get(message, "(s)", pm);
+       NETWORK_LOG(NETWORK_LOW, "MPTCP path manager [%s]", *pm);
+       g_variant_unref(message);
+
+       __NETWORK_FUNC_EXIT__;
+       return Error;
+}
+
+int _net_dbus_mptcp_set_scheduler(const char *scheduler)
+{
+       __NETWORK_FUNC_ENTER__;
+       net_err_t Error = NET_ERR_NONE;
+       GVariant *message = NULL;
+       GVariant *params;
+
+       params = g_variant_new("(s)", scheduler);
+
+       message = _net_invoke_dbus_method(NETCONFIG_SERVICE, NETCONFIG_MPTCP_PATH,
+                       NETCONFIG_MPTCP_INTERFACE, "MptcpSetScheduler", params, &Error);
+       if (Error != NET_ERR_NONE)
+               NETWORK_LOG(NETWORK_ERROR, "_net_invoke_dbus_method failed");
+
+       if (message != NULL)
+               g_variant_unref(message);
+
+       __NETWORK_FUNC_EXIT__;
+       return Error;
+}
+
+int _net_dbus_mptcp_get_scheduler(char **scheduler)
+{
+       __NETWORK_FUNC_ENTER__;
+       net_err_t Error = NET_ERR_NONE;
+       GVariant *message = NULL;
+
+       message = _net_invoke_dbus_method(NETCONFIG_SERVICE, NETCONFIG_MPTCP_PATH,
+                       NETCONFIG_MPTCP_INTERFACE, "MptcpGetScheduler", NULL, &Error);
+
+       if (message == NULL) {
+               NETWORK_LOG(NETWORK_ERROR, "Failed to get MPTCP path manager");
+               __NETWORK_FUNC_EXIT__;
+               return Error;
+       }
+
+       g_variant_get(message, "(s)", scheduler);
+       g_variant_unref(message);
+
+       __NETWORK_FUNC_EXIT__;
+       return Error;
+}
diff --git a/src/network-mptcp-intf.c b/src/network-mptcp-intf.c
new file mode 100644 (file)
index 0000000..7e4e29c
--- /dev/null
@@ -0,0 +1,119 @@
+/*
+ * Network Client Library
+ *
+ * Copyright 2012 Samsung Electronics Co., Ltd
+ *
+ * Licensed under the Flora License, Version 1.1 (the "License")
+{
+}
+
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.tizenopensource.org/license
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include "network-internal.h"
+#include "network-dbus-request.h"
+#include "network-signal-handler.h"
+#include "network-mptcp-intf.h"
+
+EXPORT_API int net_mptcp_supported(gboolean* support)
+{
+       __NETWORK_FUNC_ENTER__;
+       net_err_t Error = NET_ERR_NONE;
+
+       Error = _net_dbus_mptcp_supported(support);
+       if (Error != NET_ERR_NONE)
+               NETWORK_LOG(NETWORK_ERROR, "net_mptcp_supported failed\n");
+
+       __NETWORK_FUNC_EXIT__;
+       return Error;
+}
+
+EXPORT_API int net_mptcp_set_enable(int enable)
+{
+       __NETWORK_FUNC_ENTER__;
+       net_err_t Error = NET_ERR_NONE;
+
+       Error = _net_dbus_mptcp_set_enable(enable);
+       if (Error != NET_ERR_NONE)
+               NETWORK_LOG(NETWORK_ERROR, "net_mptcp_set_enable failed\n");
+
+       __NETWORK_FUNC_EXIT__;
+       return Error;
+}
+
+EXPORT_API int net_mptcp_get_enabled(int* enable)
+{
+       __NETWORK_FUNC_ENTER__;
+       net_err_t Error = NET_ERR_NONE;
+
+       Error = _net_dbus_mptcp_get_enabled(enable);
+       if (Error != NET_ERR_NONE)
+               NETWORK_LOG(NETWORK_ERROR, "net_mptcp_get_enabled failed\n");
+
+       __NETWORK_FUNC_EXIT__;
+       return Error;
+}
+
+
+EXPORT_API int net_mptcp_set_path_manager(const char *pm)
+{
+       __NETWORK_FUNC_ENTER__;
+       net_err_t Error = NET_ERR_NONE;
+
+       Error = _net_dbus_mptcp_set_path_manager(pm);
+       if (Error != NET_ERR_NONE)
+               NETWORK_LOG(NETWORK_ERROR, "net_mptcp_set_path_manager failed\n");
+
+       __NETWORK_FUNC_EXIT__;
+       return Error;
+}
+
+EXPORT_API int net_mptcp_get_path_manager(char **pm)
+{
+       __NETWORK_FUNC_ENTER__;
+       net_err_t Error = NET_ERR_NONE;
+
+       Error = _net_dbus_mptcp_get_path_manager(pm);
+       if (Error != NET_ERR_NONE)
+               NETWORK_LOG(NETWORK_ERROR, "net_mptcp_get_path_manager failed\n");
+
+       __NETWORK_FUNC_EXIT__;
+       return Error;
+}
+
+
+EXPORT_API int net_mptcp_set_scheduler(const char *scheduler)
+{
+       __NETWORK_FUNC_ENTER__;
+       net_err_t Error = NET_ERR_NONE;
+
+       Error = _net_dbus_mptcp_set_scheduler(scheduler);
+       if (Error != NET_ERR_NONE)
+               NETWORK_LOG(NETWORK_ERROR, "net_mptcp_set_scheduler failed\n");
+
+       __NETWORK_FUNC_EXIT__;
+       return Error;
+}
+
+EXPORT_API int net_mptcp_get_scheduler(char **scheduler)
+{
+       __NETWORK_FUNC_ENTER__;
+       net_err_t Error = NET_ERR_NONE;
+
+       Error = _net_dbus_mptcp_get_scheduler(scheduler);
+       if (Error != NET_ERR_NONE)
+               NETWORK_LOG(NETWORK_ERROR, "net_mptcp_get_scheduler failed\n");
+
+       __NETWORK_FUNC_EXIT__;
+       return Error;
+}