Tizen Native API
Connection Manager

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_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)
 Registers callback for ethernet cable is plugged [in/out] event.
int connection_unset_ethernet_cable_state_chaged_cb (connection_h connection)
 Unregisters 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)
 Registers the callback that is called when the type of the current connection is changed.
int connection_unset_type_changed_cb (connection_h connection)
 Unregisters 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)
 Registers the callback that is called when the IP address is changed.
int connection_unset_ip_address_changed_cb (connection_h connection)
 Unregisters 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)
 Registers the callback that is called when the proxy address is changed.
int connection_unset_proxy_address_changed_cb (connection_h connection)
 Unregisters 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)
 Adds a IPv4 route to the routing table.
int connection_remove_route (connection_h connection, const char *interface_name, const char *host_address)
 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)
 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)
 Removes a IPV6 route from the routing table.

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 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_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.

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:

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 List.


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
Parameters:
[in]ipv4_addressThe IP address for IPv4
[in]ipv6_addressThe IP address for IPv6
[in]user_dataThe user data passed from the callback registration function
See also:
connection_set_ip_address_changed_cb()
connection_unset_ip_address_changed_cb()
connection_set_proxy_address_changed_cb()
connection_unset_proxy_address_changed_cb()
typedef void(* connection_closed_cb)(connection_error_e result, void *user_data)

Called after connection_close_profile() is finished.

Since :
2.3
Parameters:
[in]resultThe result
[in]user_dataThe user data passed from connection_close_profile()
Precondition:
connection_close_profile() will invoke this callback function.
See also:
connection_close_profile()

Called when ethernet cable is plugged [in/out].

Since :
2.4
Parameters:
[in]stateThe ethernet cable state (connection_ethernet_cable_state_e)
[in]user_dataThe user data passed to callback registration function
typedef void* connection_h

The connection handle.

Since :
2.3
typedef void(* connection_opened_cb)(connection_error_e result, void *user_data)

Called after connection_open_profile() is finished.

Since :
2.3
Parameters:
[in]resultThe result
[in]user_dataThe user data passed from connection_open_profile()
Precondition:
connection_open_profile() will invoke this callback function.
See also:
connection_open_profile()

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]resultThe result
[in]user_dataThe 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]resultThe result
[in]user_dataThe user data passed from connection_open_profile()
Precondition:
connection_set_default_cellular_service_profile_async() will invoke this callback function.
See also:
connection_set_default_cellular_service_profile_async()
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]typeThe type of the current network connection
[in]user_dataThe user data passed from the callback registration function
See also:
connection_set_type_changed_cb()
connection_unset_type_changed_cb()

Enumeration Type Documentation

Enumeration for Bluetooth state.

Since :
2.3
Enumerator:
CONNECTION_BT_STATE_DEACTIVATED 

There is no Bluetooth profile to open

CONNECTION_BT_STATE_DISCONNECTED 

Disconnected

CONNECTION_BT_STATE_CONNECTED 

Connected

Enumeration for cellular network state.

Since :
2.3
Enumerator:
CONNECTION_CELLULAR_STATE_OUT_OF_SERVICE 

Out of service

CONNECTION_CELLULAR_STATE_FLIGHT_MODE 

Flight mode

CONNECTION_CELLULAR_STATE_ROAMING_OFF 

Roaming is turned off

CONNECTION_CELLULAR_STATE_CALL_ONLY_AVAILABLE 

Call is only available

CONNECTION_CELLULAR_STATE_AVAILABLE 

Available but not connected yet

CONNECTION_CELLULAR_STATE_CONNECTED 

Connected

Enumeration for connection errors.

Since :
2.3
Enumerator:
CONNECTION_ERROR_NONE 

Successful

CONNECTION_ERROR_INVALID_PARAMETER 

Invalid parameter

CONNECTION_ERROR_OUT_OF_MEMORY 

Out of memory error

CONNECTION_ERROR_INVALID_OPERATION 

Invalid Operation

CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTED 

Address family not supported

CONNECTION_ERROR_OPERATION_FAILED 

Operation failed

CONNECTION_ERROR_ITERATOR_END 

End of iteration

CONNECTION_ERROR_NO_CONNECTION 

There is no connection

CONNECTION_ERROR_ALREADY_EXISTS 

Now in progress Already exists

CONNECTION_ERROR_OPERATION_ABORTED 

