Tizen Native API  6.0
Network Monitoring Specific

The Network Monitoring Specific API provides functions for provide monitoring specific.

Required Header

#include <inm.h>

Overview

This set of functions is used to get information about network information provided by well-known linux functions. To use This kind of APIs, You should create a inm handle using inm_initialize(). After that, you can obtain network information. You should destroy the created inm handle if you do not need it anymore. You can detect IP collision, do dump network status, dump TCP, monitor ethernet, Wi-Fi module state, get network statistics.

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.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_set_ethernet_cable_state_changed_cb (inm_h inm, inm_ethernet_cable_state_changed_cb callback, void *user_data)
 Sets a callback called when the Ethernet cable state is changed.
int inm_unset_ethernet_cable_state_changed_cb (inm_h inm)
 Unsets the callback called when the Ethernet cable state is changed.
int inm_get_ethernet_cable_state (inm_h inm, inm_ethernet_cable_state_e *state)
 Gets the Ethernet cable state.
int inm_set_wifi_module_state_changed_cb (inm_h inm, inm_wifi_module_state_changed_cb callback, void *user_data)
 Sets a callback called when the Wi-Fi Module state is changed.
int inm_unset_wifi_module_state_changed_cb (inm_h inm)
 Unsets the callback called when the Wi-Fi Module state is changed.
int inm_get_wifi_module_state (inm_h inm, inm_wifi_module_state_e *state)
 Gets the Wi-Fi Module state.
int inm_set_ip_conflict_cb (inm_h inm, inm_ip_conflict_cb callback, void *user_data)
 Sets the callback called when IP conflict state is changed.
int inm_unset_ip_conflict_cb (inm_h inm)
 Unsets the callback called when IP conflict state is changed.
int inm_ip_conflict_detect_is_enabled (inm_h inm, bool *state)
 Checks whether IP conflict detection is enabled.
int inm_get_ip_conflict_state (inm_h inm, inm_ip_conflict_state_e *state)
 Gets the state of the IP conflict.
int inm_get_statistics (inm_h inm, inm_connection_type_e connection_type, inm_statistics_type_e statistics_type, unsigned long long *size)
 Gets the statistics information.
int inm_reset_statistics (inm_h inm, inm_connection_type_e connection_type, inm_statistics_type_e statistics_type)
 Resets the statistics information.
int inm_set_congestion_level_cb (inm_h inm, inm_congestion_level_cb callback, void *user_data)
 Sets the callback called when the TCP congestion level is updated.
int inm_unset_congestion_level_cb (inm_h inm)
 Unsets the callback called when the TCP congestion level is updated.
int inm_get_congestion_level (inm_h inm, inm_congestion_level_e *level)
 Gets the TCP congestion level.
int inm_set_retry_tx_rate_cb (inm_h inm, inm_retry_tx_rate_cb callback, void *user_data)
 Sets the callback called the TCP TX retry rate is updated.
int inm_unset_retry_tx_rate_cb (inm_h inm)
 Unsets the callback called when the TCP TX retry rate is updated.
int inm_get_retry_tx_rate (inm_h inm, int *rate)
 Gets the TCP TX retry rate.
int inm_set_channel_interference_cb (inm_h inm, inm_channel_interference_cb callback, void *user_data)
 Sets the callback to be called when the channel interference is updated.
int inm_unset_channel_interference_cb (inm_h inm)
 Unsets the callback called when the channel interference is updated.
int inm_get_channel_interference (inm_h inm, double *ch_intf)
 Gets the channel interference of the wireless network.

Typedefs

typedef void(* inm_ethernet_cable_state_changed_cb )(inm_ethernet_cable_state_e state, void *user_data)
 Called when the Ethernet cable state is changed.
typedef void(* inm_wifi_module_state_changed_cb )(inm_wifi_module_state_e state, void *user_data)
 Called when the Wi-Fi Module state is changed.
