Tizen Native API
6.5
|
The Network Monitoring API provides functions for getting connection information.
Required Header
#include <inm.h>
Overview
This set of functions is used to get connection information. To use This kind of APIs, You should create a inm handle using inm_initialize(). After that, you need to get connection handle using inm_get_current_connection(), inm_connection_clone(), inm_connection_iterator_next. You should destroy the created connection handle if you do not need it anymore. You should destroy the created inm handle if you do not need it anymore.
Related Features
This API is related with the following features:
- http://tizen.org/feature/network.ethernet
- http://tizen.org/feature/network.wifi
- http://tizen.org/feature/network.telephony
- http://tizen.org/feature/network.tethering.bluetooth
- http://tizen.org/feature/network.inm
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 | inm_connection_get_id (inm_connection_h connection, char **id) |
Gets the connection ID. | |
int | inm_connection_get_name (inm_connection_h connection, char **name) |
Gets the connection name. | |
int | inm_connection_get_type (inm_connection_h connection, inm_connection_type_e *type) |
Gets the network type. | |
int | inm_connection_get_network_interface_name (inm_connection_h connection, char **interface_name) |
Gets the name of the network interface, e.g. eth0 and pdp0. | |
int | inm_connection_refresh (inm_connection_h connection) |
Refreshes the connection information. | |
int | inm_connection_get_state (inm_connection_h connection, inm_connection_state_e *state) |
Gets the network state. | |
int | inm_connection_get_ipv6_state (inm_connection_h connection, inm_connection_state_e *state) |
Gets the IPv6 network state. | |
int | inm_connection_get_ip_config_type (inm_connection_h connection, inm_address_family_e address_family, inm_ip_config_type_e *type) |
Gets the IP config type. | |
int | inm_connection_get_ip_address (inm_connection_h connection, inm_address_family_e address_family, char **ip_address) |
Gets the IP address. | |
int | inm_connection_get_subnet_mask (inm_connection_h connection, inm_address_family_e address_family, char **subnet_mask) |
Gets the Subnet Mask. | |
int | inm_connection_get_gateway_address (inm_connection_h connection, inm_address_family_e address_family, char **gateway_address) |
Gets the Gateway address. | |
int | inm_connection_get_dhcp_server_address (inm_connection_h connection, inm_address_family_e address_family, char **dhcp_server) |
Gets the DHCP Server address. | |
int | inm_connection_get_dhcp_lease_duration (inm_connection_h connection, inm_address_family_e address_family, int *dhcp_lease_duration) |
Gets the DHCP lease duration. | |
int | inm_connection_get_dns_address (inm_connection_h connection, int order, inm_address_family_e address_family, char **dns_address) |
Gets the DNS address. | |
int | inm_connection_get_proxy_type (inm_connection_h connection, inm_proxy_type_e *type) |
Gets the Proxy type. | |
int | inm_connection_get_proxy_address (inm_connection_h connection, inm_address_family_e address_family, char **proxy_address) |
Gets the Proxy address. | |
int | inm_connection_get_dns_config_type (inm_connection_h connection, inm_address_family_e address_family, inm_dns_config_type_e *type) |
Gets the DNS config type. | |
int | inm_connection_get_prefix_length (inm_connection_h connection, inm_address_family_e address_family, int *prefix_len) |
Gets the network prefix length. | |
int | inm_connection_set_state_changed_cb (inm_connection_h connection, connection_state_changed_cb callback, void *user_data) |
Sets the callback that is called when the state of connection is changed. | |
int | inm_connection_unset_state_changed_cb (inm_connection_h connection) |
Unsets the callback that is called when the state of connection is changed. | |
int | inm_connection_get_link (inm_connection_h connection, inm_link_h *link) |
Gets the link handle for this connection. | |
Typedefs | |
typedef void(* | connection_state_changed_cb )(inm_connection_state_e state, void *user_data) |
Called when the state of the connection is changed. |
Typedef Documentation
typedef void(* connection_state_changed_cb)(inm_connection_state_e state, void *user_data) |
Called when the state of the connection is changed.
- Since :
- 5.0
- Parameters:
-
[in] state The state [in] user_data The user data passed from the callback registration function
Enumeration Type Documentation
enum inm_address_family_e |
enum inm_ip_config_type_e |
Enumeration for IP configuration type.
- Since :
- 5.0
- Enumerator:
enum inm_proxy_type_e |
Function Documentation
int inm_connection_get_dhcp_lease_duration | ( | inm_connection_h | connection, |
inm_address_family_e | address_family, | ||
int * | dhcp_lease_duration | ||
) |
Gets the DHCP lease duration.
- Since :
- 5.0
- Remarks:
- This function is supported only for IPv4 address family.
- Parameters:
-
[in] connection The connection handle [in] address_family The address family [out] dhcp_lease_duration The DHCP lease duration in seconds
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
INM_ERROR_NONE Successful INM_ERROR_INVALID_PARAMETER Invalid parameter INM_ERROR_NOT_SUPPORTED Not supported INM_ERROR_NOT_INITIALIZED Not initialized INM_ERROR_OPERATION_FAILED Operation failed
int inm_connection_get_dhcp_server_address | ( | inm_connection_h | connection, |
inm_address_family_e | address_family, | ||
char ** | dhcp_server | ||
) |
Gets the DHCP Server address.
- Since :
- 5.0
- Remarks:
- You must release dhcp_server using free(). This function is supported only for IPv4 address family.
- Parameters:
-
[in] connection The connection handle [in] address_family The address family [out] dhcp_server The DHCP Server address
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
INM_ERROR_NONE Successful INM_ERROR_OUT_OF_MEMORY Out of memory INM_ERROR_INVALID_PARAMETER Invalid parameter INM_ERROR_NOT_SUPPORTED Not supported INM_ERROR_NOT_INITIALIZED Not initialized INM_ERROR_OPERATION_FAILED Operation failed
int inm_connection_get_dns_address | ( | inm_connection_h | connection, |
int | order, | ||
inm_address_family_e | address_family, | ||
char ** | dns_address | ||
) |
Gets the DNS address.
- Since :
- 5.0
- Remarks:
- The allowance of the DNS address is
2
. You must release dns_address using free().
- Parameters:
-
[in] connection The connection handle [in] order The order of DNS address
It starts from 1, which means first DNS address[in] address_family The address family [out] dns_address The DNS address
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
INM_ERROR_NONE Successful INM_ERROR_OUT_OF_MEMORY Out of memory INM_ERROR_INVALID_PARAMETER Invalid parameter INM_ERROR_NOT_SUPPORTED Not supported INM_ERROR_NOT_INITIALIZED Not initialized INM_ERROR_OPERATION_FAILED Operation failed
int inm_connection_get_dns_config_type | ( | inm_connection_h | connection, |
inm_address_family_e | address_family, | ||
inm_dns_config_type_e * | type | ||
) |
Gets the DNS config type.
- Since :
- 5.0
- Parameters:
-
[in] connection The connection handle [in] address_family The address family [out] type The DNS config type
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
INM_ERROR_NONE Successful INM_ERROR_INVALID_PARAMETER Invalid parameter INM_ERROR_NOT_SUPPORTED Not supported INM_ERROR_NOT_INITIALIZED Not initialized INM_ERROR_OPERATION_FAILED Operation failed
int inm_connection_get_gateway_address | ( | inm_connection_h | connection, |
inm_address_family_e | address_family, | ||
char ** | gateway_address | ||
) |
Gets the Gateway address.
- Since :
- 5.0
- Remarks:
- You must release gateway_address using free().
- Parameters:
-
[in] connection The connection handle [in] address_family The address family [out] gateway_address The gateway address
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
INM_ERROR_NONE Successful INM_ERROR_OUT_OF_MEMORY Out of memory INM_ERROR_INVALID_PARAMETER Invalid parameter INM_ERROR_NOT_SUPPORTED Not supported INM_ERROR_NOT_INITIALIZED Not initialized INM_ERROR_OPERATION_FAILED Operation failed
int inm_connection_get_id | ( | inm_connection_h | connection, |
char ** | id | ||
) |
Gets the connection ID.
Two different connections can have the same name. So, you must use this function instead of inm_connection_get_name() if you want to get the unique identification.
- Since :
- 5.0
- Remarks:
- You must release id using free().
- Parameters:
-
[in] connection The connection handle [out] id The ID of the connection
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
INM_ERROR_NONE Successful INM_ERROR_OUT_OF_MEMORY Out of memory INM_ERROR_INVALID_PARAMETER Invalid parameter INM_ERROR_NOT_SUPPORTED Not supported INM_ERROR_NOT_INITIALIZED Not initialized INM_ERROR_OPERATION_FAILED Operation failed
- See also:
- inm_connection_get_name()
int inm_connection_get_ip_address | ( | inm_connection_h | connection, |
inm_address_family_e | address_family, | ||
char ** | ip_address | ||
) |
Gets the IP address.
- Since :
- 5.0
- Remarks:
- You must release ip_address using free().
- Parameters:
-
[in] connection The connection handle [in] address_family The address family [out] ip_address The IP address
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
INM_ERROR_NONE Successful INM_ERROR_OUT_OF_MEMORY Out of memory INM_ERROR_INVALID_PARAMETER Invalid parameter INM_ERROR_NOT_SUPPORTED Not supported INM_ERROR_NOT_INITIALIZED Not initialized INM_ERROR_OPERATION_FAILED Operation failed
int inm_connection_get_ip_config_type | ( | inm_connection_h | connection, |
inm_address_family_e | address_family, | ||
inm_ip_config_type_e * | type | ||
) |
Gets the IP config type.
- Since :
- 5.0
- Parameters:
-
[in] connection The connection handle [in] address_family The address family [out] type The type of the IP config
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
INM_ERROR_NONE Successful INM_ERROR_INVALID_PARAMETER Invalid parameter INM_ERROR_NOT_SUPPORTED Not supported INM_ERROR_NOT_INITIALIZED Not initialized INM_ERROR_OPERATION_FAILED Operation failed
int inm_connection_get_ipv6_state | ( | inm_connection_h | connection, |
inm_connection_state_e * | state | ||
) |
Gets the IPv6 network state.
- Since :
- 5.0
- Parameters:
-
[in] connection The connection handle [out] state The connection state
- Returns:
- 0 on success, otherwise negative error value
- Return values:
-
INM_ERROR_NONE Successful INM_ERROR_INVALID_PARAMETER Invalid parameter INM_ERROR_NOT_SUPPORTED Not supported INM_ERROR_NOT_INITIALIZED Not initialized INM_ERROR_OPERATION_FAILED Operation failed
int inm_connection_get_link | ( | inm_connection_h | connection, |
inm_link_h * | link | ||
) |
Gets the link handle for this connection.
- Since :
- 5.5
- Remarks:
- You must release link using inm_link_destroy().
- Parameters:
-
[in] connection The connection handle [out] link The link of the connection handle
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
INM_ERROR_NONE Successful INM_ERROR_OUT_OF_MEMORY Out of memory INM_ERROR_INVALID_PARAMETER Invalid parameter INM_ERROR_NOT_SUPPORTED Not supported INM_ERROR_NOT_INITIALIZED Not initialized INM_ERROR_OPERATION_FAILED Operation failed
- See also:
- inm_link_clone()
int inm_connection_get_name | ( | inm_connection_h | connection, |
char ** | name | ||
) |
Gets the connection name.
- Since :
- 5.0
- Remarks:
- You must release name using free().
- Parameters:
-
[in] connection The connection handle [out] name The name of the connection
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
INM_ERROR_NONE Successful INM_ERROR_OUT_OF_MEMORY Out of memory INM_ERROR_INVALID_PARAMETER Invalid parameter INM_ERROR_NOT_SUPPORTED Not supported INM_ERROR_NOT_INITIALIZED Not initialized INM_ERROR_OPERATION_FAILED Operation failed
- See also:
- inm_connection_get_id()
int inm_connection_get_network_interface_name | ( | inm_connection_h | connection, |
char ** | interface_name | ||
) |
Gets the name of the network interface, e.g. eth0 and pdp0.
- Since :
- 5.0
- Remarks:
- You must release interface_name using free().
- Parameters:
-
[in] connection The connection handle [out] interface_name The name of the network interface
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
INM_ERROR_NONE Successful INM_ERROR_OUT_OF_MEMORY Out of memory INM_ERROR_INVALID_PARAMETER Invalid parameter INM_ERROR_NOT_SUPPORTED Not supported INM_ERROR_NOT_INITIALIZED Not initialized INM_ERROR_OPERATION_FAILED Operation failed
int inm_connection_get_prefix_length | ( | inm_connection_h | connection, |
inm_address_family_e | address_family, | ||
int * | prefix_len | ||
) |
Gets the network prefix length.
- Since :
- 5.0
- Parameters:
-
[in] connection The connection handle [in] address_family The address family [out] prefix_len The network prefix length
In case of IPv4, it means netmask length (also called a prefix, e.g. 8, 16, 24, 32)
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
INM_ERROR_NONE Successful INM_ERROR_INVALID_PARAMETER Invalid parameter INM_ERROR_NOT_SUPPORTED Not supported INM_ERROR_NOT_INITIALIZED Not initialized INM_ERROR_OPERATION_FAILED Operation failed
int inm_connection_get_proxy_address | ( | inm_connection_h | connection, |
inm_address_family_e | address_family, | ||
char ** | proxy_address | ||
) |
Gets the Proxy address.
- Since :
- 5.0
- Remarks:
- You must release proxy_address using free().
- Parameters:
-
[in] connection The connection handle [in] address_family The address family [out] proxy_address The proxy address
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
INM_ERROR_NONE Successful INM_ERROR_OUT_OF_MEMORY Out of memory INM_ERROR_INVALID_PARAMETER Invalid parameter INM_ERROR_NOT_SUPPORTED Not supported INM_ERROR_NOT_INITIALIZED Not initialized INM_ERROR_OPERATION_FAILED Operation failed
int inm_connection_get_proxy_type | ( | inm_connection_h | connection, |
inm_proxy_type_e * | type | ||
) |
Gets the Proxy type.
- Since :
- 5.0
- Parameters:
-
[in] connection The connection handle [out] type The type of the proxy
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
INM_ERROR_NONE Successful INM_ERROR_INVALID_PARAMETER Invalid parameter INM_ERROR_NOT_SUPPORTED Not supported INM_ERROR_NOT_INITIALIZED Not initialized INM_ERROR_OPERATION_FAILED Operation failed
int inm_connection_get_state | ( | inm_connection_h | connection, |
inm_connection_state_e * | state | ||
) |
Gets the network state.
- Since :
- 5.0
- Parameters:
-
[in] connection The connection handle [out] state The state of the connection
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
INM_ERROR_NONE Successful INM_ERROR_INVALID_PARAMETER Invalid parameter INM_ERROR_NOT_SUPPORTED Not supported INM_ERROR_NOT_INITIALIZED Not initialized INM_ERROR_OPERATION_FAILED Operation failed
int inm_connection_get_subnet_mask | ( | inm_connection_h | connection, |
inm_address_family_e | address_family, | ||
char ** | subnet_mask | ||
) |
Gets the Subnet Mask.
- Since :
- 5.0
- Remarks:
- You must release subnet_mask using free(). This function is supported only for IPv4 address family.
- Parameters:
-
[in] connection The connection handle [in] address_family The address family [out] subnet_mask The subnet mask
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
INM_ERROR_NONE Successful INM_ERROR_OUT_OF_MEMORY Out of memory INM_ERROR_INVALID_PARAMETER Invalid parameter INM_ERROR_NOT_SUPPORTED Not supported INM_ERROR_NOT_INITIALIZED Not initialized INM_ERROR_OPERATION_FAILED Operation failed
int inm_connection_get_type | ( | inm_connection_h | connection, |
inm_connection_type_e * | type | ||
) |
Gets the network type.
- Since :
- 5.0
- Parameters:
-
[in] connection The connection handle [out] type The type of the connection
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
INM_ERROR_NONE Successful INM_ERROR_INVALID_PARAMETER Invalid parameter INM_ERROR_NOT_SUPPORTED Not supported INM_ERROR_NOT_INITIALIZED Not initialized INM_ERROR_OPERATION_FAILED Operation failed
int inm_connection_refresh | ( | inm_connection_h | connection | ) |
Refreshes the connection information.
- Since :
- 5.0
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/network.get
- Remarks:
- You should call this function in order to get the current information because the connection information can be changed.
- Parameters:
-
[in] connection The connection handle
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
INM_ERROR_NONE Successful INM_ERROR_OUT_OF_MEMORY Out of memory INM_ERROR_PERMISSION_DENIED Permission Denied INM_ERROR_INVALID_PARAMETER Invalid parameter INM_ERROR_NOT_SUPPORTED Not supported INM_ERROR_NOT_INITIALIZED Not initialized INM_ERROR_OPERATION_FAILED Operation failed
int inm_connection_set_state_changed_cb | ( | inm_connection_h | connection, |
connection_state_changed_cb | callback, | ||
void * | user_data | ||
) |
Sets the callback that is called when the state of connection is changed.
- Since :
- 5.0
- Parameters:
-
[in] connection The connection handle [in] callback The callback function to be called [in] user_data The user data passed to the callback function
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
INM_ERROR_NONE Successful INM_ERROR_INVALID_PARAMETER Invalid parameter INM_ERROR_NOT_SUPPORTED Not supported INM_ERROR_NOT_INITIALIZED Not initialized INM_ERROR_OPERATION_FAILED Operation failed
- Postcondition:
- connection_opened_cb() is invoked when the state of connection is changed.
int inm_connection_unset_state_changed_cb | ( | inm_connection_h | connection | ) |
Unsets the callback that is called when the state of connection is changed.
- Since :
- 5.0
- Parameters:
-
[in] connection The connection handle
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
INM_ERROR_NONE Successful INM_ERROR_INVALID_PARAMETER Invalid parameter INM_ERROR_NOT_SUPPORTED Not supported INM_ERROR_NOT_INITIALIZED Not initialized INM_ERROR_OPERATION_FAILED Operation failed