Operation is aborted

CONNECTION_ERROR_DHCP_FAILED 

DHCP failed

CONNECTION_ERROR_INVALID_KEY 

Invalid key

CONNECTION_ERROR_NO_REPLY 

No reply

CONNECTION_ERROR_PERMISSION_DENIED 

Permission denied

CONNECTION_ERROR_NOT_SUPPORTED 

Not Supported

This enumeration defines the attached or detached state of ethernet cable.

Since :
2.4
Enumerator:
CONNECTION_ETHERNET_CABLE_DETACHED 

Ethernet cable is detached

CONNECTION_ETHERNET_CABLE_ATTACHED 

Ethernet cable is attached

Enumeration for ethernet state.

Since :
2.4
Enumerator:
CONNECTION_ETHERNET_STATE_DEACTIVATED 

There is no Ethernet profile to open

CONNECTION_ETHERNET_STATE_DISCONNECTED 

Disconnected

CONNECTION_ETHERNET_STATE_CONNECTED 

Connected

Enumeration for connection iterator type.

Since :
2.3
Enumerator:
CONNECTION_ITERATOR_TYPE_REGISTERED 

The iterator of the registered profile

CONNECTION_ITERATOR_TYPE_CONNECTED 

The iterator of the connected profile

CONNECTION_ITERATOR_TYPE_DEFAULT 

The iterator of the default profile

Enumeration for reset profile type.

Since :
2.3
Enumerator:
CONNECTION_RESET_DEFAULT_PROFILE 

Initialized with the default profile defined by csc

CONNECTION_RESET_CLEAR_PROFILE 

Remove all profiles

Enumeration for connection type.

Since :
2.3
Enumerator:
CONNECTION_TYPE_DISCONNECTED 

Disconnected

CONNECTION_TYPE_WIFI 

Wi-Fi type

CONNECTION_TYPE_CELLULAR 

Cellular type

CONNECTION_TYPE_ETHERNET 

Ethernet type

CONNECTION_TYPE_BT 

Bluetooth type

Enumeration for Wi-Fi state.

Since :
2.3
Enumerator:
CONNECTION_WIFI_STATE_DEACTIVATED 

Wi-Fi is deactivated

CONNECTION_WIFI_STATE_DISCONNECTED 

Disconnected

CONNECTION_WIFI_STATE_CONNECTED 

Connected


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]connectionThe connection handle
[in]profileThe profile handle
Returns:
0 on success, otherwise a negative error value
Return values:
CONNECTION_ERROR_NONESuccessful
CONNECTION_ERROR_INVALID_PARAMETERInvalid parameter
CONNECTION_ERROR_OPERATION_FAILEDOperation failed
CONNECTION_ERROR_PERMISSION_DENIEDPermission Denied
CONNECTION_ERROR_NOT_SUPPORTEDNot 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.

Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/network.set
Parameters:
[in]connectionThe connection handle
[in]interface_nameThe name of network interface
[in]host_addressThe IP address of the host
Returns:
0 on success, otherwise negative error value
Return values:
CONNECTION_ERROR_NONESuccessful
CONNECTION_ERROR_INVALID_PARAMETERInvalid parameter
CONNECTION_ERROR_ALREADY_EXISTSAlready exists
CONNECTION_ERROR_OPERATION_FAILEDOperation failed
CONNECTION_ERROR_PERMISSION_DENIEDPermission Denied
See also:
connection_profile_get_network_interface_name()
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.

Since :
2.3.1
Privilege Level:
public
Privilege:
http://tizen.org/privilege/network.set
Parameters:
[in]connectionThe connection handle
[in]interface_nameThe name of network interface
[in]host_addressThe IP address of the host
[in]gatewayThe gateway address
Returns:
0 on success, otherwise negative error value
Return values:
CONNECTION_ERROR_NONESuccessful
CONNECTION_ERROR_INVALID_PARAMETERInvalid parameter
CONNECTION_ERROR_ALREADY_EXISTSAlready exists
CONNECTION_ERROR_OPERATION_FAILEDOperation failed
CONNECTION_ERROR_PERMISSION_DENIEDPermission Denied
See also:
connection_profile_get_network_interface_name()
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]connectionThe connection handle
[in]profileThe profile handle
[in]callbackThe callback function to be called
[in]user_dataThe user data passed to the callback function
Returns:
0 on success, otherwise negative error value
Return values:
CONNECTION_ERROR_NONESuccessful
CONNECTION_ERROR_INVALID_PARAMETERInvalid parameter
CONNECTION_ERROR_OPERATION_FAILEDOperation failed
CONNECTION_ERROR_PERMISSION_DENIEDPermission Denied
Postcondition:
connection_closed_cb() will be invoked.
See also:
connection_closed_cb()
connection_open_profile()
connection_profile_set_state_changed_cb()
connection_profile_unset_state_changed_cb()
connection_profile_state_changed_cb()
int connection_create ( connection_h connection)

