Merge "Add os upgrade file for database" into tizen accepted/tizen/unified/20190911.111652 submit/tizen/20190910.082117
authorJaehyun Kim <jeik01.kim@samsung.com>
Tue, 10 Sep 2019 08:20:45 +0000 (08:20 +0000)
committerGerrit Code Review <gerrit@review.ap-northeast-2.compute.internal>
Tue, 10 Sep 2019 08:20:45 +0000 (08:20 +0000)
packaging/stc-manager.spec
plugin/pcap/stc-plugin-pcap.c
resources/systemd/stc-manager.service
src/database/include/table-statistics.h
src/database/tables/table-statistics.c
src/stc-statistics.c

index 2ed5dc0..2dc6918 100644 (file)
@@ -1,6 +1,6 @@
 Name:       stc-manager
 Summary:    STC(Smart Traffic Control) manager
-Version:    0.0.93
+Version:    0.0.95
 Release:    0
 Group:      Network & Connectivity/Other
 License:    Apache-2.0
index 0859700..862a0be 100755 (executable)
@@ -1441,8 +1441,8 @@ static gpointer __pcap_thread_func(gpointer data)
        pcap_loop(pcap_data->handle, 0, __pcap_handler, (u_char *)pcap_data);
        STC_LOGD("Pcap loop end [%s]", name);
 
+       STC_LOGD("Pcap before closing [%p]", pcap_data->handle);
        pcap_close(pcap_data->handle);
-       STC_LOGD("Pcap closed [%p]", pcap_data->handle);
 
 thread_exit:
        FREE(name);
index e3bce9f..e20402f 100644 (file)
@@ -1,7 +1,5 @@
 [Unit]
 Description=Smart Traffic Control Manager
-Requires=dbus.socket
-After=dbus.socket
 
 [Service]
 Type=dbus
index 284fb48..a510f32 100755 (executable)
@@ -37,6 +37,7 @@ typedef struct {
 } table_statistics_reset_rule;
 
 typedef struct {
+       char *app_id;
        time_t from;
        time_t to;
        stc_iface_type_e iftype;
@@ -55,7 +56,7 @@ stc_error_e table_statistics_foreach_app(const table_statistics_select_rule *rul
                                         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);
 
index 719b9a2..7d13a3f 100755 (executable)
@@ -440,13 +440,19 @@ stc_error_e table_statistics_foreach_app(const table_statistics_select_rule *rul
                       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) ?
@@ -508,7 +514,7 @@ handle_error:
 }
 
 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)
 {
index 0d5a761..a0b5a07 100755 (executable)
@@ -76,6 +76,15 @@ void __stc_extract_select_rule(const char *key, GVariant *value,
                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 if (!g_strcmp0(key, "granularity")) {
+               rule->granularity = g_variant_get_int32(value);
+               STC_LOGD("granularity: [%d]", rule->granularity);
+
        } else {
                STC_LOGD("Unknown select rule"); //LCOV_EXCL_LINE
        }
@@ -277,6 +286,7 @@ gboolean handle_statistics_get_all(StcStatistics *object,
        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
        }
@@ -287,12 +297,13 @@ gboolean handle_statistics_get_all(StcStatistics *object,
        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__;