typedef void(* inm_ip_conflict_cb )(char *if_name, char *ip, inm_ip_conflict_state_e state, void *user_data)
 Called when the IP conflict state is changed.
typedef void(* inm_congestion_level_cb )(inm_congestion_level_e level, void *user_data)
 Called when the TCP congestion level is updated.
typedef void(* inm_retry_tx_rate_cb )(int rate, void *user_data)
 Called when the retry TX rate is updated.
typedef void(* inm_channel_interference_cb )(int freq, double channel_intf, void *user_data)
 Called when the channel interference is updated.

Typedef Documentation

typedef void(* inm_channel_interference_cb)(int freq, double channel_intf, void *user_data)

Called when the channel interference is updated.

Since :
5.0
Parameters:
[in]freqThe frequency of wireless network
[in]channel_intfThe current channel interference
[in]user_dataThe user data passed from the callback registration function
See also:
inm_set_channel_interference_cb()
inm_unset_channel_interference_cb()
typedef void(* inm_congestion_level_cb)(inm_congestion_level_e level, void *user_data)

Called when the TCP congestion level is updated.

Since :
5.0
Parameters:
[in]levelThe current TCP congestion level
[in]user_dataThe user data passed from the callback registration function
See also:
inm_set_congestion_level_cb()
inm_unset_congestion_level_cb()
typedef void(* inm_ethernet_cable_state_changed_cb)(inm_ethernet_cable_state_e state, void *user_data)

Called when the Ethernet cable state is changed.

Since :
5.0
Parameters:
[in]stateThe Ethernet cable state
[in]user_dataThe user data passed from the callback registration function
See also:
inm_set_ethernet_cable_state_changed_cb()
inm_unset_ethernet_cable_state_changed_cb()
typedef void(* inm_ip_conflict_cb)(char *if_name, char *ip, inm_ip_conflict_state_e state, void *user_data)

Called when the IP conflict state is changed.

Since :
5.0
Remarks:
if_name and ip should not be freed. if_name and ip is available only in the callback. To use outside the callback, make a copy.
Parameters:
[in]if_nameThe destination interface name causing conflict
[in]ipThe local IP address causing conflict
[in]stateThe current state
[in]user_dataThe user data passed from the callback registration function
See also:
inm_set_ip_conflict_cb()
inm_unset_ip_conflict_cb()
typedef void(* inm_retry_tx_rate_cb)(int rate, void *user_data)

Called when the retry TX rate is updated.

Since :
5.0
Parameters:
[in]rateThe current TCP TX retry rate
[in]user_dataThe user data passed from the callback registration function
See also:
inm_set_retry_tx_rate_cb()
inm_unset_retry_tx_rate_cb()
typedef void(* inm_wifi_module_state_changed_cb)(inm_wifi_module_state_e state, void *user_data)

Called when the Wi-Fi Module state is changed.

Since :
5.0
Parameters:
[in]stateThe Wi-Fi Module state
[in]user_dataThe user data passed from the callback registration function
See also:
inm_set_wifi_module_state_changed_cb()
inm_unset_wifi_module_state_changed_cb()

Enumeration Type Documentation

Enumeration for congestion level.

Since :
5.0
Enumerator:
INM_CONGESTION_LEVEL_VERY_HIGH 

Very high TCP congestion

INM_CONGESTION_LEVEL_HIGH 

High TCP congestion

INM_CONGESTION_LEVEL_MEDIUM 

Medium TCP congestion

INM_CONGESTION_LEVEL_LOW 

Low TCP congestion

Enumeration for connection type.

Since :
5.0
Enumerator:
INM_CONNECTION_TYPE_DISCONNECTED 

Disconnected

INM_CONNECTION_TYPE_WIFI 

Wi-Fi type

INM_CONNECTION_TYPE_CELLULAR 

Cellular type

INM_CONNECTION_TYPE_ETHERNET 

Ethernet type

INM_CONNECTION_TYPE_BT 

Bluetooth type

