Name: stc-manager
Summary: STC(Smart Traffic Control) manager
-Version: 0.0.33
+Version: 0.0.34
Release: 0
Group: Network & Connectivity/Other
License: Apache-2.0
#include "helper-file.h"
#include "helper-net-cls.h"
-#define CUR_CLASSID_PATH "/tmp/cur_classid"
+#define CUR_CLASSID_PATH "/var/lib/stc/cur_classid"
#define CLASSID_FILE_NAME "net_cls.classid"
typedef GArray task_classid_array;
return classid;
}
+stc_error_e init_current_classid(void)
+{
+ int ret = 0;
+ struct stat stat_buf;
+
+ if (stat(STC_CGROUP_NETWORK, &stat_buf) != 0) {
+ uint32_t classid = STC_RESERVED_CLASSID_MAX;
+ ret = fwrite_uint(CUR_CLASSID_PATH, classid);
+ if (ret < 0) {
+ STC_LOGE("Can not init current classid");
+ return STC_ERROR_FAIL;
+ }
+ }
+
+ return STC_ERROR_NONE;
+}
+
uint32_t get_classid_by_app_id(const char *app_id, int create)
{
int ret = 0;
typedef GArray int_array;
-/**
- * @desc Get appid from classid task table. At present it is package name.
- */
-char *get_app_id_by_pid(const pid_t pid);
+stc_error_e init_current_classid(void);
/**
* @desc take classid from net_cls cgroup by appid
return STC_ERROR_NONE;
}
+#if 0
static void __excn_hash_foreach_print(gpointer key, gpointer value,
gpointer data)
{
process_name, exe_type);
}
-#if 0
static void __excn_hash_printall(void)
{
g_hash_table_foreach(g_system->excns_hash,
ret_value_msg_if(system == NULL, STC_ERROR_OUT_OF_MEMORY, "stc_system_s malloc fail!");
+ /* initializing current classid */
+ init_current_classid();
+
/* initializing cgroups */
cgroup_init();