Add some LCOV macro for coverage
[platform/core/api/connection.git] / include / connection_extension.h
1 /*
2  * Copyright (c) 2011-2013 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #ifndef __TIZEN_NETWORK_CONNECTION_EXTENSION_H__
18 #define __TIZEN_NETWORK_CONNECTION_EXTENSION_H__
19
20 #include "net_connection.h"
21 #include <glib.h>
22
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26
27 /**
28  * @file connection_extension.h
29  */
30
31 /**
32  * @brief Enumeration for extended network connection type.
33  * @since_tizen 5.0
34  */
35 typedef enum {
36         CONNECTION_PROFILE_TYPE_MESH = CONNECTION_PROFILE_TYPE_BT + 1,  /**< Wi-Fi Mesh type */
37 } connection_profile_type_extended_e;
38
39 /**
40  * @brief Start TCP Dump.
41  *
42  * @param[in] connection        The connection handle
43  *
44  * @return @c 0 on success, otherwise a negative error value
45  * @retval #CONNECTION_ERROR_NONE                    Successful
46  * @retval #CONNECTION_ERROR_OPERATION_FAILED        Operation failed
47  * @retval #CONNECTION_ERROR_INVALID_PARAMETER       Invalid parameter
48 */
49 int connection_profile_start_tcpdump(connection_h connection);
50
51 /**
52  * @brief Stop TCP Dump.
53  *
54  * @param[in] connection        The connection handle
55  *
56  * @return @c 0 on success, otherwise a negative error value
57  * @retval #CONNECTION_ERROR_NONE                    Successful
58  * @retval #CONNECTION_ERROR_OPERATION_FAILED        Operation failed
59  * @retval #CONNECTION_ERROR_INVALID_PARAMETER       Invalid parameter
60 */
61 int connection_profile_stop_tcpdump(connection_h connection);
62
63 /**
64  * @brief Get TCP Dump Running Status.
65  *
66  * @param[in] connection        The connection handle
67  * @param[out] tcpdump_state    The state of tcpdump, tcpdump is in progress or not
68  *
69  * @return @c 0 on success, otherwise a negative error value
70  * @retval #CONNECTION_ERROR_NONE                    Successful
71  * @retval #CONNECTION_ERROR_OPERATION_FAILED        Operation failed
72  * @retval #CONNECTION_ERROR_INVALID_PARAMETER       Invalid parameter
73 */
74 int connection_profile_get_tcpdump_state(connection_h connection, gboolean *tcpdump_state);
75
76 /**
77  * @brief Creates a handle for managing data connections in C# API.
78  * @since_tizen 5.0
79  * @privlevel public
80  * @privilege %http://tizen.org/privilege/network.get
81  * @remarks You must release @a handle using connection_destroy_cs().
82  * @param[in]  tid              TID in C#
83  * @param[out] connection       The connection handle
84  * @return @c 0 on success,
85  *         otherwise a negative error value
86  * @retval #CONNECTION_ERROR_NONE                  Successful
87  * @retval #CONNECTION_ERROR_INVALID_PARAMETER     Invalid parameter
88  * @retval #CONNECTION_ERROR_OUT_OF_MEMORY         Out of memory
89  * @retval #CONNECTION_ERROR_PERMISSION_DENIED     Permission denied
90  * @see connection_destroy_cs()
91  */
92 int connection_create_cs(int tid, connection_h *connection);
93
94 /**
95  * @brief Destroys the connection handle in C# API.
96  * @since_tizen 5.0
97  * @param[in]  tid              TID in C#
98  * @param[in] connection        The connection handle
99  * @return @c 0 on success,
100  *         otherwise a negative error value
101  * @retval #CONNECTION_ERROR_NONE                  Successful
102  * @retval #CONNECTION_ERROR_INVALID_PARAMETER     Invalid parameter
103  * @see connection_create_cs()
104  */
105 int connection_destroy_cs(int tid, connection_h connection);
106
107 typedef enum {
108         CONNECTION_MPTCP_DISABLE = 0,                   // disable
109         CONNECTION_MPTCP_ENABLE_ALL = 1,                // enable
110         CONNECTION_MPTCP_ENABLE_SOCKOPT = 2,    // enable if the MPTCP_ENABLED socket option is set
111 } connection_mptcp_enable_e;
112
113 typedef enum {
114         CONNECTION_MPTCP_PM_UNKNOWN,                    // Unknown path manager
115         CONNECTION_MPTCP_PM_DEFAULT,                    // Default path manager - Do nothing
116         CONNECTION_MPTCP_PM_FULLMESH,                   // Full mesh of subflows
117 } connection_mptcp_path_manager_e;
118
119 typedef enum {
120         CONNECTION_MPTCP_SCHEDULER_UNKNOWN,             // Unknown scheduler
121         CONNECTION_MPTCP_SCHEDULER_DEFAULT,             // Default scheduler
122         CONNECTION_MPTCP_SCHEDULER_ROUNDROBIN,  // Round robin scheduler
123 } connection_mptcp_scheduler_e;
124
125 /**
126  * @brief Check if Multipath TCP is supported
127  * @since_tizen 5.0
128  * @param[in] connection        The connection handle
129  * @param[out] supported        true if Multipath TCP is supported, false otherwise
130  * @return @c 0 on success,
131  *         otherwise a negative error value
132  * @retval #CONNECTION_ERROR_NONE                               Successful
133  */
134 int connection_mptcp_is_supported(connection_h connection, bool* supported);
135
136 /**
137  * @brief Enable Multipath TCP
138  * @since_tizen 5.0
139  * @param[in] connection        The connection handle
140  * @param[in] enable    The enabled value
141  * @return @c 0 on success,
142  *         otherwise a negative error value
143  * @retval #CONNECTION_ERROR_NONE                               Successful
144  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
145  * @retval #CONNECTION_ERROR_NOT_SUPPORTED              Not supported
146  * @retval #CONNECTION_ERROR_OPERATION_FAILED   Operation failed
147  * @retval #CONNECTION_ERROR_PERMISSION_DENIED  Permission denied
148  */
149 int connection_mptcp_enable(connection_h connection, connection_mptcp_enable_e enable);
150
151 /**
152  * @brief Disable Multipath TCP
153  * @since_tizen 5.0
154  * @param[in] connection        The connection handle
155  * @return @c 0 on success,
156  *         otherwise a negative error value
157  * @retval #CONNECTION_ERROR_NONE                               Successful
158  * @retval #CONNECTION_ERROR_INVALID_PARAMETER     Invalid parameter
159  * @retval #CONNECTION_ERROR_NOT_SUPPORTED              Not supported
160  * @retval #CONNECTION_ERROR_OPERATION_FAILED   Operation failed
161  * @retval #CONNECTION_ERROR_PERMISSION_DENIED  Permission denied
162  */
163 int connection_mptcp_disable(connection_h connection);
164
165 /**
166  * @brief Get the enabled value for Multipath TCP
167  * @since_tizen 5.0
168  * @param[in] connection        The connection handle
169  * @param[out] enable   The enabled value
170  * @return @c 0 on success,
171  *         otherwise a negative error value
172  * @retval #CONNECTION_ERROR_NONE                               Successful
173  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
174  * @retval #CONNECTION_ERROR_NOT_SUPPORTED              Not supported
175  * @retval #CONNECTION_ERROR_OPERATION_FAILED   Operation failed
176  * @retval #CONNECTION_ERROR_PERMISSION_DENIED  Permission denied
177  */
178 int connection_mptcp_get_enabled(connection_h connection, connection_mptcp_enable_e* enable);
179
180 /**
181  * @brief Set the path manager of Multipath TCP
182  * @since_tizen 5.0
183  * @param[in] connection        The connection handle
184  * @param[in] pm        The path manager of Multipath TCP
185  * @return @c 0 on success,
186  *         otherwise a negative error value
187  * @retval #CONNECTION_ERROR_NONE                               Successful
188  * @retval #CONNECTION_ERROR_INVALID_PARAMETER     Invalid parameter
189  * @retval #CONNECTION_ERROR_NOT_SUPPORTED              Not supported
190  * @retval #CONNECTION_ERROR_OPERATION_FAILED   Operation failed
191  * @retval #CONNECTION_ERROR_PERMISSION_DENIED  Permission denied
192  */
193 int connection_mptcp_set_path_manager(connection_h connection, connection_mptcp_path_manager_e pm);
194
195 /**
196  * @brief Get the path manager of Multipath TCP
197  * @since_tizen 5.0
198  * @param[in] connection        The connection handle
199  * @param[out] pm       The path manager of Multipath TCP
200  * @return @c 0 on success,
201  *         otherwise a negative error value
202  * @retval #CONNECTION_ERROR_NONE                               Successful
203  * @retval #CONNECTION_ERROR_INVALID_PARAMETER     Invalid parameter
204  * @retval #CONNECTION_ERROR_NOT_SUPPORTED              Not supported
205  * @retval #CONNECTION_ERROR_OPERATION_FAILED   Operation failed
206  * @retval #CONNECTION_ERROR_PERMISSION_DENIED  Permission denied
207  */
208 int connection_mptcp_get_path_manager(connection_h connection, connection_mptcp_path_manager_e* pm);
209
210 /**
211  * @brief Set the path manager of Multipath TCP
212  * @since_tizen 5.0
213  * @param[in] connection        The connection handle
214  * @param[in] scheduler         The schedduler of Multipath TCP
215  * @return @c 0 on success,
216  *         otherwise a negative error value
217  * @retval #CONNECTION_ERROR_NONE                               Successful
218  * @retval #CONNECTION_ERROR_INVALID_PARAMETER     Invalid parameter
219  * @retval #CONNECTION_ERROR_NOT_SUPPORTED              Not supported
220  * @retval #CONNECTION_ERROR_OPERATION_FAILED   Operation failed
221  * @retval #CONNECTION_ERROR_PERMISSION_DENIED  Permission denied
222  */
223 int connection_mptcp_set_scheduler(connection_h connection, connection_mptcp_scheduler_e scheduler);
224
225 /**
226  * @brief Set the path manager of Multipath TCP
227  * @since_tizen 5.0
228  * @param[in] connection        The connection handle
229  * @param[out] scheduler                The schedduler of Multipath TCP
230  * @return @c 0 on success,
231  *         otherwise a negative error value
232  * @retval #CONNECTION_ERROR_NONE                               Successful
233  * @retval #CONNECTION_ERROR_INVALID_PARAMETER     Invalid parameter
234  * @retval #CONNECTION_ERROR_NOT_SUPPORTED              Not supported
235  * @retval #CONNECTION_ERROR_OPERATION_FAILED   Operation failed
236  * @retval #CONNECTION_ERROR_PERMISSION_DENIED  Permission denied
237  */
238 int connection_mptcp_get_scheduler(connection_h connection, connection_mptcp_scheduler_e* scheduler);
239
240 /**
241 * @}
242 */
243
244
245 #ifdef __cplusplus
246 }
247 #endif /* __cplusplus */
248
249
250 #endif /* __TIZEN_NETWORK_CONNECTION_EXTENSION_H__ */