Tizen Native API  10.0
Connection Manager

The Connection Manager API provides functions for managing data connections.

Required Header

#include <net_connection.h>

Overview

To use Connection Manager API, first create a connection handle using connection_create(). After that, you can obtain network information. You should destroy the created connection handle if you do not need it anymore. This API is related with libsoup and sockets. It allows you to create a socket on the kernel Linux stack, which can be used directly or by libsoup or any other network library.

Related Features

This API is related with the following features:

  • http://tizen.org/feature/network.wifi
  • http://tizen.org/feature/network.telephony
  • http://tizen.org/feature/network.tethering.bluetooth
  • http://tizen.org/feature/network.ethernet
  • http://tizen.org/feature/network.net_proxy
  • http://tizen.org/feature/network.route
    It is recommended to design feature related codes in your application for reliability.
    You can check if a device supports the related features for this API by using System Information, thereby controlling the procedure of your application.
    To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.
    More details on featuring your application can be found from Feature Element.

Functions

int connection_create (connection_h *connection)
 Creates a handle for managing data connections.
int connection_destroy (connection_h connection)
 Destroys the connection handle.
int connection_get_type (connection_h connection, connection_type_e *type)
 Gets the type of the current profile for data connection.
int connection_get_ip_address (connection_h connection, connection_address_family_e address_family, char **ip_address)
 Gets the IP address of the current connection.
int connection_get_proxy (connection_h connection, connection_address_family_e address_family, char **proxy)
 Gets the proxy address of the current connection.
int connection_get_mac_address (connection_h connection, connection_type_e type, char **mac_addr)
 Gets the MAC address of the Wi-Fi or ethernet.
int connection_is_metered_network (connection_h connection, bool *is_metered)
 Gets if the current connection is metered.
int connection_get_cellular_state (connection_h connection, connection_cellular_state_e *state)
 Gets the state of cellular connection.
int connection_get_wifi_state (connection_h connection, connection_wifi_state_e *state)
 Gets the state of the Wi-Fi.
int connection_get_ethernet_state (connection_h connection, connection_ethernet_state_e *state)
 Gets the state of the Ethernet.
int connection_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_get_dhcp_state (connection_h connection, const char *interface_name, connection_dhcp_state_e *state)
 Gets the DHCP state of the interface.
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_set_dhcp_state_changed_cb (connection_h connection, connection_dhcp_state_changed_cb callback, void *user_data)
 Sets the callback that is called when the DHCP state is changed.
int connection_unset_dhcp_state_changed_cb (connection_h connection)
 Unsets the callback that is called when the DHCP state 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_dhcp_state_changed_cb )(connection_dhcp_state_e state, const char *interface_name, connection_error_e result, void *user_data)
 Called when the DHCP state is changed.
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 Documentation

typedef void(* connection_address_changed_cb)(const char *ipv4_address, const char *ipv6_address, void *user_data)

Called when the address is changed.

This callback function is called when the IP address for IPv4 or IPv6 changes.
The addresses provided within this callback are valid only during the execution of the callback.
If you need to use these addresses outside of the callback, you must make a copy of them.

Since :
2.3
Remarks:
ipv4_address ipv6_address should not be freed. ipv4_address ipv6_address is available only in the callback. To use outside the callback, make a copy.
Parameters:
[in]ipv4_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.

This callback function is invoked when the connection_close_profile() function has completed its execution.
It receives the result of the operation and any user data that was passed to the connection_close_profile() function.

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()
typedef void(* connection_dhcp_state_changed_cb)(connection_dhcp_state_e state, const char *interface_name, connection_error_e result, void *user_data)

Called when the DHCP state is changed.

This callback function is invoked when the DHCP state changes for a given network interface.
It provides information about DHCP state changes, the network interface associated with the state change,
and the result of the DHCP operation.

