int connection_destroy_cs(int tid, connection_h connection);
typedef enum {
- CONNECTION_MPTCP_DISABLE = 0,
- CONNECTION_MPTCP_ENABLE_ALL = 1,
- CONNECTION_MPTCP_ENABLE_SOCKOPT = 2,
+ CONNECTION_MPTCP_DISABLE = 0, // disable
+ CONNECTION_MPTCP_ENABLE_ALL = 1, // enable
+ CONNECTION_MPTCP_ENABLE_SOCKOPT = 2, // enable if the MPTCP_ENABLED socket option is set
} connection_mptcp_enable_e;
typedef enum {
- CONNECTION_MPTCP_PM_UNKNOWN,
- CONNECTION_MPTCP_PM_DEFAULT,
- CONNECTION_MPTCP_PM_FULLMESH,
+ CONNECTION_MPTCP_PM_UNKNOWN, // Unknown path manager
+ CONNECTION_MPTCP_PM_DEFAULT, // Default path manager - Do nothing
+ CONNECTION_MPTCP_PM_FULLMESH, // Full mesh of subflows
} connection_mptcp_path_manager_e;
typedef enum {
- CONNECTION_MPTCP_SCHEDULER_UNKNOWN,
- CONNECTION_MPTCP_SCHEDULER_DEFAULT,
- CONNECTION_MPTCP_SCHEDULER_ROUNDROBIN,
+ CONNECTION_MPTCP_SCHEDULER_UNKNOWN, // Unknown scheduler
+ CONNECTION_MPTCP_SCHEDULER_DEFAULT, // Default scheduler
+ CONNECTION_MPTCP_SCHEDULER_ROUNDROBIN, // Round robin scheduler
} connection_mptcp_scheduler_e;
-int connection_mptcp_enable(connection_mptcp_enable_e enable);
-int connection_mptcp_disable(void);
-int connection_mptcp_get_enabled(connection_mptcp_enable_e* enable);
+/**
+ * @brief Check if Multipath TCP is supported
+ * @since_tizen 5.0
+ * @param[in] connection The connection handle
+ * @param[out] supported true if Multipath TCP is supported, false otherwise
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #CONNECTION_ERROR_NONE Successful
+ */
+int connection_mptcp_is_supported(connection_h connection, bool* supported);
+
+/**
+ * @brief Enable Multipath TCP
+ * @since_tizen 5.0
+ * @param[in] connection The connection handle
+ * @param[in] enable The enabled value
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #CONNECTION_ERROR_NONE Successful
+ * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
+ * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
+ * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission denied
+ */
+int connection_mptcp_enable(connection_h connection, connection_mptcp_enable_e enable);
+
+/**
+ * @brief Disable Multipath TCP
+ * @since_tizen 5.0
+ * @param[in] connection The connection handle
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #CONNECTION_ERROR_NONE Successful
+ * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
+ * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
+ * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission denied
+ */
+int connection_mptcp_disable(connection_h connection);
+
+/**
+ * @brief Get the enabled value for Multipath TCP
+ * @since_tizen 5.0
+ * @param[in] connection The connection handle
+ * @param[out] enable The enabled value
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #CONNECTION_ERROR_NONE Successful
+ * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
+ * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
+ * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission denied
+ */
+int connection_mptcp_get_enabled(connection_h connection, connection_mptcp_enable_e* enable);
+
+/**
+ * @brief Set the path manager of Multipath TCP
+ * @since_tizen 5.0
+ * @param[in] connection The connection handle
+ * @param[in] pm The path manager of Multipath TCP
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #CONNECTION_ERROR_NONE Successful
+ * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
+ * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
+ * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission denied
+ */
+int connection_mptcp_set_path_manager(connection_h connection, connection_mptcp_path_manager_e pm);
-int connection_mptcp_set_path_manager(connection_mptcp_path_manager_e pm);
-int connection_mptcp_get_path_manager(connection_mptcp_path_manager_e* pm);
+/**
+ * @brief Get the path manager of Multipath TCP
+ * @since_tizen 5.0
+ * @param[in] connection The connection handle
+ * @param[out] pm The path manager of Multipath TCP
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #CONNECTION_ERROR_NONE Successful
+ * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
+ * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
+ * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission denied
+ */
+int connection_mptcp_get_path_manager(connection_h connection, connection_mptcp_path_manager_e* pm);
-int connection_mptcp_set_scheduler(connection_mptcp_scheduler_e scheduler);
-int connection_mptcp_get_scheduler(connection_mptcp_scheduler_e* scheduler);
+/**
+ * @brief Set the path manager of Multipath TCP
+ * @since_tizen 5.0
+ * @param[in] connection The connection handle
+ * @param[in] scheduler The schedduler of Multipath TCP
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #CONNECTION_ERROR_NONE Successful
+ * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
+ * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
+ * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission denied
+ */
+int connection_mptcp_set_scheduler(connection_h connection, connection_mptcp_scheduler_e scheduler);
+
+/**
+ * @brief Set the path manager of Multipath TCP
+ * @since_tizen 5.0
+ * @param[in] connection The connection handle
+ * @param[out] scheduler The schedduler of Multipath TCP
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #CONNECTION_ERROR_NONE Successful
+ * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
+ * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
+ * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission denied
+ */
+int connection_mptcp_get_scheduler(connection_h connection, connection_mptcp_scheduler_e* scheduler);
/**
* @}
#include "net_connection_private.h"
#include "net_connection_mptcp_private.h"
-EXPORT_API int connection_mptcp_enable(connection_mptcp_enable_e enable)
+EXPORT_API int connection_mptcp_is_supported(connection_h connection, bool* supported)
{
+ if (!(_connection_check_handle_validity(connection))) {
+ CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
+ return CONNECTION_ERROR_INVALID_PARAMETER;
+ }
+
+ *supported = _connection_libnet_mptcp_supported();
+ return CONNECTION_ERROR_NONE;
+}
+
+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_libnet_mptcp_enable(enable);
}
-EXPORT_API int connection_mptcp_disable(void)
+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_libnet_mptcp_enable(CONNECTION_MPTCP_DISABLE);
}
-EXPORT_API int connection_mptcp_get_enabled(connection_mptcp_enable_e* enable)
+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;
+ }
+
// check MPTCP support
if (_connection_libnet_mptcp_supported() == FALSE) {
CONNECTION_LOG(CONNECTION_ERROR, "MPTCP is not supported");
}
-EXPORT_API int connection_mptcp_set_path_manager(connection_mptcp_path_manager_e pm)
+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_libnet_mptcp_set_path_manager(pm);
}
-EXPORT_API int connection_mptcp_get_path_manager(connection_mptcp_path_manager_e* 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;
+ }
+
// check MPTCP support
if (_connection_libnet_mptcp_supported() == FALSE) {
CONNECTION_LOG(CONNECTION_ERROR, "MPTCP is not supported");
}
-EXPORT_API int connection_mptcp_set_scheduler(connection_mptcp_scheduler_e scheduler)
+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_libnet_mptcp_set_scheduler(scheduler);
}
-EXPORT_API int connection_mptcp_get_scheduler(connection_mptcp_scheduler_e* 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;
+ }
+
// check MPTCP support
if (_connection_libnet_mptcp_supported() == FALSE) {
CONNECTION_LOG(CONNECTION_ERROR, "MPTCP is not supported");
int test_mptcp_enable(void)
{
int rv = 0;
- rv = connection_mptcp_enable(CONNECTION_MPTCP_ENABLE_ALL);
+ bool supported = false;
+ rv = connection_mptcp_is_supported(connection, &supported);
+ if (rv != CONNECTION_ERROR_NONE) {
+ printf("Failure[%s]\n", test_print_error(rv));
+ return -1;
+ }
+ printf("MPTCP Support: %d\n", supported);
+ rv = connection_mptcp_enable(connection, CONNECTION_MPTCP_ENABLE_ALL);
if (rv != CONNECTION_ERROR_NONE) {
printf("Failure[%s]\n", test_print_error(rv));
return -1;
int test_mptcp_disable(void)
{
int rv = 0;
- rv = connection_mptcp_disable();
+ rv = connection_mptcp_disable(connection);
if (rv != CONNECTION_ERROR_NONE) {
printf("Failure[%s]\n", test_print_error(rv));
switch (input) {
case 1:
- rv = connection_mptcp_set_path_manager(CONNECTION_MPTCP_PM_DEFAULT);
+ rv = connection_mptcp_set_path_manager(connection, CONNECTION_MPTCP_PM_DEFAULT);
break;
case 2:
- rv = connection_mptcp_set_path_manager(CONNECTION_MPTCP_PM_FULLMESH);
+ rv = connection_mptcp_set_path_manager(connection, CONNECTION_MPTCP_PM_FULLMESH);
break;
default:
printf("Invalid input!!\n");
int rv = 0;
connection_mptcp_path_manager_e pm;
- rv = connection_mptcp_get_path_manager(&pm);
+ rv = connection_mptcp_get_path_manager(connection, &pm);
if (rv != CONNECTION_ERROR_NONE) {
printf("Failure[%s]\n", test_print_error(rv));
return -1;
switch (input) {
case 1:
- rv = connection_mptcp_set_scheduler(CONNECTION_MPTCP_SCHEDULER_DEFAULT);
+ rv = connection_mptcp_set_scheduler(connection, CONNECTION_MPTCP_SCHEDULER_DEFAULT);
break;
case 2:
- rv = connection_mptcp_set_scheduler(CONNECTION_MPTCP_SCHEDULER_ROUNDROBIN);
+ rv = connection_mptcp_set_scheduler(connection, CONNECTION_MPTCP_SCHEDULER_ROUNDROBIN);
break;
default:
printf("Invalid input!!\n");
int rv = 0;
connection_mptcp_scheduler_e scheduler;
- rv = connection_mptcp_get_scheduler(&scheduler);
+ rv = connection_mptcp_get_scheduler(connection, &scheduler);
if (rv != CONNECTION_ERROR_NONE) {
printf("Failure[%s]\n", test_print_error(rv));
return -1;