Add missing description for doxygen doc
[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  * @remarks The @a profile will be destroyed automatically when the profile iterator is destroyed.
852  *          Make a copy if you want to keep using it.
853  * @param[in] profile_iterator  The iterator of profile
854  * @param[out] profile          The profile handle
855  * @return @c 0 on success,
856  *         otherwise a negative error value
857  * @retval #CONNECTION_ERROR_NONE                  Successful
858  * @retval #CONNECTION_ERROR_NOT_INITIALIZED       Not initialized
859  * @retval #CONNECTION_ERROR_INVALID_PARAMETER     Invalid parameter
860  * @retval #CONNECTION_ERROR_ITERATOR_END          End of iteration
861  * @retval #CONNECTION_ERROR_NOT_SUPPORTED         Not supported
862  */
863 int connection_profile_iterator_next(connection_profile_iterator_h profile_iterator,
864                 connection_profile_h* profile);
865
866
867 /**
868  * @brief Checks whether the next element of a profile iterator exists or not.
869  * @since_tizen 2.3
870  * @remarks The specific error code can be obtained using the get_last_result() method.
871  *          Error codes are described in Exception section.
872  * @param[in] profile_iterator  The iterator of profile
873  * @return @c true if next element exists,
874  *         otherwise @c false if next element doesn't exist
875  * @exception #CONNECTION_ERROR_NONE                  Successful
876  * @retval #CONNECTION_ERROR_NOT_INITIALIZED          Not initialized
877  * @exception #CONNECTION_ERROR_NOT_SUPPORTED         Not supported
878  * @see get_last_result()
879  */
880 bool connection_profile_iterator_has_next(connection_profile_iterator_h profile_iterator);
881
882
883 /**
884  * @brief Destroys a profiles iterator.
885  * @since_tizen 2.3
886  * @param[in] profile_iterator  The iterator of the profile
887  * @return @c 0 on success,
888  *         otherwise a negative error value
889  * @retval #CONNECTION_ERROR_NONE                  Successful
890  * @retval #CONNECTION_ERROR_NOT_INITIALIZED       Not initialized
891  * @retval #CONNECTION_ERROR_INVALID_PARAMETER     Invalid parameter
892  * @retval #CONNECTION_ERROR_NOT_SUPPORTED         Not supported
893  */
894 int connection_destroy_profile_iterator(connection_profile_iterator_h profile_iterator);
895
896
897 /**
898  * @brief Gets the name of the default profile.
899  * @since_tizen 2.3
900  * @privlevel public
901  * @privilege %http://tizen.org/privilege/network.get
902  * @remarks You must release @a profile using connection_profile_destroy().
903  * @param[in] connection        The connection handle
904  * @param[out] profile          The profile handle
905  * @return @c 0 on success,
906  *         otherwise a negative error value
907  * @retval #CONNECTION_ERROR_NONE                  Successful
908  * @retval #CONNECTION_ERROR_NOT_INITIALIZED       Not initialized
909  * @retval #CONNECTION_ERROR_INVALID_PARAMETER     Invalid parameter
910  * @retval #CONNECTION_ERROR_OUT_OF_MEMORY         Out of memory
911  * @retval #CONNECTION_ERROR_OPERATION_FAILED      Operation failed
912  * @retval #CONNECTION_ERROR_NO_CONNECTION         There is no connection
913  * @retval #CONNECTION_ERROR_PERMISSION_DENIED     Permission denied
914  * @retval #CONNECTION_ERROR_NOT_SUPPORTED         Not supported
915  */
916 int connection_get_current_profile(connection_h connection, connection_profile_h* profile);
917
918
919 /**
920  * @brief Gets the default profile which provides the given cellular service.
921  * @since_tizen 2.3
922  * @privlevel public
923  * @privilege %http://tizen.org/privilege/network.get
924  * @remarks You must release @a profile using connection_profile_destroy().
925  * @param[in] connection        The connection handle
926  * @param[in] type              The type of cellular service \n
927  *            #CONNECTION_CELLULAR_SERVICE_TYPE_APPLICATION is not permitted
928  * @param[out] profile          The profile handle
929  * @return @c 0 on success,
930  *         otherwise a negative error value
931  * @retval #CONNECTION_ERROR_NONE                  Successful
932  * @retval #CONNECTION_ERROR_NOT_INITIALIZED       Not initialized
933  * @retval #CONNECTION_ERROR_INVALID_PARAMETER     Invalid parameter
934  * @retval #CONNECTION_ERROR_OUT_OF_MEMORY         Out of memory
935  * @retval #CONNECTION_ERROR_OPERATION_FAILED      Operation failed
936  * @retval #CONNECTION_ERROR_PERMISSION_DENIED     Permission denied
937  * @retval #CONNECTION_ERROR_NOT_SUPPORTED         Not supported
938  */
939 int connection_get_default_cellular_service_profile(connection_h connection,
940                 connection_cellular_service_type_e type, connection_profile_h* profile);
941
942
943 /**
944  * @brief Sets the default profile which provides the given cellular service.
945  * @since_tizen 2.3
946  * @privlevel public
947  * @privilege %http://tizen.org/privilege/network.profile \n
948  *            %http://tizen.org/privilege/network.get
949  * @remarks This function needs both privileges.
950  * @param[in] connection        The connection handle
951  * @param[in] type              The type of cellular service \n
952  *            Only #CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET and
953  *            #CONNECTION_CELLULAR_SERVICE_TYPE_PREPAID_INTERNET are permitted
954  * @param[in] profile           The profile handle
955  * @return @c 0 on success,
956  *         otherwise a negative error value
957  * @retval #CONNECTION_ERROR_NONE                  Successful
958  * @retval #CONNECTION_ERROR_NOT_INITIALIZED       Not initialized
959  * @retval #CONNECTION_ERROR_INVALID_PARAMETER     Invalid parameter
960  * @retval #CONNECTION_ERROR_OPERATION_FAILED      Operation failed
961  * @retval #CONNECTION_ERROR_PERMISSION_DENIED     Permission denied
962  * @retval #CONNECTION_ERROR_NOT_SUPPORTED         Not supported
963  */
964 int connection_set_default_cellular_service_profile(connection_h connection,
965                 connection_cellular_service_type_e type, connection_profile_h profile);
966
967
968 /**
969  * @brief Sets the default profile which provides the given cellular service, asynchronously.
970  * @since_tizen 2.3
971  * @privlevel public
972  * @privilege %http://tizen.org/privilege/network.profile \n
973  *                %http://tizen.org/privilege/network.get
974  * @remarks This function needs both privileges.
975  * @param[in] connection        The connection handle
976  * @param[in] type              The type of cellular service \n
977  *            Only #CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET and
978  *            #CONNECTION_CELLULAR_SERVICE_TYPE_PREPAID_INTERNET are permitted
979  * @param[in] profile The profile handle
980  * @param[in] callback The callback function to be called
981  * @param[in] user_data The user data passed to the callback function
982  * @return @c 0 on success,
983  *         otherwise a negative error value
984  * @retval #CONNECTION_ERROR_NONE                  Successful
985  * @retval #CONNECTION_ERROR_NOT_INITIALIZED       Not initialized
986  * @retval #CONNECTION_ERROR_INVALID_PARAMETER     Invalid parameter
987  * @retval #CONNECTION_ERROR_OPERATION_FAILED      Operation failed
988  * @retval #CONNECTION_ERROR_PERMISSION_DENIED     Permission denied
989  * @retval #CONNECTION_ERROR_NOT_SUPPORTED         Not supported
990  */
991 int connection_set_default_cellular_service_profile_async(connection_h connection,
992                 connection_cellular_service_type_e type, connection_profile_h profile,
993                 connection_set_default_cb callback, void* user_data);
994
995
996 /**
997  * @brief Called after connection_open_profile() is finished.
998  * @since_tizen 2.3
999  * @param[in] result            The result
1000  * @param[in] user_data         The user data passed from connection_open_profile()
1001  * @pre connection_open_profile() will invoke this callback function.
1002  * @see connection_open_profile()
1003 */
1004 typedef void(*connection_opened_cb)(connection_error_e result, void* user_data);
1005
1006
1007 /**
1008  * @brief Called after connection_close_profile() is finished.
1009  * @since_tizen 2.3
1010  * @param[in] result            The result
1011  * @param[in] user_data         The user data passed from connection_close_profile()
1012  * @pre connection_close_profile() will invoke this callback function.
1013  * @see connection_close_profile()
1014 */
1015 typedef void(*connection_closed_cb)(connection_error_e result, void* user_data);
1016
1017
1018 /**
1019  * @brief Called after connection_reset_profile() is finished.
1020  * @since_tizen 2.3
1021  * @param[in] result            The result
1022  * @param[in] user_data         The user data passed from connection_reset_profile()
1023  * @pre connection_reset_profile() will invoke this callback function.
1024  * @see connection_reset_profile()
1025 */
1026 typedef void(*connection_reset_cb)(connection_error_e result, void* user_data);
1027
1028
1029 /**
1030  * @brief Opens a connection of profile, asynchronously.
1031  * @since_tizen 2.3
1032  * @privlevel public
1033  * @privilege %http://tizen.org/privilege/network.set \n
1034  *            %http://tizen.org/privilege/network.get
1035  * @remarks This function needs both privileges.
1036  * @param[in] connection        The connection handle
1037  * @param[in] profile           The profile handle
1038  * @param[in] callback          The callback function to be called
1039  * @param[in] user_data         The user data passed to the callback function
1040  * @return @c 0 on success,
1041  *         otherwise a negative error value
1042  * @retval #CONNECTION_ERROR_NONE                  Successful
1043  * @retval #CONNECTION_ERROR_NOT_INITIALIZED       Not initialized
1044  * @retval #CONNECTION_ERROR_INVALID_PARAMETER     Invalid parameter
1045  * @retval #CONNECTION_ERROR_OPERATION_FAILED      Operation failed
1046  * @retval #CONNECTION_ERROR_PERMISSION_DENIED     Permission denied
1047  * @retval #CONNECTION_ERROR_NOT_SUPPORTED         Not supported
1048  * @post connection_opened_cb() will be invoked.
1049  * @see connection_opened_cb()
1050  * @see connection_close_profile()
1051  * @see connection_profile_set_state_changed_cb()
1052  * @see connection_profile_unset_state_changed_cb()
1053  * @see connection_profile_state_changed_cb()
1054  */
1055 int connection_open_profile(connection_h connection, connection_profile_h profile,
1056                 connection_opened_cb callback, void* user_data);
1057
1058
1059 /**
1060  * @brief Closes a connection of profile.
1061  * @since_tizen 2.3
1062  * @privlevel public
1063  * @privilege %http://tizen.org/privilege/network.set
1064  * @param[in] connection        The connection handle
1065  * @param[in] profile           The profile handle
1066  * @param[in] callback          The callback function to be called
1067  * @param[in] user_data         The user data passed to the callback function
1068  * @return @c 0 on success,
1069  *         otherwise a negative error value
1070  * @retval #CONNECTION_ERROR_NONE                  Successful
1071  * @retval #CONNECTION_ERROR_NOT_INITIALIZED       Not initialized
1072  * @retval #CONNECTION_ERROR_INVALID_PARAMETER     Invalid parameter
1073  * @retval #CONNECTION_ERROR_OPERATION_FAILED      Operation failed
1074  * @retval #CONNECTION_ERROR_PERMISSION_DENIED     Permission denied
1075  * @retval #CONNECTION_ERROR_NOT_SUPPORTED         Not supported
1076  * @post connection_closed_cb() will be invoked.
1077  * @see connection_closed_cb()
1078  * @see connection_open_profile()
1079  * @see connection_profile_set_state_changed_cb()
1080  * @see connection_profile_unset_state_changed_cb()
1081  * @see connection_profile_state_changed_cb()
1082  */
1083 int connection_close_profile(connection_h connection, connection_profile_h profile,
1084                 connection_closed_cb callback, void* user_data);
1085
1086
1087 /**
1088  * @brief Resets the cellular profile.
1089  * @since_tizen 2.3
1090  * @privlevel public
1091  * @privilege %http://tizen.org/privilege/network.profile \n
1092  *                %http://tizen.org/privilege/network.get
1093  * @remarks This function needs both privileges.
1094  * @param[in] connection        The connection handle
1095  * @param[in] type              The type of reset
1096  * @param[in] id                The subscriber identity module ID to reset
1097  *                              (The sim index starts from 0.)
1098  * @param[in] callback          The callback function to be called
1099  * @param[in] user_data         The user data passed to the callback function
1100  * @return @c 0 on success,
1101  *         otherwise a negative error value
1102  * @retval #CONNECTION_ERROR_NONE                  Successful
1103  * @retval #CONNECTION_ERROR_NOT_INITIALIZED       Not initialized
1104  * @retval #CONNECTION_ERROR_INVALID_PARAMETER     Invalid parameter
1105  * @retval #CONNECTION_ERROR_OPERATION_FAILED      Operation failed
1106  * @retval #CONNECTION_ERROR_PERMISSION_DENIED     Permission denied
1107  * @retval #CONNECTION_ERROR_NOT_SUPPORTED         Not supported
1108  * @post connection_reset_cb() will be invoked.
1109 */
1110 int connection_reset_profile(connection_h connection, connection_reset_option_e type,
1111                 int id, connection_reset_cb callback, void *user_data);
1112
1113
1114 /**
1115  * @platform
1116  * @deprecated Deprecated since 4.0. Use connection_add_route_entry() instead.
1117  * @brief Adds a IPv4 route to the routing table.
1118  * @details You can get the @a interface_name from
1119  *          connection_profile_get_network_interface_name() of opened profile.
1120  * @since_tizen 2.3
1121  * @privlevel partner
1122  * @privilege %http://tizen.org/privilege/network.route
1123  * @remarks Since 6.0, the required privilege and level of this function has changed.
1124  * @param[in] connection        The connection handle
1125  * @param[in] interface_name    The name of network interface
1126  * @param[in] host_address      The IP address of the host
1127  * @return @c 0 on success,
1128  *         otherwise a negative error value
1129  * @retval #CONNECTION_ERROR_NONE                  Successful
1130  * @retval #CONNECTION_ERROR_NOT_INITIALIZED       Not initialized
1131  * @retval #CONNECTION_ERROR_INVALID_PARAMETER     Invalid parameter
1132  * @retval #CONNECTION_ERROR_ALREADY_EXISTS        Already exists
1133  * @retval #CONNECTION_ERROR_OPERATION_FAILED      Operation failed
1134  * @retval #CONNECTION_ERROR_PERMISSION_DENIED     Permission denied
1135  * @retval #CONNECTION_ERROR_NOT_SUPPORTED         Not supported
1136  * @see connection_profile_get_network_interface_name()
1137  */
1138 int connection_add_route(connection_h connection, const char* interface_name,
1139                 const char* host_address) TIZEN_DEPRECATED_API;
1140
1141
1142 /**
1143  * @platform
1144  * @deprecated Deprecated since 4.0. Use connection_remove_route_entry() instead.
1145  * @brief Removes a IPv4 route from the routing table.
1146  * @details You can get the @a interface_name from
1147  *          connection_profile_get_network_interface_name() of opened profile.
1148  * @since_tizen 2.3
1149  * @privlevel partner
1150  * @privilege %http://tizen.org/privilege/network.route
1151  * @remarks Since 6.0, the required privilege and level of this function has changed.
1152  * @param[in] connection        The connection handle
1153  * @param[in] interface_name    The name of network interface
1154  * @param[in] host_address      The IP address of the host
1155  * @return @c 0 on success,
1156  *         otherwise a negative error value
1157  * @retval #CONNECTION_ERROR_NONE                  Successful
1158  * @retval #CONNECTION_ERROR_NOT_INITIALIZED       Not initialized
1159  * @retval #CONNECTION_ERROR_INVALID_PARAMETER     Invalid parameter
1160  * @retval #CONNECTION_ERROR_OPERATION_FAILED      Operation failed
1161  * @retval #CONNECTION_ERROR_PERMISSION_DENIED     Permission denied
1162  * @retval #CONNECTION_ERROR_NOT_SUPPORTED         Not supported
1163  * @see connection_profile_get_network_interface_name()
1164  */
1165 int connection_remove_route(connection_h connection, const char* interface_name,
1166                 const char* host_address) TIZEN_DEPRECATED_API;
1167
1168
1169 /**
1170  * @platform
1171  * @deprecated Deprecated since 4.0. Use connection_add_route_entry() instead.
1172  * @brief Adds a IPv6 route to the routing table.
1173  * @details You can get the @a interface_name from
1174  *          connection_profile_get_network_interface_name() of opened profile.
1175  * @since_tizen 2.3.1
1176  * @privlevel partner
1177  * @privilege %http://tizen.org/privilege/network.route
1178  * @remarks Since 6.0, the required privilege and level of this function has changed.
1179  * @param[in] connection        The connection handle
1180  * @param[in] interface_name    The name of network interface
1181  * @param[in] host_address      The IP address of the host
1182  * @param[in] gateway           The gateway address
1183  * @return @c 0 on success,
1184  *         otherwise a negative error value
1185  * @retval #CONNECTION_ERROR_NONE                  Successful
1186  * @retval #CONNECTION_ERROR_NOT_INITIALIZED       Not initialized
1187  * @retval #CONNECTION_ERROR_INVALID_PARAMETER     Invalid parameter
1188  * @retval #CONNECTION_ERROR_ALREADY_EXISTS        Already exists
1189  * @retval #CONNECTION_ERROR_OPERATION_FAILED      Operation failed
1190  * @retval #CONNECTION_ERROR_PERMISSION_DENIED     Permission denied
1191  * @retval #CONNECTION_ERROR_NOT_SUPPORTED         Not supported
1192  * @see connection_profile_get_network_interface_name()
1193  */
1194 int connection_add_route_ipv6(connection_h connection, const char *interface_name,
1195                 const char *host_address, const char * gateway) TIZEN_DEPRECATED_API;
1196
1197
1198 /**
1199  * @platform
1200  * @deprecated Deprecated since 4.0. Use connection_remove_route_entry() instead.
1201  * @brief Removes a IPV6 route from the routing table.
1202  * @details You can get the @a interface_name from
1203  *          connection_profile_get_network_interface_name() of opened profile.
1204  * @since_tizen 2.3.1
1205  * @privlevel partner
1206  * @privilege %http://tizen.org/privilege/network.route
1207  * @remarks Since 6.0, the required privilege and level of this function has changed.
1208  * @param[in] connection        The connection handle
1209  * @param[in] interface_name    The name of network interface
1210  * @param[in] host_address      The IP address of the host
1211  * @param[in] gateway           The gateway address
1212  * @return @c 0 on success,
1213  *         otherwise a negative error value
1214  * @retval #CONNECTION_ERROR_NONE                  Successful
1215  * @retval #CONNECTION_ERROR_NOT_INITIALIZED       Not initialized
1216  * @retval #CONNECTION_ERROR_INVALID_PARAMETER     Invalid parameter
1217  * @retval #CONNECTION_ERROR_OPERATION_FAILED      Operation failed
1218  * @retval #CONNECTION_ERROR_PERMISSION_DENIED     Permission denied
1219  * @retval #CONNECTION_ERROR_NOT_SUPPORTED         Not supported
1220  * @see connection_profile_get_network_interface_name()
1221  */
1222 int connection_remove_route_ipv6(connection_h connection, const char *interface_name,
1223                 const char *host_address, const char * gateway) TIZEN_DEPRECATED_API;
1224
1225 /**
1226  * @platform
1227  * @brief Adds a route to the routing table.
1228  * @details You can get the @a interface_name from \n
1229  *          connection_profile_get_network_interface_name() of opened profile.
1230  * @since_tizen 4.0
1231  * @privlevel partner
1232  * @privilege %http://tizen.org/privilege/network.route
1233  * @remarks Since 6.0, the required privilege and level of this function has changed.
1234  * @param[in] connection        The connection handle
1235  * @param[in] address_family    The address family
1236  * @param[in] interface_name    The name of network interface
1237  * @param[in] host_address      The IP address of the host (e.g., single IP address such as
1238  *            163.152.10.2,192.168.1.2), group's IP address (e.g., 163.152.10.0, 192.168.0.0)
1239  *            is not allowed
1240  * @param[in] gateway           The gateway address
1241  * @return @c 0 on success,
1242  *         otherwise a negative error value
1243  * @retval #CONNECTION_ERROR_NONE                  Successful
1244  * @retval #CONNECTION_ERROR_NOT_INITIALIZED       Not initialized
1245  * @retval #CONNECTION_ERROR_INVALID_PARAMETER     Invalid parameter
1246  * @retval #CONNECTION_ERROR_ALREADY_EXISTS        Already exists
1247  * @retval #CONNECTION_ERROR_OPERATION_FAILED      Operation failed
1248  * @retval #CONNECTION_ERROR_PERMISSION_DENIED     Permission denied
1249  * @retval #CONNECTION_ERROR_NOT_SUPPORTED         Not supported
1250  * @see connection_profile_get_network_interface_name()
1251  */
1252 int connection_add_route_entry(connection_h connection,
1253                 connection_address_family_e address_family, const char *interface_name,
1254                 const char *host_address, const char *gateway);
1255
1256 /**
1257  * @platform
1258  * @brief Removes a route from the routing table.
1259  * @details You can get the @a interface_name from \n
1260  *          connection_profile_get_network_interface_name() of opened profile.
1261  * @since_tizen 4.0
1262  * @privlevel partner
1263  * @privilege %http://tizen.org/privilege/network.route
1264  * @remarks Since 6.0, the required privilege and level of this function has changed.
1265  * @param[in] connection        The connection handle
1266  * @param[in] address_family    The address family
1267  * @param[in] interface_name    The name of network interface
1268  * @param[in] host_address      The IP address of the host (e.g., single IP address such as
1269  *            163.152.10.2,192.168.1.2), group's IP address (e.g., 163.152.10.0, 192.168.0.0)
1270  *            is not allowed
1271  * @param[in] gateway           The gateway address
1272  * @return @c 0 on success,
1273  *         otherwise a negative error value
1274  * @retval #CONNECTION_ERROR_NONE                  Successful
1275  * @retval #CONNECTION_ERROR_NOT_INITIALIZED       Not initialized
1276  * @retval #CONNECTION_ERROR_INVALID_PARAMETER     Invalid parameter
1277  * @retval #CONNECTION_ERROR_OPERATION_FAILED      Operation failed
1278  * @retval #CONNECTION_ERROR_PERMISSION_DENIED     Permission denied
1279  * @retval #CONNECTION_ERROR_NOT_SUPPORTED         Not supported
1280  * @see connection_profile_get_network_interface_name()
1281  */
1282 int connection_remove_route_entry(connection_h connection,
1283                 connection_address_family_e address_family, const char *interface_name,
1284                 const char *host_address, const char *gateway);
1285
1286 /**
1287  * @brief Gets all IPv6 addresses assigned to the network interface.
1288  * @since_tizen 4.0
1289  * @param[in] connection       The connection handle
1290  * @param[in] connection_type  The connection type
1291  * @param[in] callback         The callback to be called for each IPv6 address
1292  * @param[in] user_data        The user data passed to the callback function
1293  * @return 0 on success, otherwise negative error value.
1294  * @retval #CONNECTION_ERROR_NONE               Successful
1295  * @retval #CONNECTION_ERROR_NOT_INITIALIZED       Not initialized
1296  * @retval #CONNECTION_ERROR_INVALID_PARAMETER  Invalid parameter
1297  * @retval #CONNECTION_ERROR_OPERATION_FAILED   Operation failed
1298  * @retval #CONNECTION_ERROR_NOT_SUPPORTED      Not supported
1299  */
1300 int connection_foreach_ipv6_address(connection_h connection, connection_type_e connection_type,
1301                 connection_ipv6_address_cb callback, void *user_data);
1302
1303 /**
1304  * @}
1305 */
1306
1307
1308 /**
1309  * @addtogroup CAPI_NETWORK_CONNECTION_STATISTICS_MODULE
1310  * @{
1311 */
1312
1313
1314 /**
1315  * @brief Gets the statistics information.
1316  * @since_tizen 2.3
1317  * @privlevel public
1318  * @privilege %http://tizen.org/privilege/network.get
1319  * @param[in] connection The connection handle
1320  * @param[in] connection_type   The type of connection \n
1321  *            Only #CONNECTION_TYPE_WIFI and #CONNECTION_TYPE_CELLULAR are supported
1322  * @param[in] statistics_type   The type of statistics
1323  * @param[out] size             The received data size of the last cellular packet data connection (bytes)
1324  * @return @c 0 on success,
1325  *         otherwise a negative error value
1326  * @retval #CONNECTION_ERROR_NONE                  Successful
1327  * @retval #CONNECTION_ERROR_NOT_INITIALIZED       Not initialized
1328  * @retval #CONNECTION_ERROR_INVALID_PARAMETER     Invalid parameter
1329  * @retval #CONNECTION_ERROR_OPERATION_FAILED      Operation failed
1330  * @retval #CONNECTION_ERROR_PERMISSION_DENIED     Permission denied
1331  * @retval #CONNECTION_ERROR_NOT_SUPPORTED         Not supported
1332  */
1333 int connection_get_statistics(connection_h connection, connection_type_e connection_type,
1334                 connection_statistics_type_e statistics_type, long long* size);
1335
1336
1337 /**
1338  * @brief Resets the statistics information.
1339  * @since_tizen 2.3
1340  * @privlevel public
1341  * @privilege %http://tizen.org/privilege/network.set
1342  * @param[in] connection        The connection handle
1343  * @param[in] connection_type   The type of connection \n
1344  *            Only #CONNECTION_TYPE_WIFI and #CONNECTION_TYPE_CELLULAR are supported
1345  * @param[in] statistics_type   The type of statistics
1346  * @return @c 0 on success,
1347  *         otherwise a negative error value
1348  * @retval #CONNECTION_ERROR_NONE                  Successful
1349  * @retval #CONNECTION_ERROR_NOT_INITIALIZED       Not initialized
1350  * @retval #CONNECTION_ERROR_INVALID_PARAMETER     Invalid parameter
1351  * @retval #CONNECTION_ERROR_OPERATION_FAILED      Operation failed
1352  * @retval #CONNECTION_ERROR_PERMISSION_DENIED     Permission denied
1353  * @retval #CONNECTION_ERROR_NOT_SUPPORTED         Not supported
1354  */
1355 int connection_reset_statistics(connection_h connection, connection_type_e connection_type,
1356                 connection_statistics_type_e statistics_type);
1357 /**
1358  * @}
1359 */
1360
1361
1362 #ifdef __cplusplus
1363 }
1364 #endif /* __cplusplus */
1365
1366
1367 #endif /* __TIZEN_NETWORK_NET_CONNECTION_H__ */