#define STC_TOTAL_IPV4 "TOTAL_IPV4"
#define STC_TOTAL_IPV6 "TOTAL_IPV6"
+#define STC_DEBUG_LOG 0
+
typedef enum {
STC_CANCEL = 0, /**< cancel */
STC_CONTINUE = 1, /**< continue */
Name: stc-manager
Summary: STC(Smart Traffic Control) manager
-Version: 0.0.34
+Version: 0.0.35
Release: 0
Group: Network & Connectivity/Other
License: Apache-2.0
{
char buf[MAX_PATH_LENGTH];
snprintf(buf, sizeof(buf), "%s/%s", cgroup_name, file_name);
+#if STC_DEBUG_LOG
STC_LOGD("cgroup_buf %s, value %d\n", buf, value);
+#endif
return fwrite_uint(buf, value);
}
{
char buf[MAX_PATH_LENGTH];
snprintf(buf, sizeof(buf), "%s/%s", cgroup_name, file_name);
+#if STC_DEBUG_LOG
STC_LOGD("cgroup_buf %s, string %s\n", buf, string);
+#endif
return fwrite_str(buf, string);
}
int ret;
snprintf(buf, sizeof(buf), "%s/%s", cgroup_name, file_name);
ret = fread_uint(buf, value);
+#if STC_DEBUG_LOG
STC_LOGD("cgroup_buf %s, value %d\n", buf, *value);
+#endif
return ret;
}
{
struct genl req;
+#if STC_DEBUG_LOG
STC_LOGD("send remove request for %s", counter->name);
+#endif
prepare_netlink_msg(&req, NFNL_MSG_ACCT_DEL, NLM_F_ACK);
add_string_attr(&req, counter->name, NFACCT_NAME);
strncpy(exec_buf + (cmd_pos - cmd_buf), IPTABLES_CHECK,
sizeof(IPTABLES_CHECK) - 1);
+#if STC_DEBUG_LOG
STC_LOGD("check rule %s", exec_buf);
+#endif
args = g_strsplit_set(exec_buf, " ", -1);
int ret;
char *save_ptr = NULL;
- STC_LOGD("executing iptables cmd %s in forked process",
- cmd_buf);
+#if STC_DEBUG_LOG
+ STC_LOGD("executing iptables cmd %s in forked process", cmd_buf);
+#endif
if (is_rule_present(cmd_buf)) {
STC_LOGD("Rule %s already present", cmd_buf);
int ret;
char *save_ptr = NULL;
- STC_LOGD("executing ip6tables cmd %s in forked process",
- cmd_buf);
+#if STC_DEBUG_LOG
+ STC_LOGD("executing ip6tables cmd %s in forked process", cmd_buf);
+#endif
if (is_rule_present(cmd_buf)) {
STC_LOGD("Rule %s already present", cmd_buf);
g_tree_foreach(processes, __processes_tree_foreach_print, NULL);
}
+#if STC_DEBUG_LOG
static gboolean __apps_tree_foreach_print(gpointer key, gpointer value,
gpointer data)
{
__processes_tree_printall(app_value->processes);
return FALSE;
}
+#endif
#if 0
static void __apps_tree_printall(void)
stc_app_value_s *app_value = (stc_app_value_s *)value;
if (!g_tree_remove(app_value->processes, context->proc_key)) {
+#if STC_DEBUG_LOG
STC_LOGD("key not found");
+#endif
return FALSE;
}
app_value->counter.in_bytes = context->bytes;
g_system->apps_tree_updated = TRUE;
+#if STC_DEBUG_LOG
__apps_tree_foreach_print(app_key, app_value, NULL);
+#endif
break;
case NFACCT_COUNTER_OUT:
app_value->data_usage.out_bytes += context->bytes;
app_value->counter.out_bytes = context->bytes;
g_system->apps_tree_updated = TRUE;
+#if STC_DEBUG_LOG
__apps_tree_foreach_print(app_key, app_value, NULL);
+#endif
break;
default:
STC_LOGE("unknown iotype");