Since :
8.0
Parameters:
[in]stateThe DHCP state
[in]interface_nameThe interface name with DHCP state change
[in]resultThe result of DHCP operation
[in]user_dataThe user data passed from the callback registration function
See also:
connection_set_dhcp_state_changed_cb()
connection_unset_dhcp_state_changed_cb()

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

Deprecated:
Deprecated since 4.0. Use connection_ethernet_cable_state_changed_cb() instead.
Since :
2.4
Parameters:
[in]stateThe state of ethernet cable
[in]user_dataThe user data passed to callback registration function

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

This callback function is invoked when an Ethernet cable is either plugged in or unplugged.

Since :
4.0
Parameters:
[in]stateThe state of ethernet cable
[in]user_dataThe user data passed to callback registration function
typedef void* connection_h

The connection handle.

Since :
2.3
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.

This callback function is invoked when the Internet state of the current connection changes.
It provides information about the new state of the connection and allows you to handle any necessary actions based on the updated state.

Since :
5.5
Parameters:
[in]stateThe Internet state of current connection
[in]user_dataThe user data passed to callback registration function
typedef bool(* connection_ipv6_address_cb)(char *ipv6_address, void *user_data)

Called with an IPv6 address.

This callback function is invoked when iterating through the list of IPv6 addresses associated with a network interface.
It provides each IPv6 address as a character string and allows the caller to perform custom operations on each address.

Since :
4.0
Remarks:
If ipv6_address is needed outside the callback, a copy should be made.
ipv6_address will be freed automatically after the execution of this callback.
Parameters:
[in]ipv6_addressThe IPv6 address
[in]user_dataThe user data passed from the foreach function
Returns:
true to continue with the next iteration of the loop,
false to break out of the loop
Precondition:
connection_foreach_ipv6_address() will invoke this callback.
See also:
connection_foreach_ipv6_address()
typedef void(* connection_opened_cb)(connection_error_e result, void *user_data)

Called after connection_open_profile() is finished.

This callback function is invoked when the asynchronous operation of opening a network profile is completed.
It provides the result of the operation and any user data that was passed during the call to connection_open_profile().
The application can use this callback to handle the result of the profile opening process.

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.

This callback function is invoked when the connection_reset_profile() function completes its operation.
It receives the result of the operation and the user data that was passed to the connection_reset_profile() function.

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.

This callback function is invoked after the asynchronous operation of
setting a default cellular service profile is completed.
It provides the result of the operation and any user data that was passed
during the invocation of connection_set_default_cellular_service_profile_async().

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.

This callback function is invoked when the type of the network connection changes.
It provides information about the connection type changes and allows you to handle the change accordingly.

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 the DHCP state.

Since :
8.0
Enumerator:
CONNECTION_DHCP_STATE_UNKNOWN 

Unknown state

CONNECTION_DHCP_STATE_STARTED 

DHCP is running

CONNECTION_DHCP_STATE_FINISHED 

DHCP is finished

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_NOW_IN_PROGRESS 

Now inprogress

CONNECTION_ERROR_PERMISSION_DENIED 

Permission denied

CONNECTION_ERROR_NOT_SUPPORTED 

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 

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_ALREADY_INITIALIZED 

Already initialized (Since 5.0)

CONNECTION_ERROR_NOT_INITIALIZED 

Not initialized (Since 5.0)

Enumeration for 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

CONNECTION_TYPE_NET_PROXY 

Proxy type for Internet connection (Since 3.0)

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().

This function adds a new cellular profile to the profile list to be used for cellular connection.
The profile must be created using connection_profile_create() and should be of the cellular type.
The caller must have the necessary privileges to perform this operation.

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_NOT_INITIALIZEDNot initialized
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.

Warning:
This is not for use by third-party applications.
Deprecated:
Deprecated since 4.0. Use connection_add_route_entry() instead.

You can get the interface_name from connection_profile_get_network_interface_name() of opened profile.

