Tizen Native API
5.0
|
The Connection Manager API provides functions for managing data connections.
Required Header
#include <net_connection.h>
Overview
To use Connection Manager API, first create a connection handle using connection_create(). After that, you can obtain network information. You should destroy the created connection handle if you do not need it anymore. This API is related with libsoup and sockets. It allows you to create a socket on the kernel Linux stack, which can be used directly or by libsoup or any other network library.
Related Features
This API is related with the following features:
- http://tizen.org/feature/network.wifi
- http://tizen.org/feature/network.telephony
- http://tizen.org/feature/network.tethering.bluetooth
- http://tizen.org/feature/network.ethernet
- http://tizen.org/feature/network.net_proxy
It is recommended to design feature related codes in your application for reliability.
You can check if a device supports the related features for this API by using System Information, thereby controlling the procedure of your application.
To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.
More details on featuring your application can be found from Feature Element.
Functions | |
int | connection_create (connection_h *connection) |
Creates a handle for managing data connections. | |
int | connection_destroy (connection_h connection) |
Destroys the connection handle. | |
int | connection_get_type (connection_h connection, connection_type_e *type) |
Gets the type of the current profile for data connection. | |
int | connection_get_ip_address (connection_h connection, connection_address_family_e address_family, char **ip_address) |
Gets the IP address of the current connection. | |
int | connection_get_proxy (connection_h connection, connection_address_family_e address_family, char **proxy) |
Gets the proxy address of the current connection. | |
int | connection_get_mac_address (connection_h connection, connection_type_e type, char **mac_addr) |
Gets the MAC address of the Wi-Fi or ethernet. | |
int | connection_is_metered_network (connection_h connection, bool *is_metered) |
Gets if the current connection is metered. | |
int | connection_get_cellular_state (connection_h connection, connection_cellular_state_e *state) |
Gets the state of cellular connection. | |
int | connection_get_wifi_state (connection_h connection, connection_wifi_state_e *state) |
Gets the state of the Wi-Fi. | |
int | connection_get_ethernet_state (connection_h connection, connection_ethernet_state_e *state) |
Gets the state of the Ethernet. | |
int | connection_get_ethernet_cable_state (connection_h connection, connection_ethernet_cable_state_e *state) |
Checks for ethernet cable is attached or not. | |
int | connection_set_ethernet_cable_state_chaged_cb (connection_h connection, connection_ethernet_cable_state_chaged_cb callback, void *user_data) TIZEN_DEPRECATED_API |
Sets callback for ethernet cable is plugged [in/out] event. | |
int | connection_unset_ethernet_cable_state_chaged_cb (connection_h connection) TIZEN_DEPRECATED_API |
Unsets callback for ethernet cable is plugged [in/out] event. | |
int | connection_set_ethernet_cable_state_changed_cb (connection_h connection, connection_ethernet_cable_state_changed_cb callback, void *user_data) |
Sets callback for ethernet cable is plugged [in/out] event. | |
int | connection_unset_ethernet_cable_state_changed_cb (connection_h connection) |
Unsets callback for ethernet cable is plugged [in/out] event. | |
int | connection_get_bt_state (connection_h connection, connection_bt_state_e *state) |
Gets the state of the Bluetooth. | |
int | connection_set_type_changed_cb (connection_h connection, connection_type_changed_cb callback, void *user_data) |
Sets the callback that is called when the type of the current connection is changed. | |
int | connection_unset_type_changed_cb (connection_h connection) |
Unsets the callback that is called when the type of current connection is changed. | |
int | connection_set_ip_address_changed_cb (connection_h connection, connection_address_changed_cb callback, void *user_data) |
Sets the callback that is called when the IP address is changed. | |
int | connection_unset_ip_address_changed_cb (connection_h connection) |
Unsets the callback that is called when the IP address is changed. | |
int | connection_set_proxy_address_changed_cb (connection_h connection, connection_address_changed_cb callback, void *user_data) |
Sets the callback that is called when the proxy address is changed. | |
int | connection_unset_proxy_address_changed_cb (connection_h connection) |
Unsets the callback that is called when the proxy address is changed. | |
int | connection_add_profile (connection_h connection, connection_profile_h profile) |
Adds a new profile which is created by connection_profile_create(). | |
int | connection_remove_profile (connection_h connection, connection_profile_h profile) |
Removes an existing profile. | |
int | connection_update_profile (connection_h connection, connection_profile_h profile) |
Updates an existing profile. | |
int | connection_get_profile_iterator (connection_h connection, connection_iterator_type_e type, connection_profile_iterator_h *profile_iterator) |
Gets a profiles iterator. | |
int | connection_profile_iterator_next (connection_profile_iterator_h profile_iterator, connection_profile_h *profile) |
Moves the profile iterator to the next position and gets a profile handle. | |
bool | connection_profile_iterator_has_next (connection_profile_iterator_h profile_iterator) |
Checks whether the next element of a profile iterator exists or not. | |
int | connection_destroy_profile_iterator (connection_profile_iterator_h profile_iterator) |
Destroys a profiles iterator. | |
int | connection_get_current_profile (connection_h connection, connection_profile_h *profile) |
Gets the name of the default profile. | |
int | connection_get_default_cellular_service_profile (connection_h connection, connection_cellular_service_type_e type, connection_profile_h *profile) |
Gets the default profile which provides the given cellular service. | |
int | connection_set_default_cellular_service_profile (connection_h connection, connection_cellular_service_type_e type, connection_profile_h profile) |
Sets the default profile which provides the given cellular service. | |
int | connection_set_default_cellular_service_profile_async (connection_h connection, connection_cellular_service_type_e type, connection_profile_h profile, connection_set_default_cb callback, void *user_data) |
Sets the default profile which provides the given cellular service, asynchronously. | |
int | connection_open_profile (connection_h connection, connection_profile_h profile, connection_opened_cb callback, void *user_data) |
Opens a connection of profile, asynchronously. | |
int | connection_close_profile (connection_h connection, connection_profile_h profile, connection_closed_cb callback, void *user_data) |
Closes a connection of profile. | |
int | connection_reset_profile (connection_h connection, connection_reset_option_e type, int id, connection_reset_cb callback, void *user_data) |
Resets the cellular profile. | |
int | connection_add_route (connection_h connection, const char *interface_name, const char *host_address) TIZEN_DEPRECATED_API |
Adds a IPv4 route to the routing table. | |
int | connection_remove_route (connection_h connection, const char *interface_name, const char *host_address) TIZEN_DEPRECATED_API |
Removes a IPv4 route from the routing table. | |
int | connection_add_route_ipv6 (connection_h connection, const char *interface_name, const char *host_address, const char *gateway) TIZEN_DEPRECATED_API |
Adds a IPv6 route to the routing table. | |
int | connection_remove_route_ipv6 (connection_h connection, const char *interface_name, const char *host_address, const char *gateway) TIZEN_DEPRECATED_API |
Removes a IPV6 route from the routing table. | |
int | connection_add_route_entry (connection_h connection, connection_address_family_e address_family, const char *interface_name, const char *host_address, const char *gateway) |
Adds a route to the routing table. | |
int | connection_remove_route_entry (connection_h connection, connection_address_family_e address_family, const char *interface_name, const char *host_address, const char *gateway) |
Removes a route from the routing table. | |
int | connection_foreach_ipv6_address (connection_h connection, connection_type_e connection_type, connection_ipv6_address_cb callback, void *user_data) |
Gets all IPv6 addresses assigned to the network interface. | |
Typedefs | |
typedef void * | connection_h |
The connection handle. | |
typedef void * | connection_profile_iterator_h |
The profiles iterator handle. | |
typedef void(* | connection_type_changed_cb )(connection_type_e type, void *user_data) |
Called when the type of a connection is changed. | |
typedef void(* | connection_address_changed_cb )(const char *ipv4_address, const char *ipv6_address, void *user_data) |
Called when the address is changed. | |
typedef void(* | connection_set_default_cb )(connection_error_e result, void *user_data) |
Called when connection_set_default_cellular_service_profile_async() finishes. | |
typedef bool(* | connection_ipv6_address_cb )(char *ipv6_address, void *user_data) |
Called with an IPv6 address. | |
typedef void(* | connection_ethernet_cable_state_chaged_cb )(connection_ethernet_cable_state_e state, void *user_data) |
Called when ethernet cable is plugged [in/out]. | |
typedef void(* | connection_ethernet_cable_state_changed_cb )(connection_ethernet_cable_state_e state, void *user_data) |
Called when ethernet cable is plugged [in/out]. | |
typedef void(* | connection_opened_cb )(connection_error_e result, void *user_data) |
Called after connection_open_profile() is finished. | |
typedef void(* | connection_closed_cb )(connection_error_e result, void *user_data) |
Called after connection_close_profile() is finished. | |
typedef void(* | connection_reset_cb )(connection_error_e result, void *user_data) |
Called after connection_reset_profile() is finished. |
Typedef Documentation
typedef void(* connection_address_changed_cb)(const char *ipv4_address, const char *ipv6_address, void *user_data) |
Called when the address is changed.
- Since :
- 2.3
- Remarks:
- ipv4_address ipv6_address should not be freed. ipv4_address ipv6_address is available only in the callback. To use outside the callback, make a copy.
- Parameters:
-
[in] ipv4_address The IP address for IPv4 [in] ipv6_address The IP address for IPv6 [in] user_data The user data passed from the callback registration function
typedef void(* connection_closed_cb)(connection_error_e result, void *user_data) |
Called after connection_close_profile() is finished.
- Since :
- 2.3
- Parameters:
-
[in] result The result [in] user_data The user data passed from connection_close_profile()
- Precondition:
- connection_close_profile() will invoke this callback function.
- See also:
- connection_close_profile()
typedef void(* connection_ethernet_cable_state_chaged_cb)(connection_ethernet_cable_state_e state, void *user_data) |
Called when ethernet cable is plugged [in/out].
- Deprecated:
- Deprecated since 4.0. Use connection_ethernet_cable_state_changed_cb() instead.
- Since :
- 2.4
- Parameters:
-
[in] state The state of ethernet cable [in] user_data The user data passed to callback registration function
typedef void(* connection_ethernet_cable_state_changed_cb)(connection_ethernet_cable_state_e state, void *user_data) |
Called when ethernet cable is plugged [in/out].
- Since :
- 4.0
- Parameters:
-
[in] state The state of ethernet cable [in] user_data The user data passed to callback registration function
typedef void* connection_h |
The connection handle.
- Since :
- 2.3
typedef bool(* connection_ipv6_address_cb)(char *ipv6_address, void *user_data) |
Called with an IPv6 address.
- Since :
- 4.0
- Remarks:
- If ipv6_address is needed outside the callback, a copy should be made.
ipv6_address will be freed automatically after the execution of this callback.
- Parameters:
-
[in] ipv6_address The IPv6 address [in] user_data The user data passed from the foreach function
- Returns:
true
to continue with the next iteration of the loop,
false
to break out of the loop
- Precondition:
- connection_foreach_ipv6_addresses() will invoke this callback.
- See also:
- connection_foreach_ipv6_addresses()
typedef void(* connection_opened_cb)(connection_error_e result, void *user_data) |
Called after connection_open_profile() is finished.
- Since :
- 2.3
- Parameters:
-
[in] result The result [in] user_data The user data passed from connection_open_profile()
- Precondition:
- connection_open_profile() will invoke this callback function.
- See also:
- connection_open_profile()
typedef void* connection_profile_iterator_h |
The profiles iterator handle.
- Since :
- 2.3
typedef void(* connection_reset_cb)(connection_error_e result, void *user_data) |
Called after connection_reset_profile() is finished.
- Since :
- 2.3
- Parameters:
-
[in] result The result [in] user_data The user data passed from connection_reset_profile()
- Precondition:
- connection_reset_profile() will invoke this callback function.
- See also:
- connection_reset_profile()
typedef void(* connection_set_default_cb)(connection_error_e result, void *user_data) |
Called when connection_set_default_cellular_service_profile_async() finishes.
- Since :
- 2.3
- Parameters:
-
[in] result The result [in] user_data The user data passed from connection_open_profile()
- Precondition:
- connection_set_default_cellular_service_profile_async() will invoke this callback function.
typedef void(* connection_type_changed_cb)(connection_type_e type, void *user_data) |
Called when the type of a connection is changed.
- Since :
- 2.3
- Parameters:
-
[in] type The type of the current network connection [in] user_data The user data passed from the callback registration function
Enumeration Type Documentation
Enumeration for cellular network state.
- Since :
- 2.3
- Enumerator:
enum connection_error_e |
Enumeration for connection errors.
- Since :
- 2.3
- Enumerator:
enum connection_type_e |
Enumeration for connection type.
- Since :
- 2.3
Function Documentation
int connection_add_profile | ( | connection_h | connection, |
connection_profile_h | profile | ||
) |
Adds a new profile which is created by connection_profile_create().
- Since :
- 2.3
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/network.profile
- Remarks:
- You can only add a profile of the cellular type.
- Parameters:
-
[in] connection The connection handle [in] profile The profile handle
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
CONNECTION_ERROR_NONE Successful CONNECTION_ERROR_NOT_INITIALIZED Not initialized CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter CONNECTION_ERROR_OPERATION_FAILED Operation failed CONNECTION_ERROR_PERMISSION_DENIED Permission denied CONNECTION_ERROR_NOT_SUPPORTED Not supported
int connection_add_route | ( | connection_h | connection, |
const char * | interface_name, | ||
const char * | host_address | ||
) |
Adds a IPv4 route to the routing table.
- Deprecated:
- Deprecated since 4.0. Use connection_add_route_entry() instead.
You can get the interface_name from connection_profile_get_network_interface_name() of opened profile.
- Since :
- 2.3
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/network.set
- Parameters:
-
[in] connection The connection handle [in] interface_name The name of network interface [in] host_address The IP address of the host
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
CONNECTION_ERROR_NONE Successful CONNECTION_ERROR_NOT_INITIALIZED Not initialized CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter CONNECTION_ERROR_ALREADY_EXISTS Already exists CONNECTION_ERROR_OPERATION_FAILED Operation failed CONNECTION_ERROR_PERMISSION_DENIED Permission denied
int connection_add_route_entry | ( | connection_h | connection, |
connection_address_family_e | address_family, | ||
const char * | interface_name, | ||
const char * | host_address, | ||
const char * | gateway | ||
) |
Adds a route to the routing table.
You can get the interface_name from
connection_profile_get_network_interface_name() of opened profile.
- Since :
- 4.0
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/network.set
- Parameters:
-
[in] connection The connection handle [in] address_family The address family [in] interface_name The name of network interface [in] host_address The IP address of the host (e.g., single IP address such as 163.152.10.2,192.168.1.2), group's IP address (e.g., 163.152.10.0, 192.168.0.0) is not allowed [in] gateway The gateway address
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
CONNECTION_ERROR_NONE Successful CONNECTION_ERROR_NOT_INITIALIZED Not initialized CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter CONNECTION_ERROR_ALREADY_EXISTS Already exists CONNECTION_ERROR_OPERATION_FAILED Operation failed CONNECTION_ERROR_PERMISSION_DENIED Permission denied
int connection_add_route_ipv6 | ( | connection_h | connection, |
const char * | interface_name, | ||
const char * | host_address, | ||
const char * | gateway | ||
) |
Adds a IPv6 route to the routing table.
- Deprecated:
- Deprecated since 4.0. Use connection_add_route_entry() instead.
You can get the interface_name from connection_profile_get_network_interface_name() of opened profile.
- Since :
- 2.3.1
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/network.set
- Parameters:
-
[in] connection The connection handle [in] interface_name The name of network interface [in] host_address The IP address of the host [in] gateway The gateway address
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
CONNECTION_ERROR_NONE Successful CONNECTION_ERROR_NOT_INITIALIZED Not initialized CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter CONNECTION_ERROR_ALREADY_EXISTS Already exists CONNECTION_ERROR_OPERATION_FAILED Operation failed CONNECTION_ERROR_PERMISSION_DENIED Permission denied
int connection_close_profile | ( | connection_h | connection, |
connection_profile_h | profile, | ||
connection_closed_cb | callback, | ||
void * | user_data | ||
) |
Closes a connection of profile.
- Since :
- 2.3
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/network.set
- Parameters:
-
[in] connection The connection handle [in] profile The profile handle [in] callback The callback function to be called [in] user_data The user data passed to the callback function
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
CONNECTION_ERROR_NONE Successful CONNECTION_ERROR_NOT_INITIALIZED Not initialized CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter CONNECTION_ERROR_OPERATION_FAILED Operation failed CONNECTION_ERROR_PERMISSION_DENIED Permission denied
- Postcondition:
- connection_closed_cb() will be invoked.
int connection_create | ( | connection_h * | connection | ) |
Creates a handle for managing data connections.
If you do not use this function and use other functions, you will get the CONNECTION_ERROR_NOT_INITIALIZED error. If you put an invalid handle, you will get the CONNECTION_ERROR_INVALID_PARAMETER error.
- Since :
- 2.3
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/network.get
- Remarks:
- You must release connection using connection_destroy().
- Parameters:
-
[out] connection The connection handle
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
CONNECTION_ERROR_NONE Successful CONNECTION_ERROR_ALREADY_INITIALIZED Already initialized CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter CONNECTION_ERROR_OUT_OF_MEMORY Out of memory CONNECTION_ERROR_PERMISSION_DENIED Permission denied
- See also:
- connection_destroy()
int connection_destroy | ( | connection_h | connection | ) |
Destroys the connection handle.
- Since :
- 2.3
- Parameters:
-
[in] connection The connection handle
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
CONNECTION_ERROR_NONE Successful CONNECTION_ERROR_NOT_INITIALIZED Not initialized CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
- See also:
- connection_create()
int connection_destroy_profile_iterator | ( | connection_profile_iterator_h | profile_iterator | ) |
Destroys a profiles iterator.
- Since :
- 2.3
- Parameters:
-
[in] profile_iterator The iterator of the profile
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
CONNECTION_ERROR_NONE Successful CONNECTION_ERROR_NOT_INITIALIZED Not initialized CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter
int connection_foreach_ipv6_address | ( | connection_h | connection, |
connection_type_e | connection_type, | ||
connection_ipv6_address_cb | callback, | ||
void * | user_data | ||
) |
Gets all IPv6 addresses assigned to the network interface.
- Since :
- 4.0
- Parameters:
-
[in] connection The connection handle [in] connection_type The connection type [in] callback The callback to be called for each IPv6 address [in] user_data The user data passed to the callback function
- Returns:
- 0 on success, otherwise negative error value.
- Return values:
-
CONNECTION_ERROR_NONE Successful CONNECTION_ERROR_NOT_INITIALIZED Not initialized CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter CONNECTION_ERROR_OPERATION_FAILED Operation failed CONNECTION_ERROR_NOT_SUPPORTED Not supported
int connection_get_bt_state | ( | connection_h | connection, |
connection_bt_state_e * | state | ||
) |
Gets the state of the Bluetooth.
The returned state is for the Bluetooth connection state.
- Since :
- 2.3
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/network.get
- Parameters:
-
[in] connection The connection handle [out] state The state of the Bluetooth connection
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
CONNECTION_ERROR_NONE Successful CONNECTION_ERROR_NOT_INITIALIZED Not initialized CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter CONNECTION_ERROR_OPERATION_FAILED Operation failed CONNECTION_ERROR_PERMISSION_DENIED Permission denied CONNECTION_ERROR_NOT_SUPPORTED Not supported
int connection_get_cellular_state | ( | connection_h | connection, |
connection_cellular_state_e * | state | ||
) |
Gets the state of cellular connection.
The returned state is for the cellular connection state.
- Since :
- 2.3
- Parameters:
-
[in] connection The connection handle [out] state The state of the cellular connection
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
CONNECTION_ERROR_NONE Successful CONNECTION_ERROR_NOT_INITIALIZED Not initialized CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter CONNECTION_ERROR_OPERATION_FAILED Operation failed CONNECTION_ERROR_NOT_SUPPORTED Not supported
int connection_get_current_profile | ( | connection_h | connection, |
connection_profile_h * | profile | ||
) |
Gets the name of the default profile.
- Since :
- 2.3
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/network.get
- Remarks:
- You must release profile using connection_profile_destroy().
- Parameters:
-
[in] connection The connection handle [out] profile The profile handle
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
CONNECTION_ERROR_NONE Successful CONNECTION_ERROR_NOT_INITIALIZED Not initialized CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter CONNECTION_ERROR_OUT_OF_MEMORY Out of memory CONNECTION_ERROR_OPERATION_FAILED Operation failed CONNECTION_ERROR_NO_CONNECTION There is no connection CONNECTION_ERROR_PERMISSION_DENIED Permission denied
int connection_get_default_cellular_service_profile | ( | connection_h | connection, |
connection_cellular_service_type_e | type, | ||
connection_profile_h * | profile | ||
) |
Gets the default profile which provides the given cellular service.
- Since :
- 2.3
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/network.get
- Remarks:
- You must release profile using connection_profile_destroy().
- Parameters:
-
[in] connection The connection handle [in] type The type of cellular service
CONNECTION_CELLULAR_SERVICE_TYPE_APPLICATION is not permitted[out] profile The profile handle
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
CONNECTION_ERROR_NONE Successful CONNECTION_ERROR_NOT_INITIALIZED Not initialized CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter CONNECTION_ERROR_OUT_OF_MEMORY Out of memory CONNECTION_ERROR_OPERATION_FAILED Operation failed CONNECTION_ERROR_PERMISSION_DENIED Permission denied CONNECTION_ERROR_NOT_SUPPORTED Not supported
int connection_get_ethernet_cable_state | ( | connection_h | connection, |
connection_ethernet_cable_state_e * | state | ||
) |
Checks for ethernet cable is attached or not.
The returned state is for the ethernet cable state.
- Since :
- 2.4
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/network.get
- Parameters:
-
[in] connection The handle of the connection [in] state The state of ethernet cable
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
CONNECTION_ERROR_NONE Successful CONNECTION_ERROR_NOT_INITIALIZED Not initialized CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter CONNECTION_ERROR_OPERATION_FAILED Operation failed CONNECTION_ERROR_NOT_SUPPORTED Not supported CONNECTION_ERROR_PERMISSION_DENIED Permission denied
int connection_get_ethernet_state | ( | connection_h | connection, |
connection_ethernet_state_e * | state | ||
) |
Gets the state of the Ethernet.
The returned state is for the Ethernet connection state.
- Since :
- 2.4
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/network.get
- Parameters:
-
[in] connection The connection handle [out] state The state of Ethernet connection
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
CONNECTION_ERROR_NONE Successful CONNECTION_ERROR_NOT_INITIALIZED Not initialized CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter CONNECTION_ERROR_OPERATION_FAILED Operation failed CONNECTION_ERROR_PERMISSION_DENIED Permission denied CONNECTION_ERROR_NOT_SUPPORTED Not supported
int connection_get_ip_address | ( | connection_h | connection, |
connection_address_family_e | address_family, | ||
char ** | ip_address | ||
) |
Gets the IP address of the current connection.
- Since :
- 2.3
- Remarks:
- You must release ip_address using free().
- Parameters:
-
[in] connection The connection handle [in] address_family The address family [out] ip_address The pointer to the IP address string
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
CONNECTION_ERROR_NONE Successful CONNECTION_ERROR_NOT_INITIALIZED Not initialized CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter CONNECTION_ERROR_OPERATION_FAILED Operation failed CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED Not supported address family
int connection_get_mac_address | ( | connection_h | connection, |
connection_type_e | type, | ||
char ** | mac_addr | ||
) |
Gets the MAC address of the Wi-Fi or ethernet.
- Since :
- 2.4
- Remarks:
- mac_addr must be released with free() by you.
- Parameters:
-
[in] connection The handle of the connection [in] type The type of current network connection [out] mac_addr The MAC address
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
CONNECTION_ERROR_NONE Successful CONNECTION_ERROR_NOT_INITIALIZED Not initialized CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter CONNECTION_ERROR_INVALID_OPERATION Invalid operation CONNECTION_ERROR_OPERATION_FAILED Operation failed CONNECTION_ERROR_NOT_SUPPORTED Not supported CONNECTION_ERROR_OUT_OF_MEMORY Out of memory
int connection_get_profile_iterator | ( | connection_h | connection, |
connection_iterator_type_e | type, | ||
connection_profile_iterator_h * | profile_iterator | ||
) |
Gets a profiles iterator.
- Since :
- 2.3
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/network.get
- Remarks:
- You must release profile_iterator using connection_destroy().
- Parameters:
-
[in] connection The connection handle [in] type The type of the connection iterator [out] profile_iterator The iterator of profile
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
CONNECTION_ERROR_NONE Successful CONNECTION_ERROR_NOT_INITIALIZED Not initialized CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter CONNECTION_ERROR_OUT_OF_MEMORY Out of memory CONNECTION_ERROR_OPERATION_FAILED Operation failed CONNECTION_ERROR_PERMISSION_DENIED Permission denied
int connection_get_proxy | ( | connection_h | connection, |
connection_address_family_e | address_family, | ||
char ** | proxy | ||
) |
Gets the proxy address of the current connection.
- Since :
- 2.3
- Remarks:
- You must release proxy using free().
- Parameters:
-
[in] connection The connection handle [in] address_family The address family [out] proxy The proxy address
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
CONNECTION_ERROR_NONE Successful CONNECTION_ERROR_NOT_INITIALIZED Not initialized CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter CONNECTION_ERROR_OPERATION_FAILED Operation failed CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED Not supported address family
int connection_get_type | ( | connection_h | connection, |
connection_type_e * | type | ||
) |
Gets the type of the current profile for data connection.
- Since :
- 2.3
- Parameters:
-
[in] connection The connection handle [out] type The type of the network
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
CONNECTION_ERROR_NONE Successful CONNECTION_ERROR_NOT_INITIALIZED Not initialized CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter CONNECTION_ERROR_OPERATION_FAILED Operation failed
int connection_get_wifi_state | ( | connection_h | connection, |
connection_wifi_state_e * | state | ||
) |
Gets the state of the Wi-Fi.
The returned state is for the Wi-Fi connection state.
- Since :
- 2.3
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/network.get
- Parameters:
-
[in] connection The connection handle [out] state The state of Wi-Fi connection
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
CONNECTION_ERROR_NONE Successful CONNECTION_ERROR_NOT_INITIALIZED Not initialized CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter CONNECTION_ERROR_OPERATION_FAILED Operation failed CONNECTION_ERROR_PERMISSION_DENIED Permission denied CONNECTION_ERROR_NOT_SUPPORTED Not supported
int connection_is_metered_network | ( | connection_h | connection, |
bool * | is_metered | ||
) |
Gets if the current connection is metered.
- Since :
- 4.0
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/network.get
- Parameters:
-
[in] connection The connection handle [out] is_metered The value indicating whether it is metered
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
CONNECTION_ERROR_NONE Successful CONNECTION_ERROR_NOT_INITIALIZED Not initialized CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter CONNECTION_ERROR_OPERATION_FAILED Operation failed CONNECTION_ERROR_PERMISSION_DENIED Permission denied CONNECTION_ERROR_NOT_SUPPORTED Not supported
int connection_open_profile | ( | connection_h | connection, |
connection_profile_h | profile, | ||
connection_opened_cb | callback, | ||
void * | user_data | ||
) |
Opens a connection of profile, asynchronously.
- Since :
- 2.3
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/network.set
http://tizen.org/privilege/network.get
- Remarks:
- This function needs both privileges.
- Parameters:
-
[in] connection The connection handle [in] profile The profile handle [in] callback The callback function to be called [in] user_data The user data passed to the callback function
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
CONNECTION_ERROR_NONE Successful CONNECTION_ERROR_NOT_INITIALIZED Not initialized CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter CONNECTION_ERROR_OPERATION_FAILED Operation failed CONNECTION_ERROR_PERMISSION_DENIED Permission denied
- Postcondition:
- connection_opened_cb() will be invoked.
bool connection_profile_iterator_has_next | ( | connection_profile_iterator_h | profile_iterator | ) |
Checks whether the next element of a profile iterator exists or not.
- Since :
- 2.3
- Remarks:
- The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
- Parameters:
-
[in] profile_iterator The iterator of profile
- Returns:
true
if next element exists, otherwisefalse
if next element doesn't exist
- Exceptions:
-
CONNECTION_ERROR_NONE Successful
- Return values:
-
CONNECTION_ERROR_NOT_INITIALIZED Not initialized
- Exceptions:
-
CONNECTION_ERROR_NOT_SUPPORTED Not supported
- See also:
- get_last_result()
int connection_profile_iterator_next | ( | connection_profile_iterator_h | profile_iterator, |
connection_profile_h * | profile | ||
) |
Moves the profile iterator to the next position and gets a profile handle.
- Since :
- 2.3
- Parameters:
-
[in] profile_iterator The iterator of profile [out] profile The profile handle
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
CONNECTION_ERROR_NONE Successful CONNECTION_ERROR_NOT_INITIALIZED Not initialized CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter CONNECTION_ERROR_ITERATOR_END End of iteration
int connection_remove_profile | ( | connection_h | connection, |
connection_profile_h | profile | ||
) |
Removes an existing profile.
- Since :
- 2.3
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/network.profile
http://tizen.org/privilege/network.get
- Remarks:
- This function needs both privileges.
- Parameters:
-
[in] connection The connection handle [in] profile The profile handle
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
CONNECTION_ERROR_NONE Successful CONNECTION_ERROR_NOT_INITIALIZED Not initialized CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter CONNECTION_ERROR_OPERATION_FAILED Operation failed CONNECTION_ERROR_PERMISSION_DENIED Permission denied CONNECTION_ERROR_NOT_SUPPORTED Not supported
int connection_remove_route | ( | connection_h | connection, |
const char * | interface_name, | ||
const char * | host_address | ||
) |
Removes a IPv4 route from the routing table.
- Deprecated:
- Deprecated since 4.0. Use connection_remove_route_entry() instead.
You can get the interface_name from connection_profile_get_network_interface_name() of opened profile.
- Since :
- 2.3
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/network.set
- Parameters:
-
[in] connection The connection handle [in] interface_name The name of network interface [in] host_address The IP address of the host
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
CONNECTION_ERROR_NONE Successful CONNECTION_ERROR_NOT_INITIALIZED Not initialized CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter CONNECTION_ERROR_OPERATION_FAILED Operation failed CONNECTION_ERROR_PERMISSION_DENIED Permission denied
int connection_remove_route_entry | ( | connection_h | connection, |
connection_address_family_e | address_family, | ||
const char * | interface_name, | ||
const char * | host_address, | ||
const char * | gateway | ||
) |
Removes a route from the routing table.
You can get the interface_name from
connection_profile_get_network_interface_name() of opened profile.
- Since :
- 4.0
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/network.set
- Parameters:
-
[in] connection The connection handle [in] address_family The address family [in] interface_name The name of network interface [in] host_address The IP address of the host (e.g., single IP address such as 163.152.10.2,192.168.1.2), group's IP address (e.g., 163.152.10.0, 192.168.0.0) is not allowed [in] gateway The gateway address
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
CONNECTION_ERROR_NONE Successful CONNECTION_ERROR_NOT_INITIALIZED Not initialized CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter CONNECTION_ERROR_OPERATION_FAILED Operation failed CONNECTION_ERROR_PERMISSION_DENIED Permission denied
int connection_remove_route_ipv6 | ( | connection_h | connection, |
const char * | interface_name, | ||
const char * | host_address, | ||
const char * | gateway | ||
) |
Removes a IPV6 route from the routing table.
- Deprecated:
- Deprecated since 4.0. Use connection_remove_route_entry() instead.
You can get the interface_name from connection_profile_get_network_interface_name() of opened profile.
- Since :
- 2.3.1
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/network.set
- Parameters:
-
[in] connection The connection handle [in] interface_name The name of network interface [in] host_address The IP address of the host [in] gateway The gateway address
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
CONNECTION_ERROR_NONE Successful CONNECTION_ERROR_NOT_INITIALIZED Not initialized CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter CONNECTION_ERROR_OPERATION_FAILED Operation failed CONNECTION_ERROR_PERMISSION_DENIED Permission denied
int connection_reset_profile | ( | connection_h | connection, |
connection_reset_option_e | type, | ||
int | id, | ||
connection_reset_cb | callback, | ||
void * | user_data | ||
) |
Resets the cellular profile.
- Since :
- 2.3
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/network.profile
http://tizen.org/privilege/network.get
- Remarks:
- This function needs both privileges.
- Parameters:
-
[in] connection The connection handle [in] type The type of reset [in] id The subscriber identity module ID to reset (The sim index starts from 0.) [in] callback The callback function to be called [in] user_data The user data passed to the callback function
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
CONNECTION_ERROR_NONE Successful CONNECTION_ERROR_NOT_INITIALIZED Not initialized CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter CONNECTION_ERROR_OPERATION_FAILED Operation failed CONNECTION_ERROR_PERMISSION_DENIED Permission denied CONNECTION_ERROR_NOT_SUPPORTED Not supported
- Postcondition:
- connection_reset_cb() will be invoked.
int connection_set_default_cellular_service_profile | ( | connection_h | connection, |
connection_cellular_service_type_e | type, | ||
connection_profile_h | profile | ||
) |
Sets the default profile which provides the given cellular service.
- Since :
- 2.3
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/network.profile
http://tizen.org/privilege/network.get
- Remarks:
- This function needs both privileges.
- Parameters:
-
[in] connection The connection handle [in] type The type of cellular service
Only CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET and CONNECTION_CELLULAR_SERVICE_TYPE_PREPAID_INTERNET are permitted[in] profile The profile handle
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
CONNECTION_ERROR_NONE Successful CONNECTION_ERROR_NOT_INITIALIZED Not initialized CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter CONNECTION_ERROR_OPERATION_FAILED Operation failed CONNECTION_ERROR_PERMISSION_DENIED Permission denied CONNECTION_ERROR_NOT_SUPPORTED Not supported
int connection_set_default_cellular_service_profile_async | ( | connection_h | connection, |
connection_cellular_service_type_e | type, | ||
connection_profile_h | profile, | ||
connection_set_default_cb | callback, | ||
void * | user_data | ||
) |
Sets the default profile which provides the given cellular service, asynchronously.
- Since :
- 2.3
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/network.profile
http://tizen.org/privilege/network.get
- Remarks:
- This function needs both privileges.
- Parameters:
-
[in] connection The connection handle [in] type The type of cellular service
Only CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET and CONNECTION_CELLULAR_SERVICE_TYPE_PREPAID_INTERNET are permitted[in] profile The profile handle [in] callback The callback function to be called [in] user_data The user data passed to the callback function
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
CONNECTION_ERROR_NONE Successful CONNECTION_ERROR_NOT_INITIALIZED Not initialized CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter CONNECTION_ERROR_OPERATION_FAILED Operation failed CONNECTION_ERROR_PERMISSION_DENIED Permission denied CONNECTION_ERROR_NOT_SUPPORTED Not supported
int connection_set_ethernet_cable_state_chaged_cb | ( | connection_h | connection, |
connection_ethernet_cable_state_chaged_cb | callback, | ||
void * | user_data | ||
) |
Sets callback for ethernet cable is plugged [in/out] event.
- Deprecated:
- Deprecated since 4.0. Use connection_set_ethernet_cable_state_changed_cb() instead.
- Since :
- 2.4
- Parameters:
-
[in] connection The handle of connection [in] callback The callback function to be called [in] user_data The user data passed to the callback function
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
CONNECTION_ERROR_NONE Successful CONNECTION_ERROR_NOT_INITIALIZED Not initialized CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter CONNECTION_ERROR_OPERATION_FAILED Operation failed CONNECTION_ERROR_NOT_SUPPORTED Not supported
int connection_set_ethernet_cable_state_changed_cb | ( | connection_h | connection, |
connection_ethernet_cable_state_changed_cb | callback, | ||
void * | user_data | ||
) |
Sets callback for ethernet cable is plugged [in/out] event.
- Since :
- 4.0
- Parameters:
-
[in] connection The handle of connection [in] callback The callback function to be called [in] user_data The user data passed to the callback function
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
CONNECTION_ERROR_NONE Successful CONNECTION_ERROR_NOT_INITIALIZED Not initialized CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter CONNECTION_ERROR_OPERATION_FAILED Operation failed CONNECTION_ERROR_NOT_SUPPORTED Not supported
int connection_set_ip_address_changed_cb | ( | connection_h | connection, |
connection_address_changed_cb | callback, | ||
void * | user_data | ||
) |
Sets the callback that is called when the IP address is changed.
- Since :
- 2.3
- Parameters:
-
[in] connection The connection handle [in] callback The callback function to be called [in] user_data The user data passed to the callback function
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
CONNECTION_ERROR_NONE Successful CONNECTION_ERROR_NOT_INITIALIZED Not initialized CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter CONNECTION_ERROR_OPERATION_FAILED Operation failed
int connection_set_proxy_address_changed_cb | ( | connection_h | connection, |
connection_address_changed_cb | callback, | ||
void * | user_data | ||
) |
Sets the callback that is called when the proxy address is changed.
- Since :
- 2.3
- Parameters:
-
[in] connection The connection handle [in] callback The callback function to be called [in] user_data The user data passed to the callback function
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
CONNECTION_ERROR_NONE Successful CONNECTION_ERROR_NOT_INITIALIZED Not initialized CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter CONNECTION_ERROR_OPERATION_FAILED Operation failed
int connection_set_type_changed_cb | ( | connection_h | connection, |
connection_type_changed_cb | callback, | ||
void * | user_data | ||
) |
Sets the callback that is called when the type of the current connection is changed.
- Since :
- 2.3
- Parameters:
-
[in] connection The connection handle [in] callback The callback function to be called [in] user_data The user data passed to the callback function
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
CONNECTION_ERROR_NONE Successful CONNECTION_ERROR_NOT_INITIALIZED Not initialized CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter CONNECTION_ERROR_OPERATION_FAILED Operation failed
int connection_unset_ethernet_cable_state_chaged_cb | ( | connection_h | connection | ) |
Unsets callback for ethernet cable is plugged [in/out] event.
- Deprecated:
- Deprecated since 4.0. Use connection_unset_ethernet_cable_state_changed_cb() instead.
- Since :
- 2.4
- Parameters:
-
[in] connection The handle of connection
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
CONNECTION_ERROR_NONE Successful CONNECTION_ERROR_NOT_INITIALIZED Not initialized CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter CONNECTION_ERROR_OPERATION_FAILED Operation failed CONNECTION_ERROR_NOT_SUPPORTED Not supported
int connection_unset_ethernet_cable_state_changed_cb | ( | connection_h | connection | ) |
Unsets callback for ethernet cable is plugged [in/out] event.
- Since :
- 4.0
- Parameters:
-
[in] connection The handle of connection
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
CONNECTION_ERROR_NONE Successful CONNECTION_ERROR_NOT_INITIALIZED Not initialized CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter CONNECTION_ERROR_OPERATION_FAILED Operation failed CONNECTION_ERROR_NOT_SUPPORTED Not supported
int connection_unset_ip_address_changed_cb | ( | connection_h | connection | ) |
Unsets the callback that is called when the IP address is changed.
- Since :
- 2.3
- Parameters:
-
[in] connection The connection handle
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
CONNECTION_ERROR_NONE Successful CONNECTION_ERROR_NOT_INITIALIZED Not initialized CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter CONNECTION_ERROR_OPERATION_FAILED Operation failed
int connection_unset_proxy_address_changed_cb | ( | connection_h | connection | ) |
Unsets the callback that is called when the proxy address is changed.
- Since :
- 2.3
- Parameters:
-
[in] connection The connection handle
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
CONNECTION_ERROR_NONE Successful CONNECTION_ERROR_NOT_INITIALIZED Not initialized CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter CONNECTION_ERROR_OPERATION_FAILED Operation failed
int connection_unset_type_changed_cb | ( | connection_h | connection | ) |
Unsets the callback that is called when the type of current connection is changed.
- Since :
- 2.3
- Parameters:
-
[in] connection The connection handle
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
CONNECTION_ERROR_NONE Successful CONNECTION_ERROR_NOT_INITIALIZED Not initialized CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter CONNECTION_ERROR_OPERATION_FAILED Operation failed
int connection_update_profile | ( | connection_h | connection, |
connection_profile_h | profile | ||
) |
Updates an existing profile.
When a profile is changed, these changes will be not applied to the Connection Manager immediately. When you call this function, your changes affect the Connection Manager and the existing profile is updated. In addition, the existing profile will be updated if you call connection_open_profile().
- Since :
- 2.3
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/network.profile
http://tizen.org/privilege/network.get
- Remarks:
- This function needs both privileges.
- Parameters:
-
[in] connection The connection handle [in] profile The profile handle
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
CONNECTION_ERROR_NONE Successful CONNECTION_ERROR_NOT_INITIALIZED Not initialized CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter CONNECTION_ERROR_OPERATION_FAILED Operation failed CONNECTION_ERROR_PERMISSION_DENIED Permission denied CONNECTION_ERROR_NOT_SUPPORTED Not supported
- See also:
- connection_open_profile()