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_is_supported(connection_h connection, bool* supported)
28 if (!(_connection_check_handle_validity(connection))) {
29 CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
30 return CONNECTION_ERROR_INVALID_PARAMETER;
33 *supported = _connection_libnet_mptcp_supported();
34 return CONNECTION_ERROR_NONE;
37 EXPORT_API int connection_mptcp_enable(connection_h connection, connection_mptcp_enable_e enable)
39 // check MPTCP support
40 if (_connection_libnet_mptcp_supported() == FALSE) {
41 CONNECTION_LOG(CONNECTION_ERROR, "MPTCP is not supported");
42 return CONNECTION_ERROR_NOT_SUPPORTED;
45 if (!(_connection_check_handle_validity(connection))) {
46 CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
47 return CONNECTION_ERROR_INVALID_PARAMETER;
50 if (enable == CONNECTION_MPTCP_DISABLE) {
51 CONNECTION_LOG(CONNECTION_ERROR, "Use connection_mptcp_disable()");
52 return CONNECTION_ERROR_INVALID_PARAMETER;
55 return _connection_libnet_mptcp_enable(enable);
58 EXPORT_API int connection_mptcp_disable(connection_h connection)
60 // check MPTCP support
61 if (_connection_libnet_mptcp_supported() == FALSE) {
62 CONNECTION_LOG(CONNECTION_ERROR, "MPTCP is not supported");
63 return CONNECTION_ERROR_NOT_SUPPORTED;
66 if (!(_connection_check_handle_validity(connection))) {
67 CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
68 return CONNECTION_ERROR_INVALID_PARAMETER;
71 return _connection_libnet_mptcp_enable(CONNECTION_MPTCP_DISABLE);
74 EXPORT_API int connection_mptcp_get_enabled(connection_h connection, connection_mptcp_enable_e* enable)
76 // check MPTCP support
77 if (_connection_libnet_mptcp_supported() == FALSE) {
78 CONNECTION_LOG(CONNECTION_ERROR, "MPTCP is not supported");
79 return CONNECTION_ERROR_NOT_SUPPORTED;
82 if (!(_connection_check_handle_validity(connection))) {
83 CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
84 return CONNECTION_ERROR_INVALID_PARAMETER;
88 CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
89 return CONNECTION_ERROR_INVALID_PARAMETER;
92 return _connection_libnet_mptcp_get_enabled(enable);
96 EXPORT_API int connection_mptcp_set_path_manager(connection_h connection, connection_mptcp_path_manager_e pm)
98 // check MPTCP support
99 if (_connection_libnet_mptcp_supported() == FALSE) {
100 CONNECTION_LOG(CONNECTION_ERROR, "MPTCP is not supported");
101 return CONNECTION_ERROR_NOT_SUPPORTED;
104 if (!(_connection_check_handle_validity(connection))) {
105 CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
106 return CONNECTION_ERROR_INVALID_PARAMETER;
109 return _connection_libnet_mptcp_set_path_manager(pm);
112 EXPORT_API int connection_mptcp_get_path_manager(connection_h connection, connection_mptcp_path_manager_e* pm)
114 // check MPTCP support
115 if (_connection_libnet_mptcp_supported() == FALSE) {
116 CONNECTION_LOG(CONNECTION_ERROR, "MPTCP is not supported");
117 return CONNECTION_ERROR_NOT_SUPPORTED;
120 if (!(_connection_check_handle_validity(connection))) {
121 CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
122 return CONNECTION_ERROR_INVALID_PARAMETER;
126 CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
127 return CONNECTION_ERROR_INVALID_PARAMETER;
130 return _connection_libnet_mptcp_get_path_manager(pm);
134 EXPORT_API int connection_mptcp_set_scheduler(connection_h connection, connection_mptcp_scheduler_e scheduler)
136 // check MPTCP support
137 if (_connection_libnet_mptcp_supported() == FALSE) {
138 CONNECTION_LOG(CONNECTION_ERROR, "MPTCP is not supported");
139 return CONNECTION_ERROR_NOT_SUPPORTED;
142 if (!(_connection_check_handle_validity(connection))) {
143 CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
144 return CONNECTION_ERROR_INVALID_PARAMETER;
147 return _connection_libnet_mptcp_set_scheduler(scheduler);
150 EXPORT_API int connection_mptcp_get_scheduler(connection_h connection, connection_mptcp_scheduler_e* scheduler)
152 // check MPTCP support
153 if (_connection_libnet_mptcp_supported() == FALSE) {
154 CONNECTION_LOG(CONNECTION_ERROR, "MPTCP is not supported");
155 return CONNECTION_ERROR_NOT_SUPPORTED;
158 if (!(_connection_check_handle_validity(connection))) {
159 CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
160 return CONNECTION_ERROR_INVALID_PARAMETER;
163 if (scheduler == NULL) {
164 CONNECTION_LOG(CONNECTION_ERROR, "Invalid parameter");
165 return CONNECTION_ERROR_INVALID_PARAMETER;
168 return _connection_libnet_mptcp_get_scheduler(scheduler);