#include "helper-nfacct-rule.h"
#include "helper-iptables.h"
#include "stc-monitor.h"
-#include "stc-manager-plugin.h"
-#include "stc-app-lifecycle.h"
+#include "stc-firewall.h"
+#include "stc-manager-plugin-appstatus.h"
+#include "stc-manager-plugin-exception.h"
+#include "stc-manager-plugin-procfs.h"
static stc_s *g_stc = NULL;
stc_deinit_db_guard();
stc_db_deinitialize();
+ iptables_flush_chains();
iptables_deinit();
+
stc_manager_gdbus_deinit((gpointer)g_stc);
- stc_app_lifecycle_monitor_deinit();
- stc_manager_plugin_deinit();
+
+ stc_firewall_deinit();
+
+ stc_plugin_appstatus_deinit();
+ stc_plugin_exception_deinit();
+ stc_plugin_procfs_deinit();
STC_LOGI("stc manager deinitialized");
FREE(g_stc);
stc = MALLOC0(stc_s, 1);
if (!stc) {
- STC_LOGE("Failed to allocate memory for manager structure");
- return NULL;
+ STC_LOGE("Failed to allocate memory for manager structure"); //LCOV_EXCL_LINE
+ return NULL; //LCOV_EXCL_LINE
}
g_stc = stc;
EXEC(STC_ERROR_NONE, stc_db_initialize());
+ stc_plugin_appstatus_init();
+ stc_plugin_exception_init();
+ stc_plugin_procfs_init();
+
+ stc_firewall_init();
+
err = stc_monitor_init();
if (err != STC_ERROR_NONE)
goto handle_error;
- stc_manager_plugin_init();
- stc_app_lifecycle_monitor_init();
stc_manager_gdbus_init((gpointer)stc);
STC_LOGI("stc manager initialized");
return stc;
handle_error:
- STC_LOGD("Failed to initialize stc manager");
- __stc_manager_deinit();
- return NULL;
+ STC_LOGD("Failed to initialize stc manager"); //LCOV_EXCL_LINE
+ __stc_manager_deinit(); //LCOV_EXCL_LINE
+ return NULL; //LCOV_EXCL_LINE
}
stc_s *stc_get_manager(void)
return g_stc;
}
+void stc_stop_manager(void)
+{
+ if (g_stc && g_stc->main_loop)
+ g_main_loop_quit(g_stc->main_loop);
+}
+
gint32 main(gint32 argc, gchar *argv[])
{
GMainLoop *main_loop = NULL;
STC_LOGI("Smart Traffic Control Manager");
+#ifdef TIZEN_GTESTS
+ setenv("GCOV_PREFIX", "/tmp/daemon", 1);
+#endif
+
if (daemon(0, 0) != 0)
- STC_LOGE("Can't start daemon");
+ STC_LOGE("Can't start daemon"); //LCOV_EXCL_LINE
/* Initialize required subsystems */
#if !GLIB_CHECK_VERSION(2, 35, 0)