Creates a handle for managing data connections.

Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/network.get
Remarks:
You must release handle using connection_destroy().
Parameters:
[out]connectionThe connection handle
Returns:
0 on success, otherwise a negative error value
Return values:
CONNECTION_ERROR_NONESuccessful
CONNECTION_ERROR_INVALID_PARAMETERInvalid parameter
CONNECTION_ERROR_OUT_OF_MEMORYOut of memory
See also:
connection_destroy()
int connection_destroy ( connection_h  connection)

Destroys the connection handle.

Since :
2.3
Parameters:
[in]connectionThe connection handle
Returns:
0 on success, otherwise negative error value
Return values:
CONNECTION_ERROR_NONESuccessful
CONNECTION_ERROR_INVALID_PARAMETERInvalid parameter
See also:
connection_create()

Destroys a profiles iterator.

Since :
2.3
Parameters:
[in]profile_iteratorThe iterator of the profile
Returns:
0 on success, otherwise a negative error value
Return values:
CONNECTION_ERROR_NONESuccessful
CONNECTION_ERROR_INVALID_PARAMETERInvalid parameter
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]connectionThe connection handle
[out]stateThe state of the Bluetooth connection
Returns:
0 on success, otherwise a negative error value
Return values:
CONNECTION_ERROR_NONESuccessful
CONNECTION_ERROR_INVALID_PARAMETERInvalid parameter
CONNECTION_ERROR_OPERATION_FAILEDOperation failed
CONNECTION_ERROR_PERMISSION_DENIEDPermission Denied
CONNECTION_ERROR_NOT_SUPPORTEDNot supported

Gets the state of cellular connection.

The returned state is for the cellular connection state.

