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