Make local handle for event loop
[platform/core/api/connection.git] / src / connection_mptcp.c
index e715155..3d44567 100755 (executable)
@@ -30,16 +30,16 @@ EXPORT_API int connection_mptcp_is_supported(connection_h connection, bool* supp
                return CONNECTION_ERROR_INVALID_PARAMETER;
        }
 
-       *supported = _connection_libnet_mptcp_supported();
+       *supported = _connection_libnet_mptcp_supported(connection);
        return CONNECTION_ERROR_NONE;
 }
 
 EXPORT_API int connection_mptcp_enable(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_libnet_mptcp_supported(connection) == FALSE) {
+               CONNECTION_LOG(CONNECTION_ERROR, "MPTCP is not supported");     //LCOV_EXCL_LINE
+               return CONNECTION_ERROR_NOT_SUPPORTED;  //LCOV_EXCL_LINE
        }
 
        if (!(_connection_check_handle_validity(connection))) {
@@ -47,20 +47,21 @@ EXPORT_API int connection_mptcp_enable(connection_h connection, connection_mptcp
                return CONNECTION_ERROR_INVALID_PARAMETER;
        }
 
-       if (enable == CONNECTION_MPTCP_DISABLE) {
-               CONNECTION_LOG(CONNECTION_ERROR, "Use connection_mptcp_disable()");
-               return CONNECTION_ERROR_INVALID_PARAMETER;
+       if (enable <= CONNECTION_MPTCP_DISABLE
+                       || enable > CONNECTION_MPTCP_ENABLE_SOCKOPT) {
+               CONNECTION_LOG(CONNECTION_ERROR, "Use connection_mptcp_disable()");     //LCOV_EXCL_LINE
+               return CONNECTION_ERROR_INVALID_PARAMETER;      //LCOV_EXCL_LINE
        }
 
-       return _connection_libnet_mptcp_enable(enable);
+       return _connection_libnet_mptcp_enable(connection, enable);
 }
 
 EXPORT_API int connection_mptcp_disable(connection_h connection)
 {
        // check MPTCP support
-       if (_connection_libnet_mptcp_supported() == FALSE) {
-               CONNECTION_LOG(CONNECTION_ERROR, "MPTCP is not supported");
-               return CONNECTION_ERROR_NOT_SUPPORTED;
+       if (_connection_libnet_mptcp_supported(connection) == FALSE) {
+               CONNECTION_LOG(CONNECTION_ERROR, "MPTCP is not supported");     //LCOV_EXCL_LINE
+               return CONNECTION_ERROR_NOT_SUPPORTED;  //LCOV_EXCL_LINE
        }
 
        if (!(_connection_check_handle_validity(connection))) {
@@ -68,15 +69,15 @@ EXPORT_API int connection_mptcp_disable(connection_h connection)
                return CONNECTION_ERROR_INVALID_PARAMETER;
        }
 
-       return _connection_libnet_mptcp_enable(CONNECTION_MPTCP_DISABLE);
+       return _connection_libnet_mptcp_enable(connection, 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_libnet_mptcp_supported(connection) == FALSE) {
+               CONNECTION_LOG(CONNECTION_ERROR, "MPTCP is not supported");     //LCOV_EXCL_LINE
+               return CONNECTION_ERROR_NOT_SUPPORTED;  //LCOV_EXCL_LINE
        }
 
        if (!(_connection_check_handle_validity(connection))) {
@@ -85,20 +86,20 @@ EXPORT_API int connection_mptcp_get_enabled(connection_h connection, connection_
        }
 
        if (enable == NULL) {
-               CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
-               return CONNECTION_ERROR_INVALID_PARAMETER;
+               CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");  //LCOV_EXCL_LINE
+               return CONNECTION_ERROR_INVALID_PARAMETER;      //LCOV_EXCL_LINE
        }
 
-       return _connection_libnet_mptcp_get_enabled(enable);
+       return _connection_libnet_mptcp_get_enabled(connection, enable);
 }
 
 
 EXPORT_API int connection_mptcp_set_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_libnet_mptcp_supported(connection) == FALSE) {
+               CONNECTION_LOG(CONNECTION_ERROR, "MPTCP is not supported");     //LCOV_EXCL_LINE
+               return CONNECTION_ERROR_NOT_SUPPORTED;  //LCOV_EXCL_LINE
        }
 
        if (!(_connection_check_handle_validity(connection))) {
@@ -106,15 +107,15 @@ EXPORT_API int connection_mptcp_set_path_manager(connection_h connection, connec
                return CONNECTION_ERROR_INVALID_PARAMETER;
        }
 
-       return _connection_libnet_mptcp_set_path_manager(pm);
+       return _connection_libnet_mptcp_set_path_manager(connection, 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_libnet_mptcp_supported(connection) == FALSE) {
+               CONNECTION_LOG(CONNECTION_ERROR, "MPTCP is not supported");     //LCOV_EXCL_LINE
+               return CONNECTION_ERROR_NOT_SUPPORTED;  //LCOV_EXCL_LINE
        }
 
        if (!(_connection_check_handle_validity(connection))) {
@@ -127,16 +128,16 @@ EXPORT_API int connection_mptcp_get_path_manager(connection_h connection, connec
                return CONNECTION_ERROR_INVALID_PARAMETER;
        }
 
-       return _connection_libnet_mptcp_get_path_manager(pm);
+       return _connection_libnet_mptcp_get_path_manager(connection, pm);
 }
 
 
 EXPORT_API int connection_mptcp_set_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_libnet_mptcp_supported(connection) == FALSE) {
+               CONNECTION_LOG(CONNECTION_ERROR, "MPTCP is not supported");     //LCOV_EXCL_LINE
+               return CONNECTION_ERROR_NOT_SUPPORTED;  //LCOV_EXCL_LINE
        }
 
        if (!(_connection_check_handle_validity(connection))) {
@@ -144,15 +145,15 @@ EXPORT_API int connection_mptcp_set_scheduler(connection_h connection, connectio
                return CONNECTION_ERROR_INVALID_PARAMETER;
        }
 
-       return _connection_libnet_mptcp_set_scheduler(scheduler);
+       return _connection_libnet_mptcp_set_scheduler(connection, 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_libnet_mptcp_supported(connection) == FALSE) {
+               CONNECTION_LOG(CONNECTION_ERROR, "MPTCP is not supported");     //LCOV_EXCL_LINE
+               return CONNECTION_ERROR_NOT_SUPPORTED;  //LCOV_EXCL_LINE
        }
 
        if (!(_connection_check_handle_validity(connection))) {
@@ -165,7 +166,7 @@ EXPORT_API int connection_mptcp_get_scheduler(connection_h connection, connectio
                return CONNECTION_ERROR_INVALID_PARAMETER;
        }
 
-       return _connection_libnet_mptcp_get_scheduler(scheduler);
+       return _connection_libnet_mptcp_get_scheduler(connection, scheduler);
 }