Add new APIs for IPv6 and DNS configuration
[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  * @brief Called when ethernet cable is plugged [in/out].
423  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
424  * @param[in] state The ethernet cable state (connection_ethernet_cable_state_e)
425  * @param[in] user_data The user data passed to callback registration function
426  */
427 typedef void(*connection_ethernet_cable_state_chaged_cb)(connection_ethernet_cable_state_e state, void* user_data);
428
429
430 /**
431  * @brief Registers callback for ethernet cable is plugged [in/out] event.
432  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
433  * @param[in] connection  The handle of connection
434  * @param[in] callback  The callback function to be called
435  * @param[in] user_data The user data passed to the callback function
436  * @return @c 0 on success,
437  *         otherwise a negative error value
438  * @retval #CONNECTION_ERROR_NONE Successful
439  * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
440  * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
441  * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
442  */
443 int connection_set_ethernet_cable_state_chaged_cb(connection_h connection, connection_ethernet_cable_state_chaged_cb callback, void *user_data);
444
445
446 /**
447  * @brief Unregisters callback for ethernet cable is plugged [in/out] event.
448  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
449  * @param[in] connection The handle of connection
450  * @return @c 0 on success,
451  *         otherwise a negative error value
452  * @retval #CONNECTION_ERROR_NONE Successful
453  * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
454  * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
455  * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
456  */
457 int connection_unset_ethernet_cable_state_chaged_cb(connection_h connection);
458
459
460 /**
461  * @brief Gets the state of the Bluetooth.
462  * @details The returned state is for the Bluetooth connection state.
463  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
464  * @privlevel public
465  * @privilege %http://tizen.org/privilege/network.get
466  * @param[in] connection The connection handle
467  * @param[out] state The state of the Bluetooth connection
468  * @return @c 0 on success,
469  *         otherwise a negative error value
470  * @retval #CONNECTION_ERROR_NONE Successful
471  * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
472  * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
473  * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
474  * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
475  */
476 int connection_get_bt_state(connection_h connection, connection_bt_state_e* state);
477
478
479 /**
480  * @brief Registers the callback that is called when the type of the current connection is changed.
481  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
482  * @param[in] connection The connection handle
483  * @param[in] callback The callback function to be called
484  * @param[in] user_data The user data passed to the callback function
485  * @return @c 0 on success,
486  *         otherwise a negative error value
487  * @retval #CONNECTION_ERROR_NONE Successful
488  * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
489  * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
490  */
491 int connection_set_type_changed_cb(connection_h connection, connection_type_changed_cb callback, void* user_data);
492
493
494 /**
495  * @brief Unregisters the callback that is called when the type of current connection is changed.
496  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
497  * @param[in] connection The connection handle
498  * @return @c 0 on success,
499  *         otherwise a negative error value
500  * @retval #CONNECTION_ERROR_NONE Successful
501  * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
502  * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
503  */
504 int connection_unset_type_changed_cb(connection_h connection);
505
506
507 /**
508  * @brief Registers the callback that is called when the IP address is changed.
509  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
510  * @param[in] connection The connection handle
511  * @param[in] callback The callback function to be called
512  * @param[in] user_data The user data passed to the callback function
513  * @return @c 0 on success,
514  *         otherwise a negative error value
515  * @retval #CONNECTION_ERROR_NONE Successful
516  * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
517  * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
518  */
519 int connection_set_ip_address_changed_cb(connection_h connection, connection_address_changed_cb callback, void* user_data);
520
521
522 /**
523  * @brief Unregisters the callback that is called when the IP address is changed.
524  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
525  * @param[in] connection The connection handle
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_unset_ip_address_changed_cb(connection_h connection);
533
534
535 /**
536  * @brief Registers the callback that is called when the proxy address is changed.
537  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
538  * @param[in] connection The connection handle
539  * @param[in] callback The callback function to be called
540  * @param[in] user_data The user data passed to the callback function
541  * @return @c 0 on success,
542  *         otherwise a negative error value
543  * @retval #CONNECTION_ERROR_NONE Successful
544  * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
545  * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
546  */
547 int connection_set_proxy_address_changed_cb(connection_h connection, connection_address_changed_cb callback, void* user_data);
548
549
550 /**
551  * @brief Unregisters the callback that is called when the proxy address is changed.
552  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
553  * @param[in] connection The connection handle
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_unset_proxy_address_changed_cb(connection_h connection);
561
562
563 /**
564  * @brief Adds a new profile which is created by connection_profile_create().
565  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
566  * @privlevel public
567  * @privilege %http://tizen.org/privilege/network.profile
568  * @remarks You can only add a profile of the cellular type.
569  * @param[in] connection The connection handle
570  * @param[in] profile The profile handle
571  * @return @c 0 on success,
572  *         otherwise a negative error value
573  * @retval #CONNECTION_ERROR_NONE Successful
574  * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
575  * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
576  * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
577  * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not Supported
578  */
579 int connection_add_profile(connection_h connection, connection_profile_h profile);
580
581
582 /**
583  * @brief Removes an existing profile.
584  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
585  * @privlevel public
586  * @privilege %http://tizen.org/privilege/network.profile \n
587  *            %http://tizen.org/privilege/network.get
588  * @remarks This API needs both privileges.
589  * @param[in] connection The connection handle
590  * @param[in] profile The profile handle
591  * @return @c 0 on success,
592  *         otherwise a negative error value
593  * @retval #CONNECTION_ERROR_NONE Successful
594  * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
595  * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
596  * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
597  * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not Supported
598  */
599 int connection_remove_profile(connection_h connection, connection_profile_h profile);
600
601
602 /**
603  * @brief Updates an existing profile.
604  * @details When a profile is changed, these changes will be not applied to the Connection Manager immediately.
605  *          When you call this function, your changes affect the Connection Manager and the existing profile is updated.
606  *          In addition, the existing profile will be updated if you call connection_open_profile().
607  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
608  * @privlevel public
609  * @privilege %http://tizen.org/privilege/network.profile \n
610  *            %http://tizen.org/privilege/network.get
611  * @remarks This API needs both privileges.
612  * @param[in] connection The connection handle
613  * @param[in] profile The profile handle
614  * @return @c 0 on success,
615  *         otherwise a negative error value
616  * @retval #CONNECTION_ERROR_NONE Successful
617  * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
618  * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
619  * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
620  * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not Supported
621  * @see connection_open_profile()
622  */
623 int connection_update_profile(connection_h connection, connection_profile_h profile);
624
625
626 /**
627  * @brief Gets a profiles iterator.
628  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
629  * @privlevel public
630  * @privilege %http://tizen.org/privilege/network.get
631  * @remarks You must release @a profile_iterator using connection_destroy().
632  * @param[in] connection The connection handle
633  * @param[in] type The type of the connection iterator
634  * @param[out] profile_iterator The iterator of profile
635  * @return @c 0 on success,
636  *         otherwise a negative error value
637  * @retval #CONNECTION_ERROR_NONE Successful
638  * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
639  * @retval #CONNECTION_ERROR_OUT_OF_MEMORY Out of memory
640  * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
641  * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
642  */
643 int connection_get_profile_iterator(connection_h connection, connection_iterator_type_e type, connection_profile_iterator_h* profile_iterator);
644
645
646 /**
647  * @brief Moves the profile iterator to the next position and gets a profile handle.
648  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
649  * @param[in] profile_iterator The iterator of profile
650  * @param[out] profile The profile handle
651  * @return @c 0 on success,
652  *         otherwise a negative error value
653  * @retval #CONNECTION_ERROR_NONE Successful
654  * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
655  * @retval #CONNECTION_ERROR_ITERATOR_END End of iteration
656  */
657 int connection_profile_iterator_next(connection_profile_iterator_h profile_iterator, connection_profile_h* profile);
658
659
660 /**
661  * @brief Checks whether the next element of a profile iterator exists or not.
662  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
663  * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
664  * @param[in] profile_iterator The iterator of profile
665  * @return @c true if next element exists,
666  *         otherwise @c false if next element doesn't exist
667  */
668 bool connection_profile_iterator_has_next(connection_profile_iterator_h profile_iterator);
669
670
671 /**
672  * @brief Destroys a profiles iterator.
673  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
674  * @param[in] profile_iterator The iterator of the profile
675  * @return @c 0 on success,
676  *         otherwise a negative error value
677  * @retval #CONNECTION_ERROR_NONE Successful
678  * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
679  */
680 int connection_destroy_profile_iterator(connection_profile_iterator_h profile_iterator);
681
682
683 /**
684  * @brief Gets the name of the default profile.
685  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
686  * @privlevel public
687  * @privilege %http://tizen.org/privilege/network.get
688  * @remarks You must release @a profile using connection_profile_destroy().
689  * @param[in] connection The connection handle
690  * @param[out] profile The profile handle
691  * @return @c 0 on success,
692  *         otherwise a negative error value
693  * @retval #CONNECTION_ERROR_NONE Successful
694  * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
695  * @retval #CONNECTION_ERROR_OUT_OF_MEMORY Out of memory
696  * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
697  * @retval #CONNECTION_ERROR_NO_CONNECTION There is no connection
698  * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
699  */
700 int connection_get_current_profile(connection_h connection, connection_profile_h* profile);
701
702
703 /**
704  * @brief Gets the default profile which provides the given cellular service.
705  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
706  * @privlevel public
707  * @privilege %http://tizen.org/privilege/network.get
708  * @remarks You must release @a profile using connection_profile_destroy().
709  * @param[in] connection The connection handle
710  * @param[in] type The type of cellular service \n
711  *                         #CONNECTION_CELLULAR_SERVICE_TYPE_APPLICATION is not permitted
712  * @param[out] profile The profile handle
713  * @return @c 0 on success,
714  *         otherwise a negative error value
715  * @retval #CONNECTION_ERROR_NONE Successful
716  * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
717  * @retval #CONNECTION_ERROR_OUT_OF_MEMORY Out of memory
718  * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
719  * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
720  * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not Supported
721  */
722 int connection_get_default_cellular_service_profile(connection_h connection, connection_cellular_service_type_e type, connection_profile_h* profile);
723
724
725 /**
726  * @brief Sets the default profile which provides the given cellular service.
727  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
728  * @privlevel public
729  * @privilege %http://tizen.org/privilege/network.profile \n
730  *                %http://tizen.org/privilege/network.get
731  * @remarks This API needs both privileges.
732  * @param[in] connection The connection handle
733  * @param[in] type The type of cellular service \n
734  *                         only #CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET and #CONNECTION_CELLULAR_SERVICE_TYPE_PREPAID_INTERNET are permitted
735  * @param[in] profile The profile handle
736  * @return @c 0 on success,
737  *         otherwise a negative error value
738  * @retval #CONNECTION_ERROR_NONE Successful
739  * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
740  * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
741  * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
742  * @retval #CONNECTION_ERROR_NOT_SUPPORTED      Not Supported
743  */
744 int connection_set_default_cellular_service_profile(connection_h connection, connection_cellular_service_type_e type, connection_profile_h profile);
745
746
747 /**
748  * @brief Sets the default profile which provides the given cellular service, asynchronously.
749  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
750  * @privlevel public
751  * @privilege %http://tizen.org/privilege/network.profile \n
752  *                %http://tizen.org/privilege/network.get
753  * @remarks This API needs both privileges.
754  * @param[in] connection The connection handle
755  * @param[in] type The type of cellular service (only #CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET and #CONNECTION_CELLULAR_SERVICE_TYPE_PREPAID_INTERNET are permitted)
756  * @param[in] profile The profile handle
757  * @param[in] callback The callback function to be called
758  * @param[in] user_data The user data passed to the callback function
759  * @return @c 0 on success,
760  *         otherwise a negative error value
761  * @retval #CONNECTION_ERROR_NONE Successful
762  * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
763  * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
764  * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
765  * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not Supported
766  */
767 int connection_set_default_cellular_service_profile_async(connection_h connection,
768                 connection_cellular_service_type_e type, connection_profile_h profile, connection_set_default_cb callback, void* user_data);
769
770
771 /**
772  * @brief Called after connection_open_profile() is finished.
773  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
774  * @param[in] result The result
775  * @param[in] user_data The user data passed from connection_open_profile()
776  * @pre connection_open_profile() will invoke this callback function.
777  * @see connection_open_profile()
778 */
779 typedef void(*connection_opened_cb)(connection_error_e result, void* user_data);
780
781
782 /**
783  * @brief Called after connection_close_profile() is finished.
784  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
785  * @param[in] result The result
786  * @param[in] user_data The user data passed from connection_close_profile()
787  * @pre connection_close_profile() will invoke this callback function.
788  * @see connection_close_profile()
789 */
790 typedef void(*connection_closed_cb)(connection_error_e result, void* user_data);
791
792
793 /**
794  * @brief Called after connection_reset_profile() is finished.
795  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
796  * @param[in] result The result
797  * @param[in] user_data The user data passed from connection_reset_profile()
798  * @pre connection_reset_profile() will invoke this callback function.
799  * @see connection_reset_profile()
800 */
801 typedef void(*connection_reset_cb)(connection_error_e result, void* user_data);
802
803
804 /**
805  * @brief Opens a connection of profile, asynchronously.
806  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
807  * @privlevel public
808  * @privilege %http://tizen.org/privilege/network.set \n
809  *                %http://tizen.org/privilege/network.get
810  * @remarks This API needs both privileges.
811  * @param[in] connection The connection handle
812  * @param[in] profile The profile handle
813  * @param[in] callback The callback function to be called
814  * @param[in] user_data The user data passed to the callback function
815  * @return @c 0 on success,
816  *         otherwise a negative error value
817  * @retval #CONNECTION_ERROR_NONE Successful
818  * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
819  * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
820  * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
821  * @post connection_opened_cb() will be invoked.
822  * @see connection_opened_cb()
823  * @see connection_close_profile()
824  * @see connection_profile_set_state_changed_cb()
825  * @see connection_profile_unset_state_changed_cb()
826  * @see connection_profile_state_changed_cb()
827  */
828 int connection_open_profile(connection_h connection, connection_profile_h profile, connection_opened_cb callback, void* user_data);
829
830
831 /**
832  * @brief Closes a connection of profile.
833  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
834  * @privlevel public
835  * @privilege %http://tizen.org/privilege/network.set
836  * @param[in] connection The connection handle
837  * @param[in] profile The profile handle
838  * @param[in] callback The callback function to be called
839  * @param[in] user_data The user data passed to the callback function
840  * @return @c 0 on success,
841  *         otherwise a negative error value
842  * @retval #CONNECTION_ERROR_NONE Successful
843  * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
844  * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
845  * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
846  * @post connection_closed_cb() will be invoked.
847  * @see connection_closed_cb()
848  * @see connection_open_profile()
849  * @see connection_profile_set_state_changed_cb()
850  * @see connection_profile_unset_state_changed_cb()
851  * @see connection_profile_state_changed_cb()
852  */
853 int connection_close_profile(connection_h connection, connection_profile_h profile, connection_closed_cb callback, void* user_data);
854
855
856 /**
857  * @brief Resets the cellular profile.
858  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
859  * @privlevel public
860  * @privilege %http://tizen.org/privilege/network.profile \n
861  *                %http://tizen.org/privilege/network.get
862  * @remarks This API needs both privileges.
863  * @param[in] connection The connection handle
864  * @param[in] type The type of reset
865  * @param[in] id The subscriber identity module ID to reset (The sim index starts from 0.)
866  * @param[in] callback The callback function to be called
867  * @param[in] user_data The user data passed to the callback function
868  * @return @c 0 on success,
869  *         otherwise a negative error value
870  * @retval #CONNECTION_ERROR_NONE Successful
871  * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
872  * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
873  * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
874  * @retval #CONNECTION_ERROR_NOT_SUPPORTED      Not Supported
875  * @post connection_reset_cb() will be invoked.
876 */
877 int connection_reset_profile(connection_h connection, connection_reset_option_e type, int id, connection_reset_cb callback, void *user_data);
878
879
880 /**
881  * @brief Adds a IPv4 route to the routing table.
882  * @details You can get the @a interface_name from connection_profile_get_network_interface_name() of opened profile.
883  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
884  * @privlevel public
885  * @privilege %http://tizen.org/privilege/network.set
886  * @param[in] connection The connection handle
887  * @param[in] interface_name The name of network interface
888  * @param[in] host_address The IP address of the host
889  * @return @c 0 on success,
890  *         otherwise a negative error value
891  * @retval #CONNECTION_ERROR_NONE Successful
892  * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
893  * @retval #CONNECTION_ERROR_ALREADY_EXISTS Already exists
894  * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
895  * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
896  * @see connection_profile_get_network_interface_name()
897  */
898 int connection_add_route(connection_h connection, const char* interface_name, const char* host_address);
899
900
901 /**
902  * @brief Removes a IPv4 route from the routing table.
903  * @details You can get the @a interface_name from connection_profile_get_network_interface_name() of opened profile.
904  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
905  * @privlevel public
906  * @privilege %http://tizen.org/privilege/network.set
907  * @param[in] connection The connection handle
908  * @param[in] interface_name The name of network interface
909  * @param[in] host_address The IP address of the host
910  * @return @c 0 on success,
911  *         otherwise a negative error value
912  * @retval #CONNECTION_ERROR_NONE Successful
913  * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
914  * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
915  * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
916  * @see connection_profile_get_network_interface_name()
917  */
918 int connection_remove_route(connection_h connection, const char* interface_name, const char* host_address);
919
920
921 /**
922  * @brief Adds a IPv6 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 2.3.1
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  * @param[in] gateway The gateway address
931  * @return @c 0 on success,
932  *         otherwise a negative error value
933  * @retval #CONNECTION_ERROR_NONE Successful
934  * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
935  * @retval #CONNECTION_ERROR_ALREADY_EXISTS Already exists
936  * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
937  * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
938  * @see connection_profile_get_network_interface_name()
939  */
940 int connection_add_route_ipv6(connection_h connection, const char *interface_name, const char *host_address, const char * gateway);
941
942
943 /**
944  * @brief Removes a IPV6 route from the routing table.
945  * @details You can get the @a interface_name from connection_profile_get_network_interface_name() of opened profile.
946  * @since_tizen 2.3.1
947  * @privlevel public
948  * @privilege %http://tizen.org/privilege/network.set
949  * @param[in] connection The connection handle
950  * @param[in] interface_name The name of network interface
951  * @param[in] host_address The IP address of the host
952  * @param[in] gateway The gateway address
953  * @return @c 0 on success,
954  *         otherwise a negative error value
955  * @retval #CONNECTION_ERROR_NONE Successful
956  * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
957  * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
958  * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
959  * @see connection_profile_get_network_interface_name()
960  */
961 int connection_remove_route_ipv6(connection_h connection, const char *interface_name, const char *host_address, const char * gateway);
962
963 /*
964  * @brief Gets all IPv6 addresses assigned to the network interface.
965  * @since_tizen 4.0
966  * @param[in] connection       The connection handle
967  * @param[in] connection_type  The connection type
968  * @param[in] callback         The callback to be called for each IPv6 address
969  * @param[in] user_data        The user data passed to the callback function
970  * @return 0 on success, otherwise negative error value.
971  * @retval #CONNECTION_ERROR_NONE               Successful
972  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
973  * @retval #CONNECTION_ERROR_OPERATION_FAILED   Operation failed
974  * @retval #CONNECTION_ERROR_NOT_SUPPORTED      Not supported
975  */
976 int connection_foreach_ipv6_address(connection_h connection, connection_type_e connection_type,
977                 connection_ipv6_address_cb callback, void *user_data);
978
979 /**
980  * @}
981 */
982
983
984 /**
985  * @addtogroup CAPI_NETWORK_CONNECTION_STATISTICS_MODULE
986  * @{
987 */
988
989
990 /**
991  * @brief Gets the statistics information.
992  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
993  * @privlevel public
994  * @privilege %http://tizen.org/privilege/network.get
995  * @param[in] connection The connection handle
996  * @param[in] connection_type The type of connection (only CONNECTION_TYPE_WIFI and CONNECTION_TYPE_CELLULAR are supported)
997  * @param[in] statistics_type The type of statistics
998  * @param[out] size The received data size of the last cellular packet data connection (bytes)
999  * @return @c 0 on success,
1000  *         otherwise a negative error value
1001  * @retval #CONNECTION_ERROR_NONE Successful
1002  * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
1003  * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
1004  * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not Supported
1005  */
1006 int connection_get_statistics(connection_h connection, connection_type_e connection_type, connection_statistics_type_e statistics_type, long long* size);
1007
1008
1009 /**
1010  * @brief Resets the statistics information.
1011  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
1012  * @privlevel public
1013  * @privilege %http://tizen.org/privilege/network.set
1014  * @remarks This API needs both privileges.
1015  * @param[in] connection The connection handle
1016  * @param[in] connection_type The type of connection (only CONNECTION_TYPE_WIFI and CONNECTION_TYPE_CELLULAR are supported)
1017  * @param[in] statistics_type The type of statistics
1018  * @return @c 0 on success,
1019  *         otherwise a negative error value
1020  * @retval #CONNECTION_ERROR_NONE Successful
1021  * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
1022  * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
1023  * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission Denied
1024  * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not Supported
1025  */
1026 int connection_reset_statistics(connection_h connection, connection_type_e connection_type, connection_statistics_type_e statistics_type);
1027
1028 /**
1029  * @}
1030 */
1031
1032
1033 #ifdef __cplusplus
1034 }
1035 #endif /* __cplusplus */
1036
1037
1038 #endif