Check if mptcp is supported first 14/187714/1
authorchleun.moon <chleun.moon@samsung.com>
Tue, 28 Aug 2018 04:41:02 +0000 (13:41 +0900)
committerchleun.moon <chleun.moon@samsung.com>
Tue, 28 Aug 2018 04:41:11 +0000 (13:41 +0900)
Change-Id: I814e8304cddcecde4cfae111afe5506f683e97f8
Signed-off-by: Cheoleun Moon <chleun.moon@samsung.com>
src/connection_mptcp.c

index 88546b0..e715155 100755 (executable)
@@ -36,17 +36,17 @@ EXPORT_API int connection_mptcp_is_supported(connection_h connection, bool* supp
 
 EXPORT_API int connection_mptcp_enable(connection_h connection, connection_mptcp_enable_e enable)
 {
-       if (!(_connection_check_handle_validity(connection))) {
-               CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
-               return CONNECTION_ERROR_INVALID_PARAMETER;
-       }
-
        // check MPTCP support
        if (_connection_libnet_mptcp_supported() == FALSE) {
                CONNECTION_LOG(CONNECTION_ERROR, "MPTCP is not supported");
                return CONNECTION_ERROR_NOT_SUPPORTED;
        }
 
+       if (!(_connection_check_handle_validity(connection))) {
+               CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
+               return CONNECTION_ERROR_INVALID_PARAMETER;
+       }
+
        if (enable == CONNECTION_MPTCP_DISABLE) {
                CONNECTION_LOG(CONNECTION_ERROR, "Use connection_mptcp_disable()");
                return CONNECTION_ERROR_INVALID_PARAMETER;
@@ -57,33 +57,33 @@ EXPORT_API int connection_mptcp_enable(connection_h connection, connection_mptcp
 
 EXPORT_API int connection_mptcp_disable(connection_h connection)
 {
-       if (!(_connection_check_handle_validity(connection))) {
-               CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
-               return CONNECTION_ERROR_INVALID_PARAMETER;
-       }
-
        // check MPTCP support
        if (_connection_libnet_mptcp_supported() == FALSE) {
                CONNECTION_LOG(CONNECTION_ERROR, "MPTCP is not supported");
                return CONNECTION_ERROR_NOT_SUPPORTED;
        }
 
-       return _connection_libnet_mptcp_enable(CONNECTION_MPTCP_DISABLE);
-}
-
-EXPORT_API int connection_mptcp_get_enabled(connection_h connection, connection_mptcp_enable_e* enable)
-{
        if (!(_connection_check_handle_validity(connection))) {
                CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
                return CONNECTION_ERROR_INVALID_PARAMETER;
        }
 
+       return _connection_libnet_mptcp_enable(CONNECTION_MPTCP_DISABLE);
+}
+
+EXPORT_API int connection_mptcp_get_enabled(connection_h connection, connection_mptcp_enable_e* enable)
+{
        // check MPTCP support
        if (_connection_libnet_mptcp_supported() == FALSE) {
                CONNECTION_LOG(CONNECTION_ERROR, "MPTCP is not supported");
                return CONNECTION_ERROR_NOT_SUPPORTED;
        }
 
+       if (!(_connection_check_handle_validity(connection))) {
+               CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
+               return CONNECTION_ERROR_INVALID_PARAMETER;
+       }
+
        if (enable == NULL) {
                CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
                return CONNECTION_ERROR_INVALID_PARAMETER;
@@ -95,33 +95,33 @@ EXPORT_API int connection_mptcp_get_enabled(connection_h connection, connection_
 
 EXPORT_API int connection_mptcp_set_path_manager(connection_h connection, connection_mptcp_path_manager_e pm)
 {
-       if (!(_connection_check_handle_validity(connection))) {
-               CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
-               return CONNECTION_ERROR_INVALID_PARAMETER;
-       }
-
        // check MPTCP support
        if (_connection_libnet_mptcp_supported() == FALSE) {
                CONNECTION_LOG(CONNECTION_ERROR, "MPTCP is not supported");
                return CONNECTION_ERROR_NOT_SUPPORTED;
        }
 
-       return _connection_libnet_mptcp_set_path_manager(pm);
-}
-
-EXPORT_API int connection_mptcp_get_path_manager(connection_h connection, connection_mptcp_path_manager_e* pm)
-{
        if (!(_connection_check_handle_validity(connection))) {
                CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
                return CONNECTION_ERROR_INVALID_PARAMETER;
        }
 
+       return _connection_libnet_mptcp_set_path_manager(pm);
+}
+
+EXPORT_API int connection_mptcp_get_path_manager(connection_h connection, connection_mptcp_path_manager_e* pm)
+{
        // check MPTCP support
        if (_connection_libnet_mptcp_supported() == FALSE) {
                CONNECTION_LOG(CONNECTION_ERROR, "MPTCP is not supported");
                return CONNECTION_ERROR_NOT_SUPPORTED;
        }
 
+       if (!(_connection_check_handle_validity(connection))) {
+               CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
+               return CONNECTION_ERROR_INVALID_PARAMETER;
+       }
+
        if (pm == NULL) {
                CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
                return CONNECTION_ERROR_INVALID_PARAMETER;
@@ -133,33 +133,33 @@ EXPORT_API int connection_mptcp_get_path_manager(connection_h connection, connec
 
 EXPORT_API int connection_mptcp_set_scheduler(connection_h connection, connection_mptcp_scheduler_e scheduler)
 {
-       if (!(_connection_check_handle_validity(connection))) {
-               CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
-               return CONNECTION_ERROR_INVALID_PARAMETER;
-       }
-
        // check MPTCP support
        if (_connection_libnet_mptcp_supported() == FALSE) {
                CONNECTION_LOG(CONNECTION_ERROR, "MPTCP is not supported");
                return CONNECTION_ERROR_NOT_SUPPORTED;
        }
 
-       return _connection_libnet_mptcp_set_scheduler(scheduler);
-}
-
-EXPORT_API int connection_mptcp_get_scheduler(connection_h connection, connection_mptcp_scheduler_e* scheduler)
-{
        if (!(_connection_check_handle_validity(connection))) {
                CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
                return CONNECTION_ERROR_INVALID_PARAMETER;
        }
 
+       return _connection_libnet_mptcp_set_scheduler(scheduler);
+}
+
+EXPORT_API int connection_mptcp_get_scheduler(connection_h connection, connection_mptcp_scheduler_e* scheduler)
+{
        // check MPTCP support
        if (_connection_libnet_mptcp_supported() == FALSE) {
                CONNECTION_LOG(CONNECTION_ERROR, "MPTCP is not supported");
                return CONNECTION_ERROR_NOT_SUPPORTED;
        }
 
+       if (!(_connection_check_handle_validity(connection))) {
+               CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
+               return CONNECTION_ERROR_INVALID_PARAMETER;
+       }
+
        if (scheduler == NULL) {
                CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
                return CONNECTION_ERROR_INVALID_PARAMETER;