Merge "Add new APIs for ethernet cable and deprecate wrong APIs" into tizen
[platform/core/api/connection.git] / include / net_connection.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
18 #ifndef __NET_CONNECTION_INTF_H__
19 #define __NET_CONNECTION_INTF_H__
20
21
22 #include "connection_profile.h"
23
24
25 #ifdef __cplusplus
26 extern "C" {
27 #endif /* __cplusplus */
28
29
30 /**
31  * @file net_connection.h
32  */
33
34
35 /**
36  * @addtogroup CAPI_NETWORK_CONNECTION_MANAGER_MODULE
37  * @{
38  */
39
40
41 /**
42  * @brief The connection handle.
43  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
44 */
45 typedef void* connection_h;
46
47
48 /**
49  * @brief The profiles iterator handle.
50  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
51 */
52 typedef void* connection_profile_iterator_h;
53
54
55 /**
56  * @brief Enumeration for connection type.
57  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
58  */
59 typedef enum {
60         CONNECTION_TYPE_DISCONNECTED = 0, /**< Disconnected */
61         CONNECTION_TYPE_WIFI = 1, /**< Wi-Fi type */
62         CONNECTION_TYPE_CELLULAR = 2, /**< Cellular type */
63         CONNECTION_TYPE_ETHERNET = 3, /**< Ethernet type */
64         CONNECTION_TYPE_BT = 4, /**< Bluetooth type */
65         CONNECTION_TYPE_NET_PROXY, /**< Proxy type for internet connection (Since 3.0) */
66 } connection_type_e;
67
68
69 /**
70  * @brief Enumeration for cellular network state.
71  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
72  */
73 typedef enum {
74         CONNECTION_CELLULAR_STATE_OUT_OF_SERVICE = 0, /**< Out of service */
75         CONNECTION_CELLULAR_STATE_FLIGHT_MODE = 1, /**< Flight mode */
76         CONNECTION_CELLULAR_STATE_ROAMING_OFF = 2, /**< Roaming is turned off */
77         CONNECTION_CELLULAR_STATE_CALL_ONLY_AVAILABLE = 3, /**< Call is only available */
78         CONNECTION_CELLULAR_STATE_AVAILABLE = 4, /**< Available but not connected yet */
79         CONNECTION_CELLULAR_STATE_CONNECTED = 5, /**< Connected */
80 } connection_cellular_state_e;
81
82
83 /**
84  * @brief Enumeration for Wi-Fi state.
85  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
86  */
87 typedef enum {
88         CONNECTION_WIFI_STATE_DEACTIVATED = 0, /**< Wi-Fi is deactivated */
89         CONNECTION_WIFI_STATE_DISCONNECTED = 1, /**< Disconnected */
90         CONNECTION_WIFI_STATE_CONNECTED = 2, /**< Connected */
91 } connection_wifi_state_e;
92
93
94 /**
95  * @brief Enumeration for ethernet state.
96  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
97  */
98 typedef enum {
99         CONNECTION_ETHERNET_STATE_DEACTIVATED = 0, /**< There is no Ethernet profile to open */
100         CONNECTION_ETHERNET_STATE_DISCONNECTED = 1, /**< Disconnected */
101         CONNECTION_ETHERNET_STATE_CONNECTED = 2, /**< Connected */
102 } connection_ethernet_state_e;
103
104
105 /**
106  * @brief Enumeration for Bluetooth state.
107  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
108  */
109 typedef enum {
110         CONNECTION_BT_STATE_DEACTIVATED = 0, /**< There is no Bluetooth profile to open */
111         CONNECTION_BT_STATE_DISCONNECTED = 1, /**< Disconnected */
112         CONNECTION_BT_STATE_CONNECTED = 2, /**< Connected */
113 } connection_bt_state_e;
114
115
116 /**
117  * @brief Enumeration for connection iterator type.
118  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
119  */
120 typedef enum {
121         CONNECTION_ITERATOR_TYPE_REGISTERED = 0, /**< The iterator of the registered profile */
122         CONNECTION_ITERATOR_TYPE_CONNECTED = 1, /**< The iterator of the connected profile */
123         CONNECTION_ITERATOR_TYPE_DEFAULT = 2, /**< The iterator of the default profile */
124 } connection_iterator_type_e;
125
126
127 /**
128  * @brief Enumeration for reset profile type.
129  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
130 */
131 typedef enum {
132         CONNECTION_RESET_DEFAULT_PROFILE = 0, /**< Initialized with the default profile defined by csc */
133         CONNECTION_RESET_CLEAR_PROFILE = 1, /**< Remove all profiles */
134 } connection_reset_option_e;
135
136
137 /**
138  * @brief Enumeration for the attached or detached state of ethernet cable.
139  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
140  */
141 typedef enum {
142         CONNECTION_ETHERNET_CABLE_DETACHED = 0, /**< Ethernet cable is detached */
143         CONNECTION_ETHERNET_CABLE_ATTACHED = 1, /**< Ethernet cable is attached */
144 } connection_ethernet_cable_state_e;
145
146
147 /**
148  * @brief Enumeration for connection errors.
149  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
150  */
151 typedef enum {
152         CONNECTION_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
153         CONNECTION_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
154         CONNECTION_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory error */
155         CONNECTION_ERROR_INVALID_OPERATION = TIZEN_ERROR_INVALID_OPERATION, /**< Invalid Operation */
156         CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED = TIZEN_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED, /**< Address family not supported */
157         CONNECTION_ERROR_OPERATION_FAILED = TIZEN_ERROR_CONNECTION|0x0401, /**< Operation failed */
158         CONNECTION_ERROR_ITERATOR_END = TIZEN_ERROR_CONNECTION|0x0402, /**< End of iteration */
159         CONNECTION_ERROR_NO_CONNECTION = TIZEN_ERROR_CONNECTION|0x0403, /**< There is no connection */
160         CONNECTION_ERROR_NOW_IN_PROGRESS = TIZEN_ERROR_NOW_IN_PROGRESS, /** Now in progress */
161         CONNECTION_ERROR_ALREADY_EXISTS = TIZEN_ERROR_CONNECTION|0x0404, /**< Already exists */
162         CONNECTION_ERROR_OPERATION_ABORTED = TIZEN_ERROR_CONNECTION|0x0405, /**< Operation is aborted */
163         CONNECTION_ERROR_DHCP_FAILED = TIZEN_ERROR_CONNECTION|0x0406, /**< DHCP failed */
164         CONNECTION_ERROR_INVALID_KEY = TIZEN_ERROR_CONNECTION|0x0407, /**< Invalid key */
165         CONNECTION_ERROR_NO_REPLY = TIZEN_ERROR_CONNECTION|0x0408, /**< No reply */
166         CONNECTION_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */
167         CONNECTION_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED      /**< Not Supported */
168 } connection_error_e;
169
170 /**
171  * @}
172 */
173
174
175 /**
176  * @addtogroup CAPI_NETWORK_CONNECTION_STATISTICS_MODULE
177  * @{
178 */
179
180
181 /**
182  * @brief Enumeration for statistics type.
183  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
184  */
185 typedef enum {
186         CONNECTION_STATISTICS_TYPE_LAST_RECEIVED_DATA = 0, /**< Last received data */
187         CONNECTION_STATISTICS_TYPE_LAST_SENT_DATA = 1, /**< Last sent data */
188         CONNECTION_STATISTICS_TYPE_TOTAL_RECEIVED_DATA = 2, /**< Total received data */
189         CONNECTION_STATISTICS_TYPE_TOTAL_SENT_DATA = 3, /**< Total sent data */
190 } connection_statistics_type_e;
191
192
193 /**
194  * @}
195 */
196
197
198 /**
199  * @addtogroup CAPI_NETWORK_CONNECTION_MANAGER_MODULE
200  * @{
201 */
202
203
204 /**
205  * @brief Creates a handle for managing data connections.
206  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
207  * @privlevel public
208  * @privilege %http://tizen.org/privilege/network.get
209  * @remarks You must release @a handle using connection_destroy().
210  * @param[out] connection The connection handle
211  * @return @c 0 on success,
212  *         otherwise a negative error value
213  * @retval #CONNECTION_ERROR_NONE Successful
214  * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
215  * @retval #CONNECTION_ERROR_OUT_OF_MEMORY Out of memory
216  * @see connection_destroy()
217  */
218 int connection_create(connection_h* connection);
219
220
221 /**
222  * @brief Destroys the connection handle.
223  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
224  * @param[in] connection The connection handle
225  * @return @c 0 on success,
226  *         otherwise a negative error value
227  * @retval #CONNECTION_ERROR_NONE Successful
228  * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
229  * @see connection_create()
230  */
231 int connection_destroy(connection_h connection);
232
233
234 /**
235  * @brief Called when the type of a connection is changed.
236  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
237  * @param[in] type The type of the current network connection
238  * @param[in] user_data The user data passed from the callback registration function
239  * @see connection_set_type_changed_cb()
240  * @see connection_unset_type_changed_cb()
241  */
242 typedef void(*connection_type_changed_cb)(connection_type_e type, void* user_data);
243
244
245 /**
246  * @brief Called when the address is changed.
247  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
248  * @param[in] ipv4_address The IP address for IPv4
249  * @param[in] ipv6_address The IP address for IPv6
250  * @param[in] user_data The user data passed from the callback registration function
251  * @see connection_set_ip_address_changed_cb()
252  * @see connection_unset_ip_address_changed_cb()
253  * @see connection_set_proxy_address_changed_cb()
254  * @see connection_unset_proxy_address_changed_cb()
255  */
256 typedef void(*connection_address_changed_cb)(const char* ipv4_address, const char* ipv6_address, void* user_data);
257
258
259 /**
260  * @brief Called when connection_set_default_cellular_service_profile_async() finishes.
261  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
262  * @param[in] result The result
263  * @param[in] user_data The user data passed from connection_open_profile()
264  * @pre connection_set_default_cellular_service_profile_async() will invoke this callback function.
265  * @see connection_set_default_cellular_service_profile_async()
266 */
267 typedef void(*connection_set_default_cb)(connection_error_e result, void* user_data);
268
269 /* @brief Called with an IPv6 address.
270  * @since_tizen 4.0
271  * @remarks   If @a ipv6_address is needed outside the callback, a copy should be made. \n
272  *            @a ipv6_address will be freed automatically after the execution of this callback.
273  * @param[in]  ipv6_address  The IPv6 address
274  * @param[in]  user_data     The user data passed from the foreach function
275  * @return  @c true to continue with the next iteration of the loop, \n @c false to break out of the loop
276  * @pre  connection_foreach_ipv6_addresses() will invoke this callback.
277  * @see  connection_foreach_ipv6_addresses()
278  */
279 typedef bool(*connection_ipv6_address_cb)(char *ipv6_address, void *user_data);
280
281 /**
282  * @brief Gets the type of the current profile for data connection.
283  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
284  * @param[in] connection The connection handle
285  * @param[out] type The type of the network
286  * @return @c 0 on success,
287  *         otherwise a negative error value
288  * @retval #CONNECTION_ERROR_NONE Successful
289  * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
290  * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
291  */
292 int connection_get_type(connection_h connection, connection_type_e* type);
293
294
295 /**
296  * @brief Gets the IP address of the current connection.
297  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
298  * @remarks You must release @a ip_address using free().
299  * @param[in] connection The connection handle
300  * @param[in] address_family The address family
301  * @param[out] ip_address The pointer to the IP address string
302  * @return @c 0 on success,
303  *         otherwise a negative error value
304  * @retval #CONNECTION_ERROR_NONE Successful
305  * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
306  * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
307  * @retval #CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED Not supported address family
308  */
309 int connection_get_ip_address(connection_h connection, connection_address_family_e address_family, char** ip_address);
310
311
312 /**
313  * @brief Gets the proxy address of the current connection.
314  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
315  * @remarks You must release @a proxy using free().
316  * @param[in] connection The connection handle
317  * @param[in] address_family The address family
318  * @param[out] proxy The proxy address
319  * @return @c 0 on success,
320  *         otherwise a negative error value
321  * @retval #CONNECTION_ERROR_NONE Successful
322  * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
323  * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
324  * @retval #CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED Not supported address family
325  */
326 int connection_get_proxy(connection_h connection, connection_address_family_e address_family, char** proxy);
327
328
329 /**
330  * @brief Gets the MAC address of the Wi-Fi or ethernet.
331  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
332  * @remarks @a mac_addr must be released with free() by you.
333  * @param[in] connection The handle of the connection
334  * @param[in] type The type of current network connection
335  * @param[out] mac_addr The MAC address
336  * @return @c 0 on success,
337  *         otherwise a negative error value
338  * @retval #CONNECTION_ERROR_NONE Successful
339  * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
340  * @retval #CONNECTION_ERROR_INVALID_OPERATION Invalid operation
341  * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
342  * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
343  * @retval #CONNECTION_ERROR_OUT_OF_MEMORY Out of memory
344  */
345 int connection_get_mac_address(connection_h connection, connection_type_e type, char** mac_addr);
346
347
348 /**
349  * @brief Gets the state of cellular connection.
350  * @details The returned state is for the cellular connection state.
351  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
352  * @param[in] connection The connection handle
353  * @param[out] state The state of the cellular connection
354  * @return @c 0 on success,
355  *         otherwise a negative error value
356  * @retval #CONNECTION_ERROR_NONE Successful
357  * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
358  * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
359  * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
360  */
361 int connection_get_cellular_state(connection_h connection, connection_cellular_state_e* state);
362
363
364 /**
365  * @brief Gets the state of the Wi-Fi.
366  * @details The returned state is for the Wi-Fi connection state.
367  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
368  * @privlevel public
369  * @privilege %http://tizen.org/privilege/network.get
370  * @param[in] connection The connection handle
371  * @param[out] state The state of Wi-Fi connection
372  * @return @c 0 on success,
373  *         otherwise a negative error value
374  * @retval #CONNECTION_ERROR_NONE Successful
375  * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
376  * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
377  * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
378  * @retval #CONNECTION_ERROR_NOT_SUPPORTED      Not supported
379  */
380 int connection_get_wifi_state(connection_h connection, connection_wifi_state_e* state);
381
382
383 /**
384  * @brief Gets the state of the Ethernet.
385  * @details The returned state is for the Ethernet connection state.
386  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
387  * @privlevel public
388  * @privilege %http://tizen.org/privilege/network.get
389  * @param[in] connection The connection handle
390  * @param[out] state The state of Ethernet connection
391  * @return @c 0 on success,
392  *         otherwise a negative error value
393  * @retval #CONNECTION_ERROR_NONE Successful
394  * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
395  * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
396  * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
397  * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
398  */
399 int connection_get_ethernet_state(connection_h connection, connection_ethernet_state_e* state);
400
401
402 /**
403  * @brief Checks for ethernet cable is attached or not.
404  * @details The returned state is for the ethernet cable state.
405  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
406  * @privlevel public
407  * @privilege %http://tizen.org/privilege/network.get
408  * @param[in] connection The handle of the connection
409  * @param[in] state - Enum connection_ethernet_cable_state_e
410  * @return @c 0 on success,
411  *         otherwise a negative error value
412  * @retval #CONNECTION_ERROR_NONE Successful
413  * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
414  * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
415  * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
416  * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
417  */
418 int connection_get_ethernet_cable_state(connection_h connection, connection_ethernet_cable_state_e *state);
419
420
421 /**
422  * @deprecated Deprecated since 4.0. Use connection_ethernet_cable_state_changed_cb instead.
423  * @brief Called when ethernet cable is plugged [in/out].
424  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
425  * @param[in] state The ethernet cable state (connection_ethernet_cable_state_e)
426  * @param[in] user_data The user data passed to callback registration function
427  */
428 typedef void(*connection_ethernet_cable_state_chaged_cb)(connection_ethernet_cable_state_e state, void* user_data);
429
430
431 /**
432  * @deprecated Deprecated since 4.0. Use connection_set_ethernet_cable_state_changed_cb() instead.
433  * @brief Registers callback for ethernet cable is plugged [in/out] event.
434  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
435  * @param[in] connection  The handle of connection
436  * @param[in] callback  The callback function to be called
437  * @param[in] user_data The user data passed to the callback function
438  * @return @c 0 on success,
439  *         otherwise a negative error value
440  * @retval #CONNECTION_ERROR_NONE Successful
441  * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
442  * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
443  * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
444  */
445 int connection_set_ethernet_cable_state_chaged_cb(connection_h connection, connection_ethernet_cable_state_chaged_cb callback, void *user_data) TIZEN_DEPRECATED_API;
446
447
448 /**
449  * @deprecated Deprecated since 4.0. Use connection_unset_ethernet_cable_state_changed_cb() instead.
450  * @brief Unregisters callback for ethernet cable is plugged [in/out] event.
451  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
452  * @param[in] connection The handle of connection
453  * @return @c 0 on success,
454  *         otherwise a negative error value
455  * @retval #CONNECTION_ERROR_NONE Successful
456  * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
457  * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
458  * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
459  */
460 int connection_unset_ethernet_cable_state_chaged_cb(connection_h connection) TIZEN_DEPRECATED_API;
461
462 /**
463  * @brief Called when ethernet cable is plugged [in/out].
464  * @since_tizen 4.0
465  * @param[in] state The ethernet cable state (connection_ethernet_cable_state_e)
466  * @param[in] user_data The user data passed to callback registration function
467  */
468 typedef void(*connection_ethernet_cable_state_changed_cb)(connection_ethernet_cable_state_e state, void* user_data);
469
470
471 /**
472  * @brief Registers callback for ethernet cable is plugged [in/out] event.
473  * @since_tizen 4.0
474  * @param[in] connection  The handle of connection
475  * @param[in] callback  The callback function to be called
476  * @param[in] user_data The user data passed to the callback function
477  * @return @c 0 on success,
478  *         otherwise a negative error value
479  * @retval #CONNECTION_ERROR_NONE Successful
480  * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
481  * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
482  * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
483  */
484 int connection_set_ethernet_cable_state_changed_cb(connection_h connection, connection_ethernet_cable_state_changed_cb callback, void *user_data);
485
486
487 /**
488  * @brief Unregisters callback for ethernet cable is plugged [in/out] event.
489  * @since_tizen 4.0
490  * @param[in] connection The handle of connection
491  * @return @c 0 on success,
492  *         otherwise a negative error value
493  * @retval #CONNECTION_ERROR_NONE Successful
494  * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
495  * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
496  * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
497  */
498 int connection_unset_ethernet_cable_state_changed_cb(connection_h connection);
499
500
501 /**
502  * @brief Gets the state of the Bluetooth.
503  * @details The returned state is for the Bluetooth connection state.
504  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
505  * @privlevel public
506  * @privilege %http://tizen.org/privilege/network.get
507  * @param[in] connection The connection handle
508  * @param[out] state The state of the Bluetooth connection
509  * @return @c 0 on success,
510  *         otherwise a negative error value
511  * @retval #CONNECTION_ERROR_NONE Successful
512  * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
513  * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
514  * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
515  * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
516  */
517 int connection_get_bt_state(connection_h connection, connection_bt_state_e* state);
518
519
520 /**
521  * @brief Registers the callback that is called when the type of the current connection is changed.
522  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
523  * @param[in] connection The connection handle
524  * @param[in] callback The callback function to be called
525  * @param[in] user_data The user data passed to the callback function
526  * @return @c 0 on success,
527  *         otherwise a negative error value
528  * @retval #CONNECTION_ERROR_NONE Successful
529  * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
530  * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
531  */
532 int connection_set_type_changed_cb(connection_h connection, connection_type_changed_cb callback, void* user_data);
533
534
535 /**
536  * @brief Unregisters the callback that is called when the type of current connection is changed.
537  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
538  * @param[in] connection The connection handle
539  * @return @c 0 on success,
540  *         otherwise a negative error value
541  * @retval #CONNECTION_ERROR_NONE Successful
542  * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
543  * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
544  */
545 int connection_unset_type_changed_cb(connection_h connection);
546
547
548 /**
549  * @brief Registers the callback that is called when the IP address is changed.
550  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
551  * @param[in] connection The connection handle
552  * @param[in] callback The callback function to be called
553  * @param[in] user_data The user data passed to the callback function
554  * @return @c 0 on success,
555  *         otherwise a negative error value
556  * @retval #CONNECTION_ERROR_NONE Successful
557  * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
558  * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
559  */
560 int connection_set_ip_address_changed_cb(connection_h connection, connection_address_changed_cb callback, void* user_data);
561
562
563 /**
564  * @brief Unregisters the callback that is called when the IP address is changed.
565  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
566  * @param[in] connection The connection handle
567  * @return @c 0 on success,
568  *         otherwise a negative error value
569  * @retval #CONNECTION_ERROR_NONE Successful
570  * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
571  * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
572  */
573 int connection_unset_ip_address_changed_cb(connection_h connection);
574
575
576 /**
577  * @brief Registers the callback that is called when the proxy address is changed.
578  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
579  * @param[in] connection The connection handle
580  * @param[in] callback The callback function to be called
581  * @param[in] user_data The user data passed to the callback function
582  * @return @c 0 on success,
583  *         otherwise a negative error value
584  * @retval #CONNECTION_ERROR_NONE Successful
585  * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
586  * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
587  */
588 int connection_set_proxy_address_changed_cb(connection_h connection, connection_address_changed_cb callback, void* user_data);
589
590
591 /**
592  * @brief Unregisters the callback that is called when the proxy address is changed.
593  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
594  * @param[in] connection The connection handle
595  * @return @c 0 on success,
596  *         otherwise a negative error value
597  * @retval #CONNECTION_ERROR_NONE Successful
598  * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
599  * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
600  */
601 int connection_unset_proxy_address_changed_cb(connection_h connection);
602
603
604 /**
605  * @brief Adds a new profile which is created by connection_profile_create().
606  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
607  * @privlevel public
608  * @privilege %http://tizen.org/privilege/network.profile
609  * @remarks You can only add a profile of the cellular type.
610  * @param[in] connection The connection handle
611  * @param[in] profile The profile handle
612  * @return @c 0 on success,
613  *         otherwise a negative error value
614  * @retval #CONNECTION_ERROR_NONE Successful
615  * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
616  * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
617  * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
618  * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not Supported
619  */
620 int connection_add_profile(connection_h connection, connection_profile_h profile);
621
622
623 /**
624  * @brief Removes an existing profile.
625  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
626  * @privlevel public
627  * @privilege %http://tizen.org/privilege/network.profile \n
628  *            %http://tizen.org/privilege/network.get
629  * @remarks This API needs both privileges.
630  * @param[in] connection The connection handle
631  * @param[in] profile The profile handle
632  * @return @c 0 on success,
633  *         otherwise a negative error value
634  * @retval #CONNECTION_ERROR_NONE Successful
635  * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
636  * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
637  * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
638  * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not Supported
639  */
640 int connection_remove_profile(connection_h connection, connection_profile_h profile);
641
642
643 /**
644  * @brief Updates an existing profile.
645  * @details When a profile is changed, these changes will be not applied to the Connection Manager immediately.
646  *          When you call this function, your changes affect the Connection Manager and the existing profile is updated.
647  *          In addition, the existing profile will be updated if you call connection_open_profile().
648  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
649  * @privlevel public
650  * @privilege %http://tizen.org/privilege/network.profile \n
651  *            %http://tizen.org/privilege/network.get
652  * @remarks This API needs both privileges.
653  * @param[in] connection The connection handle
654  * @param[in] profile The profile handle
655  * @return @c 0 on success,
656  *         otherwise a negative error value
657  * @retval #CONNECTION_ERROR_NONE Successful
658  * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
659  * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
660  * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
661  * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not Supported
662  * @see connection_open_profile()
663  */
664 int connection_update_profile(connection_h connection, connection_profile_h profile);
665
666
667 /**
668  * @brief Gets a profiles iterator.
669  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
670  * @privlevel public
671  * @privilege %http://tizen.org/privilege/network.get
672  * @remarks You must release @a profile_iterator using connection_destroy().
673  * @param[in] connection The connection handle
674  * @param[in] type The type of the connection iterator
675  * @param[out] profile_iterator The iterator of profile
676  * @return @c 0 on success,
677  *         otherwise a negative error value
678  * @retval #CONNECTION_ERROR_NONE Successful
679  * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
680  * @retval #CONNECTION_ERROR_OUT_OF_MEMORY Out of memory
681  * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
682  * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
683  */
684 int connection_get_profile_iterator(connection_h connection, connection_iterator_type_e type, connection_profile_iterator_h* profile_iterator);
685
686
687 /**
688  * @brief Moves the profile iterator to the next position and gets a profile handle.
689  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
690  * @param[in] profile_iterator The iterator of profile
691  * @param[out] profile The profile handle
692  * @return @c 0 on success,
693  *         otherwise a negative error value
694  * @retval #CONNECTION_ERROR_NONE Successful
695  * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
696  * @retval #CONNECTION_ERROR_ITERATOR_END End of iteration
697  */
698 int connection_profile_iterator_next(connection_profile_iterator_h profile_iterator, connection_profile_h* profile);
699
700
701 /**
702  * @brief Checks whether the next element of a profile iterator exists or not.
703  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
704  * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
705  * @param[in] profile_iterator The iterator of profile
706  * @return @c true if next element exists,
707  *         otherwise @c false if next element doesn't exist
708  */
709 bool connection_profile_iterator_has_next(connection_profile_iterator_h profile_iterator);
710
711
712 /**
713  * @brief Destroys a profiles iterator.
714  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
715  * @param[in] profile_iterator The iterator of the profile
716  * @return @c 0 on success,
717  *         otherwise a negative error value
718  * @retval #CONNECTION_ERROR_NONE Successful
719  * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
720  */
721 int connection_destroy_profile_iterator(connection_profile_iterator_h profile_iterator);
722
723
724 /**
725  * @brief Gets the name of the default profile.
726  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
727  * @privlevel public
728  * @privilege %http://tizen.org/privilege/network.get
729  * @remarks You must release @a profile using connection_profile_destroy().
730  * @param[in] connection The connection handle
731  * @param[out] profile The profile handle
732  * @return @c 0 on success,
733  *         otherwise a negative error value
734  * @retval #CONNECTION_ERROR_NONE Successful
735  * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
736  * @retval #CONNECTION_ERROR_OUT_OF_MEMORY Out of memory
737  * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
738  * @retval #CONNECTION_ERROR_NO_CONNECTION There is no connection
739  * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
740  */
741 int connection_get_current_profile(connection_h connection, connection_profile_h* profile);
742
743
744 /**
745  * @brief Gets the default profile which provides the given cellular service.
746  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
747  * @privlevel public
748  * @privilege %http://tizen.org/privilege/network.get
749  * @remarks You must release @a profile using connection_profile_destroy().
750  * @param[in] connection The connection handle
751  * @param[in] type The type of cellular service \n
752  *                         #CONNECTION_CELLULAR_SERVICE_TYPE_APPLICATION is not permitted
753  * @param[out] profile The profile handle
754  * @return @c 0 on success,
755  *         otherwise a negative error value
756  * @retval #CONNECTION_ERROR_NONE Successful
757  * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
758  * @retval #CONNECTION_ERROR_OUT_OF_MEMORY Out of memory
759  * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
760  * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
761  * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not Supported
762  */
763 int connection_get_default_cellular_service_profile(connection_h connection, connection_cellular_service_type_e type, connection_profile_h* profile);
764
765
766 /**
767  * @brief Sets the default profile which provides the given cellular service.
768  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
769  * @privlevel public
770  * @privilege %http://tizen.org/privilege/network.profile \n
771  *                %http://tizen.org/privilege/network.get
772  * @remarks This API needs both privileges.
773  * @param[in] connection The connection handle
774  * @param[in] type The type of cellular service \n
775  *                         only #CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET and #CONNECTION_CELLULAR_SERVICE_TYPE_PREPAID_INTERNET are permitted
776  * @param[in] profile The profile handle
777  * @return @c 0 on success,
778  *         otherwise a negative error value
779  * @retval #CONNECTION_ERROR_NONE Successful
780  * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
781  * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
782  * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
783  * @retval #CONNECTION_ERROR_NOT_SUPPORTED      Not Supported
784  */
785 int connection_set_default_cellular_service_profile(connection_h connection, connection_cellular_service_type_e type, connection_profile_h profile);
786
787
788 /**
789  * @brief Sets the default profile which provides the given cellular service, asynchronously.
790  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
791  * @privlevel public
792  * @privilege %http://tizen.org/privilege/network.profile \n
793  *                %http://tizen.org/privilege/network.get
794  * @remarks This API needs both privileges.
795  * @param[in] connection The connection handle
796  * @param[in] type The type of cellular service (only #CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET and #CONNECTION_CELLULAR_SERVICE_TYPE_PREPAID_INTERNET are permitted)
797  * @param[in] profile The profile handle
798  * @param[in] callback The callback function to be called
799  * @param[in] user_data The user data passed to the callback function
800  * @return @c 0 on success,
801  *         otherwise a negative error value
802  * @retval #CONNECTION_ERROR_NONE Successful
803  * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
804  * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
805  * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
806  * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not Supported
807  */
808 int connection_set_default_cellular_service_profile_async(connection_h connection,
809                 connection_cellular_service_type_e type, connection_profile_h profile, connection_set_default_cb callback, void* user_data);
810
811
812 /**
813  * @brief Called after connection_open_profile() is finished.
814  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
815  * @param[in] result The result
816  * @param[in] user_data The user data passed from connection_open_profile()
817  * @pre connection_open_profile() will invoke this callback function.
818  * @see connection_open_profile()
819 */
820 typedef void(*connection_opened_cb)(connection_error_e result, void* user_data);
821
822
823 /**
824  * @brief Called after connection_close_profile() is finished.
825  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
826  * @param[in] result The result
827  * @param[in] user_data The user data passed from connection_close_profile()
828  * @pre connection_close_profile() will invoke this callback function.
829  * @see connection_close_profile()
830 */
831 typedef void(*connection_closed_cb)(connection_error_e result, void* user_data);
832
833
834 /**
835  * @brief Called after connection_reset_profile() is finished.
836  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
837  * @param[in] result The result
838  * @param[in] user_data The user data passed from connection_reset_profile()
839  * @pre connection_reset_profile() will invoke this callback function.
840  * @see connection_reset_profile()
841 */
842 typedef void(*connection_reset_cb)(connection_error_e result, void* user_data);
843
844
845 /**
846  * @brief Opens a connection of profile, asynchronously.
847  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
848  * @privlevel public
849  * @privilege %http://tizen.org/privilege/network.set \n
850  *                %http://tizen.org/privilege/network.get
851  * @remarks This API needs both privileges.
852  * @param[in] connection The connection handle
853  * @param[in] profile The profile handle
854  * @param[in] callback The callback function to be called
855  * @param[in] user_data The user data passed to the callback function
856  * @return @c 0 on success,
857  *         otherwise a negative error value
858  * @retval #CONNECTION_ERROR_NONE Successful
859  * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
860  * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
861  * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
862  * @post connection_opened_cb() will be invoked.
863  * @see connection_opened_cb()
864  * @see connection_close_profile()
865  * @see connection_profile_set_state_changed_cb()
866  * @see connection_profile_unset_state_changed_cb()
867  * @see connection_profile_state_changed_cb()
868  */
869 int connection_open_profile(connection_h connection, connection_profile_h profile, connection_opened_cb callback, void* user_data);
870
871
872 /**
873  * @brief Closes a connection of profile.
874  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
875  * @privlevel public
876  * @privilege %http://tizen.org/privilege/network.set
877  * @param[in] connection The connection handle
878  * @param[in] profile The profile handle
879  * @param[in] callback The callback function to be called
880  * @param[in] user_data The user data passed to the callback function
881  * @return @c 0 on success,
882  *         otherwise a negative error value
883  * @retval #CONNECTION_ERROR_NONE Successful
884  * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
885  * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
886  * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
887  * @post connection_closed_cb() will be invoked.
888  * @see connection_closed_cb()
889  * @see connection_open_profile()
890  * @see connection_profile_set_state_changed_cb()
891  * @see connection_profile_unset_state_changed_cb()
892  * @see connection_profile_state_changed_cb()
893  */
894 int connection_close_profile(connection_h connection, connection_profile_h profile, connection_closed_cb callback, void* user_data);
895
896
897 /**
898  * @brief Resets the cellular profile.
899  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
900  * @privlevel public
901  * @privilege %http://tizen.org/privilege/network.profile \n
902  *                %http://tizen.org/privilege/network.get
903  * @remarks This API needs both privileges.
904  * @param[in] connection The connection handle
905  * @param[in] type The type of reset
906  * @param[in] id The subscriber identity module ID to reset (The sim index starts from 0.)
907  * @param[in] callback The callback function to be called
908  * @param[in] user_data The user data passed to the callback function
909  * @return @c 0 on success,
910  *         otherwise a negative error value
911  * @retval #CONNECTION_ERROR_NONE Successful
912  * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
913  * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
914  * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
915  * @retval #CONNECTION_ERROR_NOT_SUPPORTED      Not Supported
916  * @post connection_reset_cb() will be invoked.
917 */
918 int connection_reset_profile(connection_h connection, connection_reset_option_e type, int id, connection_reset_cb callback, void *user_data);
919
920
921 /**
922  * @brief Adds a IPv4 route to the routing table.
923  * @details You can get the @a interface_name from connection_profile_get_network_interface_name() of opened profile.
924  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
925  * @privlevel public
926  * @privilege %http://tizen.org/privilege/network.set
927  * @param[in] connection The connection handle
928  * @param[in] interface_name The name of network interface
929  * @param[in] host_address The IP address of the host
930  * @return @c 0 on success,
931  *         otherwise a negative error value
932  * @retval #CONNECTION_ERROR_NONE Successful
933  * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
934  * @retval #CONNECTION_ERROR_ALREADY_EXISTS Already exists
935  * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
936  * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
937  * @see connection_profile_get_network_interface_name()
938  */
939 int connection_add_route(connection_h connection, const char* interface_name, const char* host_address);
940
941
942 /**
943  * @brief Removes a IPv4 route from the routing table.
944  * @details You can get the @a interface_name from connection_profile_get_network_interface_name() of opened profile.
945  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
946  * @privlevel public
947  * @privilege %http://tizen.org/privilege/network.set
948  * @param[in] connection The connection handle
949  * @param[in] interface_name The name of network interface
950  * @param[in] host_address The IP address of the host
951  * @return @c 0 on success,
952  *         otherwise a negative error value
953  * @retval #CONNECTION_ERROR_NONE Successful
954  * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
955  * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
956  * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
957  * @see connection_profile_get_network_interface_name()
958  */
959 int connection_remove_route(connection_h connection, const char* interface_name, const char* host_address);
960
961
962 /**
963  * @brief Adds a IPv6 route to the routing table.
964  * @details You can get the @a interface_name from connection_profile_get_network_interface_name() of opened profile.
965  * @since_tizen 2.3.1
966  * @privlevel public
967  * @privilege %http://tizen.org/privilege/network.set
968  * @param[in] connection The connection handle
969  * @param[in] interface_name The name of network interface
970  * @param[in] host_address The IP address of the host
971  * @param[in] gateway The gateway address
972  * @return @c 0 on success,
973  *         otherwise a negative error value
974  * @retval #CONNECTION_ERROR_NONE Successful
975  * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
976  * @retval #CONNECTION_ERROR_ALREADY_EXISTS Already exists
977  * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
978  * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
979  * @see connection_profile_get_network_interface_name()
980  */
981 int connection_add_route_ipv6(connection_h connection, const char *interface_name, const char *host_address, const char * gateway);
982
983
984 /**
985  * @brief Removes a IPV6 route from the routing table.
986  * @details You can get the @a interface_name from connection_profile_get_network_interface_name() of opened profile.
987  * @since_tizen 2.3.1
988  * @privlevel public
989  * @privilege %http://tizen.org/privilege/network.set
990  * @param[in] connection The connection handle
991  * @param[in] interface_name The name of network interface
992  * @param[in] host_address The IP address of the host
993  * @param[in] gateway The gateway address
994  * @return @c 0 on success,
995  *         otherwise a negative error value
996  * @retval #CONNECTION_ERROR_NONE Successful
997  * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
998  * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
999  * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
1000  * @see connection_profile_get_network_interface_name()
1001  */
1002 int connection_remove_route_ipv6(connection_h connection, const char *interface_name, const char *host_address, const char * gateway);
1003
1004 /*
1005  * @brief Gets all IPv6 addresses assigned to the network interface.
1006  * @since_tizen 4.0
1007  * @param[in] connection       The connection handle
1008  * @param[in] connection_type  The connection type
1009  * @param[in] callback         The callback to be called for each IPv6 address
1010  * @param[in] user_data        The user data passed to the callback function
1011  * @return 0 on success, otherwise negative error value.
1012  * @retval #CONNECTION_ERROR_NONE               Successful
1013  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
1014  * @retval #CONNECTION_ERROR_OPERATION_FAILED   Operation failed
1015  * @retval #CONNECTION_ERROR_NOT_SUPPORTED      Not supported
1016  */
1017 int connection_foreach_ipv6_address(connection_h connection, connection_type_e connection_type,
1018                 connection_ipv6_address_cb callback, void *user_data);
1019
1020 /**
1021  * @}
1022 */
1023
1024
1025 /**
1026  * @addtogroup CAPI_NETWORK_CONNECTION_STATISTICS_MODULE
1027  * @{
1028 */
1029
1030
1031 /**
1032  * @brief Gets the statistics information.
1033  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
1034  * @privlevel public
1035  * @privilege %http://tizen.org/privilege/network.get
1036  * @param[in] connection The connection handle
1037  * @param[in] connection_type The type of connection (only CONNECTION_TYPE_WIFI and CONNECTION_TYPE_CELLULAR are supported)
1038  * @param[in] statistics_type The type of statistics
1039  * @param[out] size The received data size of the last cellular packet data connection (bytes)
1040  * @return @c 0 on success,
1041  *         otherwise a negative error value
1042  * @retval #CONNECTION_ERROR_NONE Successful
1043  * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
1044  * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
1045  * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not Supported
1046  */
1047 int connection_get_statistics(connection_h connection, connection_type_e connection_type, connection_statistics_type_e statistics_type, long long* size);
1048
1049
1050 /**
1051  * @brief Resets the statistics information.
1052  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
1053  * @privlevel public
1054  * @privilege %http://tizen.org/privilege/network.set
1055  * @remarks This API needs both privileges.
1056  * @param[in] connection The connection handle
1057  * @param[in] connection_type The type of connection (only CONNECTION_TYPE_WIFI and CONNECTION_TYPE_CELLULAR are supported)
1058  * @param[in] statistics_type The type of statistics
1059  * @return @c 0 on success,
1060  *         otherwise a negative error value
1061  * @retval #CONNECTION_ERROR_NONE Successful
1062  * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
1063  * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
1064  * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
1065  * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not Supported
1066  */
1067 int connection_reset_statistics(connection_h connection, connection_type_e connection_type, connection_statistics_type_e statistics_type);
1068
1069 /**
1070  * @}
1071 */
1072
1073
1074 #ifdef __cplusplus
1075 }
1076 #endif /* __cplusplus */
1077
1078
1079 #endif