Since :
2.3
Parameters:
[in]connectionThe connection handle
[out]stateThe state of the cellular connection
Returns:
0 on success, otherwise a negative error value
Return values:
CONNECTION_ERROR_NONESuccessful
CONNECTION_ERROR_INVALID_PARAMETERInvalid parameter
CONNECTION_ERROR_OPERATION_FAILEDOperation failed
CONNECTION_ERROR_NOT_SUPPORTEDNot supported

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]connectionThe connection handle
[out]profileThe profile handle
Returns:
0 on success, otherwise a negative error value
Return values:
CONNECTION_ERROR_NONESuccessful
CONNECTION_ERROR_INVALID_PARAMETERInvalid parameter
CONNECTION_ERROR_OUT_OF_MEMORYOut of memory
CONNECTION_ERROR_OPERATION_FAILEDOperation failed
CONNECTION_ERROR_NO_CONNECTIONThere is no connection
CONNECTION_ERROR_PERMISSION_DENIEDPermission Denied

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]connectionThe connection handle
[in]typeThe type of cellular service
CONNECTION_CELLULAR_SERVICE_TYPE_APPLICATION is not permitted.
[out]profileThe profile handle
Returns:
0 on success, otherwise a negative error value
Return values:
CONNECTION_ERROR_NONESuccessful
CONNECTION_ERROR_INVALID_PARAMETERInvalid parameter
CONNECTION_ERROR_OUT_OF_MEMORYOut of memory
CONNECTION_ERROR_OPERATION_FAILEDOperation failed
CONNECTION_ERROR_PERMISSION_DENIEDPermission Denieda
CONNECTION_ERROR_NOT_SUPPORTEDNot Supported

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]connectionThe handle of the connection
[in]state- Enum connection_ethernet_cable_state_e
Returns:
0 on success, otherwise negative error value
Return values:
CONNECTION_ERROR_NONESuccessful
CONNECTION_ERROR_INVALID_PARAMETERInvalid parameter
CONNECTION_ERROR_OPERATION_FAILEDOperation failed
CONNECTION_ERROR_NOT_SUPPORTEDNot supported
CONNECTION_ERROR_PERMISSION_DENIEDPermission Denied

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]connectionThe connection handle
[out]stateThe state of Ethernet connection
Returns:
0 on success, otherwise a negative error value
Return values:
CONNECTION_ERROR_NONESuccessful
CONNECTION_ERROR_INVALID_PARAMETERInvalid parameter
CONNECTION_ERROR_OPERATION_FAILEDOperation failed
CONNECTION_ERROR_PERMISSION_DENIEDPermission Denied
CONNECTION_ERROR_NOT_SUPPORTEDNot 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]connectionThe connection handle
[in]address_familyThe address family
[out]ip_addressThe pointer to the IP address string
Returns:
0 on success, otherwise a negative error value
Return values:
CONNECTION_ERROR_NONESuccessful
CONNECTION_ERROR_INVALID_PARAMETERInvalid parameter
CONNECTION_ERROR_OPERATION_FAILEDOperation failed
CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTEDNot 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]connectionThe handle of the connection
[in]typeThe type of current network connection
[out]mac_addrThe MAC address
Returns:
0 on success, otherwise negative error value.
Return values:
CONNECTION_ERROR_NONESuccessful
CONNECTION_ERROR_INVALID_PARAMETERInvalid parameter
CONNECTION_ERROR_INVALID_OPERATIONInvalid operation
CONNECTION_ERROR_OPERATION_FAILEDOperation failed
CONNECTION_ERROR_NOT_SUPPORTEDNot supported
CONNECTION_ERROR_OUT_OF_MEMORYOut of memory

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]connectionThe connection handle
[in]typeThe type of the connetion iterator
[out]profile_iteratorThe iterator of profile
Returns:
0 on success, otherwise a negative error value
Return values:
CONNECTION_ERROR_NONESuccessful
CONNECTION_ERROR_INVALID_PARAMETERInvalid parameter
CONNECTION_ERROR_OUT_OF_MEMORYOut of memory
CONNECTION_ERROR_OPERATION_FAILEDOperation failed
CONNECTION_ERROR_PERMISSION_DENIEDPermission 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]connectionThe connection handle
[in]address_familyThe address family
[out]proxyThe proxy address
Returns:
0 on success, otherwise a negative error value
Return values:
CONNECTION_ERROR_NONESuccessful
CONNECTION_ERROR_INVALID_PARAMETERInvalid parameter
CONNECTION_ERROR_OPERATION_FAILEDOperation failed
CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTEDNot 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]connectionThe connection handle
[out]typeThe type of the network
Returns:
0 on success, otherwise negative error value
Return values:
CONNECTION_ERROR_NONESuccessful
CONNECTION_ERROR_INVALID_PARAMETERInvalid parameter
CONNECTION_ERROR_OPERATION_FAILEDOperation failed

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]connectionThe connection handle
[out]stateThe state of Wi-Fi connection
Returns:
0 on success, otherwise a negative error value
Return values:
CONNECTION_ERROR_NONESuccessful
CONNECTION_ERROR_INVALID_PARAMETERInvalid parameter
CONNECTION_ERROR_OPERATION_FAILEDOperation failed
CONNECTION_ERROR_PERMISSION_DENIEDPermission Denied
CONNECTION_ERROR_NOT_SUPPORTEDNot 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 API needs both privileges.
Parameters:
[in]connectionThe connection handle
[in]profileThe profile handle
[in]callbackThe callback function to be called
[in]user_dataThe user data passed to the callback function
Returns:
0 on success, otherwise negative error value
Return values:
CONNECTION_ERROR_NONESuccessful
CONNECTION_ERROR_INVALID_PARAMETERInvalid parameter
CONNECTION_ERROR_OPERATION_FAILEDOperation failed
CONNECTION_ERROR_PERMISSION_DENIEDPermission Denied
Postcondition:
connection_opened_cb() will be invoked.
See also:
connection_opened_cb()
connection_close_profile()
connection_profile_set_state_changed_cb()
connection_profile_unset_state_changed_cb()
connection_profile_state_changed_cb()

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_iteratorThe iterator of profile
Returns:
true if next element exists, otherwise false if next element doesn't exist

Moves the profile iterator to the next position and gets a profile handle.

