执行顺序术语修改:将execute sequence修改为evaluation order。
This commit is contained in:
@@ -259,10 +259,10 @@ int Maat_rule_get_ex_new_index(Maat_feather_t feather, const char* compile_table
|
|||||||
//returned data is duplicated by dup_func of Maat_rule_get_ex_new_index, caller is responsible to free the data.
|
//returned data is duplicated by dup_func of Maat_rule_get_ex_new_index, caller is responsible to free the data.
|
||||||
MAAT_RULE_EX_DATA Maat_rule_get_ex_data(Maat_feather_t feather, const struct Maat_rule_t* rule, int idx);
|
MAAT_RULE_EX_DATA Maat_rule_get_ex_data(Maat_feather_t feather, const struct Maat_rule_t* rule, int idx);
|
||||||
|
|
||||||
//Sort rule by execute sequence.
|
//Sort rules by their evaluation order.
|
||||||
//rule_array will be modified with sorted rule.
|
//rule_array will be modified with sorted rule.
|
||||||
//Return sortted rule number, maybe less than n_rule if some rules are invalid.
|
//Return sortted rule number, maybe less than n_rule if some rules are invalid.
|
||||||
size_t Maat_rule_sort_by_exec_seq(Maat_feather_t feather, struct Maat_rule_t* rule_array, size_t n_rule);
|
size_t Maat_rule_sort_by_evaluation_order(Maat_feather_t feather, struct Maat_rule_t* rule_array, size_t n_rule);
|
||||||
|
|
||||||
|
|
||||||
//Helper function for parsing space or tab seperated line.
|
//Helper function for parsing space or tab seperated line.
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ void fill_maat_rule(struct Maat_rule_t *rule, const struct Maat_rule_head* rule_
|
|||||||
}
|
}
|
||||||
struct compile_sort_para
|
struct compile_sort_para
|
||||||
{
|
{
|
||||||
double exec_seq;
|
double evaluation_order;
|
||||||
int group_cnt;
|
int group_cnt;
|
||||||
int compile_id;
|
int compile_id;
|
||||||
void* user;
|
void* user;
|
||||||
@@ -129,7 +129,7 @@ struct compile_sort_para
|
|||||||
static void compile_sort_para_set(struct compile_sort_para* para, const struct Maat_compile_group_relation* compile_relation, void* user)
|
static void compile_sort_para_set(struct compile_sort_para* para, const struct Maat_compile_group_relation* compile_relation, void* user)
|
||||||
{
|
{
|
||||||
para->compile_id=compile_relation->compile_id;
|
para->compile_id=compile_relation->compile_id;
|
||||||
para->exec_seq=compile_relation->compile->exec_seq;
|
para->evaluation_order=compile_relation->compile->evaluation_order;
|
||||||
para->group_cnt=compile_relation->group_cnt;
|
para->group_cnt=compile_relation->group_cnt;
|
||||||
para->user=user;
|
para->user=user;
|
||||||
return;
|
return;
|
||||||
@@ -137,13 +137,13 @@ static void compile_sort_para_set(struct compile_sort_para* para, const struct M
|
|||||||
static int compile_sort_para_compare(const struct compile_sort_para* a, const struct compile_sort_para* b)
|
static int compile_sort_para_compare(const struct compile_sort_para* a, const struct compile_sort_para* b)
|
||||||
{
|
{
|
||||||
//If both of compile rule's execute sequences are specified, compile rule with lower execute sequence is priority.
|
//If both of compile rule's execute sequences are specified, compile rule with lower execute sequence is priority.
|
||||||
if(a->exec_seq!=0 && b->exec_seq!=0)
|
if(a->evaluation_order!=0 && b->evaluation_order!=0)
|
||||||
{
|
{
|
||||||
if(a->exec_seq - b->exec_seq <0)
|
if(a->evaluation_order - b->evaluation_order <0)
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
else if(a->exec_seq - b->exec_seq >0)
|
else if(a->evaluation_order - b->evaluation_order >0)
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -175,7 +175,7 @@ static int compile_sort_para_compare_no_type(const void* a, const void* b)
|
|||||||
return compile_sort_para_compare((const struct compile_sort_para*) a, (const struct compile_sort_para*) b);
|
return compile_sort_para_compare((const struct compile_sort_para*) a, (const struct compile_sort_para*) b);
|
||||||
|
|
||||||
}
|
}
|
||||||
size_t Maat_rule_sort_by_exec_seq(Maat_feather_t feather, struct Maat_rule_t* rule_array, size_t n_rule)
|
size_t Maat_rule_sort_by_evaluation_order(Maat_feather_t feather, struct Maat_rule_t* rule_array, size_t n_rule)
|
||||||
{
|
{
|
||||||
struct _Maat_feather_t *_feather=(struct _Maat_feather_t *)feather;
|
struct _Maat_feather_t *_feather=(struct _Maat_feather_t *)feather;
|
||||||
struct compile_sort_para sort_para[n_rule];
|
struct compile_sort_para sort_para[n_rule];
|
||||||
|
|||||||
@@ -33,7 +33,7 @@
|
|||||||
#include "stream_fuzzy_hash.h"
|
#include "stream_fuzzy_hash.h"
|
||||||
#include "gram_index_engine.h"
|
#include "gram_index_engine.h"
|
||||||
|
|
||||||
int MAAT_FRAME_VERSION_2_8_20200113=1;
|
int MAAT_FRAME_VERSION_2_8_20200204=1;
|
||||||
|
|
||||||
int is_valid_table_name(const char* str)
|
int is_valid_table_name(const char* str)
|
||||||
{
|
{
|
||||||
@@ -759,7 +759,7 @@ struct Maat_compile_rule* create_compile_rule(struct Maat_rule_head* p_head, con
|
|||||||
p->head.serv_def_len=strlen(service_define)+1;
|
p->head.serv_def_len=strlen(service_define)+1;
|
||||||
p->service_defined=ALLOC(char, p->head.serv_def_len);
|
p->service_defined=ALLOC(char, p->head.serv_def_len);
|
||||||
memcpy(p->service_defined, service_define, p->head.serv_def_len);
|
memcpy(p->service_defined, service_define, p->head.serv_def_len);
|
||||||
p->exec_seq=exec_seq;
|
p->evaluation_order=exec_seq;
|
||||||
|
|
||||||
for(i=0; i<table->compile.ex_data_num; i++)
|
for(i=0; i<table->compile.ex_data_num; i++)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -844,7 +844,7 @@ int write_compile_line(cJSON *compile, struct iris_description_t *p_iris, void *
|
|||||||
compile_cmd[cmd_cnt].json_type=cJSON_Number;
|
compile_cmd[cmd_cnt].json_type=cJSON_Number;
|
||||||
cmd_cnt++;
|
cmd_cnt++;
|
||||||
|
|
||||||
compile_cmd[cmd_cnt].json_string="exec_seq";
|
compile_cmd[cmd_cnt].json_string="evaluation_order";
|
||||||
compile_cmd[cmd_cnt].json_type=cJSON_String;
|
compile_cmd[cmd_cnt].json_type=cJSON_String;
|
||||||
compile_cmd[cmd_cnt].empty_allowed=1;
|
compile_cmd[cmd_cnt].empty_allowed=1;
|
||||||
compile_cmd[cmd_cnt].default_string="0.0";
|
compile_cmd[cmd_cnt].default_string="0.0";
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ struct Maat_compile_rule
|
|||||||
char* service_defined;
|
char* service_defined;
|
||||||
int is_valid;
|
int is_valid;
|
||||||
int declared_grp_num;
|
int declared_grp_num;
|
||||||
double exec_seq;
|
double evaluation_order;
|
||||||
const struct Maat_table_desc* ref_table;
|
const struct Maat_table_desc* ref_table;
|
||||||
MAAT_RULE_EX_DATA* ads;
|
MAAT_RULE_EX_DATA* ads;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1308,9 +1308,9 @@
|
|||||||
"action": 1,
|
"action": 1,
|
||||||
"do_blacklist": 1,
|
"do_blacklist": 1,
|
||||||
"do_log": 1,
|
"do_log": 1,
|
||||||
"user_region": "ExecuteSequence",
|
"user_region": "EvaluationOrder",
|
||||||
"is_valid": "yes",
|
"is_valid": "yes",
|
||||||
"exec_seq":"2.111",
|
"evaluation_order":"2.111",
|
||||||
"groups": [
|
"groups": [
|
||||||
{
|
{
|
||||||
"group_name": "Untitled",
|
"group_name": "Untitled",
|
||||||
@@ -1350,9 +1350,9 @@
|
|||||||
"action": 1,
|
"action": 1,
|
||||||
"do_blacklist": 1,
|
"do_blacklist": 1,
|
||||||
"do_log": 1,
|
"do_log": 1,
|
||||||
"user_region": "ExecuteSequence",
|
"user_region": "EvaluationOrder",
|
||||||
"is_valid": "yes",
|
"is_valid": "yes",
|
||||||
"exec_seq":"100.233",
|
"evaluation_order":"100.233",
|
||||||
"groups": [
|
"groups": [
|
||||||
{
|
{
|
||||||
"group_name": "Untitled",
|
"group_name": "Untitled",
|
||||||
@@ -1377,9 +1377,9 @@
|
|||||||
"action": 1,
|
"action": 1,
|
||||||
"do_blacklist": 1,
|
"do_blacklist": 1,
|
||||||
"do_log": 1,
|
"do_log": 1,
|
||||||
"user_region": "ExecuteSequence",
|
"user_region": "EvaluationOrder",
|
||||||
"is_valid": "yes",
|
"is_valid": "yes",
|
||||||
"exec_seq":"300.999",
|
"evaluation_order":"300.999",
|
||||||
"groups": [
|
"groups": [
|
||||||
{
|
{
|
||||||
"group_name": "Untitled",
|
"group_name": "Untitled",
|
||||||
|
|||||||
@@ -1409,7 +1409,7 @@ TEST(Policy, SubGroup)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(Policy, ExecuteSequence)
|
TEST(Policy, EvaluationOrder)
|
||||||
{
|
{
|
||||||
#define TestExecuteSequence
|
#define TestExecuteSequence
|
||||||
int ret=0, table_id=0;
|
int ret=0, table_id=0;
|
||||||
@@ -1447,7 +1447,7 @@ TEST(Policy, ExecuteSequence)
|
|||||||
EXPECT_EQ(result[i].config_id, 165);
|
EXPECT_EQ(result[i].config_id, 165);
|
||||||
i+=ret;
|
i+=ret;
|
||||||
|
|
||||||
ret=Maat_rule_sort_by_exec_seq(g_feather, result, i);
|
ret=Maat_rule_sort_by_evaluation_order(g_feather, result, i);
|
||||||
EXPECT_EQ(ret, i);
|
EXPECT_EQ(ret, i);
|
||||||
EXPECT_EQ(result[0].config_id, 165);
|
EXPECT_EQ(result[0].config_id, 165);
|
||||||
EXPECT_EQ(result[1].config_id, 166);
|
EXPECT_EQ(result[1].config_id, 166);
|
||||||
|
|||||||
Reference in New Issue
Block a user