2 * Copyright (c) 2011-2013 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License")
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
22 #include "connection_extension.h"
23 #include "net_connection_private.h"
24 #include "net_connection_mptcp_private.h"
26 EXPORT_API int connection_mptcp_enable(connection_mptcp_enable_e enable)
28 // check MPTCP support
29 if (_connection_libnet_mptcp_supported() == FALSE) {
30 CONNECTION_LOG(CONNECTION_ERROR, "MPTCP is not supported");
31 return CONNECTION_ERROR_NOT_SUPPORTED;
34 if (enable == CONNECTION_MPTCP_DISABLE) {
35 CONNECTION_LOG(CONNECTION_ERROR, "Use connection_mptcp_disable()");
36 return CONNECTION_ERROR_INVALID_PARAMETER;
39 return _connection_libnet_mptcp_enable(enable);
42 EXPORT_API int connection_mptcp_disable(void)
44 // check MPTCP support
45 if (_connection_libnet_mptcp_supported() == FALSE) {
46 CONNECTION_LOG(CONNECTION_ERROR, "MPTCP is not supported");
47 return CONNECTION_ERROR_NOT_SUPPORTED;
50 return _connection_libnet_mptcp_enable(CONNECTION_MPTCP_DISABLE);
53 EXPORT_API int connection_mptcp_get_enabled(connection_mptcp_enable_e* enable)
55 // check MPTCP support
56 if (_connection_libnet_mptcp_supported() == FALSE) {
57 CONNECTION_LOG(CONNECTION_ERROR, "MPTCP is not supported");
58 return CONNECTION_ERROR_NOT_SUPPORTED;
62 CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
63 return CONNECTION_ERROR_INVALID_PARAMETER;
66 return _connection_libnet_mptcp_get_enabled(enable);
70 EXPORT_API int connection_mptcp_set_path_manager(connection_mptcp_path_manager_e pm)
72 // check MPTCP support
73 if (_connection_libnet_mptcp_supported() == FALSE) {
74 CONNECTION_LOG(CONNECTION_ERROR, "MPTCP is not supported");
75 return CONNECTION_ERROR_NOT_SUPPORTED;
78 return _connection_libnet_mptcp_set_path_manager(pm);
81 EXPORT_API int connection_mptcp_get_path_manager(connection_mptcp_path_manager_e* pm)
83 // check MPTCP support
84 if (_connection_libnet_mptcp_supported() == FALSE) {
85 CONNECTION_LOG(CONNECTION_ERROR, "MPTCP is not supported");
86 return CONNECTION_ERROR_NOT_SUPPORTED;
90 CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
91 return CONNECTION_ERROR_INVALID_PARAMETER;
94 return _connection_libnet_mptcp_get_path_manager(pm);
98 EXPORT_API int connection_mptcp_set_scheduler(connection_mptcp_scheduler_e scheduler)
100 // check MPTCP support
101 if (_connection_libnet_mptcp_supported() == FALSE) {
102 CONNECTION_LOG(CONNECTION_ERROR, "MPTCP is not supported");
103 return CONNECTION_ERROR_NOT_SUPPORTED;
106 return _connection_libnet_mptcp_set_scheduler(scheduler);
109 EXPORT_API int connection_mptcp_get_scheduler(connection_mptcp_scheduler_e* scheduler)
111 // check MPTCP support
112 if (_connection_libnet_mptcp_supported() == FALSE) {
113 CONNECTION_LOG(CONNECTION_ERROR, "MPTCP is not supported");
114 return CONNECTION_ERROR_NOT_SUPPORTED;
117 if (scheduler == NULL) {
118 CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
119 return CONNECTION_ERROR_INVALID_PARAMETER;
122 return _connection_libnet_mptcp_get_scheduler(scheduler);