INM_CONNECTION_TYPE_NET_PROXY 

Proxy type for internet connection

Enumeration for the Ethernet cable state.

Since :
5.0
Enumerator:
INM_ETHERNET_CABLE_STATE_DETACHED 

Ethernet cable is detached

INM_ETHERNET_CABLE_STATE_ATTACHED 

Ethernet cable is attached

Enumeration for the state of the IP conflict.

Since :
5.0
Enumerator:
INM_IP_CONFLICT_STATE_UNKNOWN 

Unknown state

INM_IP_CONFLICT_STATE_CONFLICT_NOT_DETECTED 

Resolved state

INM_IP_CONFLICT_STATE_CONFLICT_DETECTED 

Conflict state

Enumeration for statistics type.

Since :
5.0
Enumerator:
INM_STATISTICS_TYPE_LAST_RECEIVED_DATA 

Last received data

INM_STATISTICS_TYPE_LAST_SENT_DATA 

Last sent data

INM_STATISTICS_TYPE_TOTAL_RECEIVED_DATA 

Total received data

INM_STATISTICS_TYPE_TOTAL_SENT_DATA 

Total sent data

Enumeration for the Wi-Fi Module state.

Since :
5.0
Enumerator:
INM_WIFI_MODULE_STATE_DETACHED 

Wi-Fi Module is detached

INM_WIFI_MODULE_STATE_ATTACHED 

Wi-Fi Module is attached


Function Documentation

int inm_get_channel_interference ( inm_h  inm,
double *  ch_intf 
)

Gets the channel interference of the wireless network.

Since :
5.0
Privilege Level:
public
Privilege:
http://tizen.org/privilege/network.get
Parameters:
[in]inmThe monitoring handle
[out]ch_intfThe current channel interference
Returns:
0 on success, otherwise negative error value
Return values:
INM_ERROR_NONESuccessful
INM_ERROR_PERMISSION_DENIEDPermission Denied
INM_ERROR_INVALID_PARAMETERInvalid parameter
INM_ERROR_NOT_SUPPORTEDNot supported
INM_ERROR_NOT_INITIALIZEDNot initialized
INM_ERROR_OPERATION_FAILEDOperation failed

Gets the TCP congestion level.

Since :
5.0
Privilege Level:
public
Privilege:
http://tizen.org/privilege/network.get
Parameters:
[in]inmThe monitoring handle
[out]levelThe current TCP congestion level
Returns:
0 on success, otherwise negative error value
Return values:
INM_ERROR_NONESuccessful
INM_ERROR_PERMISSION_DENIEDPermission Denied
INM_ERROR_INVALID_PARAMETERInvalid parameter
INM_ERROR_NOT_SUPPORTEDNot supported
INM_ERROR_NOT_INITIALIZEDNot initialized
INM_ERROR_OPERATION_FAILEDOperation failed

Gets the Ethernet cable state.

Since :
5.0
Privilege Level:
public
Privilege:
http://tizen.org/privilege/network.get
Parameters:
[in]inmThe monitor handle
[out]stateThe Ethernet cable state
Returns:
0 on success, otherwise negative error value
Return values:
INM_ERROR_NONESuccessful
INM_ERROR_PERMISSION_DENIEDPermission Denied
INM_ERROR_INVALID_PARAMETERInvalid parameter
INM_ERROR_NOT_SUPPORTEDNot supported
INM_ERROR_NOT_INITIALIZEDNot initialized
INM_ERROR_OPERATION_FAILEDOperation failed

Gets the state of the IP conflict.

Since :
5.0
Privilege Level:
public
Privilege:
http://tizen.org/privilege/network.get
Parameters:
[in]inmThe monitoring handle
[out]stateThe current state of IP conflict
Returns:
0 on success, otherwise negative error value
Return values:
INM_ERROR_NONESuccessful
INM_ERROR_PERMISSION_DENIEDPermission Denied
INM_ERROR_INVALID_PARAMETERInvalid parameter
INM_ERROR_NOT_SUPPORTEDNot supported
INM_ERROR_NOT_INITIALIZEDNot initialized
INM_ERROR_OPERATION_FAILEDOperation failed
int inm_get_retry_tx_rate ( inm_h  inm,
int *  rate 
)

