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