char trace_env_path[PATH_MAX + 1];
static FILE *log_fp_ptrace = NULL;
static struct wl_protocol_logger *ds_wl_protocol_logger;
-static struct protocol_trace_rule_checker *rc = NULL;
+static struct protocol_trace_rule_checker *global_rc = NULL;
static struct wl_display *display;
static struct
const char *cmd = "";
int ret;
- if (!rc)
+ if (!global_rc)
return false;
cmd = logger_cmd_get(log->cmd);
- ret = rulechecker_validate_rules(rc, log->type, log->target_id, log->name,
+ ret = rulechecker_validate_rules(global_rc, log->type, log->target_id, log->name,
log->client_pid, cmd);
return ret;
ds_dbg("(parameter) argc = %d, argv[0] = %s", argc, argv[0]);
if (argc == 0) {
- rulechecker_print_rules(rc, reply, len);
+ rulechecker_print_rules(global_rc, reply, len);
return true;
}
if (apply == 0) {
const char * plus = "|| type=reply || type=error";
int size_plus = strlen(plus);
- int len = MIN(size_rule - index, size_plus);
+ int l = MIN(size_rule - index, size_plus);
snprintf(rule, sizeof(rule), "%s", plus);
- index += len;
+ index += l;
if (index >size_rule)
return false;
apply =1;
}
ds_dbg("ADD :: rule = %s", rule);
- result = rulechecker_rule_add(rc, policy_type, rule);
+ result = rulechecker_rule_add(global_rc, policy_type, rule);
if (result == PROTOCOL_TRACE_RULE_SET_ERR_TOO_MANY_RULES) {
ds_err("Error: Too many rules were added.");
remove_idx = argv[i + 1];
if (!strcasecmp(remove_idx, "all")) {
ds_dbg("REMOVE :: all");
- rulechecker_destroy(rc);
- rc = rulechecker_init();
- if (!rc) {
+ rulechecker_destroy(global_rc);
+ global_rc = rulechecker_init();
+ if (!global_rc) {
ds_err("Error: rules not removed");
return false;
}
ds_dbg("REMOVE :: remove idx = %d", index);
if (isdigit(*remove_idx) &&
- rulechecker_rule_remove(rc, index) == 0)
+ rulechecker_rule_remove(global_rc, index) == 0)
ds_dbg("Rule remove success : rule [%d]", index);
else
ds_err("Rule remove fail : No rule [%s]", remove_idx);
if (!rule_file_set(argv[1], reply, len))
return false;
- rulechecker_print_rules(rc, reply, len);
+ rulechecker_print_rules(global_rc, reply, len);
} else if (!strcasecmp(command, "print")) {
- rulechecker_print_rules(rc, reply, len);
+ rulechecker_print_rules(global_rc, reply, len);
} else if (!strcasecmp(command, "help")) {
ds_dbg( "%s", rulechecker_usage_print());
} else {
char *env_path = NULL;
display = d;
- rc = rulechecker_init();
+ global_rc = rulechecker_init();
env_path = getenv("DS_PROTOCOL_RULE_FILE");
ret = rule_init(env_path);
char *tmp = strdup(env_path);
if (!tmp) return false;
free(tmp);
- env_path = NULL;
}
if (!ret)
return ret;
void
protocol_trace_fini()
{
- rulechecker_destroy(rc);
-}
\ No newline at end of file
+ rulechecker_destroy(global_rc);
+}