Gets the TCP TX retry rate.

Since :
5.0
Privilege Level:
public
Privilege:
http://tizen.org/privilege/network.get
Parameters:
[in]inmThe monitoring handle
[out]rateThe current TCP TX retry rate
Returns:
0 on success, otherwise negative error value
Return values:
INM_ERROR_NONESuccessful
INM_ERROR_PERMISSION_DENIEDPermission Denied
INM_ERROR_INVALID_PARAMETERInvalid parameter
INM_ERROR_NOT_SUPPORTEDNot supported
INM_ERROR_NOT_INITIALIZEDNot initialized
INM_ERROR_OPERATION_FAILEDOperation failed
int inm_get_statistics ( inm_h  inm,
inm_connection_type_e  connection_type,
inm_statistics_type_e  statistics_type,
unsigned long long *  size 
)

Gets the statistics information.

Since :
5.0
Privilege Level:
public
Privilege:
http://tizen.org/privilege/network.get
Parameters:
[in]inmThe monitor handle
[in]connection_typeThe type of connection
Only INM_CONNECTION_TYPE_WIFI and INM_CONNECTION_TYPE_CELLULAR are supported
[in]statistics_typeThe type of statistics
[out]sizeThe received data size of the last cellular packet data connection (bytes)
Returns:
0 on success, otherwise a negative error value
Return values:
INM_ERROR_NONESuccessful
INM_ERROR_PERMISSION_DENIEDPermission Denied
INM_ERROR_INVALID_PARAMETERInvalid parameter
INM_ERROR_NOT_SUPPORTEDNot supported
INM_ERROR_NOT_INITIALIZEDNot initialized
INM_ERROR_OPERATION_FAILEDOperation failed

Gets the Wi-Fi Module state.

Since :
5.0
Parameters:
[in]inmThe monitor handle
[out]stateThe Wi-Fi Module state
Returns:
0 on success, otherwise negative error value
Return values:
INM_ERROR_NONESuccessful
INM_ERROR_INVALID_PARAMETERInvalid parameter
INM_ERROR_NOT_SUPPORTEDNot supported
INM_ERROR_NOT_INITIALIZEDNot initialized
INM_ERROR_OPERATION_FAILEDOperation failed
int inm_ip_conflict_detect_is_enabled ( inm_h  inm,
bool *  state 
)

Checks whether IP conflict detection is enabled.

Since :
5.0
Privilege Level:
public
Privilege:
http://tizen.org/privilege/network.get
Parameters:
[in]inmThe monitoring handle
[out]statetrue if IP conflict detection is enabled, otherwise false if IP conflict detection is disabled.
Returns:
0 on success, otherwise negative error value
Return values:
INM_ERROR_NONESuccessful
INM_ERROR_PERMISSION_DENIEDPermission Denied
INM_ERROR_INVALID_PARAMETERInvalid parameter
INM_ERROR_NOT_SUPPORTEDNot supported
INM_ERROR_NOT_INITIALIZEDNot initialized
INM_ERROR_OPERATION_FAILEDOperation failed
int inm_reset_statistics ( inm_h  inm,
inm_connection_type_e  connection_type,
inm_statistics_type_e  statistics_type 
)

Resets the statistics information.