Since :
2.3
Parameters:
[in]profile_iteratorThe iterator of profile
[out]profileThe profile handle
Returns:
0 on success, otherwise a negative error value
Return values:
CONNECTION_ERROR_NONESuccessful
CONNECTION_ERROR_INVALID_PARAMETERInvalid parameter
CONNECTION_ERROR_ITERATOR_ENDEnd 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 API needs both privileges.
Parameters:
[in]connectionThe connection handle
[in]profileThe profile handle
Returns:
0 on success, otherwise a negative error value
Return values:
CONNECTION_ERROR_NONESuccessful
CONNECTION_ERROR_INVALID_PARAMETERInvalid parameter
CONNECTION_ERROR_OPERATION_FAILEDOperation failed
CONNECTION_ERROR_PERMISSION_DENIEDPermission Denied
CONNECTION_ERROR_NOT_SUPPORTEDNot 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.

Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/network.set
Parameters:
[in]connectionThe connection handle
[in]interface_nameThe name of network interface
[in]host_addressThe IP address of the host
Returns:
0 on success, otherwise negative error value
Return values:
CONNECTION_ERROR_NONESuccessful
CONNECTION_ERROR_INVALID_PARAMETERInvalid parameter
CONNECTION_ERROR_OPERATION_FAILEDOperation failed
CONNECTION_ERROR_PERMISSION_DENIEDPermission Denied
See also:
connection_profile_get_network_interface_name()
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.

Since :
2.3.1
Privilege Level:
public
Privilege:
http://tizen.org/privilege/network.set
Parameters:
[in]connectionThe connection handle
[in]interface_nameThe name of network interface
[in]host_addressThe IP address of the host
[in]gatewayThe gateway address
Returns:
0 on success, otherwise negative error value
Return values:
CONNECTION_ERROR_NONESuccessful
CONNECTION_ERROR_INVALID_PARAMETERInvalid parameter
CONNECTION_ERROR_OPERATION_FAILEDOperation failed
CONNECTION_ERROR_PERMISSION_DENIEDPermission Denied
See also:
connection_profile_get_network_interface_name()
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 API needs both privileges.
Parameters:
[in]connectionThe connection handle
[in]typeThe type of reset
[in]idThe subscriber identity module id to reset (The sim index starts from 0.)
[in]callbackThe callback function to be called
[in]user_dataThe user data passed to the callback function
Returns:
0 on success, otherwise negative error value
Return values:
CONNECTION_ERROR_NONESuccessful
CONNECTION_ERROR_INVALID_PARAMETERInvalid parameter
CONNECTION_ERROR_OPERATION_FAILEDOperation failed
CONNECTION_ERROR_PERMISSION_DENIEDPermission Denied
CONNECTION_ERROR_NOT_SUPPORTEDNot Supported
Postcondition:
connection_reset_cb() will be invoked.

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 API needs both privileges.
Parameters:
[in]connectionThe connection handle
[in]typeThe type of cellular service
only CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET and CONNECTION_CELLULAR_SERVICE_TYPE_PREPAID_INTERNET are permitted.
[in]profileThe profile handle
Returns:
0 on success, otherwise a negative error value
Return values:
CONNECTION_ERROR_NONESuccessful
CONNECTION_ERROR_INVALID_PARAMETERInvalid parameter
CONNECTION_ERROR_OPERATION_FAILEDOperation failed
CONNECTION_ERROR_PERMISSION_DENIEDPermission Denied
CONNECTION_ERROR_NOT_SUPPORTEDNot Supported

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 API needs both privileges.
Parameters:
[in]connectionThe connection handle
[in]typeThe type of cellular service (only CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET and CONNECTION_CELLULAR_SERVICE_TYPE_PREPAID_INTERNET are permitted)
[in]profileThe profile handle
[in]callbackThe callback function to be called
[in]user_dataThe user data passed to the callback function
Returns:
0 on success, otherwise negative error value
Return values:
CONNECTION_ERROR_NONESuccessful
CONNECTION_ERROR_INVALID_PARAMETERInvalid parameter
CONNECTION_ERROR_OPERATION_FAILEDOperation failed
CONNECTION_ERROR_PERMISSION_DENIEDPermission Denied
CONNECTION_ERROR_NOT_SUPPORTEDNot Supported

Registers callback for ethernet cable is plugged [in/out] event.

