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