Tizen Native API
5.0
|
The Network Monitoring API provides functions for getting connection information.
#include <inm.h>
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.
This API is related with the following features:
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. | |
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 void(* connection_state_changed_cb)(inm_connection_state_e state, void *user_data) |
Called when the state of the connection is changed.
[in] | state | The state |
[in] | user_data | The user data passed from the callback registration function |
enum inm_address_family_e |
enum inm_ip_config_type_e |
Enumeration for IP configuration type.
enum inm_proxy_type_e |
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.
[in] | connection | The connection handle |
[in] | address_family | The address family |
[out] | dhcp_lease_duration | The DHCP lease duration in seconds |
0
on success, otherwise a negative error value 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.
[in] | connection | The connection handle |
[in] | address_family | The address family |
[out] | dhcp_server | The DHCP Server address |
0
on success, otherwise a negative error value 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.
2
. You must release dns_address using free(). [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 |
0
on success, otherwise a negative error value 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.
[in] | connection | The connection handle |
[in] | address_family | The address family |
[out] | type | The DNS config type |
0
on success, otherwise a negative error value 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.
[in] | connection | The connection handle |
[in] | address_family | The address family |
[out] | gateway_address | The gateway address |
0
on success, otherwise a negative error value 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.
[in] | connection | The connection handle |
[out] | id | The ID of the connection |
0
on success, otherwise a negative error value 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_address | ( | inm_connection_h | connection, |
inm_address_family_e | address_family, | ||
char ** | ip_address | ||
) |
Gets the IP address.
[in] | connection | The connection handle |
[in] | address_family | The address family |
[out] | ip_address | The IP address |
0
on success, otherwise a negative error value 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.
[in] | connection | The connection handle |
[in] | address_family | The address family |
[out] | type | The type of the IP config |
0
on success, otherwise a negative error value 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.
[in] | connection | The connection handle |
[out] | state | The connection state |
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_name | ( | inm_connection_h | connection, |
char ** | name | ||
) |
Gets the connection name.
[in] | connection | The connection handle |
[out] | name | The name of the connection |
0
on success, otherwise a negative error value 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_network_interface_name | ( | inm_connection_h | connection, |
char ** | interface_name | ||
) |
Gets the name of the network interface, e.g. eth0 and pdp0.
[in] | connection | The connection handle |
[out] | interface_name | The name of the network interface |
0
on success, otherwise a negative error value 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.
[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) |
0
on success, otherwise a negative error value 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.
[in] | connection | The connection handle |
[in] | address_family | The address family |
[out] | proxy_address | The proxy address |
0
on success, otherwise a negative error value 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.
[in] | connection | The connection handle |
[out] | type | The type of the proxy |
0
on success, otherwise a negative error value 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.
[in] | connection | The connection handle |
[out] | state | The state of the connection |
0
on success, otherwise a negative error value 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.
[in] | connection | The connection handle |
[in] | address_family | The address family |
[out] | subnet_mask | The subnet mask |
0
on success, otherwise a negative error value 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.
[in] | connection | The connection handle |
[out] | type | The type of the connection |
0
on success, otherwise a negative error value 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.
[in] | connection | The connection handle |
0
on success, otherwise a negative error value 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.
[in] | connection | The connection handle |
[in] | callback | The callback function to be called |
[in] | user_data | The user data passed to the callback function |
0
on success, otherwise a negative error value 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_unset_state_changed_cb | ( | inm_connection_h | connection | ) |
Unsets the callback that is called when the state of connection is changed.
[in] | connection | The connection handle |
0
on success, otherwise a negative error value 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 |