Since :
5.0
Privilege Level:
public
Privilege:
http://tizen.org/privilege/network.set
Parameters:
[in]inmThe monitor handle
[in]connection_typeThe type of connection
Only INM_CONNECTION_TYPE_WIFI and INM_CONNECTION_TYPE_CELLULAR are supported
[in]statistics_typeThe type of statistics
Returns:
0 on success, otherwise a negative error value
Return values:
INM_ERROR_NONESuccessful
INM_ERROR_PERMISSION_DENIEDPermission Denied
INM_ERROR_INVALID_PARAMETERInvalid parameter
INM_ERROR_NOT_SUPPORTEDNot supported
INM_ERROR_NOT_INITIALIZEDNot initialized
INM_ERROR_OPERATION_FAILEDOperation failed
int inm_set_channel_interference_cb ( inm_h  inm,
inm_channel_interference_cb  callback,
void *  user_data 
)

Sets the callback to be called when the channel interference is updated.

Since :
5.0
Parameters:
[in]inmThe monitoring handle
[in]callbackThe callback function to be called
[in]user_dataThe user data passed to the callback function
Returns:
0 on success, otherwise negative error value
Return values:
INM_ERROR_NONESuccessful
INM_ERROR_INVALID_PARAMETERInvalid parameter
INM_ERROR_NOT_SUPPORTEDNot supported
INM_ERROR_NOT_INITIALIZEDNot initialized
INM_ERROR_OPERATION_FAILEDOperation failed
int inm_set_congestion_level_cb ( inm_h  inm,
inm_congestion_level_cb  callback,
void *  user_data 
)

Sets the callback called when the TCP congestion level is updated.

Since :
5.0
Parameters:
[in]inmThe monitoring handle
[in]callbackThe callback function to be called
[in]user_dataThe user data passed to the callback function
Returns:
0 on success, otherwise negative error value
Return values:
INM_ERROR_NONESuccessful
INM_ERROR_INVALID_PARAMETERInvalid parameter
INM_ERROR_NOT_SUPPORTEDNot supported
INM_ERROR_NOT_INITIALIZEDNot initialized
INM_ERROR_OPERATION_FAILEDOperation failed

Sets a callback called when the Ethernet cable state is changed.

Since :
5.0
Parameters:
[in]inmThe monitor handle
[in]callbackThe callback function to be called
[in]user_dataThe user data passed to the callback function
Returns:
0 on success, otherwise negative error value
Return values:
INM_ERROR_NONESuccessful
INM_ERROR_INVALID_PARAMETERInvalid parameter
INM_ERROR_NOT_SUPPORTEDNot supported
INM_ERROR_NOT_INITIALIZEDNot initialized
INM_ERROR_OPERATION_FAILEDOperation failed
See also:
inm_ethernet_cable_state_changed_cb()
inm_unset_ethernet_cable_state_changed_cb()
int inm_set_ip_conflict_cb ( inm_h  inm,
inm_ip_conflict_cb  callback,
void *  user_data 
)

Sets the callback called when IP conflict state is changed.

Since :
5.0
Parameters:
[in]inmThe monitoring handle
[in]callbackThe callback function to be called
[in]user_dataThe user data passed to the callback function
Returns:
0 on success, otherwise negative error value
Return values:
INM_ERROR_NONESuccessful
INM_ERROR_INVALID_PARAMETERInvalid parameter
INM_ERROR_NOT_SUPPORTEDNot supported
INM_ERROR_NOT_INITIALIZEDNot initialized
INM_ERROR_OPERATION_FAILEDOperation failed
int inm_set_retry_tx_rate_cb ( inm_h  inm,
inm_retry_tx_rate_cb  callback,
void *  user_data 
)

Sets the callback called the TCP TX retry rate is updated.

Since :
5.0
Parameters:
[in]inmThe monitoring handle
[in]callbackThe callback function to be called
[in]user_dataThe user data passed to the callback function
Returns:
0 on success, otherwise negative error value
Return values:
INM_ERROR_NONESuccessful
INM_ERROR_INVALID_PARAMETERInvalid parameter
INM_ERROR_NOT_SUPPORTEDNot supported
INM_ERROR_NOT_INITIALIZEDNot initialized
INM_ERROR_OPERATION_FAILEDOperation failed
int inm_set_wifi_module_state_changed_cb ( inm_h  inm,
inm_wifi_module_state_changed_cb  callback,
void *  user_data 
)

