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