Tizen Native API
9.0
|
The STC statistics API provides functions for managing STC statistics.
Required Header
#include <stc.h>
Overview
To use STC statistics API, first create the STC handle using stc_initialize(). After that, you can obtain STC information. You should destroy the created STC handle if you do not need it anymore. The STC statistics API provides functions for managing STC statistics.
Related Features
This API is related with the following features:
It is recommended to use features 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 | stc_stats_rule_create (stc_h stc, stc_stats_rule_h *rule) |
Creates the statistics rule handle. | |
int | stc_stats_rule_destroy (stc_stats_rule_h rule) |
Destroys the statistics rule handle. | |
int | stc_stats_rule_set_app_id (stc_stats_rule_h rule, const char *app_id) |
Sets the application ID for statistics rule. | |
int | stc_stats_rule_set_time_interval (stc_stats_rule_h rule, time_t from, time_t to) |
Sets the time interval for statistics rule. | |
int | stc_stats_rule_set_iface_type (stc_stats_rule_h rule, stc_iface_type_e iface_type) |
Sets the interface type for statistics rule. | |
int | stc_stats_rule_set_time_period (stc_stats_rule_h rule, stc_time_period_e time_period) |
Sets the time period for statistics rule. | |
int | stc_stats_rule_get_app_id (stc_stats_rule_h rule, char **app_id) |
Gets the application ID for statistics rule. | |
int | stc_stats_rule_get_time_interval (stc_stats_rule_h rule, time_t *from, time_t *to) |
Gets the time interval for statistics rule. | |
int | stc_stats_rule_get_iface_type (stc_stats_rule_h rule, stc_iface_type_e *iface_type) |
Gets the interface type for statistics rule. | |
int | stc_stats_rule_get_time_period (stc_stats_rule_h rule, stc_time_period_e *time_period) |
Gets the time period for statistics rule. | |
int | stc_stats_info_clone (stc_stats_info_h info, stc_stats_info_h *cloned) |
Clones the statistics info handle. | |
int | stc_stats_info_destroy (stc_stats_info_h info) |
Destroys the statistics info handle. | |
int | stc_stats_info_get_app_id (stc_stats_info_h info, char **app_id) |
Gets the application ID from statistics information. | |
int | stc_stats_info_get_iface_name (stc_stats_info_h info, char **iface_name) |
Gets the interface name from statistics information. | |
int | stc_stats_info_get_time_interval (stc_stats_info_h info, time_t *from, time_t *to) |
Gets the time interval from statistics information. | |
int | stc_stats_info_get_iface_type (stc_stats_info_h info, stc_iface_type_e *iface_type) |
Gets the interface type from statistics information. | |
int | stc_stats_info_get_counter (stc_stats_info_h info, int64_t *incoming, int64_t *outgoing) |
Gets the counters from statistics information. | |
int | stc_stats_info_get_roaming_type (stc_stats_info_h info, stc_roaming_type_e *roaming_type) |
Gets the roaming type from statistics information. | |
int | stc_stats_info_get_protocol_type (stc_stats_info_h info, stc_protocol_type_e *protocol) |
Gets the protocol type from statistics information. | |
int | stc_stats_info_get_process_state (stc_stats_info_h info, stc_process_state_e *state) |
Gets the process state from statistics information. | |
Typedefs | |
typedef void * | stc_stats_rule_h |
The statistics rule handle. | |
typedef void * | stc_stats_info_h |
The handle of statistical information about network traffic. | |
typedef void * | stc_all_stats_info_h |
The handle of all statistical information about network traffic. |
Typedef Documentation
typedef void* stc_all_stats_info_h |
The handle of all statistical information about network traffic.
- Since :
- 5.5
typedef void* stc_stats_info_h |
The handle of statistical information about network traffic.
- Since :
- 4.0
typedef void* stc_stats_rule_h |
The statistics rule handle.
- Since :
- 4.0
Function Documentation
int stc_stats_info_clone | ( | stc_stats_info_h | info, |
stc_stats_info_h * | cloned | ||
) |
Clones the statistics info handle.
This function creates a new statistics info handle that is a copy of the original statistics info handle. The cloned handle can be used independently of the original handle.
- Since :
- 5.5
- Remarks:
- You must release cloned using stc_stats_info_destroy().
- Parameters:
-
[in] info The origin statistics info handle [out] cloned The cloned statistics info handle
- Returns:
- 0 on success, otherwise a negative error value
- Return values:
-
STC_ERROR_NONE Successful STC_ERROR_OUT_OF_MEMORY Out of memory STC_ERROR_INVALID_PARAMETER Invalid parameter STC_ERROR_NOT_SUPPORTED Not supported
int stc_stats_info_destroy | ( | stc_stats_info_h | info | ) |
Destroys the statistics info handle.
This function releases all resources allocated for the given statistics info handle. After calling this function, the handle becomes invalid and cannot be used further.
- Since :
- 5.5
- Parameters:
-
[in] info The statistics info handle
- Returns:
- 0 on success, otherwise a negative error value
- Return values:
-
STC_ERROR_NONE Successful STC_ERROR_INVALID_PARAMETER Invalid parameter STC_ERROR_NOT_SUPPORTED Not supported
- See also:
- stc_stats_info_h
- stc_stats_info_clone()
int stc_stats_info_get_app_id | ( | stc_stats_info_h | info, |
char ** | app_id | ||
) |
Gets the application ID from statistics information.
This function retrieves the application ID that corresponds to the given statistics information handle. The application ID indicates which application's traffic statistics are contained within the handle.
- Since :
- 4.0
- Remarks:
- You must release app_id using free().
- Parameters:
-
[in] info The statistics information handle [out] app_id The application ID
- Returns:
- 0 on success, otherwise a negative error value
- Return values:
-
STC_ERROR_NONE Successful STC_ERROR_OPERATION_FAILED General error STC_ERROR_OUT_OF_MEMORY Out of memory STC_ERROR_INVALID_PARAMETER Invalid parameter STC_ERROR_INVALID_OPERATION Invalid operation STC_ERROR_NOT_INITIALIZED Not initialized STC_ERROR_NOT_SUPPORTED Not supported
- See also:
- stc_stats_info_h
- stc_stats_info_cb()
int stc_stats_info_get_counter | ( | stc_stats_info_h | info, |
int64_t * | incoming, | ||
int64_t * | outgoing | ||
) |
Gets the counters from statistics information.
This function retrieves the traffic counters that correspond to the given statistics information handle. The traffic counters indicate the amount of data transmitted and received over the network interface during the specified time interval.
- Since :
- 4.0
- Parameters:
-
[in] info The statistics information handle [out] incoming The incoming counter [out] outgoing The outgoing counter
- Returns:
- 0 on success, otherwise a negative error value
- Return values:
-
STC_ERROR_NONE Successful STC_ERROR_OPERATION_FAILED General error STC_ERROR_OUT_OF_MEMORY Out of memory STC_ERROR_INVALID_PARAMETER Invalid parameter STC_ERROR_INVALID_OPERATION Invalid operation STC_ERROR_NOT_INITIALIZED Not initialized STC_ERROR_NOT_SUPPORTED Not supported
- See also:
- stc_stats_info_h
- stc_stats_info_cb()
int stc_stats_info_get_iface_name | ( | stc_stats_info_h | info, |
char ** | iface_name | ||
) |
Gets the interface name from statistics information.
This function retrieves the interface name that corresponds to the given statistics information handle. The interface name indicates which network interface's traffic statistics are contained within the handle.
- Since :
- 4.0
- Remarks:
- You must release iface_name using free().
- Parameters:
-
[in] info The statistics information handle [out] iface_name The interface name
- Returns:
- 0 on success, otherwise a negative error value
- Return values:
-
STC_ERROR_NONE Successful STC_ERROR_OPERATION_FAILED General error STC_ERROR_OUT_OF_MEMORY Out of memory STC_ERROR_INVALID_PARAMETER Invalid parameter STC_ERROR_INVALID_OPERATION Invalid operation STC_ERROR_NOT_INITIALIZED Not initialized STC_ERROR_NOT_SUPPORTED Not supported
- See also:
- stc_stats_info_h
- stc_stats_info_cb()
int stc_stats_info_get_iface_type | ( | stc_stats_info_h | info, |
stc_iface_type_e * | iface_type | ||
) |
Gets the interface type from statistics information.
This function retrieves the interface type that corresponds to the given statistics information handle. The interface type indicates the type of network interface whose traffic statistics are contained within the handle.
- Since :
- 4.0
- Parameters:
-
[in] info The statistics information handle [out] iface_type The interface type
- Returns:
- 0 on success, otherwise a negative error value
- Return values:
-
STC_ERROR_NONE Successful STC_ERROR_OPERATION_FAILED General error STC_ERROR_OUT_OF_MEMORY Out of memory STC_ERROR_INVALID_PARAMETER Invalid parameter STC_ERROR_INVALID_OPERATION Invalid operation STC_ERROR_NOT_INITIALIZED Not initialized STC_ERROR_NOT_SUPPORTED Not supported
int stc_stats_info_get_process_state | ( | stc_stats_info_h | info, |
stc_process_state_e * | state | ||
) |
Gets the process state from statistics information.
This function retrieves the process state that corresponds to the given statistics information handle. The process state indicates the current status of the application whose traffic statistics are contained within the handle.
- Since :
- 4.0
- Parameters:
-
[in] info The statistics information handle [out] state The process state
- Returns:
- 0 on success, otherwise a negative error value
- Return values:
-
STC_ERROR_NONE Successful STC_ERROR_OPERATION_FAILED General error STC_ERROR_OUT_OF_MEMORY Out of memory STC_ERROR_INVALID_PARAMETER Invalid parameter STC_ERROR_INVALID_OPERATION Invalid operation STC_ERROR_NOT_INITIALIZED Not initialized STC_ERROR_NOT_SUPPORTED Not supported
int stc_stats_info_get_protocol_type | ( | stc_stats_info_h | info, |
stc_protocol_type_e * | protocol | ||
) |
Gets the protocol type from statistics information.
This function retrieves the protocol type that corresponds to the given statistics information handle. The protocol type indicates the specific network protocol whose traffic statistics are contained within the handle.
- Since :
- 4.0
- Parameters:
-
[in] info The statistics information handle [out] protocol The protocol type
- Returns:
- 0 on success, otherwise a negative error value
- Return values:
-
STC_ERROR_NONE Successful STC_ERROR_OPERATION_FAILED General error STC_ERROR_OUT_OF_MEMORY Out of memory STC_ERROR_INVALID_PARAMETER Invalid parameter STC_ERROR_INVALID_OPERATION Invalid operation STC_ERROR_NOT_INITIALIZED Not initialized STC_ERROR_NOT_SUPPORTED Not supported
int stc_stats_info_get_roaming_type | ( | stc_stats_info_h | info, |
stc_roaming_type_e * | roaming_type | ||
) |
Gets the roaming type from statistics information.
This function retrieves the roaming type that corresponds to the given statistics information handle. The roaming type indicates whether the traffic statistics were gathered while the device was connected to a cellular network or not.
- Since :
- 4.0
- Parameters:
-
[in] info The statistics information handle [out] roaming_type The roaming type
- Returns:
- 0 on success, otherwise a negative error value
- Return values:
-
STC_ERROR_NONE Successful STC_ERROR_OPERATION_FAILED General error STC_ERROR_OUT_OF_MEMORY Out of memory STC_ERROR_INVALID_PARAMETER Invalid parameter STC_ERROR_INVALID_OPERATION Invalid operation STC_ERROR_NOT_INITIALIZED Not initialized STC_ERROR_NOT_SUPPORTED Not supported
int stc_stats_info_get_time_interval | ( | stc_stats_info_h | info, |
time_t * | from, | ||
time_t * | to | ||
) |
Gets the time interval from statistics information.
This function retrieves the time interval that corresponds to the given statistics information handle. The time interval indicates the range of time during which the traffic statistics were gathered.
- Since :
- 4.0
- Parameters:
-
[in] info The statistics information handle [out] from The beginning of the time interval [out] to The end of the time interval
- Returns:
- 0 on success, otherwise a negative error value
- Return values:
-
STC_ERROR_NONE Successful STC_ERROR_OPERATION_FAILED General error STC_ERROR_OUT_OF_MEMORY Out of memory STC_ERROR_INVALID_PARAMETER Invalid parameter STC_ERROR_INVALID_OPERATION Invalid operation STC_ERROR_NOT_INITIALIZED Not initialized STC_ERROR_NOT_SUPPORTED Not supported
- See also:
- stc_stats_info_h
- stc_stats_info_cb()
int stc_stats_rule_create | ( | stc_h | stc, |
stc_stats_rule_h * | rule | ||
) |
Creates the statistics rule handle.
This function creates a new statistics rule handle which can be used to specify criteria for gathering statistical information. The handle is initially empty and must be configured with the desired rules before being used with other STC functions.
- Since :
- 4.0
- Remarks:
- You must release rule using stc_stats_rule_destroy().
- Parameters:
-
[in] stc The STC handle [out] rule The statistics rule handle
- Returns:
- 0 on success, otherwise a negative error value
- Return values:
-
STC_ERROR_NONE Successful STC_ERROR_OPERATION_FAILED General error STC_ERROR_OUT_OF_MEMORY Out of memory STC_ERROR_INVALID_PARAMETER Invalid parameter STC_ERROR_INVALID_OPERATION Invalid operation STC_ERROR_NOT_INITIALIZED Not initialized STC_ERROR_NOT_SUPPORTED Not supported
int stc_stats_rule_destroy | ( | stc_stats_rule_h | rule | ) |
Destroys the statistics rule handle.
This function releases the resources associated with the given statistics rule handle. It should be called after the handle is no longer needed to clean up the system resources.
- Since :
- 4.0
- Parameters:
-
[in] rule The statistics rule handle
- Returns:
- 0 on success, otherwise a negative error value
- Return values:
-
STC_ERROR_NONE Successful STC_ERROR_OPERATION_FAILED General error STC_ERROR_OUT_OF_MEMORY Out of memory STC_ERROR_INVALID_PARAMETER Invalid parameter STC_ERROR_INVALID_OPERATION Invalid operation STC_ERROR_NOT_INITIALIZED Not initialized STC_ERROR_NOT_SUPPORTED Not supported
- See also:
- stc_stats_rule_h
- stc_stats_rule_create()
int stc_stats_rule_get_app_id | ( | stc_stats_rule_h | rule, |
char ** | app_id | ||
) |
Gets the application ID for statistics rule.
This function retrieves the application ID that has been set for the given statistics rule handle. The application ID specifies which application's traffic statistics should be gathered according to the rule.
- Since :
- 4.0
- Remarks:
- You must release app_id using free().
- Parameters:
-
[in] rule The statistics rule handle [out] app_id The application ID
- Returns:
- 0 on success, otherwise a negative error value
- Return values:
-
STC_ERROR_NONE Successful STC_ERROR_OPERATION_FAILED General error STC_ERROR_OUT_OF_MEMORY Out of memory STC_ERROR_INVALID_PARAMETER Invalid parameter STC_ERROR_INVALID_OPERATION Invalid operation STC_ERROR_NOT_INITIALIZED Not initialized STC_ERROR_NOT_SUPPORTED Not supported
int stc_stats_rule_get_iface_type | ( | stc_stats_rule_h | rule, |
stc_iface_type_e * | iface_type | ||
) |
Gets the interface type for statistics rule.
This function retrieves the interface type that has been set for the given statistics rule handle. The interface type specifies which network interfaces' traffic statistics should be gathered according to the rule.
- Since :
- 4.0
- Parameters:
-
[in] rule The statistics rule handle [out] iface_type The interface type
- Returns:
- 0 on success, otherwise a negative error value
- Return values:
-
STC_ERROR_NONE Successful STC_ERROR_OPERATION_FAILED General error STC_ERROR_OUT_OF_MEMORY Out of memory STC_ERROR_INVALID_PARAMETER Invalid parameter STC_ERROR_INVALID_OPERATION Invalid operation STC_ERROR_NOT_INITIALIZED Not initialized STC_ERROR_NOT_SUPPORTED Not supported
int stc_stats_rule_get_time_interval | ( | stc_stats_rule_h | rule, |
time_t * | from, | ||
time_t * | to | ||
) |
Gets the time interval for statistics rule.
- Since :
- 4.0
- Parameters:
-
[in] rule The statistics rule handle [out] from The beginning of the time interval [out] to The end of the time interval
- Returns:
- 0 on success, otherwise a negative error value
- Return values:
-
STC_ERROR_NONE Successful STC_ERROR_OPERATION_FAILED General error STC_ERROR_OUT_OF_MEMORY Out of memory STC_ERROR_INVALID_PARAMETER Invalid parameter STC_ERROR_INVALID_OPERATION Invalid operation STC_ERROR_NOT_INITIALIZED Not initialized STC_ERROR_NOT_SUPPORTED Not supported
int stc_stats_rule_get_time_period | ( | stc_stats_rule_h | rule, |
stc_time_period_e * | time_period | ||
) |
Gets the time period for statistics rule.
This function retrieves the time period that has been set for the given statistics rule handle. The time period specifies the frequency at which the traffic statistics should be gathered according to the rule.
- Since :
- 4.0
- Parameters:
-
[in] rule The statistics rule handle [out] time_period The time period
- Returns:
- 0 on success, otherwise a negative error value
- Return values:
-
STC_ERROR_NONE Successful STC_ERROR_OPERATION_FAILED General error STC_ERROR_OUT_OF_MEMORY Out of memory STC_ERROR_INVALID_PARAMETER Invalid parameter STC_ERROR_INVALID_OPERATION Invalid operation STC_ERROR_NOT_INITIALIZED Not initialized STC_ERROR_NOT_SUPPORTED Not supported
int stc_stats_rule_set_app_id | ( | stc_stats_rule_h | rule, |
const char * | app_id | ||
) |
Sets the application ID for statistics rule.
This function sets the application ID for the given statistics rule handle. The application ID specifies which application's traffic statistics should be gathered according to the rule.
- Since :
- 4.0
- Parameters:
-
[in] rule The statistics rule handle [in] app_id The application ID
- Returns:
- 0 on success, otherwise a negative error value
- Return values:
-
STC_ERROR_NONE Successful STC_ERROR_OPERATION_FAILED General error STC_ERROR_OUT_OF_MEMORY Out of memory STC_ERROR_INVALID_PARAMETER Invalid parameter STC_ERROR_INVALID_OPERATION Invalid operation STC_ERROR_NOT_INITIALIZED Not initialized STC_ERROR_NOT_SUPPORTED Not supported
int stc_stats_rule_set_iface_type | ( | stc_stats_rule_h | rule, |
stc_iface_type_e | iface_type | ||
) |
Sets the interface type for statistics rule.
This function sets the interface type for the given statistics rule handle. The interface type specifies which network interfaces' traffic statistics should be gathered according to the rule.
- Since :
- 4.0
- Parameters:
-
[in] rule The stats rule handle [in] iface_type The interface type
- Returns:
- 0 on success, otherwise a negative error value
- Return values:
-
STC_ERROR_NONE Successful STC_ERROR_OPERATION_FAILED General error STC_ERROR_OUT_OF_MEMORY Out of memory STC_ERROR_INVALID_PARAMETER Invalid parameter STC_ERROR_INVALID_OPERATION Invalid operation STC_ERROR_NOT_INITIALIZED Not initialized STC_ERROR_NOT_SUPPORTED Not supported
int stc_stats_rule_set_time_interval | ( | stc_stats_rule_h | rule, |
time_t | from, | ||
time_t | to | ||
) |
Sets the time interval for statistics rule.
This function sets the time interval for the given statistics rule handle. The time interval specifies the range of time during which the traffic statistics should be gathered according to the rule.
- Since :
- 4.0
- Parameters:
-
[in] rule The statistics rule handle [in] from The beginning of the time interval [in] to The end of the time interval
- Returns:
- 0 on success, otherwise a negative error value
- Return values:
-
STC_ERROR_NONE Successful STC_ERROR_OPERATION_FAILED General error STC_ERROR_OUT_OF_MEMORY Out of memory STC_ERROR_INVALID_PARAMETER Invalid parameter STC_ERROR_INVALID_OPERATION Invalid operation STC_ERROR_NOT_INITIALIZED Not initialized STC_ERROR_NOT_SUPPORTED Not supported
int stc_stats_rule_set_time_period | ( | stc_stats_rule_h | rule, |
stc_time_period_e | time_period | ||
) |
Sets the time period for statistics rule.
This function sets the time period for the given statistics rule handle. The time period specifies the frequency at which the traffic statistics should be gathered according to the rule.
- Since :
- 4.0
- Parameters:
-
[in] rule The statistics rule handle [in] time_period The time period
- Returns:
- 0 on success, otherwise a negative error value
- Return values:
-
STC_ERROR_NONE Successful STC_ERROR_OPERATION_FAILED General error STC_ERROR_OUT_OF_MEMORY Out of memory STC_ERROR_INVALID_PARAMETER Invalid parameter STC_ERROR_INVALID_OPERATION Invalid operation STC_ERROR_NOT_INITIALIZED Not initialized STC_ERROR_NOT_SUPPORTED Not supported