Since :
2.3
Privilege Level:
partner
Privilege:
http://tizen.org/privilege/network.route
Remarks:
Since 6.0, the required privilege and level of this function has changed.
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 a negative error value
Return values:
CONNECTION_ERROR_NONESuccessful
CONNECTION_ERROR_NOT_INITIALIZEDNot initialized
CONNECTION_ERROR_INVALID_PARAMETERInvalid parameter
CONNECTION_ERROR_ALREADY_EXISTSAlready exists
CONNECTION_ERROR_OPERATION_FAILEDOperation failed
CONNECTION_ERROR_PERMISSION_DENIEDPermission denied
CONNECTION_ERROR_NOT_SUPPORTEDNot supported
See also:
connection_profile_get_network_interface_name()
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.

Warning:
This is not for use by third-party applications.

You can get the interface_name from
connection_profile_get_network_interface_name() of opened profile.

Since :
4.0
Privilege Level:
partner
Privilege:
http://tizen.org/privilege/network.route
Remarks:
Since 6.0, the required privilege and level of this function has changed.
Parameters:
[in]connectionThe connection handle
[in]address_familyThe address family
[in]interface_nameThe name of network interface
[in]host_addressThe 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]gatewayThe gateway address
Returns:
0 on success, otherwise a negative error value
Return values:
CONNECTION_ERROR_NONESuccessful
CONNECTION_ERROR_NOT_INITIALIZEDNot initialized
CONNECTION_ERROR_INVALID_PARAMETERInvalid parameter
CONNECTION_ERROR_ALREADY_EXISTSAlready exists
CONNECTION_ERROR_OPERATION_FAILEDOperation failed
CONNECTION_ERROR_PERMISSION_DENIEDPermission denied
CONNECTION_ERROR_NOT_SUPPORTEDNot supported
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.

Warning:
This is not for use by third-party applications.
Deprecated:
Deprecated since 4.0. Use connection_add_route_entry() instead.

You can get the interface_name from connection_profile_get_network_interface_name() of opened profile.

Since :
2.3.1
Privilege Level:
partner
Privilege:
http://tizen.org/privilege/network.route
Remarks:
Since 6.0, the required privilege and level of this function has changed.
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 a negative error value
Return values:
CONNECTION_ERROR_NONESuccessful
CONNECTION_ERROR_NOT_INITIALIZEDNot initialized
CONNECTION_ERROR_INVALID_PARAMETERInvalid parameter
CONNECTION_ERROR_ALREADY_EXISTSAlready exists
CONNECTION_ERROR_OPERATION_FAILEDOperation failed
CONNECTION_ERROR_PERMISSION_DENIEDPermission denied
CONNECTION_ERROR_NOT_SUPPORTEDNot supported
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.

This function closes the connection of a specified profile and releases all resources associated with it.
After closing the profile, the corresponding callback function is invoked to notify the completion of the operation.

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 a negative error value
Return values:
CONNECTION_ERROR_NONESuccessful
CONNECTION_ERROR_NOT_INITIALIZEDNot initialized
CONNECTION_ERROR_INVALID_PARAMETERInvalid parameter
CONNECTION_ERROR_OPERATION_FAILEDOperation failed
CONNECTION_ERROR_PERMISSION_DENIEDPermission denied
CONNECTION_ERROR_NOT_SUPPORTEDNot supported
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.

If you do not use this function and use other functions, you will get the CONNECTION_ERROR_NOT_INITIALIZED error. If you put an invalid handle, you will get the CONNECTION_ERROR_INVALID_PARAMETER error.

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

Destroys the connection handle.

This function releases all resources allocated for the given connection handle.
should be called when the connection is no longer needed to prevent memory leaks and other potential issues.

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

Destroys a profiles iterator.

This function destroys the given profile iterator handle and releases all its resources.
After calling this function, the profile iterator handle becomes invalid, and you cannot use it to perform any operations.

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_NOT_INITIALIZEDNot initialized
CONNECTION_ERROR_INVALID_PARAMETERInvalid parameter
CONNECTION_ERROR_NOT_SUPPORTEDNot supported
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.

