Tizen Native API
5.5
|
The Connection Manager API provides functions for managing data connections.
#include <net_connection.h>
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.
This API is related with the following features:
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_set_internet_state_changed_cb (connection_h connection, connection_internet_state_changed_cb callback, void *user_data) |
Sets the callback that is called when the Internet availability over the current connection is changed. | |
int | connection_unset_internet_state_changed_cb (connection_h connection) |
Unsets the callback that is called when the Internet state of the current connection is changed. | |
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_internet_state_changed_cb )(connection_internet_state_e state, void *user_data) |
Called when the Internet state of the current connection is changed. | |
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 void(* connection_address_changed_cb)(const char *ipv4_address, const char *ipv6_address, void *user_data) |
Called when the address is changed.
[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.
[in] | result | The result |
[in] | user_data | The user data passed from 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].
[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].
[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.
typedef void(* connection_internet_state_changed_cb)(connection_internet_state_e state, void *user_data) |
Called when the Internet state of the current connection is changed.
[in] | state | The Internet state of current connection |
[in] | user_data | The user data passed to callback registration function |
typedef bool(* connection_ipv6_address_cb)(char *ipv6_address, void *user_data) |
Called with an IPv6 address.
[in] | ipv6_address | The IPv6 address |
[in] | user_data | The user data passed from the foreach function |
true
to continue with the next iteration of the loop, false
to break out of the loop typedef void(* connection_opened_cb)(connection_error_e result, void *user_data) |
Called after connection_open_profile() is finished.
[in] | result | The result |
[in] | user_data | The user data passed from connection_open_profile() |
typedef void* connection_profile_iterator_h |
The profiles iterator handle.
typedef void(* connection_reset_cb)(connection_error_e result, void *user_data) |
Called after connection_reset_profile() is finished.
[in] | result | The result |
[in] | user_data | The user data passed from 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.
[in] | result | The result |
[in] | user_data | The user data passed from connection_open_profile() |
typedef void(* connection_type_changed_cb)(connection_type_e type, void *user_data) |
Called when the type of a connection is changed.
[in] | type | The type of the current network connection |
[in] | user_data | The user data passed from the callback registration function |
Enumeration for cellular network state.
enum connection_error_e |
Enumeration for connection errors.
enum connection_type_e |
Enumeration for connection type.
int connection_add_profile | ( | connection_h | connection, |
connection_profile_h | profile | ||
) |
Adds a new profile which is created by connection_profile_create().
[in] | connection | The connection handle |
[in] | profile | The profile handle |
0
on success, otherwise a negative error value 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.
You can get the interface_name from connection_profile_get_network_interface_name() of opened profile.
[in] | connection | The connection handle |
[in] | interface_name | The name of network interface |
[in] | host_address | The IP address of the host |
0
on success, otherwise a negative error value 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.
[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 |
0
on success, otherwise a negative error value 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.
You can get the interface_name from connection_profile_get_network_interface_name() of opened profile.
[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 |
0
on success, otherwise a negative error value 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.
[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 |
0
on success, otherwise a negative error value 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_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.
[out] | connection | The connection handle |
0
on success, otherwise a negative error value 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 |
int connection_destroy | ( | connection_h | connection | ) |
Destroys the connection handle.
[in] | connection | The connection handle |
0
on success, otherwise a negative error value CONNECTION_ERROR_NONE | Successful |
CONNECTION_ERROR_NOT_INITIALIZED | Not initialized |
CONNECTION_ERROR_INVALID_PARAMETER | Invalid parameter |
int connection_destroy_profile_iterator | ( | connection_profile_iterator_h | profile_iterator | ) |
Destroys a profiles iterator.
[in] | profile_iterator | The iterator of the profile |
0
on success, otherwise a negative error value 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.
[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 |
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.
[in] | connection | The connection handle |
[out] | state | The state of the Bluetooth connection |
0
on success, otherwise a negative error value 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.
[in] | connection | The connection handle |
[out] | state | The state of the cellular connection |
0
on success, otherwise a negative error value 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.
[in] | connection | The connection handle |
[out] | profile | The profile handle |
0
on success, otherwise a negative error value 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.
[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 |
0
on success, otherwise a negative error value 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.
[in] | connection | The handle of the connection |
[in] | state | The state of ethernet cable |
0
on success, otherwise a negative error value 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.
[in] | connection | The connection handle |
[out] | state | The state of Ethernet connection |
0
on success, otherwise a negative error value 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.
[in] | connection | The connection handle |
[in] | address_family | The address family |
[out] | ip_address | The pointer to the IP address string |
0
on success, otherwise a negative error value 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.
[in] | connection | The handle of the connection |
[in] | type | The type of current network connection |
[out] | mac_addr | The MAC address |
0
on success, otherwise a negative error value 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.
[in] | connection | The connection handle |
[in] | type | The type of the connection iterator |
[out] | profile_iterator | The iterator of profile |
0
on success, otherwise a negative error value 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.
[in] | connection | The connection handle |
[in] | address_family | The address family |
[out] | proxy | The proxy address |
0
on success, otherwise a negative error value 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.
[in] | connection | The connection handle |
[out] | type | The type of the network |
0
on success, otherwise a negative error value 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.
[in] | connection | The connection handle |
[out] | state | The state of Wi-Fi connection |
0
on success, otherwise a negative error value 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.
[in] | connection | The connection handle |
[out] | is_metered | The value indicating whether it is metered |
0
on success, otherwise a negative error value 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.
[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 |
0
on success, otherwise a negative error value 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 |
bool connection_profile_iterator_has_next | ( | connection_profile_iterator_h | profile_iterator | ) |
Checks whether the next element of a profile iterator exists or not.
[in] | profile_iterator | The iterator of profile |
true
if next element exists, otherwise false
if next element doesn't exist CONNECTION_ERROR_NONE | Successful |
CONNECTION_ERROR_NOT_INITIALIZED | Not initialized |
CONNECTION_ERROR_NOT_SUPPORTED | Not supported |
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.
[in] | profile_iterator | The iterator of profile |
[out] | profile | The profile handle |
0
on success, otherwise a negative error value 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.
[in] | connection | The connection handle |
[in] | profile | The profile handle |
0
on success, otherwise a negative error value 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.
You can get the interface_name from connection_profile_get_network_interface_name() of opened profile.
[in] | connection | The connection handle |
[in] | interface_name | The name of network interface |
[in] | host_address | The IP address of the host |
0
on success, otherwise a negative error value 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.
[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 |
0
on success, otherwise a negative error value 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.
You can get the interface_name from connection_profile_get_network_interface_name() of opened profile.
[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 |
0
on success, otherwise a negative error value 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.
[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 |
0
on success, otherwise a negative error value 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 | ( | connection_h | connection, |
connection_cellular_service_type_e | type, | ||
connection_profile_h | profile | ||
) |
Sets the default profile which provides the given cellular service.
[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 |
0
on success, otherwise a negative error value 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.
[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 |
0
on success, otherwise a negative error value 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.
[in] | connection | The connection handle |
[in] | callback | The callback function to be called |
[in] | user_data | The user data passed to the callback function |
0
on success, otherwise a negative error value 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.
[in] | connection | The connection handle |
[in] | callback | The callback function to be called |
[in] | user_data | The user data passed to the callback function |
0
on success, otherwise a negative error value 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_internet_state_changed_cb | ( | connection_h | connection, |
connection_internet_state_changed_cb | callback, | ||
void * | user_data | ||
) |
Sets the callback that is called when the Internet availability over the current connection is changed.
[in] | connection | The connection handle |
[in] | callback | The callback function to be called |
[in] | user_data | The user data passed to the callback function |
0
on success, otherwise a negative error value 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.
[in] | connection | The connection handle |
[in] | callback | The callback function to be called |
[in] | user_data | The user data passed to the callback function |
0
on success, otherwise a negative error value 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.
[in] | connection | The connection handle |
[in] | callback | The callback function to be called |
[in] | user_data | The user data passed to the callback function |
0
on success, otherwise a negative error value 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.
[in] | connection | The connection handle |
[in] | callback | The callback function to be called |
[in] | user_data | The user data passed to the callback function |
0
on success, otherwise a negative error value 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.
[in] | connection | The connection handle |
0
on success, otherwise a negative error value 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.
[in] | connection | The connection handle |
0
on success, otherwise a negative error value 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_internet_state_changed_cb | ( | connection_h | connection | ) |
Unsets the callback that is called when the Internet state of the current connection is changed.
[in] | connection | The connection handle |
0
on success, otherwise a negative error value 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.
[in] | connection | The connection handle |
0
on success, otherwise a negative error value 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.
[in] | connection | The connection handle |
0
on success, otherwise a negative error value 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.
[in] | connection | The connection handle |
0
on success, otherwise a negative error value 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().
[in] | connection | The connection handle |
[in] | profile | The profile handle |
0
on success, otherwise a negative error value 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 |