Add new API to check whether metered or non metered
[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         /**
133          * Initialized with the default profile defined by csc
134          */
135         CONNECTION_RESET_DEFAULT_PROFILE = 0,
136
137         /**
138          * Remove all profiles
139          */
140         CONNECTION_RESET_CLEAR_PROFILE = 1,
141
142 } connection_reset_option_e;
143
144
145 /**
146  * @brief Enumeration for the attached or detached state of ethernet cable.
147  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
148  */
149 typedef enum {
150         CONNECTION_ETHERNET_CABLE_DETACHED = 0,   /**< Ethernet cable is detached */
151         CONNECTION_ETHERNET_CABLE_ATTACHED = 1,   /**< Ethernet cable is attached */
152 } connection_ethernet_cable_state_e;
153
154
155 /**
156  * @brief Enumeration for connection errors.
157  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
158  */
159 typedef enum {
160         /**
161          * Successful
162          */
163         CONNECTION_ERROR_NONE = TIZEN_ERROR_NONE,
164
165         /**
166          * Invalid parameter
167          */
168         CONNECTION_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER,
169
170         /**
171          * Out of memory error
172          */
173         CONNECTION_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY,
174
175         /**
176          * Invalid operation
177          */
178         CONNECTION_ERROR_INVALID_OPERATION = TIZEN_ERROR_INVALID_OPERATION,
179
180         /**
181          * Address family not supported
182          */
183         CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED = TIZEN_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED,
184
185         /**
186          * Operation failed
187          */
188         CONNECTION_ERROR_OPERATION_FAILED = TIZEN_ERROR_CONNECTION|0x0401,
189
190         /**
191          * End of iteration
192          */
193         CONNECTION_ERROR_ITERATOR_END = TIZEN_ERROR_CONNECTION|0x0402,
194
195         /**
196          * There is no connection
197          */
198         CONNECTION_ERROR_NO_CONNECTION = TIZEN_ERROR_CONNECTION|0x0403,
199
200         /**
201          * Now inprogress
202          */
203         CONNECTION_ERROR_NOW_IN_PROGRESS = TIZEN_ERROR_NOW_IN_PROGRESS,
204
205         /**
206          * Already exists
207          */
208         CONNECTION_ERROR_ALREADY_EXISTS = TIZEN_ERROR_CONNECTION|0x0404,
209
210         /**
211          * Operation is aborted
212          */
213         CONNECTION_ERROR_OPERATION_ABORTED = TIZEN_ERROR_CONNECTION|0x0405,
214
215         /**
216          * DHCP failed
217          */
218         CONNECTION_ERROR_DHCP_FAILED = TIZEN_ERROR_CONNECTION|0x0406,
219
220         /**
221          * Invalid key
222          */
223         CONNECTION_ERROR_INVALID_KEY = TIZEN_ERROR_CONNECTION|0x0407,
224
225         /**
226          * No reply
227          */
228         CONNECTION_ERROR_NO_REPLY = TIZEN_ERROR_CONNECTION|0x0408,
229
230         /**
231          * Permission denied
232          */
233         CONNECTION_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED,
234
235         /**
236          * Not supported
237          */
238         CONNECTION_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED
239
240 } connection_error_e;
241
242 /**
243  * @}
244 */
245
246
247 /**
248  * @addtogroup CAPI_NETWORK_CONNECTION_STATISTICS_MODULE
249  * @{
250 */
251
252
253 /**
254  * @brief Enumeration for statistics type.
255  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
256  */
257 typedef enum {
258         CONNECTION_STATISTICS_TYPE_LAST_RECEIVED_DATA = 0,  /**< Last received data */
259         CONNECTION_STATISTICS_TYPE_LAST_SENT_DATA = 1,      /**< Last sent data */
260         CONNECTION_STATISTICS_TYPE_TOTAL_RECEIVED_DATA = 2, /**< Total received data */
261         CONNECTION_STATISTICS_TYPE_TOTAL_SENT_DATA = 3,     /**< Total sent data */
262 } connection_statistics_type_e;
263
264
265 /**
266  * @}
267 */
268
269
270 /**
271  * @addtogroup CAPI_NETWORK_CONNECTION_MANAGER_MODULE
272  * @{
273 */
274
275
276 /**
277  * @brief Creates a handle for managing data connections.
278  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
279  * @privlevel public
280  * @privilege %http://tizen.org/privilege/network.get
281  * @remarks You must release @a handle using connection_destroy().
282  * @param[out] connection       The connection handle
283  * @return @c 0 on success,
284  *         otherwise a negative error value
285  * @retval #CONNECTION_ERROR_NONE                  Successful
286  * @retval #CONNECTION_ERROR_INVALID_PARAMETER     Invalid parameter
287  * @retval #CONNECTION_ERROR_OUT_OF_MEMORY         Out of memory
288  * @retval #CONNECTION_ERROR_PERMISSION_DENIED     Permission denied
289  * @see connection_destroy()
290  */
291 int connection_create(connection_h* connection);
292
293
294 /**
295  * @brief Destroys the connection handle.
296  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
297  * @param[in] connection        The connection handle
298  * @return @c 0 on success,
299  *         otherwise a negative error value
300  * @retval #CONNECTION_ERROR_NONE                  Successful
301  * @retval #CONNECTION_ERROR_INVALID_PARAMETER     Invalid parameter
302  * @see connection_create()
303  */
304 int connection_destroy(connection_h connection);
305
306
307 /**
308  * @brief Called when the type of a connection is changed.
309  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
310  * @param[in] type              The type of the current network connection
311  * @param[in] user_data         The user data passed from the callback registration function
312  * @see connection_set_type_changed_cb()
313  * @see connection_unset_type_changed_cb()
314  */
315 typedef void(*connection_type_changed_cb)(connection_type_e type, void* user_data);
316
317
318 /**
319  * @brief Called when the address is changed.
320  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
321  * @param[in] ipv4_address      The IP address for IPv4
322  * @param[in] ipv6_address      The IP address for IPv6
323  * @param[in] user_data         The user data passed from the callback registration function
324  * @see connection_set_ip_address_changed_cb()
325  * @see connection_unset_ip_address_changed_cb()
326  * @see connection_set_proxy_address_changed_cb()
327  * @see connection_unset_proxy_address_changed_cb()
328  */
329 typedef void(*connection_address_changed_cb)(const char* ipv4_address,
330                 const char* ipv6_address, void* user_data);
331
332
333 /**
334  * @brief Called when connection_set_default_cellular_service_profile_async() finishes.
335  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
336  * @param[in] result            The result
337  * @param[in] user_data         The user data passed from connection_open_profile()
338  * @pre connection_set_default_cellular_service_profile_async() will invoke this callback function.
339  * @see connection_set_default_cellular_service_profile_async()
340 */
341 typedef void(*connection_set_default_cb)(connection_error_e result, void* user_data);
342
343 /**
344  * @brief Called with an IPv6 address.
345  * @since_tizen 4.0
346  * @remarks   If @a ipv6_address is needed outside the callback, a copy should be made. \n
347  *            @a ipv6_address will be freed automatically after the execution of this callback.
348  * @param[in]  ipv6_address     The IPv6 address
349  * @param[in]  user_data        The user data passed from the foreach function
350  * @return  @c true to continue with the next iteration of the loop, \n
351  *          @c false to break out of the loop
352  * @pre  connection_foreach_ipv6_addresses() will invoke this callback.
353  * @see  connection_foreach_ipv6_addresses()
354  */
355 typedef bool(*connection_ipv6_address_cb)(char *ipv6_address, void *user_data);
356
357 /**
358  * @brief Gets the type of the current profile for data connection.
359  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
360  * @param[in] connection        The connection handle
361  * @param[out] type             The type of the network
362  * @return @c 0 on success,
363  *         otherwise a negative error value
364  * @retval #CONNECTION_ERROR_NONE                  Successful
365  * @retval #CONNECTION_ERROR_INVALID_PARAMETER     Invalid parameter
366  * @retval #CONNECTION_ERROR_OPERATION_FAILED      Operation failed
367  */
368 int connection_get_type(connection_h connection, connection_type_e* type);
369
370
371 /**
372  * @brief Gets the IP address of the current connection.
373  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
374  * @remarks You must release @a ip_address using free().
375  * @param[in] connection        The connection handle
376  * @param[in] address_family    The address family
377  * @param[out] ip_address       The pointer to the IP address string
378  * @return @c 0 on success,
379  *         otherwise a negative error value
380  * @retval #CONNECTION_ERROR_NONE                           Successful
381  * @retval #CONNECTION_ERROR_INVALID_PARAMETER              Invalid parameter
382  * @retval #CONNECTION_ERROR_OPERATION_FAILED               Operation failed
383  * @retval #CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED   Not supported address family
384  */
385 int connection_get_ip_address(connection_h connection,
386                 connection_address_family_e address_family, char** ip_address);
387
388
389 /**
390  * @brief Gets the proxy address of the current connection.
391  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
392  * @remarks You must release @a proxy using free().
393  * @param[in] connection        The connection handle
394  * @param[in] address_family    The address family
395  * @param[out] proxy            The proxy address
396  * @return @c 0 on success,
397  *         otherwise a negative error value
398  * @retval #CONNECTION_ERROR_NONE                           Successful
399  * @retval #CONNECTION_ERROR_INVALID_PARAMETER              Invalid parameter
400  * @retval #CONNECTION_ERROR_OPERATION_FAILED               Operation failed
401  * @retval #CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED   Not supported address family
402  */
403 int connection_get_proxy(connection_h connection,
404                 connection_address_family_e address_family, char** proxy);
405
406
407 /**
408  * @brief Gets the MAC address of the Wi-Fi or ethernet.
409  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
410  * @remarks @a mac_addr must be released with free() by you.
411  * @param[in] connection        The handle of the connection
412  * @param[in] type              The type of current network connection
413  * @param[out] mac_addr         The MAC address
414  * @return @c 0 on success,
415  *         otherwise a negative error value
416  * @retval #CONNECTION_ERROR_NONE                  Successful
417  * @retval #CONNECTION_ERROR_INVALID_PARAMETER     Invalid parameter
418  * @retval #CONNECTION_ERROR_INVALID_OPERATION     Invalid operation
419  * @retval #CONNECTION_ERROR_OPERATION_FAILED      Operation failed
420  * @retval #CONNECTION_ERROR_NOT_SUPPORTED         Not supported
421  * @retval #CONNECTION_ERROR_OUT_OF_MEMORY         Out of memory
422  */
423 int connection_get_mac_address(connection_h connection,
424                 connection_type_e type, char** mac_addr);
425
426
427 /**
428  * @brief Gets if the current connection is metered.
429  * @since_tizen 4.0
430  * @privlevel public
431  * @privilege %http://tizen.org/privilege/network.get
432  * @param[in] connection        The connection handle
433  * @param[out] is_metered       The value indicating whether it is metered
434  * @return @c 0 on success,
435  *         otherwise a negative error value
436  * @retval #CONNECTION_ERROR_NONE                  Successful
437  * @retval #CONNECTION_ERROR_INVALID_PARAMETER     Invalid parameter
438  * @retval #CONNECTION_ERROR_OPERATION_FAILED      Operation failed
439  * @retval #CONNECTION_ERROR_PERMISSION_DENIED     Permission denied
440  * @retval #CONNECTION_ERROR_NOT_SUPPORTED         Not supported
441  */
442 int connection_is_metered_network(connection_h connection, bool* is_metered);
443
444
445 /**
446  * @brief Gets the state of cellular connection.
447  * @details The returned state is for the cellular connection state.
448  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
449  * @param[in] connection        The connection handle
450  * @param[out] state            The state of the cellular connection
451  * @return @c 0 on success,
452  *         otherwise a negative error value
453  * @retval #CONNECTION_ERROR_NONE                  Successful
454  * @retval #CONNECTION_ERROR_INVALID_PARAMETER     Invalid parameter
455  * @retval #CONNECTION_ERROR_OPERATION_FAILED      Operation failed
456  * @retval #CONNECTION_ERROR_NOT_SUPPORTED         Not supported
457  */
458 int connection_get_cellular_state(connection_h connection, connection_cellular_state_e* state);
459
460
461 /**
462  * @brief Gets the state of the Wi-Fi.
463  * @details The returned state is for the Wi-Fi connection state.
464  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
465  * @privlevel public
466  * @privilege %http://tizen.org/privilege/network.get
467  * @param[in] connection        The connection handle
468  * @param[out] state            The state of Wi-Fi connection
469  * @return @c 0 on success,
470  *         otherwise a negative error value
471  * @retval #CONNECTION_ERROR_NONE                  Successful
472  * @retval #CONNECTION_ERROR_INVALID_PARAMETER     Invalid parameter
473  * @retval #CONNECTION_ERROR_OPERATION_FAILED      Operation failed
474  * @retval #CONNECTION_ERROR_PERMISSION_DENIED     Permission denied
475  * @retval #CONNECTION_ERROR_NOT_SUPPORTED         Not supported
476  */
477 int connection_get_wifi_state(connection_h connection, connection_wifi_state_e* state);
478
479
480 /**
481  * @brief Gets the state of the Ethernet.
482  * @details The returned state is for the Ethernet connection state.
483  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
484  * @privlevel public
485  * @privilege %http://tizen.org/privilege/network.get
486  * @param[in] connection        The connection handle
487  * @param[out] state            The state of Ethernet connection
488  * @return @c 0 on success,
489  *         otherwise a negative error value
490  * @retval #CONNECTION_ERROR_NONE                  Successful
491  * @retval #CONNECTION_ERROR_INVALID_PARAMETER     Invalid parameter
492  * @retval #CONNECTION_ERROR_OPERATION_FAILED      Operation failed
493  * @retval #CONNECTION_ERROR_PERMISSION_DENIED     Permission denied
494  * @retval #CONNECTION_ERROR_NOT_SUPPORTED         Not supported
495  */
496 int connection_get_ethernet_state(connection_h connection, connection_ethernet_state_e* state);
497
498
499 /**
500  * @brief Checks for ethernet cable is attached or not.
501  * @details The returned state is for the ethernet cable state.
502  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
503  * @privlevel public
504  * @privilege %http://tizen.org/privilege/network.get
505  * @param[in] connection        The handle of the connection
506  * @param[in] state             The state of ethernet cable
507  * @return @c 0 on success,
508  *         otherwise a negative error value
509  * @retval #CONNECTION_ERROR_NONE                  Successful
510  * @retval #CONNECTION_ERROR_INVALID_PARAMETER     Invalid parameter
511  * @retval #CONNECTION_ERROR_OPERATION_FAILED      Operation failed
512  * @retval #CONNECTION_ERROR_NOT_SUPPORTED         Not supported
513  * @retval #CONNECTION_ERROR_PERMISSION_DENIED     Permission denied
514  */
515 int connection_get_ethernet_cable_state(connection_h connection,
516                 connection_ethernet_cable_state_e *state);
517
518
519 /**
520  * @deprecated Deprecated since 4.0. Use connection_ethernet_cable_state_changed_cb instead.
521  * @brief Called when ethernet cable is plugged [in/out].
522  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
523  * @param[in] state             The state of ethernet cable
524  * @param[in] user_data         The user data passed to callback registration function
525  */
526 typedef void(*connection_ethernet_cable_state_chaged_cb)
527                 (connection_ethernet_cable_state_e state, void* user_data);
528
529
530 /**
531  * @deprecated Deprecated since 4.0. Use connection_set_ethernet_cable_state_changed_cb() instead.
532  * @brief Registers callback for ethernet cable is plugged [in/out] event.
533  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
534  * @param[in] connection        The handle of connection
535  * @param[in] callback          The callback function to be called
536  * @param[in] user_data         The user data passed to the callback function
537  * @return @c 0 on success,
538  *         otherwise a negative error value
539  * @retval #CONNECTION_ERROR_NONE                  Successful
540  * @retval #CONNECTION_ERROR_INVALID_PARAMETER     Invalid parameter
541  * @retval #CONNECTION_ERROR_OPERATION_FAILED      Operation failed
542  * @retval #CONNECTION_ERROR_NOT_SUPPORTED         Not supported
543  */
544 int connection_set_ethernet_cable_state_chaged_cb(connection_h connection,
545                 connection_ethernet_cable_state_chaged_cb callback, void *user_data) TIZEN_DEPRECATED_API;
546
547
548 /**
549  * @deprecated Deprecated since 4.0. Use connection_unset_ethernet_cable_state_changed_cb() instead.
550  * @brief Unregisters callback for ethernet cable is plugged [in/out] event.
551  * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
552  * @param[in] connection        The handle of connection
553  * @return @c 0 on success,
554  *         otherwise a negative error value
555  * @retval #CONNECTION_ERROR_NONE                  Successful
556  * @retval #CONNECTION_ERROR_INVALID_PARAMETER     Invalid parameter
557  * @retval #CONNECTION_ERROR_OPERATION_FAILED      Operation failed
558  * @retval #CONNECTION_ERROR_NOT_SUPPORTED         Not supported
559  */
560 int connection_unset_ethernet_cable_state_chaged_cb(connection_h connection) TIZEN_DEPRECATED_API;
561
562 /**
563  * @brief Called when ethernet cable is plugged [in/out].
564  * @since_tizen 4.0
565  * @param[in] state             The state of ethernet cable
566  * @param[in] user_data         The user data passed to callback registration function
567  */
568 typedef void(*connection_ethernet_cable_state_changed_cb)(
569                 connection_ethernet_cable_state_e state, void* user_data);
570
571
572 /**
573  * @brief Registers callback for ethernet cable is plugged [in/out] event.
574  * @since_tizen 4.0
575  * @param[in] connection        The handle of connection
576  * @param[in] callback          The callback function to be called
577  * @param[in] user_data         The user data passed to the callback function
578  * @return @c 0 on success,
579  *         otherwise a negative error value
580  * @retval #CONNECTION_ERROR_NONE                  Successful
581  * @retval #CONNECTION_ERROR_INVALID_PARAMETER     Invalid parameter
582  * @retval #CONNECTION_ERROR_OPERATION_FAILED      Operation failed
583  * @retval #CONNECTION_ERROR_NOT_SUPPORTED         Not supported
584  */
585 int connection_set_ethernet_cable_state_changed_cb(connection_h connection,
586                 connection_ethernet_cable_state_changed_cb callback, void *user_data);
587
588
589 /**
590  * @brief Unregisters callback for ethernet cable is plugged [in/out] event.
591  * @since_tizen 4.0
592  * @param[in] connection        The handle of connection
593  * @return @c 0 on success,
594  *         otherwise a negative error value
595  * @retval #CONNECTION_ERROR_NONE                  Successful
596  * @retval #CONNECTION_ERROR_INVALID_PARAMETER     Invalid parameter
597  * @retval #CONNECTION_ERROR_OPERATION_FAILED      Operation failed
598  * @retval #CONNECTION_ERROR_NOT_SUPPORTED         Not supported
599  */
600 int connection_unset_ethernet_cable_state_changed_cb(connection_h connection);
601
602
603 /**
604  * @brief Gets the state of the Bluetooth.
605  * @details The returned state is for the Bluetooth connection state.
606  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
607  * @privlevel public
608  * @privilege %http://tizen.org/privilege/network.get
609  * @param[in] connection        The connection handle
610  * @param[out] state            The state of the Bluetooth connection
611  * @return @c 0 on success,
612  *         otherwise a negative error value
613  * @retval #CONNECTION_ERROR_NONE                  Successful
614  * @retval #CONNECTION_ERROR_INVALID_PARAMETER     Invalid parameter
615  * @retval #CONNECTION_ERROR_OPERATION_FAILED      Operation failed
616  * @retval #CONNECTION_ERROR_PERMISSION_DENIED     Permission denied
617  * @retval #CONNECTION_ERROR_NOT_SUPPORTED         Not supported
618  */
619 int connection_get_bt_state(connection_h connection, connection_bt_state_e* state);
620
621
622 /**
623  * @brief Registers the callback that is called when the type of the current connection is changed.
624  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
625  * @param[in] connection        The connection handle
626  * @param[in] callback          The callback function to be called
627  * @param[in] user_data         The user data passed to the callback function
628  * @return @c 0 on success,
629  *         otherwise a negative error value
630  * @retval #CONNECTION_ERROR_NONE                  Successful
631  * @retval #CONNECTION_ERROR_INVALID_PARAMETER     Invalid parameter
632  * @retval #CONNECTION_ERROR_OPERATION_FAILED      Operation failed
633  */
634 int connection_set_type_changed_cb(connection_h connection,
635                 connection_type_changed_cb callback, void* user_data);
636
637
638 /**
639  * @brief Unregisters the callback that is called when the type of current connection is changed.
640  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
641  * @param[in] connection        The connection handle
642  * @return @c 0 on success,
643  *         otherwise a negative error value
644  * @retval #CONNECTION_ERROR_NONE                  Successful
645  * @retval #CONNECTION_ERROR_INVALID_PARAMETER     Invalid parameter
646  * @retval #CONNECTION_ERROR_OPERATION_FAILED      Operation failed
647  */
648 int connection_unset_type_changed_cb(connection_h connection);
649
650
651 /**
652  * @brief Registers the callback that is called when the IP address is changed.
653  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
654  * @param[in] connection        The connection handle
655  * @param[in] callback          The callback function to be called
656  * @param[in] user_data         The user data passed to the callback function
657  * @return @c 0 on success,
658  *         otherwise a negative error value
659  * @retval #CONNECTION_ERROR_NONE                  Successful
660  * @retval #CONNECTION_ERROR_INVALID_PARAMETER     Invalid parameter
661  * @retval #CONNECTION_ERROR_OPERATION_FAILED      Operation failed
662  */
663 int connection_set_ip_address_changed_cb(connection_h connection,
664                 connection_address_changed_cb callback, void* user_data);
665
666
667 /**
668  * @brief Unregisters the callback that is called when the IP address is changed.
669  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
670  * @param[in] connection        The connection handle
671  * @return @c 0 on success,
672  *         otherwise a negative error value
673  * @retval #CONNECTION_ERROR_NONE                  Successful
674  * @retval #CONNECTION_ERROR_INVALID_PARAMETER     Invalid parameter
675  * @retval #CONNECTION_ERROR_OPERATION_FAILED      Operation failed
676  */
677 int connection_unset_ip_address_changed_cb(connection_h connection);
678
679
680 /**
681  * @brief Registers the callback that is called when the proxy address is changed.
682  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
683  * @param[in] connection        The connection handle
684  * @param[in] callback          The callback function to be called
685  * @param[in] user_data         The user data passed to the callback function
686  * @return @c 0 on success,
687  *         otherwise a negative error value
688  * @retval #CONNECTION_ERROR_NONE                  Successful
689  * @retval #CONNECTION_ERROR_INVALID_PARAMETER     Invalid parameter
690  * @retval #CONNECTION_ERROR_OPERATION_FAILED      Operation failed
691  */
692 int connection_set_proxy_address_changed_cb(connection_h connection,
693                 connection_address_changed_cb callback, void* user_data);
694
695
696 /**
697  * @brief Unregisters the callback that is called when the proxy address is changed.
698  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
699  * @param[in] connection        The connection handle
700  * @return @c 0 on success,
701  *         otherwise a negative error value
702  * @retval #CONNECTION_ERROR_NONE                  Successful
703  * @retval #CONNECTION_ERROR_INVALID_PARAMETER     Invalid parameter
704  * @retval #CONNECTION_ERROR_OPERATION_FAILED      Operation failed
705  */
706 int connection_unset_proxy_address_changed_cb(connection_h connection);
707
708
709 /**
710  * @brief Adds a new profile which is created by connection_profile_create().
711  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
712  * @privlevel public
713  * @privilege %http://tizen.org/privilege/network.profile
714  * @remarks You can only add a profile of the cellular type.
715  * @param[in] connection        The connection handle
716  * @param[in] profile           The profile handle
717  * @return @c 0 on success,
718  *         otherwise a negative error value
719  * @retval #CONNECTION_ERROR_NONE                  Successful
720  * @retval #CONNECTION_ERROR_INVALID_PARAMETER     Invalid parameter
721  * @retval #CONNECTION_ERROR_OPERATION_FAILED      Operation failed
722  * @retval #CONNECTION_ERROR_PERMISSION_DENIED     Permission denied
723  * @retval #CONNECTION_ERROR_NOT_SUPPORTED         Not supported
724  */
725 int connection_add_profile(connection_h connection, connection_profile_h profile);
726
727
728 /**
729  * @brief Removes an existing profile.
730  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
731  * @privlevel public
732  * @privilege %http://tizen.org/privilege/network.profile \n
733  *            %http://tizen.org/privilege/network.get
734  * @remarks This API needs both privileges.
735  * @param[in] connection        The connection handle
736  * @param[in] profile           The profile handle
737  * @return @c 0 on success,
738  *         otherwise a negative error value
739  * @retval #CONNECTION_ERROR_NONE                  Successful
740  * @retval #CONNECTION_ERROR_INVALID_PARAMETER     Invalid parameter
741  * @retval #CONNECTION_ERROR_OPERATION_FAILED      Operation failed
742  * @retval #CONNECTION_ERROR_PERMISSION_DENIED     Permission denied
743  * @retval #CONNECTION_ERROR_NOT_SUPPORTED         Not supported
744  */
745 int connection_remove_profile(connection_h connection, connection_profile_h profile);
746
747
748 /**
749  * @brief Updates an existing profile.
750  * @details When a profile is changed, these changes will be not applied to the
751  *          Connection Manager immediately.
752  *          When you call this function, your changes affect the Connection Manager
753  *          and the existing profile is updated.
754  *          In addition, the existing profile will be updated if you call connection_open_profile().
755  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
756  * @privlevel public
757  * @privilege %http://tizen.org/privilege/network.profile \n
758  *            %http://tizen.org/privilege/network.get
759  * @remarks This API needs both privileges.
760  * @param[in] connection        The connection handle
761  * @param[in] profile           The profile handle
762  * @return @c 0 on success,
763  *         otherwise a negative error value
764  * @retval #CONNECTION_ERROR_NONE                  Successful
765  * @retval #CONNECTION_ERROR_INVALID_PARAMETER     Invalid parameter
766  * @retval #CONNECTION_ERROR_OPERATION_FAILED      Operation failed
767  * @retval #CONNECTION_ERROR_PERMISSION_DENIED     Permission denied
768  * @retval #CONNECTION_ERROR_NOT_SUPPORTED         Not supported
769  * @see connection_open_profile()
770  */
771 int connection_update_profile(connection_h connection, connection_profile_h profile);
772
773
774 /**
775  * @brief Gets a profiles iterator.
776  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
777  * @privlevel public
778  * @privilege %http://tizen.org/privilege/network.get
779  * @remarks You must release @a profile_iterator using connection_destroy().
780  * @param[in] connection        The connection handle
781  * @param[in] type              The type of the connection iterator
782  * @param[out] profile_iterator The iterator of profile
783  * @return @c 0 on success,
784  *         otherwise a negative error value
785  * @retval #CONNECTION_ERROR_NONE                  Successful
786  * @retval #CONNECTION_ERROR_INVALID_PARAMETER     Invalid parameter
787  * @retval #CONNECTION_ERROR_OUT_OF_MEMORY         Out of memory
788  * @retval #CONNECTION_ERROR_OPERATION_FAILED      Operation failed
789  * @retval #CONNECTION_ERROR_PERMISSION_DENIED     Permission denied
790  */
791 int connection_get_profile_iterator(connection_h connection,
792                 connection_iterator_type_e type, connection_profile_iterator_h* profile_iterator);
793
794
795 /**
796  * @brief Moves the profile iterator to the next position and gets a profile handle.
797  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
798  * @param[in] profile_iterator  The iterator of profile
799  * @param[out] profile          The profile handle
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_ITERATOR_END          End of iteration
805  */
806 int connection_profile_iterator_next(connection_profile_iterator_h profile_iterator,
807                 connection_profile_h* profile);
808
809
810 /**
811  * @brief Checks whether the next element of a profile iterator exists or not.
812  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
813  * @remarks The specific error code can be obtained using the get_last_result() method.
814  *          Error codes are described in Exception section.
815  * @param[in] profile_iterator  The iterator of profile
816  * @return @c true if next element exists,
817  *         otherwise @c false if next element doesn't exist
818  * @exception #CONNECTION_ERROR_NONE                  Successful
819  * @exception #CONNECTION_ERROR_NOT_SUPPORTED         Not supported
820  * @see get_last_result()
821  */
822 bool connection_profile_iterator_has_next(connection_profile_iterator_h profile_iterator);
823
824
825 /**
826  * @brief Destroys a profiles iterator.
827  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
828  * @param[in] profile_iterator  The iterator of the profile
829  * @return @c 0 on success,
830  *         otherwise a negative error value
831  * @retval #CONNECTION_ERROR_NONE                  Successful
832  * @retval #CONNECTION_ERROR_INVALID_PARAMETER     Invalid parameter
833  */
834 int connection_destroy_profile_iterator(connection_profile_iterator_h profile_iterator);
835
836
837 /**
838  * @brief Gets the name of the default profile.
839  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
840  * @privlevel public
841  * @privilege %http://tizen.org/privilege/network.get
842  * @remarks You must release @a profile using connection_profile_destroy().
843  * @param[in] connection        The connection handle
844  * @param[out] profile          The profile handle
845  * @return @c 0 on success,
846  *         otherwise a negative error value
847  * @retval #CONNECTION_ERROR_NONE                  Successful
848  * @retval #CONNECTION_ERROR_INVALID_PARAMETER     Invalid parameter
849  * @retval #CONNECTION_ERROR_OUT_OF_MEMORY         Out of memory
850  * @retval #CONNECTION_ERROR_OPERATION_FAILED      Operation failed
851  * @retval #CONNECTION_ERROR_NO_CONNECTION         There is no connection
852  * @retval #CONNECTION_ERROR_PERMISSION_DENIED     Permission denied
853  */
854 int connection_get_current_profile(connection_h connection, connection_profile_h* profile);
855
856
857 /**
858  * @brief Gets the default profile which provides the given cellular service.
859  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
860  * @privlevel public
861  * @privilege %http://tizen.org/privilege/network.get
862  * @remarks You must release @a profile using connection_profile_destroy().
863  * @param[in] connection        The connection handle
864  * @param[in] type              The type of cellular service \n
865  *            #CONNECTION_CELLULAR_SERVICE_TYPE_APPLICATION is not permitted
866  * @param[out] profile          The profile handle
867  * @return @c 0 on success,
868  *         otherwise a negative error value
869  * @retval #CONNECTION_ERROR_NONE                  Successful
870  * @retval #CONNECTION_ERROR_INVALID_PARAMETER     Invalid parameter
871  * @retval #CONNECTION_ERROR_OUT_OF_MEMORY         Out of memory
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  */
876 int connection_get_default_cellular_service_profile(connection_h connection,
877                 connection_cellular_service_type_e type, connection_profile_h* profile);
878
879
880 /**
881  * @brief Sets the default profile which provides the given cellular service.
882  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
883  * @privlevel public
884  * @privilege %http://tizen.org/privilege/network.profile \n
885  *            %http://tizen.org/privilege/network.get
886  * @remarks This API needs both privileges.
887  * @param[in] connection        The connection handle
888  * @param[in] type              The type of cellular service \n
889  *            Only #CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET and
890  *            #CONNECTION_CELLULAR_SERVICE_TYPE_PREPAID_INTERNET are permitted
891  * @param[in] profile           The profile handle
892  * @return @c 0 on success,
893  *         otherwise a negative error value
894  * @retval #CONNECTION_ERROR_NONE                  Successful
895  * @retval #CONNECTION_ERROR_INVALID_PARAMETER     Invalid parameter
896  * @retval #CONNECTION_ERROR_OPERATION_FAILED      Operation failed
897  * @retval #CONNECTION_ERROR_PERMISSION_DENIED     Permission denied
898  * @retval #CONNECTION_ERROR_NOT_SUPPORTED         Not supported
899  */
900 int connection_set_default_cellular_service_profile(connection_h connection,
901                 connection_cellular_service_type_e type, connection_profile_h profile);
902
903
904 /**
905  * @brief Sets the default profile which provides the given cellular service, asynchronously.
906  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
907  * @privlevel public
908  * @privilege %http://tizen.org/privilege/network.profile \n
909  *                %http://tizen.org/privilege/network.get
910  * @remarks This API needs both privileges.
911  * @param[in] connection        The connection handle
912  * @param[in] type              The type of cellular service \n
913  *            Only #CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET and
914  *            #CONNECTION_CELLULAR_SERVICE_TYPE_PREPAID_INTERNET are permitted
915  * @param[in] profile The profile handle
916  * @param[in] callback The callback function to be called
917  * @param[in] user_data The user data passed to the callback function
918  * @return @c 0 on success,
919  *         otherwise a negative error value
920  * @retval #CONNECTION_ERROR_NONE                  Successful
921  * @retval #CONNECTION_ERROR_INVALID_PARAMETER     Invalid parameter
922  * @retval #CONNECTION_ERROR_OPERATION_FAILED      Operation failed
923  * @retval #CONNECTION_ERROR_PERMISSION_DENIED     Permission denied
924  * @retval #CONNECTION_ERROR_NOT_SUPPORTED         Not supported
925  */
926 int connection_set_default_cellular_service_profile_async(connection_h connection,
927                 connection_cellular_service_type_e type, connection_profile_h profile,
928                 connection_set_default_cb callback, void* user_data);
929
930
931 /**
932  * @brief Called after connection_open_profile() is finished.
933  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
934  * @param[in] result            The result
935  * @param[in] user_data         The user data passed from connection_open_profile()
936  * @pre connection_open_profile() will invoke this callback function.
937  * @see connection_open_profile()
938 */
939 typedef void(*connection_opened_cb)(connection_error_e result, void* user_data);
940
941
942 /**
943  * @brief Called after connection_close_profile() is finished.
944  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
945  * @param[in] result            The result
946  * @param[in] user_data         The user data passed from connection_close_profile()
947  * @pre connection_close_profile() will invoke this callback function.
948  * @see connection_close_profile()
949 */
950 typedef void(*connection_closed_cb)(connection_error_e result, void* user_data);
951
952
953 /**
954  * @brief Called after connection_reset_profile() is finished.
955  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
956  * @param[in] result            The result
957  * @param[in] user_data         The user data passed from connection_reset_profile()
958  * @pre connection_reset_profile() will invoke this callback function.
959  * @see connection_reset_profile()
960 */
961 typedef void(*connection_reset_cb)(connection_error_e result, void* user_data);
962
963
964 /**
965  * @brief Opens a connection of profile, asynchronously.
966  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
967  * @privlevel public
968  * @privilege %http://tizen.org/privilege/network.set \n
969  *            %http://tizen.org/privilege/network.get
970  * @remarks This API needs both privileges.
971  * @param[in] connection        The connection handle
972  * @param[in] profile           The profile handle
973  * @param[in] callback          The callback function to be called
974  * @param[in] user_data         The user data passed to the callback function
975  * @return @c 0 on success,
976  *         otherwise a negative error value
977  * @retval #CONNECTION_ERROR_NONE                  Successful
978  * @retval #CONNECTION_ERROR_INVALID_PARAMETER     Invalid parameter
979  * @retval #CONNECTION_ERROR_OPERATION_FAILED      Operation failed
980  * @retval #CONNECTION_ERROR_PERMISSION_DENIED     Permission denied
981  * @post connection_opened_cb() will be invoked.
982  * @see connection_opened_cb()
983  * @see connection_close_profile()
984  * @see connection_profile_set_state_changed_cb()
985  * @see connection_profile_unset_state_changed_cb()
986  * @see connection_profile_state_changed_cb()
987  */
988 int connection_open_profile(connection_h connection, connection_profile_h profile,
989                 connection_opened_cb callback, void* user_data);
990
991
992 /**
993  * @brief Closes a connection of profile.
994  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
995  * @privlevel public
996  * @privilege %http://tizen.org/privilege/network.set
997  * @param[in] connection        The connection handle
998  * @param[in] profile           The profile handle
999  * @param[in] callback          The callback function to be called
1000  * @param[in] user_data         The user data passed to the callback function
1001  * @return @c 0 on success,
1002  *         otherwise a negative error value
1003  * @retval #CONNECTION_ERROR_NONE                  Successful
1004  * @retval #CONNECTION_ERROR_INVALID_PARAMETER     Invalid parameter
1005  * @retval #CONNECTION_ERROR_OPERATION_FAILED      Operation failed
1006  * @retval #CONNECTION_ERROR_PERMISSION_DENIED     Permission denied
1007  * @post connection_closed_cb() will be invoked.
1008  * @see connection_closed_cb()
1009  * @see connection_open_profile()
1010  * @see connection_profile_set_state_changed_cb()
1011  * @see connection_profile_unset_state_changed_cb()
1012  * @see connection_profile_state_changed_cb()
1013  */
1014 int connection_close_profile(connection_h connection, connection_profile_h profile,
1015                 connection_closed_cb callback, void* user_data);
1016
1017
1018 /**
1019  * @brief Resets the cellular profile.
1020  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
1021  * @privlevel public
1022  * @privilege %http://tizen.org/privilege/network.profile \n
1023  *                %http://tizen.org/privilege/network.get
1024  * @remarks This API needs both privileges.
1025  * @param[in] connection        The connection handle
1026  * @param[in] type              The type of reset
1027  * @param[in] id                The subscriber identity module ID to reset
1028  *                              (The sim index starts from 0.)
1029  * @param[in] callback          The callback function to be called
1030  * @param[in] user_data         The user data passed to the callback function
1031  * @return @c 0 on success,
1032  *         otherwise a negative error value
1033  * @retval #CONNECTION_ERROR_NONE                  Successful
1034  * @retval #CONNECTION_ERROR_INVALID_PARAMETER     Invalid parameter
1035  * @retval #CONNECTION_ERROR_OPERATION_FAILED      Operation failed
1036  * @retval #CONNECTION_ERROR_PERMISSION_DENIED     Permission denied
1037  * @retval #CONNECTION_ERROR_NOT_SUPPORTED         Not supported
1038  * @post connection_reset_cb() will be invoked.
1039 */
1040 int connection_reset_profile(connection_h connection, connection_reset_option_e type,
1041                 int id, connection_reset_cb callback, void *user_data);
1042
1043
1044 /**
1045  * @brief Adds a IPv4 route to the routing table.
1046  * @details You can get the @a interface_name from
1047  *          connection_profile_get_network_interface_name() of opened profile.
1048  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
1049  * @privlevel public
1050  * @privilege %http://tizen.org/privilege/network.set
1051  * @param[in] connection        The connection handle
1052  * @param[in] interface_name    The name of network interface
1053  * @param[in] host_address      The IP address of the host
1054  * @return @c 0 on success,
1055  *         otherwise a negative error value
1056  * @retval #CONNECTION_ERROR_NONE                  Successful
1057  * @retval #CONNECTION_ERROR_INVALID_PARAMETER     Invalid parameter
1058  * @retval #CONNECTION_ERROR_ALREADY_EXISTS        Already exists
1059  * @retval #CONNECTION_ERROR_OPERATION_FAILED      Operation failed
1060  * @retval #CONNECTION_ERROR_PERMISSION_DENIED     Permission denied
1061  * @see connection_profile_get_network_interface_name()
1062  */
1063 int connection_add_route(connection_h connection, const char* interface_name,
1064                 const char* host_address) TIZEN_DEPRECATED_API;
1065
1066
1067 /**
1068  * @deprecated Deprecated since 4.0. Use connection_remove_route_entry() instead.
1069  * @brief Removes a IPv4 route from the routing table.
1070  * @details You can get the @a interface_name from
1071  *          connection_profile_get_network_interface_name() of opened profile.
1072  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
1073  * @privlevel public
1074  * @privilege %http://tizen.org/privilege/network.set
1075  * @param[in] connection        The connection handle
1076  * @param[in] interface_name    The name of network interface
1077  * @param[in] host_address      The IP address of the host
1078  * @return @c 0 on success,
1079  *         otherwise a negative error value
1080  * @retval #CONNECTION_ERROR_NONE                  Successful
1081  * @retval #CONNECTION_ERROR_INVALID_PARAMETER     Invalid parameter
1082  * @retval #CONNECTION_ERROR_OPERATION_FAILED      Operation failed
1083  * @retval #CONNECTION_ERROR_PERMISSION_DENIED     Permission denied
1084  * @see connection_profile_get_network_interface_name()
1085  */
1086 int connection_remove_route(connection_h connection, const char* interface_name, const char* host_address);
1087
1088
1089 /**
1090  * @deprecated Deprecated since 4.0. Use connection_add_route_entry() instead.
1091  * @brief Adds a IPv6 route to the routing table.
1092  * @details You can get the @a interface_name from
1093  *          connection_profile_get_network_interface_name() of opened profile.
1094  * @since_tizen 2.3.1
1095  * @privlevel public
1096  * @privilege %http://tizen.org/privilege/network.set
1097  * @param[in] connection        The connection handle
1098  * @param[in] interface_name    The name of network interface
1099  * @param[in] host_address      The IP address of the host
1100  * @param[in] gateway           The gateway address
1101  * @return @c 0 on success,
1102  *         otherwise a negative error value
1103  * @retval #CONNECTION_ERROR_NONE                  Successful
1104  * @retval #CONNECTION_ERROR_INVALID_PARAMETER     Invalid parameter
1105  * @retval #CONNECTION_ERROR_ALREADY_EXISTS        Already exists
1106  * @retval #CONNECTION_ERROR_OPERATION_FAILED      Operation failed
1107  * @retval #CONNECTION_ERROR_PERMISSION_DENIED     Permission denied
1108  * @see connection_profile_get_network_interface_name()
1109  */
1110 int connection_add_route_ipv6(connection_h connection, const char *interface_name,
1111                 const char *host_address, const char * gateway) TIZEN_DEPRECATED_API;
1112
1113
1114 /**
1115  * @deprecated Deprecated since 4.0. Use connection_remove_route_entry() instead.
1116  * @brief Removes a IPV6 route from the routing table.
1117  * @details You can get the @a interface_name from
1118  *          connection_profile_get_network_interface_name() of opened profile.
1119  * @since_tizen 2.3.1
1120  * @privlevel public
1121  * @privilege %http://tizen.org/privilege/network.set
1122  * @param[in] connection        The connection handle
1123  * @param[in] interface_name    The name of network interface
1124  * @param[in] host_address      The IP address of the host
1125  * @param[in] gateway           The gateway address
1126  * @return @c 0 on success,
1127  *         otherwise a negative error value
1128  * @retval #CONNECTION_ERROR_NONE                  Successful
1129  * @retval #CONNECTION_ERROR_INVALID_PARAMETER     Invalid parameter
1130  * @retval #CONNECTION_ERROR_OPERATION_FAILED      Operation failed
1131  * @retval #CONNECTION_ERROR_PERMISSION_DENIED     Permission denied
1132  * @see connection_profile_get_network_interface_name()
1133  */
1134 int connection_remove_route_ipv6(connection_h connection, const char *interface_name,
1135                 const char *host_address, const char * gateway) TIZEN_DEPRECATED_API;
1136
1137 /**
1138  * @brief Adds a route to the routing table.
1139  * @details You can get the @a interface_name from \n
1140  *          connection_profile_get_network_interface_name() of opened profile.
1141  * @since_tizen 4.0
1142  * @privlevel public
1143  * @privilege %http://tizen.org/privilege/network.set
1144  * @param[in] connection        The connection handle
1145  * @param[in] address_family    The address family
1146  * @param[in] interface_name    The name of network interface
1147  * @param[in] host_address      The IP address of the host (e.g., single IP address such as
1148  *            163.152.10.2,192.168.1.2), group's IP address (e.g., 163.152.10.0, 192.168.0.0)
1149  *            is not allowed
1150  * @param[in] gateway           The gateway address
1151  * @return @c 0 on success,
1152  *         otherwise a negative error value
1153  * @retval #CONNECTION_ERROR_NONE                  Successful
1154  * @retval #CONNECTION_ERROR_INVALID_PARAMETER     Invalid parameter
1155  * @retval #CONNECTION_ERROR_ALREADY_EXISTS        Already exists
1156  * @retval #CONNECTION_ERROR_OPERATION_FAILED      Operation failed
1157  * @retval #CONNECTION_ERROR_PERMISSION_DENIED     Permission denied
1158  * @see connection_profile_get_network_interface_name()
1159  */
1160 int connection_add_route_entry(connection_h connection,
1161                 connection_address_family_e address_family, const char *interface_name,
1162                 const char *host_address, const char *gateway);
1163
1164 /**
1165  * @brief Removes a route from the routing table.
1166  * @details You can get the @a interface_name from \n
1167  *          connection_profile_get_network_interface_name() of opened profile.
1168  * @since_tizen 4.0
1169  * @privlevel public
1170  * @privilege %http://tizen.org/privilege/network.set
1171  * @param[in] connection        The connection handle
1172  * @param[in] address_family    The address family
1173  * @param[in] interface_name    The name of network interface
1174  * @param[in] host_address      The IP address of the host (e.g., single IP address such as
1175  *            163.152.10.2,192.168.1.2), group's IP address (e.g., 163.152.10.0, 192.168.0.0)
1176  *            is not allowed
1177  * @param[in] gateway           The gateway address
1178  * @return @c 0 on success,
1179  *         otherwise a negative error value
1180  * @retval #CONNECTION_ERROR_NONE                  Successful
1181  * @retval #CONNECTION_ERROR_INVALID_PARAMETER     Invalid parameter
1182  * @retval #CONNECTION_ERROR_OPERATION_FAILED      Operation failed
1183  * @retval #CONNECTION_ERROR_PERMISSION_DENIED     Permission denied
1184  * @see connection_profile_get_network_interface_name()
1185  */
1186 int connection_remove_route_entry(connection_h connection,
1187                 connection_address_family_e address_family, const char *interface_name,
1188                 const char *host_address, const char *gateway);
1189
1190 /**
1191  * @brief Gets all IPv6 addresses assigned to the network interface.
1192  * @since_tizen 4.0
1193  * @param[in] connection       The connection handle
1194  * @param[in] connection_type  The connection type
1195  * @param[in] callback         The callback to be called for each IPv6 address
1196  * @param[in] user_data        The user data passed to the callback function
1197  * @return 0 on success, otherwise negative error value.
1198  * @retval #CONNECTION_ERROR_NONE               Successful
1199  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
1200  * @retval #CONNECTION_ERROR_OPERATION_FAILED   Operation failed
1201  * @retval #CONNECTION_ERROR_NOT_SUPPORTED      Not supported
1202  */
1203 int connection_foreach_ipv6_address(connection_h connection, connection_type_e connection_type,
1204                 connection_ipv6_address_cb callback, void *user_data);
1205
1206 /**
1207  * @}
1208 */
1209
1210
1211 /**
1212  * @addtogroup CAPI_NETWORK_CONNECTION_STATISTICS_MODULE
1213  * @{
1214 */
1215
1216
1217 /**
1218  * @brief Gets the statistics information.
1219  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
1220  * @privlevel public
1221  * @privilege %http://tizen.org/privilege/network.get
1222  * @param[in] connection The connection handle
1223  * @param[in] connection_type   The type of connection \n
1224  *            Only CONNECTION_TYPE_WIFI and CONNECTION_TYPE_CELLULAR are supported
1225  * @param[in] statistics_type   The type of statistics
1226  * @param[out] size             The received data size of the last cellular packet data connection (bytes)
1227  * @return @c 0 on success,
1228  *         otherwise a negative error value
1229  * @retval #CONNECTION_ERROR_NONE                  Successful
1230  * @retval #CONNECTION_ERROR_INVALID_PARAMETER     Invalid parameter
1231  * @retval #CONNECTION_ERROR_OPERATION_FAILED      Operation failed
1232  * @retval #CONNECTION_ERROR_PERMISSION_DENIED     Permission denied
1233  * @retval #CONNECTION_ERROR_NOT_SUPPORTED         Not supported
1234  */
1235 int connection_get_statistics(connection_h connection, connection_type_e connection_type,
1236                 connection_statistics_type_e statistics_type, long long* size);
1237
1238
1239 /**
1240  * @brief Resets the statistics information.
1241  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
1242  * @privlevel public
1243  * @privilege %http://tizen.org/privilege/network.set
1244  * @param[in] connection        The connection handle
1245  * @param[in] connection_type   The type of connection \n
1246  *            Only CONNECTION_TYPE_WIFI and CONNECTION_TYPE_CELLULAR are supported
1247  * @param[in] statistics_type   The type of statistics
1248  * @return @c 0 on success,
1249  *         otherwise a negative error value
1250  * @retval #CONNECTION_ERROR_NONE                  Successful
1251  * @retval #CONNECTION_ERROR_INVALID_PARAMETER     Invalid parameter
1252  * @retval #CONNECTION_ERROR_OPERATION_FAILED      Operation failed
1253  * @retval #CONNECTION_ERROR_PERMISSION_DENIED     Permission denied
1254  * @retval #CONNECTION_ERROR_NOT_SUPPORTED         Not supported
1255  */
1256 int connection_reset_statistics(connection_h connection, connection_type_e connection_type,
1257                 connection_statistics_type_e statistics_type);
1258 /**
1259  * @}
1260 */
1261
1262
1263 #ifdef __cplusplus
1264 }
1265 #endif /* __cplusplus */
1266
1267
1268 #endif