This function retrieves all IPv6 addresses associated with a specified network interface and invokes a provided callback function for each address found.

Since :
4.0
Parameters:
[in]connectionThe connection handle
[in]connection_typeThe connection type
[in]callbackThe callback to be called for each IPv6 address
[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_NOT_INITIALIZEDNot initialized
CONNECTION_ERROR_INVALID_PARAMETERInvalid parameter
CONNECTION_ERROR_OPERATION_FAILEDOperation failed
CONNECTION_ERROR_NOT_SUPPORTEDNot supported
int connection_get_bt_state ( connection_h  connection,
connection_bt_state_e state 
)

Gets the state of the Bluetooth.

This function retrieves the current state of the Bluetooth connection.
Possible states include disconnected, connected, and deactivated.

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_NOT_INITIALIZEDNot initialized
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.

This function retrieves the current state of the cellular connection.
The state is returned as an enumeration value of the `connection_cellular_state_e` type.

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_NOT_INITIALIZEDNot initialized
CONNECTION_ERROR_INVALID_PARAMETERInvalid parameter
CONNECTION_ERROR_OPERATION_FAILEDOperation failed
CONNECTION_ERROR_NOT_SUPPORTEDNot supported

Gets the name of the default profile.

This function retrieves the default network profile currently in use by the system.

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_NOT_INITIALIZEDNot initialized
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
CONNECTION_ERROR_NOT_SUPPORTEDNot supported

Gets the default profile which provides the given cellular service.

This function retrieves the default profile that provides the specified cellular service type.
The caller must release the returned profile handle using connection_profile_destroy().

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_NOT_INITIALIZEDNot initialized
CONNECTION_ERROR_INVALID_PARAMETERInvalid parameter
CONNECTION_ERROR_OUT_OF_MEMORYOut of memory
CONNECTION_ERROR_OPERATION_FAILEDOperation failed
CONNECTION_ERROR_PERMISSION_DENIEDPermission denied
CONNECTION_ERROR_NOT_SUPPORTEDNot supported
int connection_get_dhcp_state ( connection_h  connection,
const char *  interface_name,
connection_dhcp_state_e state 
)

Gets the DHCP state of the interface.

This function retrieves the DHCP state of the network currently being used for data connection.
The DHCP state indicates whether the interface has started to obtained an IP address via DHCP or not.

Since :
8.0
Privilege Level:
public
Privilege:
http://tizen.org/privilege/network.get
Parameters:
[in]connectionThe connection handle
[in]interface_nameThe interface name
[out]stateThe DHCP state of the interface
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

Checks for ethernet cable is attached or not.

This function retrieves the current state of the ethernet cable connected to the device.
The possible states include whether the cable is attached or detached.

Since :
2.4
Privilege Level:
public
Privilege:
http://tizen.org/privilege/network.get
Parameters:
[in]connectionThe handle of the connection
[in]stateThe state of ethernet cable
Returns:
0 on success, otherwise a negative error value
Return values:
CONNECTION_ERROR_NONESuccessful
CONNECTION_ERROR_NOT_INITIALIZEDNot initialized
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.

This function retrieves the current state of the Ethernet connection.

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_NOT_INITIALIZEDNot initialized
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.

This function retrieves the IP address associated with the network currently being used for data connection and address family.
The retrieved IP address should be released using the free() function.

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_NOT_INITIALIZEDNot initialized
CONNECTION_ERROR_INVALID_PARAMETERInvalid parameter
CONNECTION_ERROR_OPERATION_FAILEDOperation failed
CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTEDNot supported address family
CONNECTION_ERROR_NOT_SUPPORTEDNot supported
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.

This function retrieves the MAC address of the specified network connection type (Wi-Fi or Ethernet).
The caller is responsible for releasing the memory allocated for the MAC address using free().

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 a negative error value
Return values:
CONNECTION_ERROR_NONESuccessful
CONNECTION_ERROR_NOT_INITIALIZEDNot initialized
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.

This function retrieves an iterator to enumerate all the profiles of a given type from the profile list.
The caller is responsible for releasing the iterator using the connection_destroy_profile_iterator() function after it is no longer needed.

Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/network.get
Remarks:
You must release profile_iterator using connection_destroy_profile_iterator().
Parameters:
[in]connectionThe connection handle
[in]typeThe type of the connection iterator
[out]profile_iteratorThe iterator of profile
Returns:
0 on success, otherwise a negative error value
Return values:
CONNECTION_ERROR_NONESuccessful
CONNECTION_ERROR_NOT_INITIALIZEDNot initialized
CONNECTION_ERROR_INVALID_PARAMETERInvalid parameter
CONNECTION_ERROR_OUT_OF_MEMORYOut of memory
CONNECTION_ERROR_OPERATION_FAILEDOperation failed
CONNECTION_ERROR_PERMISSION_DENIEDPermission denied
CONNECTION_ERROR_NOT_SUPPORTEDNot supported
int connection_get_proxy ( connection_h  connection,
connection_address_family_e  address_family,
char **  proxy 
)

Gets the proxy address of the current connection.

This function retrieves the proxy address for the specified address family associated with the network currently being used for data connection.
The retrieved proxy address should be released using free() after use.

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_NOT_INITIALIZEDNot initialized
CONNECTION_ERROR_INVALID_PARAMETERInvalid parameter
CONNECTION_ERROR_OPERATION_FAILEDOperation failed
CONNECTION_ERROR_ADDRESS_FAMILY_NOT_SUPPORTEDNot supported address family
CONNECTION_ERROR_NOT_SUPPORTEDNot supported
int connection_get_type ( connection_h  connection,
connection_type_e type 
)

Gets the type of the current profile for data connection.

This function retrieves the type of the network currently being used for data connection.
It returns an integer value representing the type of the network.

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

Gets the state of the Wi-Fi.

This function retrieves the current state of the Wi-Fi connection.
This information can be used to determine the status of the Wi-Fi network connection.

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_NOT_INITIALIZEDNot initialized
CONNECTION_ERROR_INVALID_PARAMETERInvalid parameter
CONNECTION_ERROR_OPERATION_FAILEDOperation failed
CONNECTION_ERROR_PERMISSION_DENIEDPermission denied
CONNECTION_ERROR_NOT_SUPPORTEDNot supported
int connection_is_metered_network ( connection_h  connection,
bool *  is_metered 
)

Gets if the current connection is metered.

This function retrieves information about whether the current network connection is metered or not.
A metered connection is typically one where data usage may be limited or charged for, such as a mobile network.

Since :
4.0
Privilege Level:
public
Privilege:
http://tizen.org/privilege/network.get
Parameters:
[in]connectionThe connection handle
[out]is_meteredThe value indicating whether it is metered
Returns:
0 on success, otherwise a negative error value
Return values:
CONNECTION_ERROR_NONESuccessful
CONNECTION_ERROR_NOT_INITIALIZEDNot initialized
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.

This function opens a network connection using the specified profile handle in an asynchronous manner.

Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/network.set
http://tizen.org/privilege/network.get
Remarks:
This function needs both privileges.
Parameters:
[in]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 a negative error value
Return values:
CONNECTION_ERROR_NONESuccessful
CONNECTION_ERROR_NOT_INITIALIZEDNot initialized
CONNECTION_ERROR_INVALID_PARAMETERInvalid parameter
CONNECTION_ERROR_OPERATION_FAILEDOperation failed
CONNECTION_ERROR_PERMISSION_DENIEDPermission denied
CONNECTION_ERROR_NOT_SUPPORTEDNot supported
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.

This function checks if there is another profile available to iterate over using the given profile iterator handle.
If the next element exists, it returns true; otherwise, it returns false.
The specific error code can be obtained using the get_last_result() method.
Error codes are described in Exception section.

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
Exceptions:
CONNECTION_ERROR_NONESuccessful
Return values:
CONNECTION_ERROR_NOT_INITIALIZEDNot initialized
Exceptions:
CONNECTION_ERROR_NOT_SUPPORTEDNot supported
See also:
get_last_result()

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

This function moves the given profile iterator to the next position and retrieves the profile handle at that position.
If the end of the iteration is reached, the function returns CONNECTION_ERROR_ITERATOR_END.
The retrieved profile handle will be automatically destroyed when the profile iterator is destroyed.
To continue using the profile handle after the iterator is destroyed, make a copy of it.

Since :
2.3
Remarks:
The profile will be destroyed automatically when the profile iterator is destroyed. Make a copy if you want to keep using it.
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_NOT_INITIALIZEDNot initialized
CONNECTION_ERROR_INVALID_PARAMETERInvalid parameter
CONNECTION_ERROR_ITERATOR_ENDEnd of iteration
CONNECTION_ERROR_NOT_SUPPORTEDNot supported
int connection_remove_profile ( connection_h  connection,
connection_profile_h  profile 
)

Removes an existing profile.

This function removes the specified profile from the profile list.

Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/network.profile
http://tizen.org/privilege/network.get
Remarks:
This function needs both privileges.
Parameters:
[in]connectionThe connection handle
[in]profileThe profile handle
Returns:
0 on success, otherwise a negative error value
Return values:
CONNECTION_ERROR_NONESuccessful
CONNECTION_ERROR_NOT_INITIALIZEDNot initialized
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.

Warning:
This is not for use by third-party applications.
Deprecated:
Deprecated since 4.0. Use connection_remove_route_entry() instead.

You can get the interface_name from connection_profile_get_network_interface_name() of opened profile.

Since :
2.3
Privilege Level:
partner
Privilege:
http://tizen.org/privilege/network.route
Remarks:
Since 6.0, the required privilege and level of this function has changed.
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 a negative error value
Return values:
CONNECTION_ERROR_NONESuccessful
CONNECTION_ERROR_NOT_INITIALIZEDNot initialized
CONNECTION_ERROR_INVALID_PARAMETERInvalid parameter
CONNECTION_ERROR_OPERATION_FAILEDOperation failed
CONNECTION_ERROR_PERMISSION_DENIEDPermission denied
CONNECTION_ERROR_NOT_SUPPORTEDNot supported
See also:
connection_profile_get_network_interface_name()
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.

Warning:
This is not for use by third-party applications.

You can get the interface_name from
connection_profile_get_network_interface_name() of opened profile.

Since :
4.0
Privilege Level:
partner
Privilege:
http://tizen.org/privilege/network.route
Remarks:
Since 6.0, the required privilege and level of this function has changed.
Parameters:
[in]connectionThe connection handle
[in]address_familyThe address family
[in]interface_nameThe name of network interface
[in]host_addressThe 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]gatewayThe gateway address
Returns:
0 on success, otherwise a negative error value
Return values:
CONNECTION_ERROR_NONESuccessful
CONNECTION_ERROR_NOT_INITIALIZEDNot initialized
CONNECTION_ERROR_INVALID_PARAMETERInvalid parameter
CONNECTION_ERROR_OPERATION_FAILEDOperation failed
CONNECTION_ERROR_PERMISSION_DENIEDPermission denied
CONNECTION_ERROR_NOT_SUPPORTEDNot supported
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.