Sets a callback called when the Wi-Fi Module state is changed.

Since :
5.0
Parameters:
[in]inmThe monitor handle
[in]callbackThe callback function to be called
[in]user_dataThe user data passed to the callback function
Returns:
0 on success, otherwise negative error value
Return values:
INM_ERROR_NONESuccessful
INM_ERROR_INVALID_PARAMETERInvalid parameter
INM_ERROR_NOT_SUPPORTEDNot supported
INM_ERROR_NOT_INITIALIZEDNot initialized
INM_ERROR_OPERATION_FAILEDOperation failed
See also:
inm_wifi_module_state_changed_cb()
inm_unset_wifi_module_state_changed_cb()

Unsets the callback called when the channel interference is updated.

Since :
5.0
Parameters:
[in]inmThe monitoring handle
Returns:
0 on success, otherwise negative error value
Return values:
INM_ERROR_NONESuccessful
INM_ERROR_INVALID_PARAMETERInvalid parameter
INM_ERROR_NOT_SUPPORTEDNot supported
INM_ERROR_NOT_INITIALIZEDNot initialized
INM_ERROR_OPERATION_FAILEDOperation failed

Unsets the callback called when the TCP congestion level is updated.

Since :
5.0
Parameters:
[in]inmThe monitoring handle
Returns:
0 on success, otherwise negative error value
Return values:
INM_ERROR_NONESuccessful
INM_ERROR_INVALID_PARAMETERInvalid parameter
INM_ERROR_NOT_SUPPORTEDNot supported
INM_ERROR_NOT_INITIALIZEDNot initialized
INM_ERROR_OPERATION_FAILEDOperation failed

Unsets the callback called when the Ethernet cable state is changed.

Since :
5.0
Parameters:
[in]inmThe monitor handle
Returns:
0 on success, otherwise negative error value
Return values:
INM_ERROR_NONESuccessful
INM_ERROR_INVALID_PARAMETERInvalid parameter
INM_ERROR_NOT_SUPPORTEDNot supported
INM_ERROR_NOT_INITIALIZEDNot initialized
INM_ERROR_OPERATION_FAILEDOperation failed
See also:
inm_ethernet_cable_state_changed_cb()
inm_set_ethernet_cable_state_changed_cb()

Unsets the callback called when IP conflict state is changed.

Since :
5.0
Parameters:
[in]inmThe monitoring handle
Returns:
0 on success, otherwise negative error value
Return values:
INM_ERROR_NONESuccessful
INM_ERROR_INVALID_PARAMETERInvalid parameter
INM_ERROR_NOT_SUPPORTEDNot supported
INM_ERROR_NOT_INITIALIZEDNot initialized
INM_ERROR_OPERATION_FAILEDOperation failed

Unsets the callback called when the TCP TX retry rate is updated.

Since :
5.0
Parameters:
[in]inmThe monitoring handle
Returns:
0 on success, otherwise negative error value
Return values:
INM_ERROR_NONESuccessful
INM_ERROR_INVALID_PARAMETERInvalid parameter
INM_ERROR_NOT_SUPPORTEDNot supported
INM_ERROR_NOT_INITIALIZEDNot initialized
INM_ERROR_OPERATION_FAILEDOperation failed

Unsets the callback called when the Wi-Fi Module state is changed.

Since :
5.0
Parameters:
[in]inmThe monitor handle
Returns:
0 on success, otherwise negative error value
Return values:
INM_ERROR_NONESuccessful
INM_ERROR_INVALID_PARAMETERInvalid parameter
INM_ERROR_NOT_SUPPORTEDNot supported
INM_ERROR_NOT_INITIALIZEDNot initialized
INM_ERROR_OPERATION_FAILEDOperation failed
See also:
inm_wifi_module_state_changed_cb()
inm_set_wifi_module_state_changed_cb()