diff --git a/inc/Maat_rule.h b/inc/Maat_rule.h index a68e699..07317a1 100644 --- a/inc/Maat_rule.h +++ b/inc/Maat_rule.h @@ -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. 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. //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. diff --git a/src/entry/Maat_api.cpp b/src/entry/Maat_api.cpp index f638446..d9180af 100644 --- a/src/entry/Maat_api.cpp +++ b/src/entry/Maat_api.cpp @@ -121,7 +121,7 @@ void fill_maat_rule(struct Maat_rule_t *rule, const struct Maat_rule_head* rule_ } struct compile_sort_para { - double exec_seq; + double evaluation_order; int group_cnt; int compile_id; 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) { 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->user=user; 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) { //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; } - else if(a->exec_seq - b->exec_seq >0) + else if(a->evaluation_order - b->evaluation_order >0) { 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); } -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 compile_sort_para sort_para[n_rule]; diff --git a/src/entry/Maat_rule.cpp b/src/entry/Maat_rule.cpp index 97306d1..963a49c 100644 --- a/src/entry/Maat_rule.cpp +++ b/src/entry/Maat_rule.cpp @@ -33,7 +33,7 @@ #include "stream_fuzzy_hash.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) { @@ -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->service_defined=ALLOC(char, 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; icompile.ex_data_num; i++) { diff --git a/src/entry/json2iris.cpp b/src/entry/json2iris.cpp index ed71dbc..4ff85c5 100644 --- a/src/entry/json2iris.cpp +++ b/src/entry/json2iris.cpp @@ -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; 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].empty_allowed=1; compile_cmd[cmd_cnt].default_string="0.0"; diff --git a/src/inc_internal/Maat_rule_internal.h b/src/inc_internal/Maat_rule_internal.h index 325daa2..9341ec5 100644 --- a/src/inc_internal/Maat_rule_internal.h +++ b/src/inc_internal/Maat_rule_internal.h @@ -93,7 +93,7 @@ struct Maat_compile_rule char* service_defined; int is_valid; int declared_grp_num; - double exec_seq; + double evaluation_order; const struct Maat_table_desc* ref_table; MAAT_RULE_EX_DATA* ads; }; diff --git a/test/maat_json.json b/test/maat_json.json index f28a2d2..1b84e7c 100644 --- a/test/maat_json.json +++ b/test/maat_json.json @@ -1308,9 +1308,9 @@ "action": 1, "do_blacklist": 1, "do_log": 1, - "user_region": "ExecuteSequence", + "user_region": "EvaluationOrder", "is_valid": "yes", - "exec_seq":"2.111", + "evaluation_order":"2.111", "groups": [ { "group_name": "Untitled", @@ -1350,9 +1350,9 @@ "action": 1, "do_blacklist": 1, "do_log": 1, - "user_region": "ExecuteSequence", + "user_region": "EvaluationOrder", "is_valid": "yes", - "exec_seq":"100.233", + "evaluation_order":"100.233", "groups": [ { "group_name": "Untitled", @@ -1377,9 +1377,9 @@ "action": 1, "do_blacklist": 1, "do_log": 1, - "user_region": "ExecuteSequence", + "user_region": "EvaluationOrder", "is_valid": "yes", - "exec_seq":"300.999", + "evaluation_order":"300.999", "groups": [ { "group_name": "Untitled", diff --git a/test/test_maatframe.cpp b/test/test_maatframe.cpp index 6a4561f..52aae6b 100644 --- a/test/test_maatframe.cpp +++ b/test/test_maatframe.cpp @@ -1409,7 +1409,7 @@ TEST(Policy, SubGroup) return; } -TEST(Policy, ExecuteSequence) +TEST(Policy, EvaluationOrder) { #define TestExecuteSequence int ret=0, table_id=0; @@ -1447,7 +1447,7 @@ TEST(Policy, ExecuteSequence) EXPECT_EQ(result[i].config_id, 165); 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(result[0].config_id, 165); EXPECT_EQ(result[1].config_id, 166);