Warning:
This is not for use by third-party applications.
Deprecated:
Deprecated since 4.0. Use connection_remove_route_entry() instead.

You can get the interface_name from connection_profile_get_network_interface_name() of opened profile.

Since :
2.3.1
Privilege Level:
partner
Privilege:
http://tizen.org/privilege/network.route
Remarks:
Since 6.0, the required privilege and level of this function has changed.
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 a negative error value
Return values:
CONNECTION_ERROR_NONESuccessful
CONNECTION_ERROR_NOT_INITIALIZEDNot initialized
CONNECTION_ERROR_INVALID_PARAMETERInvalid parameter
CONNECTION_ERROR_OPERATION_FAILEDOperation failed
CONNECTION_ERROR_PERMISSION_DENIEDPermission denied
CONNECTION_ERROR_NOT_SUPPORTEDNot supported
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.

This function resets the cellular profiles.
It requires both network.profile and network.get privileges.
The type of reset can be specified using the 'type' parameter,
and the subscriber identity module ID to reset can be provided using the 'id' parameter.
The callback function and user data are used for asynchronous operation handling.

Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/network.profile
http://tizen.org/privilege/network.get
Remarks:
This function needs both privileges.
Parameters:
[in]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 a negative error value
Return values:
CONNECTION_ERROR_NONESuccessful
CONNECTION_ERROR_NOT_INITIALIZEDNot initialized
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.

