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