2 * Copyright (c) 2011-2013 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 #ifndef __TIZEN_NETWORK_NET_CONNECTION_H__
19 #define __TIZEN_NETWORK_NET_CONNECTION_H__
22 #include <connection_profile.h>
27 #endif /* __cplusplus */
31 * @file net_connection.h
36 * @addtogroup CAPI_NETWORK_CONNECTION_MANAGER_MODULE
42 * @brief The connection handle.
43 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
45 typedef void* connection_h;
49 * @brief The profiles iterator handle.
50 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
52 typedef void* connection_profile_iterator_h;
56 * @brief Enumeration for connection type.
57 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
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) */
70 * @brief Enumeration for cellular network state.
71 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
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;
84 * @brief Enumeration for Wi-Fi state.
85 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
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;
95 * @brief Enumeration for ethernet state.
96 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
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;
106 * @brief Enumeration for Bluetooth state.
107 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
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;
117 * @brief Enumeration for connection iterator type.
118 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
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;
128 * @brief Enumeration for reset profile type.
129 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
133 * Initialized with the default profile defined by csc
135 CONNECTION_RESET_DEFAULT_PROFILE = 0,
138 * Remove all profiles
140 CONNECTION_RESET_CLEAR_PROFILE = 1,
142 } connection_reset_option_e;
146 * @brief Enumeration for the attached or detached state of ethernet cable.
147 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
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;
156 * @brief Enumeration for connection errors.
157 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
163 CONNECTION_ERROR_NONE = TIZEN_ERROR_NONE,
168 CONNECTION_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER,
171 * Out of memory error
173 CONNECTION_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY,
178 CONNECTION_ERROR_INVALID_OPERATION = TIZEN_ERROR_INVALID_OPERATION,
181 * Address family not supported
183 CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED = TIZEN_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED,
188 CONNECTION_ERROR_NOW_IN_PROGRESS = TIZEN_ERROR_NOW_IN_PROGRESS,
193 CONNECTION_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED,
198 CONNECTION_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED,
203 CONNECTION_ERROR_OPERATION_FAILED = TIZEN_ERROR_CONNECTION|0x0401,
208 CONNECTION_ERROR_ITERATOR_END = TIZEN_ERROR_CONNECTION|0x0402,
211 * There is no connection
213 CONNECTION_ERROR_NO_CONNECTION = TIZEN_ERROR_CONNECTION|0x0403,
218 CONNECTION_ERROR_ALREADY_EXISTS = TIZEN_ERROR_CONNECTION|0x0404,
221 * Operation is aborted
223 CONNECTION_ERROR_OPERATION_ABORTED = TIZEN_ERROR_CONNECTION|0x0405,
228 CONNECTION_ERROR_DHCP_FAILED = TIZEN_ERROR_CONNECTION|0x0406,
233 CONNECTION_ERROR_INVALID_KEY = TIZEN_ERROR_CONNECTION|0x0407,
238 CONNECTION_ERROR_NO_REPLY = TIZEN_ERROR_CONNECTION|0x0408,
241 * Already initialized (Since 5.0)
243 CONNECTION_ERROR_ALREADY_INITIALIZED = TIZEN_ERROR_CONNECTION|0x0409,
246 * Not initialized (Since 5.0)
248 CONNECTION_ERROR_NOT_INITIALIZED = TIZEN_ERROR_CONNECTION|0x040A,
250 } connection_error_e;
258 * @addtogroup CAPI_NETWORK_CONNECTION_STATISTICS_MODULE
264 * @brief Enumeration for statistics type.
265 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
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;
281 * @addtogroup CAPI_NETWORK_CONNECTION_MANAGER_MODULE
287 * @brief Creates a handle for managing data connections.
288 * @details If you do not use this function and use other functions,
289 * you will get the #CONNECTION_ERROR_NOT_INITIALIZED error.
290 * If you put an invalid handle, you will get the #CONNECTION_ERROR_INVALID_PARAMETER error.
291 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
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()
306 int connection_create(connection_h* connection);
310 * @brief Destroys the connection handle.
311 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
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()
321 int connection_destroy(connection_h connection);
325 * @brief Called when the type of a connection is changed.
326 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
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()
332 typedef void(*connection_type_changed_cb)(connection_type_e type, void* user_data);
336 * @brief Called when the address is changed.
337 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
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()
349 typedef void(*connection_address_changed_cb)(const char* ipv4_address,
350 const char* ipv6_address, void* user_data);
354 * @brief Called when connection_set_default_cellular_service_profile_async() finishes.
355 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
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()
361 typedef void(*connection_set_default_cb)(connection_error_e result, void* user_data);
364 * @brief Called with an IPv6 address.
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()
375 typedef bool(*connection_ipv6_address_cb)(char *ipv6_address, void *user_data);
378 * @brief Gets the type of the current profile for data connection.
379 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
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
390 int connection_get_type(connection_h connection, connection_type_e* type);
394 * @brief Gets the IP address of the current connection.
395 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
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
409 int connection_get_ip_address(connection_h connection,
410 connection_address_family_e address_family, char** ip_address);
414 * @brief Gets the proxy address of the current connection.
415 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
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
429 int connection_get_proxy(connection_h connection,
430 connection_address_family_e address_family, char** proxy);
434 * @brief Gets the MAC address of the Wi-Fi or ethernet.
435 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
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
450 int connection_get_mac_address(connection_h connection,
451 connection_type_e type, char** mac_addr);
455 * @brief Gets if the current connection is metered.
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
470 int connection_is_metered_network(connection_h connection, bool* is_metered);
474 * @brief Gets the state of cellular connection.
475 * @details The returned state is for the cellular connection state.
476 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
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
487 int connection_get_cellular_state(connection_h connection, connection_cellular_state_e* state);
491 * @brief Gets the state of the Wi-Fi.
492 * @details The returned state is for the Wi-Fi connection state.
493 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
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
507 int connection_get_wifi_state(connection_h connection, connection_wifi_state_e* state);
511 * @brief Gets the state of the Ethernet.
512 * @details The returned state is for the Ethernet connection state.
513 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
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
527 int connection_get_ethernet_state(connection_h connection, connection_ethernet_state_e* state);
530 * @brief Called when the Internet state of the current connection is changed.
532 * @param[in] state The Internet state of current connection
533 * @param[in] user_data The user data passed to callback registration function
535 typedef void(*connection_internet_state_changed_cb)(
536 connection_internet_state_e state, void* user_data);
539 * @brief Sets the callback that is called when the Internet availability over the current connection is changed.
541 * @param[in] connection The connection handle
542 * @param[in] callback The callback function to be called
543 * @param[in] user_data The user data passed to the callback function
544 * @return @c 0 on success,
545 * otherwise a negative error value
546 * @retval #CONNECTION_ERROR_NONE Successful
547 * @retval #CONNECTION_ERROR_NOT_INITIALIZED Not initialized
548 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
549 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
550 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
552 int connection_set_internet_state_changed_cb(connection_h connection,
553 connection_internet_state_changed_cb callback, void *user_data);
557 * @brief Unsets the callback that is called when the Internet state of the current connection is changed.
559 * @param[in] connection The connection handle
560 * @return @c 0 on success,
561 * otherwise a negative error value
562 * @retval #CONNECTION_ERROR_NONE Successful
563 * @retval #CONNECTION_ERROR_NOT_INITIALIZED Not initialized
564 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
565 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
566 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
568 int connection_unset_internet_state_changed_cb(connection_h connection);
571 * @brief Checks for ethernet cable is attached or not.
572 * @details The returned state is for the ethernet cable state.
573 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
575 * @privilege %http://tizen.org/privilege/network.get
576 * @param[in] connection The handle of the connection
577 * @param[in] state The state of ethernet cable
578 * @return @c 0 on success,
579 * otherwise a negative error value
580 * @retval #CONNECTION_ERROR_NONE Successful
581 * @retval #CONNECTION_ERROR_NOT_INITIALIZED Not initialized
582 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
583 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
584 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
585 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission denied
587 int connection_get_ethernet_cable_state(connection_h connection,
588 connection_ethernet_cable_state_e *state);
592 * @deprecated Deprecated since 4.0. Use connection_ethernet_cable_state_changed_cb() instead.
593 * @brief Called when ethernet cable is plugged [in/out].
594 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
595 * @param[in] state The state of ethernet cable
596 * @param[in] user_data The user data passed to callback registration function
598 typedef void(*connection_ethernet_cable_state_chaged_cb)
599 (connection_ethernet_cable_state_e state, void* user_data);
603 * @deprecated Deprecated since 4.0. Use connection_set_ethernet_cable_state_changed_cb() instead.
604 * @brief Sets callback for ethernet cable is plugged [in/out] event.
605 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
606 * @param[in] connection The connection handle
607 * @param[in] callback The callback function to be called
608 * @param[in] user_data The user data passed to the callback function
609 * @return @c 0 on success,
610 * otherwise a negative error value
611 * @retval #CONNECTION_ERROR_NONE Successful
612 * @retval #CONNECTION_ERROR_NOT_INITIALIZED Not initialized
613 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
614 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
615 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
617 int connection_set_ethernet_cable_state_chaged_cb(connection_h connection,
618 connection_ethernet_cable_state_chaged_cb callback, void *user_data) TIZEN_DEPRECATED_API;
622 * @deprecated Deprecated since 4.0. Use connection_unset_ethernet_cable_state_changed_cb() instead.
623 * @brief Unsets callback for ethernet cable is plugged [in/out] event.
624 * @since_tizen @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif
625 * @param[in] connection The connection handle
626 * @return @c 0 on success,
627 * otherwise a negative error value
628 * @retval #CONNECTION_ERROR_NONE Successful
629 * @retval #CONNECTION_ERROR_NOT_INITIALIZED Not initialized
630 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
631 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
632 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
634 int connection_unset_ethernet_cable_state_chaged_cb(connection_h connection) TIZEN_DEPRECATED_API;
637 * @brief Called when ethernet cable is plugged [in/out].
639 * @param[in] state The state of ethernet cable
640 * @param[in] user_data The user data passed to callback registration function
642 typedef void(*connection_ethernet_cable_state_changed_cb)(
643 connection_ethernet_cable_state_e state, void* user_data);
647 * @brief Sets callback for ethernet cable is plugged [in/out] event.
649 * @param[in] connection The connection handle
650 * @param[in] callback The callback function to be called
651 * @param[in] user_data The user data passed to the callback function
652 * @return @c 0 on success,
653 * otherwise a negative error value
654 * @retval #CONNECTION_ERROR_NONE Successful
655 * @retval #CONNECTION_ERROR_NOT_INITIALIZED Not initialized
656 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
657 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
658 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
660 int connection_set_ethernet_cable_state_changed_cb(connection_h connection,
661 connection_ethernet_cable_state_changed_cb callback, void *user_data);
665 * @brief Unsets callback for ethernet cable is plugged [in/out] event.
667 * @param[in] connection The connection handle
668 * @return @c 0 on success,
669 * otherwise a negative error value
670 * @retval #CONNECTION_ERROR_NONE Successful
671 * @retval #CONNECTION_ERROR_NOT_INITIALIZED Not initialized
672 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
673 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
674 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
676 int connection_unset_ethernet_cable_state_changed_cb(connection_h connection);
680 * @brief Gets the state of the Bluetooth.
681 * @details The returned state is for the Bluetooth connection state.
682 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
684 * @privilege %http://tizen.org/privilege/network.get
685 * @param[in] connection The connection handle
686 * @param[out] state The state of the Bluetooth connection
687 * @return @c 0 on success,
688 * otherwise a negative error value
689 * @retval #CONNECTION_ERROR_NONE Successful
690 * @retval #CONNECTION_ERROR_NOT_INITIALIZED Not initialized
691 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
692 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
693 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission denied
694 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
696 int connection_get_bt_state(connection_h connection, connection_bt_state_e* state);
700 * @brief Sets the callback that is called when the type of the current connection is changed.
701 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
702 * @param[in] connection The connection handle
703 * @param[in] callback The callback function to be called
704 * @param[in] user_data The user data passed to the callback function
705 * @return @c 0 on success,
706 * otherwise a negative error value
707 * @retval #CONNECTION_ERROR_NONE Successful
708 * @retval #CONNECTION_ERROR_NOT_INITIALIZED Not initialized
709 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
710 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
711 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
713 int connection_set_type_changed_cb(connection_h connection,
714 connection_type_changed_cb callback, void* user_data);
718 * @brief Unsets the callback that is called when the type of current connection is changed.
719 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
720 * @param[in] connection The connection handle
721 * @return @c 0 on success,
722 * otherwise a negative error value
723 * @retval #CONNECTION_ERROR_NONE Successful
724 * @retval #CONNECTION_ERROR_NOT_INITIALIZED Not initialized
725 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
726 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
727 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
729 int connection_unset_type_changed_cb(connection_h connection);
733 * @brief Sets the callback that is called when the IP address is changed.
734 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
735 * @param[in] connection The connection handle
736 * @param[in] callback The callback function to be called
737 * @param[in] user_data The user data passed to the callback function
738 * @return @c 0 on success,
739 * otherwise a negative error value
740 * @retval #CONNECTION_ERROR_NONE Successful
741 * @retval #CONNECTION_ERROR_NOT_INITIALIZED Not initialized
742 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
743 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
744 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
746 int connection_set_ip_address_changed_cb(connection_h connection,
747 connection_address_changed_cb callback, void* user_data);
751 * @brief Unsets the callback that is called when the IP address is changed.
752 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
753 * @param[in] connection The connection handle
754 * @return @c 0 on success,
755 * otherwise a negative error value
756 * @retval #CONNECTION_ERROR_NONE Successful
757 * @retval #CONNECTION_ERROR_NOT_INITIALIZED Not initialized
758 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
759 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
760 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
762 int connection_unset_ip_address_changed_cb(connection_h connection);
766 * @brief Sets the callback that is called when the proxy address is changed.
767 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
768 * @param[in] connection The connection handle
769 * @param[in] callback The callback function to be called
770 * @param[in] user_data The user data passed to the callback function
771 * @return @c 0 on success,
772 * otherwise a negative error value
773 * @retval #CONNECTION_ERROR_NONE Successful
774 * @retval #CONNECTION_ERROR_NOT_INITIALIZED Not initialized
775 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
776 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
777 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
779 int connection_set_proxy_address_changed_cb(connection_h connection,
780 connection_address_changed_cb callback, void* user_data);
784 * @brief Unsets the callback that is called when the proxy address is changed.
785 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
786 * @param[in] connection The connection handle
787 * @return @c 0 on success,
788 * otherwise a negative error value
789 * @retval #CONNECTION_ERROR_NONE Successful
790 * @retval #CONNECTION_ERROR_NOT_INITIALIZED Not initialized
791 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
792 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
793 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
795 int connection_unset_proxy_address_changed_cb(connection_h connection);
799 * @brief Adds a new profile which is created by connection_profile_create().
800 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
802 * @privilege %http://tizen.org/privilege/network.profile
803 * @remarks You can only add a profile of the cellular type.
804 * @param[in] connection The connection handle
805 * @param[in] profile The profile handle
806 * @return @c 0 on success,
807 * otherwise a negative error value
808 * @retval #CONNECTION_ERROR_NONE Successful
809 * @retval #CONNECTION_ERROR_NOT_INITIALIZED Not initialized
810 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
811 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
812 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission denied
813 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
815 int connection_add_profile(connection_h connection, connection_profile_h profile);
819 * @brief Removes an existing profile.
820 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
822 * @privilege %http://tizen.org/privilege/network.profile \n
823 * %http://tizen.org/privilege/network.get
824 * @remarks This function needs both privileges.
825 * @param[in] connection The connection handle
826 * @param[in] profile The profile handle
827 * @return @c 0 on success,
828 * otherwise a negative error value
829 * @retval #CONNECTION_ERROR_NONE Successful
830 * @retval #CONNECTION_ERROR_NOT_INITIALIZED Not initialized
831 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
832 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
833 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission denied
834 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
836 int connection_remove_profile(connection_h connection, connection_profile_h profile);
840 * @brief Updates an existing profile.
841 * @details When a profile is changed, these changes will be not applied to the
842 * Connection Manager immediately.
843 * When you call this function, your changes affect the Connection Manager
844 * and the existing profile is updated.
845 * In addition, the existing profile will be updated if you call connection_open_profile().
846 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
848 * @privilege %http://tizen.org/privilege/network.profile \n
849 * %http://tizen.org/privilege/network.get
850 * @remarks This function needs both privileges.
851 * @param[in] connection The connection handle
852 * @param[in] 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_OPERATION_FAILED Operation failed
859 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission denied
860 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
861 * @see connection_open_profile()
863 int connection_update_profile(connection_h connection, connection_profile_h profile);
867 * @brief Gets a profiles iterator.
868 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
870 * @privilege %http://tizen.org/privilege/network.get
871 * @remarks You must release @a profile_iterator using connection_destroy().
872 * @param[in] connection The connection handle
873 * @param[in] type The type of the connection iterator
874 * @param[out] profile_iterator The iterator of profile
875 * @return @c 0 on success,
876 * otherwise a negative error value
877 * @retval #CONNECTION_ERROR_NONE Successful
878 * @retval #CONNECTION_ERROR_NOT_INITIALIZED Not initialized
879 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
880 * @retval #CONNECTION_ERROR_OUT_OF_MEMORY Out of memory
881 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
882 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission denied
883 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
885 int connection_get_profile_iterator(connection_h connection,
886 connection_iterator_type_e type, connection_profile_iterator_h* profile_iterator);
890 * @brief Moves the profile iterator to the next position and gets a profile handle.
891 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
892 * @param[in] profile_iterator The iterator of profile
893 * @param[out] profile The profile handle
894 * @return @c 0 on success,
895 * otherwise a negative error value
896 * @retval #CONNECTION_ERROR_NONE Successful
897 * @retval #CONNECTION_ERROR_NOT_INITIALIZED Not initialized
898 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
899 * @retval #CONNECTION_ERROR_ITERATOR_END End of iteration
900 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
902 int connection_profile_iterator_next(connection_profile_iterator_h profile_iterator,
903 connection_profile_h* profile);
907 * @brief Checks whether the next element of a profile iterator exists or not.
908 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
909 * @remarks The specific error code can be obtained using the get_last_result() method.
910 * Error codes are described in Exception section.
911 * @param[in] profile_iterator The iterator of profile
912 * @return @c true if next element exists,
913 * otherwise @c false if next element doesn't exist
914 * @exception #CONNECTION_ERROR_NONE Successful
915 * @retval #CONNECTION_ERROR_NOT_INITIALIZED Not initialized
916 * @exception #CONNECTION_ERROR_NOT_SUPPORTED Not supported
917 * @see get_last_result()
919 bool connection_profile_iterator_has_next(connection_profile_iterator_h profile_iterator);
923 * @brief Destroys a profiles iterator.
924 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
925 * @param[in] profile_iterator The iterator of the profile
926 * @return @c 0 on success,
927 * otherwise a negative error value
928 * @retval #CONNECTION_ERROR_NONE Successful
929 * @retval #CONNECTION_ERROR_NOT_INITIALIZED Not initialized
930 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
931 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
933 int connection_destroy_profile_iterator(connection_profile_iterator_h profile_iterator);
937 * @brief Gets the name of the default profile.
938 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
940 * @privilege %http://tizen.org/privilege/network.get
941 * @remarks You must release @a profile using connection_profile_destroy().
942 * @param[in] connection The connection handle
943 * @param[out] profile The profile handle
944 * @return @c 0 on success,
945 * otherwise a negative error value
946 * @retval #CONNECTION_ERROR_NONE Successful
947 * @retval #CONNECTION_ERROR_NOT_INITIALIZED Not initialized
948 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
949 * @retval #CONNECTION_ERROR_OUT_OF_MEMORY Out of memory
950 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
951 * @retval #CONNECTION_ERROR_NO_CONNECTION There is no connection
952 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission denied
953 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
955 int connection_get_current_profile(connection_h connection, connection_profile_h* profile);
959 * @brief Gets the default profile which provides the given cellular service.
960 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
962 * @privilege %http://tizen.org/privilege/network.get
963 * @remarks You must release @a profile using connection_profile_destroy().
964 * @param[in] connection The connection handle
965 * @param[in] type The type of cellular service \n
966 * #CONNECTION_CELLULAR_SERVICE_TYPE_APPLICATION is not permitted
967 * @param[out] profile The profile handle
968 * @return @c 0 on success,
969 * otherwise a negative error value
970 * @retval #CONNECTION_ERROR_NONE Successful
971 * @retval #CONNECTION_ERROR_NOT_INITIALIZED Not initialized
972 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
973 * @retval #CONNECTION_ERROR_OUT_OF_MEMORY Out of memory
974 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
975 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission denied
976 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
978 int connection_get_default_cellular_service_profile(connection_h connection,
979 connection_cellular_service_type_e type, connection_profile_h* profile);
983 * @brief Sets the default profile which provides the given cellular service.
984 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
986 * @privilege %http://tizen.org/privilege/network.profile \n
987 * %http://tizen.org/privilege/network.get
988 * @remarks This function needs both privileges.
989 * @param[in] connection The connection handle
990 * @param[in] type The type of cellular service \n
991 * Only #CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET and
992 * #CONNECTION_CELLULAR_SERVICE_TYPE_PREPAID_INTERNET are permitted
993 * @param[in] profile The profile handle
994 * @return @c 0 on success,
995 * otherwise a negative error value
996 * @retval #CONNECTION_ERROR_NONE Successful
997 * @retval #CONNECTION_ERROR_NOT_INITIALIZED Not initialized
998 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
999 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
1000 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission denied
1001 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
1003 int connection_set_default_cellular_service_profile(connection_h connection,
1004 connection_cellular_service_type_e type, connection_profile_h profile);
1008 * @brief Sets the default profile which provides the given cellular service, asynchronously.
1009 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
1011 * @privilege %http://tizen.org/privilege/network.profile \n
1012 * %http://tizen.org/privilege/network.get
1013 * @remarks This function needs both privileges.
1014 * @param[in] connection The connection handle
1015 * @param[in] type The type of cellular service \n
1016 * Only #CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET and
1017 * #CONNECTION_CELLULAR_SERVICE_TYPE_PREPAID_INTERNET are permitted
1018 * @param[in] profile The profile handle
1019 * @param[in] callback The callback function to be called
1020 * @param[in] user_data The user data passed to the callback function
1021 * @return @c 0 on success,
1022 * otherwise a negative error value
1023 * @retval #CONNECTION_ERROR_NONE Successful
1024 * @retval #CONNECTION_ERROR_NOT_INITIALIZED Not initialized
1025 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
1026 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
1027 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission denied
1028 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
1030 int connection_set_default_cellular_service_profile_async(connection_h connection,
1031 connection_cellular_service_type_e type, connection_profile_h profile,
1032 connection_set_default_cb callback, void* user_data);
1036 * @brief Called after connection_open_profile() is finished.
1037 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
1038 * @param[in] result The result
1039 * @param[in] user_data The user data passed from connection_open_profile()
1040 * @pre connection_open_profile() will invoke this callback function.
1041 * @see connection_open_profile()
1043 typedef void(*connection_opened_cb)(connection_error_e result, void* user_data);
1047 * @brief Called after connection_close_profile() is finished.
1048 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
1049 * @param[in] result The result
1050 * @param[in] user_data The user data passed from connection_close_profile()
1051 * @pre connection_close_profile() will invoke this callback function.
1052 * @see connection_close_profile()
1054 typedef void(*connection_closed_cb)(connection_error_e result, void* user_data);
1058 * @brief Called after connection_reset_profile() is finished.
1059 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
1060 * @param[in] result The result
1061 * @param[in] user_data The user data passed from connection_reset_profile()
1062 * @pre connection_reset_profile() will invoke this callback function.
1063 * @see connection_reset_profile()
1065 typedef void(*connection_reset_cb)(connection_error_e result, void* user_data);
1069 * @brief Opens a connection of profile, asynchronously.
1070 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
1072 * @privilege %http://tizen.org/privilege/network.set \n
1073 * %http://tizen.org/privilege/network.get
1074 * @remarks This function needs both privileges.
1075 * @param[in] connection The connection handle
1076 * @param[in] profile The profile handle
1077 * @param[in] callback The callback function to be called
1078 * @param[in] user_data The user data passed to the callback function
1079 * @return @c 0 on success,
1080 * otherwise a negative error value
1081 * @retval #CONNECTION_ERROR_NONE Successful
1082 * @retval #CONNECTION_ERROR_NOT_INITIALIZED Not initialized
1083 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
1084 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
1085 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission denied
1086 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
1087 * @post connection_opened_cb() will be invoked.
1088 * @see connection_opened_cb()
1089 * @see connection_close_profile()
1090 * @see connection_profile_set_state_changed_cb()
1091 * @see connection_profile_unset_state_changed_cb()
1092 * @see connection_profile_state_changed_cb()
1094 int connection_open_profile(connection_h connection, connection_profile_h profile,
1095 connection_opened_cb callback, void* user_data);
1099 * @brief Closes a connection of profile.
1100 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
1102 * @privilege %http://tizen.org/privilege/network.set
1103 * @param[in] connection The connection handle
1104 * @param[in] profile The profile handle
1105 * @param[in] callback The callback function to be called
1106 * @param[in] user_data The user data passed to the callback function
1107 * @return @c 0 on success,
1108 * otherwise a negative error value
1109 * @retval #CONNECTION_ERROR_NONE Successful
1110 * @retval #CONNECTION_ERROR_NOT_INITIALIZED Not initialized
1111 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
1112 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
1113 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission denied
1114 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
1115 * @post connection_closed_cb() will be invoked.
1116 * @see connection_closed_cb()
1117 * @see connection_open_profile()
1118 * @see connection_profile_set_state_changed_cb()
1119 * @see connection_profile_unset_state_changed_cb()
1120 * @see connection_profile_state_changed_cb()
1122 int connection_close_profile(connection_h connection, connection_profile_h profile,
1123 connection_closed_cb callback, void* user_data);
1127 * @brief Resets the cellular profile.
1128 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
1130 * @privilege %http://tizen.org/privilege/network.profile \n
1131 * %http://tizen.org/privilege/network.get
1132 * @remarks This function needs both privileges.
1133 * @param[in] connection The connection handle
1134 * @param[in] type The type of reset
1135 * @param[in] id The subscriber identity module ID to reset
1136 * (The sim index starts from 0.)
1137 * @param[in] callback The callback function to be called
1138 * @param[in] user_data The user data passed to the callback function
1139 * @return @c 0 on success,
1140 * otherwise a negative error value
1141 * @retval #CONNECTION_ERROR_NONE Successful
1142 * @retval #CONNECTION_ERROR_NOT_INITIALIZED Not initialized
1143 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
1144 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
1145 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission denied
1146 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
1147 * @post connection_reset_cb() will be invoked.
1149 int connection_reset_profile(connection_h connection, connection_reset_option_e type,
1150 int id, connection_reset_cb callback, void *user_data);
1155 * @deprecated Deprecated since 4.0. Use connection_add_route_entry() instead.
1156 * @brief Adds a IPv4 route to the routing table.
1157 * @details You can get the @a interface_name from
1158 * connection_profile_get_network_interface_name() of opened profile.
1159 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
1160 * @privlevel partner
1161 * @privilege %http://tizen.org/privilege/network.route
1162 * @remarks Since 6.0, the required privilege and level of this function has changed.
1163 * @param[in] connection The connection handle
1164 * @param[in] interface_name The name of network interface
1165 * @param[in] host_address The IP address of the host
1166 * @return @c 0 on success,
1167 * otherwise a negative error value
1168 * @retval #CONNECTION_ERROR_NONE Successful
1169 * @retval #CONNECTION_ERROR_NOT_INITIALIZED Not initialized
1170 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
1171 * @retval #CONNECTION_ERROR_ALREADY_EXISTS Already exists
1172 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
1173 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission denied
1174 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
1175 * @see connection_profile_get_network_interface_name()
1177 int connection_add_route(connection_h connection, const char* interface_name,
1178 const char* host_address) TIZEN_DEPRECATED_API;
1183 * @deprecated Deprecated since 4.0. Use connection_remove_route_entry() instead.
1184 * @brief Removes a IPv4 route from the routing table.
1185 * @details You can get the @a interface_name from
1186 * connection_profile_get_network_interface_name() of opened profile.
1187 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
1188 * @privlevel partner
1189 * @privilege %http://tizen.org/privilege/network.route
1190 * @remarks Since 6.0, the required privilege and level of this function has changed.
1191 * @param[in] connection The connection handle
1192 * @param[in] interface_name The name of network interface
1193 * @param[in] host_address The IP address of the host
1194 * @return @c 0 on success,
1195 * otherwise a negative error value
1196 * @retval #CONNECTION_ERROR_NONE Successful
1197 * @retval #CONNECTION_ERROR_NOT_INITIALIZED Not initialized
1198 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
1199 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
1200 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission denied
1201 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
1202 * @see connection_profile_get_network_interface_name()
1204 int connection_remove_route(connection_h connection, const char* interface_name,
1205 const char* host_address) TIZEN_DEPRECATED_API;
1210 * @deprecated Deprecated since 4.0. Use connection_add_route_entry() instead.
1211 * @brief Adds a IPv6 route to the routing table.
1212 * @details You can get the @a interface_name from
1213 * connection_profile_get_network_interface_name() of opened profile.
1214 * @since_tizen 2.3.1
1215 * @privlevel partner
1216 * @privilege %http://tizen.org/privilege/network.route
1217 * @remarks Since 6.0, the required privilege and level of this function has changed.
1218 * @param[in] connection The connection handle
1219 * @param[in] interface_name The name of network interface
1220 * @param[in] host_address The IP address of the host
1221 * @param[in] gateway The gateway address
1222 * @return @c 0 on success,
1223 * otherwise a negative error value
1224 * @retval #CONNECTION_ERROR_NONE Successful
1225 * @retval #CONNECTION_ERROR_NOT_INITIALIZED Not initialized
1226 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
1227 * @retval #CONNECTION_ERROR_ALREADY_EXISTS Already exists
1228 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
1229 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission denied
1230 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
1231 * @see connection_profile_get_network_interface_name()
1233 int connection_add_route_ipv6(connection_h connection, const char *interface_name,
1234 const char *host_address, const char * gateway) TIZEN_DEPRECATED_API;
1239 * @deprecated Deprecated since 4.0. Use connection_remove_route_entry() instead.
1240 * @brief Removes a IPV6 route from the routing table.
1241 * @details You can get the @a interface_name from
1242 * connection_profile_get_network_interface_name() of opened profile.
1243 * @since_tizen 2.3.1
1244 * @privlevel partner
1245 * @privilege %http://tizen.org/privilege/network.route
1246 * @remarks Since 6.0, the required privilege and level of this function has changed.
1247 * @param[in] connection The connection handle
1248 * @param[in] interface_name The name of network interface
1249 * @param[in] host_address The IP address of the host
1250 * @param[in] gateway The gateway address
1251 * @return @c 0 on success,
1252 * otherwise a negative error value
1253 * @retval #CONNECTION_ERROR_NONE Successful
1254 * @retval #CONNECTION_ERROR_NOT_INITIALIZED Not initialized
1255 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
1256 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
1257 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission denied
1258 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
1259 * @see connection_profile_get_network_interface_name()
1261 int connection_remove_route_ipv6(connection_h connection, const char *interface_name,
1262 const char *host_address, const char * gateway) TIZEN_DEPRECATED_API;
1266 * @brief Adds a route to the routing table.
1267 * @details You can get the @a interface_name from \n
1268 * connection_profile_get_network_interface_name() of opened profile.
1270 * @privlevel partner
1271 * @privilege %http://tizen.org/privilege/network.route
1272 * @remarks Since 6.0, the required privilege and level of this function has changed.
1273 * @param[in] connection The connection handle
1274 * @param[in] address_family The address family
1275 * @param[in] interface_name The name of network interface
1276 * @param[in] host_address The IP address of the host (e.g., single IP address such as
1277 * 163.152.10.2,192.168.1.2), group's IP address (e.g., 163.152.10.0, 192.168.0.0)
1279 * @param[in] gateway The gateway address
1280 * @return @c 0 on success,
1281 * otherwise a negative error value
1282 * @retval #CONNECTION_ERROR_NONE Successful
1283 * @retval #CONNECTION_ERROR_NOT_INITIALIZED Not initialized
1284 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
1285 * @retval #CONNECTION_ERROR_ALREADY_EXISTS Already exists
1286 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
1287 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission denied
1288 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
1289 * @see connection_profile_get_network_interface_name()
1291 int connection_add_route_entry(connection_h connection,
1292 connection_address_family_e address_family, const char *interface_name,
1293 const char *host_address, const char *gateway);
1297 * @brief Removes a route from the routing table.
1298 * @details You can get the @a interface_name from \n
1299 * connection_profile_get_network_interface_name() of opened profile.
1301 * @privlevel partner
1302 * @privilege %http://tizen.org/privilege/network.route
1303 * @remarks Since 6.0, the required privilege and level of this function has changed.
1304 * @param[in] connection The connection handle
1305 * @param[in] address_family The address family
1306 * @param[in] interface_name The name of network interface
1307 * @param[in] host_address The IP address of the host (e.g., single IP address such as
1308 * 163.152.10.2,192.168.1.2), group's IP address (e.g., 163.152.10.0, 192.168.0.0)
1310 * @param[in] gateway The gateway address
1311 * @return @c 0 on success,
1312 * otherwise a negative error value
1313 * @retval #CONNECTION_ERROR_NONE Successful
1314 * @retval #CONNECTION_ERROR_NOT_INITIALIZED Not initialized
1315 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
1316 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
1317 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission denied
1318 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
1319 * @see connection_profile_get_network_interface_name()
1321 int connection_remove_route_entry(connection_h connection,
1322 connection_address_family_e address_family, const char *interface_name,
1323 const char *host_address, const char *gateway);
1326 * @brief Gets all IPv6 addresses assigned to the network interface.
1328 * @param[in] connection The connection handle
1329 * @param[in] connection_type The connection type
1330 * @param[in] callback The callback to be called for each IPv6 address
1331 * @param[in] user_data The user data passed to the callback function
1332 * @return 0 on success, otherwise negative error value.
1333 * @retval #CONNECTION_ERROR_NONE Successful
1334 * @retval #CONNECTION_ERROR_NOT_INITIALIZED Not initialized
1335 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
1336 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
1337 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
1339 int connection_foreach_ipv6_address(connection_h connection, connection_type_e connection_type,
1340 connection_ipv6_address_cb callback, void *user_data);
1348 * @addtogroup CAPI_NETWORK_CONNECTION_STATISTICS_MODULE
1354 * @brief Gets the statistics information.
1355 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
1357 * @privilege %http://tizen.org/privilege/network.get
1358 * @param[in] connection The connection handle
1359 * @param[in] connection_type The type of connection \n
1360 * Only #CONNECTION_TYPE_WIFI and #CONNECTION_TYPE_CELLULAR are supported
1361 * @param[in] statistics_type The type of statistics
1362 * @param[out] size The received data size of the last cellular packet data connection (bytes)
1363 * @return @c 0 on success,
1364 * otherwise a negative error value
1365 * @retval #CONNECTION_ERROR_NONE Successful
1366 * @retval #CONNECTION_ERROR_NOT_INITIALIZED Not initialized
1367 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
1368 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
1369 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission denied
1370 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
1372 int connection_get_statistics(connection_h connection, connection_type_e connection_type,
1373 connection_statistics_type_e statistics_type, long long* size);
1377 * @brief Resets the statistics information.
1378 * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
1380 * @privilege %http://tizen.org/privilege/network.set
1381 * @param[in] connection The connection handle
1382 * @param[in] connection_type The type of connection \n
1383 * Only #CONNECTION_TYPE_WIFI and #CONNECTION_TYPE_CELLULAR are supported
1384 * @param[in] statistics_type The type of statistics
1385 * @return @c 0 on success,
1386 * otherwise a negative error value
1387 * @retval #CONNECTION_ERROR_NONE Successful
1388 * @retval #CONNECTION_ERROR_NOT_INITIALIZED Not initialized
1389 * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
1390 * @retval #CONNECTION_ERROR_OPERATION_FAILED Operation failed
1391 * @retval #CONNECTION_ERROR_PERMISSION_DENIED Permission denied
1392 * @retval #CONNECTION_ERROR_NOT_SUPPORTED Not supported
1394 int connection_reset_statistics(connection_h connection, connection_type_e connection_type,
1395 connection_statistics_type_e statistics_type);
1403 #endif /* __cplusplus */
1406 #endif /* __TIZEN_NETWORK_NET_CONNECTION_H__ */