This function sets the default profile for the specified cellular service type.
It requires both network.profile and network.get privileges.
The function only permits CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET and CONNECTION_CELLULAR_SERVICE_TYPE_PREPAID_INTERNET as valid service types.
If successful, it returns CONNECTION_ERROR_NONE; otherwise, it returns an appropriate error code.

Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/network.profile
http://tizen.org/privilege/network.get
Remarks:
This function needs both privileges.
Parameters:
[in]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_NOT_INITIALIZEDNot initialized
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.

This function sets the default profile for a specified cellular service type asynchronously.
It requires both network.profile and network.get privileges.
Only CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET and CONNECTION_CELLULAR_SERVICE_TYPE_PREPAID_INTERNET are allowed as the service type.
The function returns an integer value indicating the result of the operation.
If successful, it returns CONNECTION_ERROR_NONE; otherwise, it returns one of the other error codes.

Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/network.profile
http://tizen.org/privilege/network.get
Remarks:
This function needs both privileges.
Parameters:
[in]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 a negative error value
Return values:
CONNECTION_ERROR_NONESuccessful
CONNECTION_ERROR_NOT_INITIALIZEDNot initialized
CONNECTION_ERROR_INVALID_PARAMETERInvalid parameter
CONNECTION_ERROR_OPERATION_FAILEDOperation failed
CONNECTION_ERROR_PERMISSION_DENIEDPermission denied
CONNECTION_ERROR_NOT_SUPPORTEDNot supported
int connection_set_dhcp_state_changed_cb ( connection_h  connection,
connection_dhcp_state_changed_cb  callback,
void *  user_data 
)

