From 40881042590197759cd4e9136dcd0a6e9aab78e8 Mon Sep 17 00:00:00 2001 From: "chleun.moon" Date: Tue, 28 Aug 2018 13:41:02 +0900 Subject: [PATCH] Check if mptcp is supported first Change-Id: I814e8304cddcecde4cfae111afe5506f683e97f8 Signed-off-by: Cheoleun Moon --- src/connection_mptcp.c | 70 +++++++++++++++++++++++++------------------------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/src/connection_mptcp.c b/src/connection_mptcp.c index 88546b0..e715155 100755 --- a/src/connection_mptcp.c +++ b/src/connection_mptcp.c @@ -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; -- 2.7.4