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