Sets the callback that is called when the DHCP state is changed.

This function registers a callback function to receive notifications whenever the DHCP state changes for the connection.
When the DHCP state changes, the registered callback function will be invoked with the new DHCP state and the provided user data.

Since :
8.0
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_NOT_INITIALIZEDNot initialized
CONNECTION_ERROR_INVALID_PARAMETERInvalid parameter
CONNECTION_ERROR_OPERATION_FAILEDOperation failed
CONNECTION_ERROR_NOT_SUPPORTEDNot supported

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

Deprecated:
Deprecated since 4.0. Use connection_set_ethernet_cable_state_changed_cb() instead.
Since :
2.4
Parameters:
[in]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_NOT_INITIALIZEDNot initialized
CONNECTION_ERROR_INVALID_PARAMETERInvalid parameter
CONNECTION_ERROR_OPERATION_FAILEDOperation failed
CONNECTION_ERROR_NOT_SUPPORTEDNot supported

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

This function registers a callback function to be invoked when the state of the ethernet cable changes.
It allows you to monitor whether the ethernet cable is plugged in or out.

Since :
4.0
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_NOT_INITIALIZEDNot initialized
CONNECTION_ERROR_INVALID_PARAMETERInvalid parameter
CONNECTION_ERROR_OPERATION_FAILEDOperation failed
CONNECTION_ERROR_NOT_SUPPORTEDNot 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.

This function sets a callback function to receive notifications about changes in the Internet availability status of the connection.
When the Internet availability state changes, the provided callback function will be invoked with the new state
and the user data supplied during the registration.

