Tizen Native API
5.0
|
The Connection Profile API provides functions for managing the connection profile.
#include <net_connection.h>
The Connection Profile provides functions for mapping connection profile. It allows you to use a handle for dealing with a connection profile. You can get details about connection using ‘connection_profile_h’ handle.
This API is related with the following features:
typedef void* connection_profile_h |
The profile handle.
typedef void(* connection_profile_state_changed_cb)(connection_profile_state_e state, void *user_data) |
Called when the state of the profile is changed.
[in] | state | The state |
[in] | user_data | The user data passed from the callback registration function |
Enumeration for IP configuration type.
int connection_profile_clone | ( | connection_profile_h * | cloned_profile, |
connection_profile_h | origin_profile | ||
) |
Clones a profile handle.
[out] | cloned_profile | The handle of the cloned profile |
[in] | origin_profile | The handle of the origin 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 |
int connection_profile_create | ( | connection_profile_type_e | type, |
const char * | keyword, | ||
connection_profile_h * | profile | ||
) |
Creates a profile handle.
The profile name, which you get from connection_profile_get_name() will include the keyword you set.
[in] | type | The type of profile CONNECTION_PROFILE_TYPE_CELLULAR and CONNECTION_PROFILE_TYPE_WIFI are supported |
[in] | keyword | The keyword included in profile name |
[out] | profile | The handle of the profile |
0
on success, otherwise 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_PERMISSION_DENIED | Permission denied |
CONNECTION_ERROR_NOT_SUPPORTED | Not supported |
int connection_profile_destroy | ( | connection_profile_h | profile | ) |
Destroys a profile handle.
[out] | profile | The handle to 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_profile_get_dhcp_lease_duration | ( | connection_profile_h | profile, |
connection_address_family_e | address_family, | ||
int * | dhcp_lease_duration | ||
) |
Gets the DHCP lease duration.
[in] | profile | The profile handle |
[in] | address_family | The address family |
[out] | dhcp_lease_duration | The DHCP lease duration in seconds |
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_ADDRESS_FAMILY_NOT_SUPPORTED | Not supported address family |
CONNECTION_ERROR_OPERATION_FAILED | Operation failed |
CONNECTION_ERROR_NOT_SUPPORTED | Not supported |
int connection_profile_get_dhcp_server_address | ( | connection_profile_h | profile, |
connection_address_family_e | address_family, | ||
char ** | dhcp_server | ||
) |
Gets the DHCP Server address.
[in] | profile | The profile handle |
[in] | address_family | The address family |
[out] | dhcp_server | The DHCP Server 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_OUT_OF_MEMORY | Out of memory |
CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED | Not supported address family |
CONNECTION_ERROR_OPERATION_FAILED | Operation failed |
int connection_profile_get_dns_address | ( | connection_profile_h | profile, |
int | order, | ||
connection_address_family_e | address_family, | ||
char ** | dns_address | ||
) |
Gets the DNS address.
2
. You must release dns_address using free(). [in] | profile | The profile handle |
[in] | order | The order of DNS address It starts from 1, which means first DNS address |
[in] | address_family | The address family |
[out] | dns_address | The DNS 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_OUT_OF_MEMORY | Out of memory |
CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED | Not supported address family |
CONNECTION_ERROR_OPERATION_FAILED | Operation failed |
int connection_profile_get_dns_config_type | ( | connection_profile_h | profile, |
connection_address_family_e | address_family, | ||
connection_dns_config_type_e * | type | ||
) |
Gets the DNS config type.
[in] | profile | The profile handle |
[in] | address_family | The address family |
[out] | type | The DNS config type |
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_profile_get_gateway_address | ( | connection_profile_h | profile, |
connection_address_family_e | address_family, | ||
char ** | gateway_address | ||
) |
Gets the Gateway address.
[in] | profile | The profile handle |
[in] | address_family | The address family |
[out] | gateway_address | 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_OUT_OF_MEMORY | Out of memory |
CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED | Not supported address family |
CONNECTION_ERROR_OPERATION_FAILED | Operation failed |
int connection_profile_get_id | ( | connection_profile_h | profile, |
char ** | profile_id | ||
) |
Gets the profile ID.
The separate profiles can have the same name. So, you must use this function instead of connection_profile_get_name() if you want to get the unique identification. In case you create a profile, this value will be determined when you add the profile.
[in] | profile | The profile handle |
[out] | profile_id | The ID 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 |
CONNECTION_ERROR_OUT_OF_MEMORY | Out of memory |
int connection_profile_get_ip_address | ( | connection_profile_h | profile, |
connection_address_family_e | address_family, | ||
char ** | ip_address | ||
) |
Gets the IP address.
[in] | profile | The profile handle |
[in] | address_family | The address family |
[out] | ip_address | The IP 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_OUT_OF_MEMORY | Out of memory |
CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED | Not supported address family |
CONNECTION_ERROR_OPERATION_FAILED | Operation failed |
int connection_profile_get_ip_config_type | ( | connection_profile_h | profile, |
connection_address_family_e | address_family, | ||
connection_ip_config_type_e * | type | ||
) |
Gets the IP config type.
[in] | profile | The profile handle |
[in] | address_family | The address family |
[out] | type | The type of the IP config |
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_profile_get_ipv6_state | ( | connection_profile_h | profile, |
connection_profile_state_e * | state | ||
) |
Gets the IPv6 network state.
[in] | profile | The profile handle |
[out] | state | The profile state |
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_profile_get_name | ( | connection_profile_h | profile, |
char ** | profile_name | ||
) |
Gets the profile name.
[in] | profile | The profile handle |
[out] | profile_name | The name 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 |
CONNECTION_ERROR_OUT_OF_MEMORY | Out of memory |
int connection_profile_get_network_interface_name | ( | connection_profile_h | profile, |
char ** | interface_name | ||
) |
Gets the name of the network interface, e.g. eth0 and pdp0.
[in] | profile | The profile handle |
[out] | interface_name | The name of the network interface |
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 |
int connection_profile_get_prefix_length | ( | connection_profile_h | profile, |
connection_address_family_e | address_family, | ||
int * | prefix_len | ||
) |
Gets the network prefix length.
[in] | profile | The profile handle |
[in] | address_family | The address family |
[out] | prefix_len | The network prefix length In case of IPv4, it means netmask length (also called a prefix, e.g. 8, 16, 24, 32) |
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_profile_get_proxy_address | ( | connection_profile_h | profile, |
connection_address_family_e | address_family, | ||
char ** | proxy_address | ||
) |
Gets the Proxy address.
[in] | profile | The profile handle |
[in] | address_family | The address family |
[out] | proxy_address | 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_OUT_OF_MEMORY | Out of memory |
CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED | Not supported address family |
CONNECTION_ERROR_OPERATION_FAILED | Operation failed |
int connection_profile_get_proxy_type | ( | connection_profile_h | profile, |
connection_proxy_type_e * | type | ||
) |
Gets the Proxy type.
[in] | profile | The profile handle |
[out] | type | The type of the proxy |
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_profile_get_state | ( | connection_profile_h | profile, |
connection_profile_state_e * | state | ||
) |
Gets the network state.
[in] | profile | The profile handle |
[out] | state | The state 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 |
CONNECTION_ERROR_OPERATION_FAILED | Operation failed |
int connection_profile_get_subnet_mask | ( | connection_profile_h | profile, |
connection_address_family_e | address_family, | ||
char ** | subnet_mask | ||
) |
Gets the Subnet Mask.
[in] | profile | The profile handle |
[in] | address_family | The address family |
[out] | subnet_mask | The subnet mask |
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_ADDRESS_FAMILY_NOT_SUPPORTED | Not supported address family |
CONNECTION_ERROR_OPERATION_FAILED | Operation failed |
int connection_profile_get_type | ( | connection_profile_h | profile, |
connection_profile_type_e * | type | ||
) |
Gets the network type.
[in] | profile | The profile handle |
[out] | type | The type 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 |
CONNECTION_ERROR_OPERATION_FAILED | Operation failed |
int connection_profile_refresh | ( | connection_profile_h | profile | ) |
Refreshes the profile information.
[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_OUT_OF_MEMORY | Out of memory |
CONNECTION_ERROR_PERMISSION_DENIED | Permission denied |
int connection_profile_set_dns_address | ( | connection_profile_h | profile, |
int | order, | ||
connection_address_family_e | address_family, | ||
const char * | dns_address | ||
) |
Sets the DNS address.
2
. [in] | profile | The profile handle |
[in] | order | The order of the DNS address It starts from 1 , which means first DNS address |
[in] | address_family | The address family |
[in] | dns_address | The DNS address If you set this value to NULL then the existing value will be deleted |
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_ADDRESS_FAMILY_NOT_SUPPORTED | Not supported address family |
CONNECTION_ERROR_OPERATION_FAILED | Operation failed |
int connection_profile_set_dns_config_type | ( | connection_profile_h | profile, |
connection_address_family_e | address_family, | ||
connection_dns_config_type_e | type | ||
) |
Sets the DNS config type.
[in] | profile | The profile handle |
[in] | address_family | The address family |
[in] | type | The DNS config type |
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_profile_set_gateway_address | ( | connection_profile_h | profile, |
connection_address_family_e | address_family, | ||
const char * | gateway_address | ||
) |
Sets the Gateway address.
[in] | profile | The profile handle |
[in] | address_family | The address family |
[in] | gateway_address | The gateway address If you set this value to NULL , then the existing value will be deleted |
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_ADDRESS_FAMILY_NOT_SUPPORTED | Not supported address family |
CONNECTION_ERROR_OPERATION_FAILED | Operation failed |
int connection_profile_set_ip_address | ( | connection_profile_h | profile, |
connection_address_family_e | address_family, | ||
const char * | ip_address | ||
) |
Sets the IP address.
[in] | profile | The profile handle |
[in] | address_family | The address family |
[in] | ip_address | The IP address If you set this value to NULL , then the existing value will be deleted |
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_ADDRESS_FAMILY_NOT_SUPPORTED | Not supported address family |
CONNECTION_ERROR_OPERATION_FAILED | Operation failed |
int connection_profile_set_ip_config_type | ( | connection_profile_h | profile, |
connection_address_family_e | address_family, | ||
connection_ip_config_type_e | type | ||
) |
Sets the IP config type.
If you set IP config type to CONNECTION_IP_CONFIG_TYPE_STATIC, then IP address, Gateway and Subnet mask will be set to the initial value "0.0.0.0".
[in] | profile | The profile handle |
[in] | address_family | The address family |
[in] | type | The type of the IP config |
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_profile_set_prefix_length | ( | connection_profile_h | profile, |
connection_address_family_e | address_family, | ||
int | prefix_len | ||
) |
Sets the network prefix length.
[in] | profile | The profile handle |
[in] | address_family | The address family |
[in] | prefix_len | The network prefix length In case of IPv4, it means netmask length (also called a prefix, e.g. 8, 16, 24, 32) |
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_profile_set_proxy_address | ( | connection_profile_h | profile, |
connection_address_family_e | address_family, | ||
const char * | proxy_address | ||
) |
Sets the Proxy address.
[in] | profile | The profile handle |
[in] | address_family | The address family |
[in] | proxy_address | The proxy address If you set this value to NULL , then the existing value will be deleted |
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_ADDRESS_FAMILY_NOT_SUPPORTED | Not supported address family |
CONNECTION_ERROR_OPERATION_FAILED | Operation failed |
int connection_profile_set_proxy_type | ( | connection_profile_h | profile, |
connection_proxy_type_e | type | ||
) |
Sets the Proxy type.
If you set the Proxy type to CONNECTION_PROXY_TYPE_AUTO or CONNECTION_PROXY_TYPE_MANUAL, then Proxy will be restored.
[in] | profile | The profile handle |
[in] | type | The type of the proxy |
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_profile_set_state_changed_cb | ( | connection_profile_h | profile, |
connection_profile_state_changed_cb | callback, | ||
void * | user_data | ||
) |
Sets the callback that is called when the state of profile is changed.
[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 |
int connection_profile_set_subnet_mask | ( | connection_profile_h | profile, |
connection_address_family_e | address_family, | ||
const char * | subnet_mask | ||
) |
Sets the Subnet Mask.
[in] | profile | The profile handle |
[in] | address_family | The address family |
[in] | subnet_mask | The subnet mask If you set this value to NULL , then the existing value will be deleted |
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_ADDRESS_FAMILY_NOT_SUPPORTED | Not supported address family |
CONNECTION_ERROR_OPERATION_FAILED | Operation failed |
int connection_profile_unset_state_changed_cb | ( | connection_profile_h | profile | ) |
Unsets the callback that is called when the state of profile is changed.
[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 |