Since :
2.4
Parameters:
[in]callbackThe callback function to be called
[in]user_dataThe user data passed to the callback function
Returns:
0 on success, otherwise negative error value
Return values:
CONNECTION_ERROR_NONESuccessful
CONNECTION_ERROR_INVALID_PARAMETERInvalid parameter
CONNECTION_ERROR_OPERATION_FAILEDOperation failed
CONNECTION_ERROR_NOT_SUPPORTEDNot supported
int connection_set_ip_address_changed_cb ( connection_h  connection,
connection_address_changed_cb  callback,
void *  user_data 
)

Registers the callback that is called when the IP address is changed.

Since :
2.3
Parameters:
[in]connectionThe connection handle
[in]callbackThe callback function to be called
[in]user_dataThe user data passed to the callback function
Returns:
0 on success, otherwise a negative error value
Return values:
CONNECTION_ERROR_NONESuccessful
CONNECTION_ERROR_INVALID_PARAMETERInvalid parameter
CONNECTION_ERROR_OPERATION_FAILEDOperation failed
int connection_set_proxy_address_changed_cb ( connection_h  connection,
connection_address_changed_cb  callback,
void *  user_data 
)

Registers the callback that is called when the proxy address is changed.

Since :
2.3
Parameters:
[in]connectionThe connection handle
[in]callbackThe callback function to be called
[in]user_dataThe user data passed to the callback function
Returns:
0 on success, otherwise a negative error value
Return values:
CONNECTION_ERROR_NONESuccessful
CONNECTION_ERROR_INVALID_PARAMETERInvalid parameter
CONNECTION_ERROR_OPERATION_FAILEDOperation failed
int connection_set_type_changed_cb ( connection_h  connection,
connection_type_changed_cb  callback,
void *  user_data 
)

Registers the callback that is called when the type of the current connection is changed.

Since :
2.3
Parameters:
[in]connectionThe connection handle
[in]callbackThe callback function to be called
[in]user_dataThe user data passed to the callback function
Returns:
0 on success, otherwise a negative error value
Return values:
CONNECTION_ERROR_NONESuccessful
CONNECTION_ERROR_INVALID_PARAMETERInvalid parameter
CONNECTION_ERROR_OPERATION_FAILEDOperation failed

Unregisters callback for ethernet cable is plugged [in/out] event.

Since :
2.4
Parameters:
[in]connectionThe handle of connection
Returns:
0 on success, otherwise negative error value
Return values:
CONNECTION_ERROR_NONESuccessful
CONNECTION_ERROR_INVALID_PARAMETERInvalid parameter
CONNECTION_ERROR_OPERATION_FAILEDOperation failed
CONNECTION_ERROR_NOT_SUPPORTEDNot supported

Unregisters the callback that is called when the IP address is changed.

Since :
2.3
Parameters:
[in]connectionThe connection handle
Returns:
0 on success, otherwise a negative error value
Return values:
CONNECTION_ERROR_NONESuccessful
CONNECTION_ERROR_INVALID_PARAMETERInvalid parameter
CONNECTION_ERROR_OPERATION_FAILEDOperation failed

Unregisters the callback that is called when the proxy address is changed.

Since :
2.3
Parameters:
[in]connectionThe connection handle
Returns:
0 on success, otherwise a negative error value
Return values:
CONNECTION_ERROR_NONESuccessful
CONNECTION_ERROR_INVALID_PARAMETERInvalid parameter
CONNECTION_ERROR_OPERATION_FAILEDOperation failed

Unregisters the callback that is called when the type of current connection is changed.

Since :
2.3
Parameters:
[in]connectionThe connection handle
Returns:
0 on success, otherwise a negative error value
Return values:
CONNECTION_ERROR_NONESuccessful
CONNECTION_ERROR_INVALID_PARAMETERInvalid parameter
CONNECTION_ERROR_OPERATION_FAILEDOperation 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 API needs both privileges.
Parameters:
[in]connectionThe connection handle
[in]profileThe profile handle
Returns:
0 on success, otherwise a negative error value
Return values:
CONNECTION_ERROR_NONESuccessful
CONNECTION_ERROR_INVALID_PARAMETERInvalid parameter
CONNECTION_ERROR_OPERATION_FAILEDOperation failed
CONNECTION_ERROR_PERMISSION_DENIEDPermission Denied
CONNECTION_ERROR_NOT_SUPPORTEDNot Supported
See also:
connection_open_profile()