Since :
5.5
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_NOT_INITIALIZEDNot initialized
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 
)

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

This function registers a callback function to be invoked when the IP address of the connection changes.

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_NOT_INITIALIZEDNot initialized
CONNECTION_ERROR_INVALID_PARAMETERInvalid parameter
CONNECTION_ERROR_OPERATION_FAILEDOperation failed
CONNECTION_ERROR_NOT_SUPPORTEDNot supported
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.

This function registers a callback function to be invoked when the proxy address changes for the connection.

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_NOT_INITIALIZEDNot initialized
CONNECTION_ERROR_INVALID_PARAMETERInvalid parameter
CONNECTION_ERROR_OPERATION_FAILEDOperation failed
CONNECTION_ERROR_NOT_SUPPORTEDNot supported
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.

This function registers a callback function to be invoked when the type of the current network connection changes.
The registered callback will be called with user data provided during registration whenever the connection type changes.

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_NOT_INITIALIZEDNot initialized
CONNECTION_ERROR_INVALID_PARAMETERInvalid parameter
CONNECTION_ERROR_OPERATION_FAILEDOperation failed
CONNECTION_ERROR_NOT_SUPPORTEDNot supported

Unsets the callback that is called when the DHCP state is changed.

This function removes the callback function that was previously registered to be invoked when the DHCP state changes.

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

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

Deprecated:
Deprecated since 4.0. Use connection_unset_ethernet_cable_state_changed_cb() instead.
Since :
2.4
Parameters:
[in]connectionThe connection handle
Returns:
0 on success, otherwise a negative error value
Return values:
CONNECTION_ERROR_NONESuccessful
CONNECTION_ERROR_NOT_INITIALIZEDNot initialized
CONNECTION_ERROR_INVALID_PARAMETERInvalid parameter
CONNECTION_ERROR_OPERATION_FAILEDOperation failed
CONNECTION_ERROR_NOT_SUPPORTEDNot supported

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

This function removes the callback that was previously set to receive notifications when the ethernet cable is plugged in or out.

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

Unsets the callback that is called when the Internet state of the current connection is changed.

This function removes the previously set callback for monitoring changes in the Internet state of the connection.
After calling this function, the callback will no longer be invoked when the Internet state changes.

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

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

This function removes the callback function that was previously set to be called when the IP address changes for the connection.
After calling this function, no further notifications will be sent about IP address changes.

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

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

This function removes the callback function that was previously set using connection_set_proxy_address_changed_cb().
After calling this function, the proxy address change events will no longer be delivered to the application.

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

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

This function removes the callback function that was previously registered using connection_set_type_changed_cb().
After calling this function, the connection_type_changed_cb callback will no longer be called when the connection type changes.

Since :
2.3
Parameters:
[in]connectionThe connection handle
Returns:
0 on success, otherwise a negative error value
Return values:
CONNECTION_ERROR_NONESuccessful
CONNECTION_ERROR_NOT_INITIALIZEDNot initialized
CONNECTION_ERROR_INVALID_PARAMETERInvalid parameter
CONNECTION_ERROR_OPERATION_FAILEDOperation failed
CONNECTION_ERROR_NOT_SUPPORTEDNot supported
int connection_update_profile ( connection_h  connection,
connection_profile_h  profile 
)

Updates an existing profile.

When a profile is changed, these changes will be not applied to the Connection Manager immediately. When you call this function, your changes affect the Connection Manager and the existing profile is updated. In addition, the existing profile will be updated if you call connection_open_profile().

Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/network.profile
http://tizen.org/privilege/network.get
Remarks:
This function needs both privileges.
Parameters:
[in]connectionThe connection handle
[in]profileThe profile handle
Returns:
0 on success, otherwise a negative error value
Return values:
CONNECTION_ERROR_NONESuccessful
CONNECTION_ERROR_NOT_INITIALIZEDNot initialized
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()