Name: stc-manager
Summary: STC(Smart Traffic Control) manager
-Version: 0.0.93
+Version: 0.0.94
Release: 0
Group: Network & Connectivity/Other
License: Apache-2.0
} table_statistics_reset_rule;
typedef struct {
+ char *app_id;
time_t from;
time_t to;
stc_iface_type_e iftype;
void *user_data);
stc_error_e table_statistics_per_app(const char *app_id,
- table_statistics_select_rule *rule,
+ const table_statistics_select_rule *rule,
table_statistics_info_cb info_cb,
void *user_data);
bind parameters in the query */
stc_db_tm_interval_s interval;
- memset(&data, 0, sizeof(data));
-
if (!rule || !info_cb) {
__STC_LOG_FUNC_EXIT__; //LCOV_EXCL_LINE
return STC_ERROR_INVALID_PARAMETER; //LCOV_EXCL_LINE
}
+ memset(&data, 0, sizeof(data));
+
+ if (rule->app_id) {
+ int ret = table_statistics_per_app(rule->app_id, rule, info_cb, user_data);
+ __STC_LOG_FUNC_EXIT__;
+ return ret;
+ }
+
/* pick a statement depending on parameters */
if (rule->granularity) {
stmt = __is_iftype_defined(rule->iftype) ?
}
API stc_error_e table_statistics_per_app(const char *app_id,
- table_statistics_select_rule *rule,
+ const table_statistics_select_rule *rule,
table_statistics_info_cb info_cb,
void *user_data)
{
rule->iftype = g_variant_get_uint16(value);
STC_LOGD("iftype: [%u]", (unsigned int) rule->iftype);
+ } else if (!g_strcmp0(key, "app_id")) {
+ gsize length = 0;
+ rule->app_id = g_variant_dup_string(value, &length);
+ STC_LOGD("app_id: [%s]", rule->app_id);
+
} else {
STC_LOGD("Unknown select rule"); //LCOV_EXCL_LINE
}
if (ret < STC_ERROR_NONE) {
g_variant_builder_unref(builder); //LCOV_EXCL_LINE
STC_STATISTICS_DBUS_REPLY_ERROR(invocation, ret); //LCOV_EXCL_LINE
+ g_free(rule.app_id);
__STC_LOG_FUNC_EXIT__; //LCOV_EXCL_LINE
return TRUE; //LCOV_EXCL_LINE
}
DEBUG_GDBUS_VARIANT("Return parameters: ", return_parameters);
STC_DBUS_REPLY(invocation, return_parameters);
+ g_free(rule.app_id);
__STC_LOG_FUNC_EXIT__;
return TRUE;
}
gboolean handle_statistics_init(StcStatistics *object,
- GDBusMethodInvocation *invocation)
+ GDBusMethodInvocation *invocation)
{
__STC_LOG_FUNC_ENTER__;