uint64_t -> long long

This commit is contained in:
liuwentan
2023-02-22 15:22:41 +08:00
parent ac51c70426
commit 9578be5ff3
22 changed files with 175 additions and 176 deletions

View File

@@ -30,15 +30,15 @@ struct maat;
struct maat_hit_path { struct maat_hit_path {
int Nth_scan; int Nth_scan;
int vtable_id; // 0 is not a virtual table. int vtable_id; // 0 is not a virtual table.
uint64_t item_id; long long item_id;
uint64_t sub_group_id; long long sub_group_id;
uint64_t top_group_id; long long top_group_id;
uint64_t compile_id; long long compile_id;
}; };
struct maat_hit_object { struct maat_hit_object {
int vtable_id; int vtable_id;
uint64_t group_id; long long group_id;
}; };
enum maat_scan_status { enum maat_scan_status {
@@ -50,7 +50,7 @@ enum maat_scan_status {
#define MAX_SERVICE_DEFINE_LEN 128 #define MAX_SERVICE_DEFINE_LEN 128
struct maat_rule { struct maat_rule {
uint64_t config_id; long long config_id;
uint8_t reserved; uint8_t reserved;
int serv_def_len; int serv_def_len;
char service_defined[MAX_SERVICE_DEFINE_LEN]; char service_defined[MAX_SERVICE_DEFINE_LEN];
@@ -116,7 +116,7 @@ int maat_compile_table_ex_schema_register(struct maat *instance, int table_id,
maat_rule_ex_dup_func_t *dup_func, maat_rule_ex_dup_func_t *dup_func,
long argl, void *argp); long argl, void *argp);
void *maat_compile_table_get_ex_data(struct maat *instance, int compile_table_id, void *maat_compile_table_get_ex_data(struct maat *instance, int compile_table_id,
uint64_t compile_id, size_t idx); long long compile_id, size_t idx);
/* maat plugin table API */ /* maat plugin table API */
int maat_plugin_table_ex_schema_register(struct maat *instance, int table_id, int maat_plugin_table_ex_schema_register(struct maat *instance, int table_id,
@@ -157,22 +157,22 @@ struct maat_state;
* MAAT_SCAN_HIT * MAAT_SCAN_HIT
*/ */
int maat_scan_flag(struct maat *instance, int table_id, int thread_id, int maat_scan_flag(struct maat *instance, int table_id, int thread_id,
uint64_t flag, uint64_t *results, size_t n_result, long long flag, long long *results, size_t n_result,
size_t *n_hit_result, struct maat_state **state); size_t *n_hit_result, struct maat_state **state);
int maat_scan_integer(struct maat *instance, int table_id, int thread_id, int maat_scan_integer(struct maat *instance, int table_id, int thread_id,
unsigned int intval, uint64_t *results, size_t n_result, unsigned int intval, long long *results, size_t n_result,
size_t *n_hit_result, struct maat_state **state); size_t *n_hit_result, struct maat_state **state);
int maat_scan_ipv4(struct maat *instance, int table_id, int thread_id, int maat_scan_ipv4(struct maat *instance, int table_id, int thread_id,
uint32_t ip_addr, uint64_t *results, size_t n_result, uint32_t ip_addr, long long *results, size_t n_result,
size_t *n_hit_result, struct maat_state **state); size_t *n_hit_result, struct maat_state **state);
int maat_scan_ipv6(struct maat *instance, int table_id, int thread_id, int maat_scan_ipv6(struct maat *instance, int table_id, int thread_id,
uint8_t *ip_addr, uint64_t *results, size_t n_result, uint8_t *ip_addr, long long *results, size_t n_result,
size_t *n_hit_result, struct maat_state **state); size_t *n_hit_result, struct maat_state **state);
int maat_scan_string(struct maat *instance, int table_id, int thread_id, int maat_scan_string(struct maat *instance, int table_id, int thread_id,
const char *data, size_t data_len, uint64_t *results, const char *data, size_t data_len, long long *results,
size_t n_result, size_t *n_hit_result, size_t n_result, size_t *n_hit_result,
struct maat_state **state); struct maat_state **state);
@@ -180,7 +180,7 @@ struct maat_stream;
struct maat_stream *maat_scan_stream_open(struct maat *instance, int table_id, int thread_id); struct maat_stream *maat_scan_stream_open(struct maat *instance, int table_id, int thread_id);
int maat_scan_stream(struct maat_stream **stream, const char* data, int data_len, int maat_scan_stream(struct maat_stream **stream, const char* data, int data_len,
uint64_t *results, size_t *n_result, struct maat_state **state); long long *results, size_t *n_result, struct maat_state **state);
void maat_scan_stream_close(struct maat_stream **stream); void maat_scan_stream_close(struct maat_stream **stream);
@@ -208,4 +208,4 @@ int maat_hit_object_compile_id(struct maat *instance, struct maat_hit_object *ob
} }
#endif #endif
#endif #endif

View File

@@ -54,7 +54,7 @@ enum hs_case_sensitive {
}; };
struct hs_scan_result { struct hs_scan_result {
uint64_t item_id; long long item_id;
void *user_tag; void *user_tag;
}; };
@@ -140,4 +140,4 @@ void adapter_hs_stream_close(struct adapter_hs_stream *stream);
} }
#endif #endif
#endif #endif

View File

@@ -28,7 +28,7 @@ struct maat_cmd_line
{ {
const char *table_name; const char *table_name;
const char *table_line; const char *table_line;
uint64_t rule_id; // for MAAT_OP_DEL, only rule_id and table_name are necessary. long long rule_id; // for MAAT_OP_DEL, only rule_id and table_name are necessary.
int expire_after; //expired after $timeout$ seconds, set to 0 for never timeout. int expire_after; //expired after $timeout$ seconds, set to 0 for never timeout.
}; };

View File

@@ -53,7 +53,7 @@ int compile_table_set_rule_ex_data_schema(struct compile_schema *compile_schema,
maat_rule_ex_dup_func_t *dup_func, maat_rule_ex_dup_func_t *dup_func,
long argl, void *argp, long argl, void *argp,
struct log_handle *logger); struct log_handle *logger);
void *compile_table_get_rule_ex_data(struct compile_schema *compile_schema, uint64_t compile_id, size_t idx); void *compile_table_get_rule_ex_data(struct compile_schema *compile_schema, long long compile_id, size_t idx);
void compile_table_rule_ex_data_iterate(struct compile_schema *compile_schema, int idx); void compile_table_rule_ex_data_iterate(struct compile_schema *compile_schema, int idx);
size_t compile_table_rule_ex_data_schema_count(struct compile_schema *compile_schema); size_t compile_table_rule_ex_data_schema_count(struct compile_schema *compile_schema);
@@ -68,7 +68,7 @@ int compile_runtime_update(void *compile_runtime, void *compile_schema,
const char *line, int valid_column); const char *line, int valid_column);
int compile_runtime_commit(void *compile_runtime, const char *table_name); int compile_runtime_commit(void *compile_runtime, const char *table_name);
int compile_runtime_match(struct compile_runtime *compile_rt, uint64_t *compile_ids, int compile_runtime_match(struct compile_runtime *compile_rt, long long *compile_ids,
size_t compile_ids_size, struct maat_state *state); size_t compile_ids_size, struct maat_state *state);
size_t compile_runtime_get_hit_paths(struct compile_runtime *compile_rt, size_t compile_runtime_get_hit_paths(struct compile_runtime *compile_rt,
@@ -92,7 +92,7 @@ struct maat_compile_state *maat_compile_state_new(int thread_id);
void maat_compile_state_free(struct maat_compile_state *compile_state); void maat_compile_state_free(struct maat_compile_state *compile_state);
int maat_compile_state_update(struct maat_item *item_hash, int vtable_id, int maat_compile_state_update(struct maat_item *item_hash, int vtable_id,
uint64_t *hit_item_ids, size_t hit_item_cnt, long long *hit_item_ids, size_t hit_item_cnt,
size_t *n_hit_group_id, struct maat_state *state); size_t *n_hit_group_id, struct maat_state *state);
int maat_compile_state_has_NOT_clause(struct maat_compile_state *compile_state); int maat_compile_state_has_NOT_clause(struct maat_compile_state *compile_state);
@@ -101,4 +101,4 @@ int maat_compile_state_has_NOT_clause(struct maat_compile_state *compile_state);
} }
#endif #endif
#endif #endif

View File

@@ -46,7 +46,7 @@ int flag_runtime_commit(void *flag_runtime, const char *table_name);
* *
* @retval the num of hit group_id * @retval the num of hit group_id
*/ */
int flag_runtime_scan(struct flag_runtime *flag_rt, int thread_id, uint64_t flag, int flag_runtime_scan(struct flag_runtime *flag_rt, int thread_id, long long flag,
int vtable_id, struct maat_state *state); int vtable_id, struct maat_state *state);
void flag_runtime_scan_hit_inc(struct flag_runtime *flag_rt, int thread_id); void flag_runtime_scan_hit_inc(struct flag_runtime *flag_rt, int thread_id);

View File

@@ -40,13 +40,13 @@ void group2group_runtime_free(void *g2g_runtime);
void maat_group_ref_inc(struct maat_group *group); void maat_group_ref_inc(struct maat_group *group);
void maat_group_ref_dec(struct maat_group *group); void maat_group_ref_dec(struct maat_group *group);
struct maat_group *group2group_runtime_add_group(void *g2g_runtime, uint64_t group_id); struct maat_group *group2group_runtime_add_group(void *g2g_runtime, long long group_id);
void group2group_runtime_remove_group(void *g2g_runtime, struct maat_group *group); void group2group_runtime_remove_group(void *g2g_runtime, struct maat_group *group);
struct maat_group *group2group_runtime_find_group(void *g2g_runtime, uint64_t group_id); struct maat_group *group2group_runtime_find_group(void *g2g_runtime, long long group_id);
int group2group_runtime_build_top_groups(void *g2g_runtime); int group2group_runtime_build_top_groups(void *g2g_runtime);
int group2group_runtime_get_top_groups(void *g2g_runtime, uint64_t *group_ids, int group2group_runtime_get_top_groups(void *g2g_runtime, long long *group_ids,
size_t n_group_ids, uint64_t *top_group_ids); size_t n_group_ids, long long *top_group_ids);
int group2group_runtime_update(void *g2g_runtime, void *g2g_schema, int group2group_runtime_update(void *g2g_runtime, void *g2g_schema,
const char *line, int valid_column); const char *line, int valid_column);
@@ -56,4 +56,4 @@ int group2group_runtime_commit(void *g2g_runtime, const char *table_name);
} }
#endif #endif
#endif #endif

View File

@@ -47,7 +47,7 @@ int interval_runtime_commit(void *interval_runtime, const char *table_name);
* @retval the num of hit group_id * @retval the num of hit group_id
*/ */
int interval_runtime_scan(struct interval_runtime *interval_rt, int thread_id, int interval_runtime_scan(struct interval_runtime *interval_rt, int thread_id,
uint64_t integer, int vtable_id, struct maat_state *state); long long integer, int vtable_id, struct maat_state *state);
void interval_runtime_scan_hit_inc(struct interval_runtime *interval_rt, int thread_id); void interval_runtime_scan_hit_inc(struct interval_runtime *interval_rt, int thread_id);
long long interval_runtime_scan_hit_sum(struct interval_runtime *interval_rt, int n_thread); long long interval_runtime_scan_hit_sum(struct interval_runtime *interval_rt, int n_thread);

View File

@@ -61,7 +61,7 @@ enum tag_match {
}; };
struct maat_rule_head { struct maat_rule_head {
uint64_t config_id; long long config_id;
char resevered; char resevered;
int serv_def_len; int serv_def_len;
}; };
@@ -69,8 +69,8 @@ struct maat_rule_head {
#define ITEM_RULE_MAGIC 0x4d3c2b1a #define ITEM_RULE_MAGIC 0x4d3c2b1a
struct maat_item_inner { struct maat_item_inner {
long long magic_num; long long magic_num;
uint64_t item_id; long long item_id;
uint64_t group_id; long long group_id;
int district_id; int district_id;
int expr_id_cnt; int expr_id_cnt;
int expr_id_lb; //low boundary int expr_id_lb; //low boundary
@@ -78,8 +78,8 @@ struct maat_item_inner {
}; };
struct maat_item { struct maat_item {
uint64_t item_id; long long item_id;
uint64_t group_id; long long group_id;
UT_hash_handle hh; UT_hash_handle hh;
void *user_data; void *user_data;
}; };
@@ -87,7 +87,7 @@ struct maat_item {
#define COMPILE_RULE_MAGIC 0x1a2b3c4d #define COMPILE_RULE_MAGIC 0x1a2b3c4d
struct compile_rule { struct compile_rule {
long long magic_num; long long magic_num;
uint64_t compile_id; long long compile_id;
struct maat_rule_head head;// fix len of Maat_rule_t struct maat_rule_head head;// fix len of Maat_rule_t
char *service_defined; char *service_defined;
int declared_clause_num; int declared_clause_num;
@@ -98,8 +98,8 @@ struct compile_rule {
}; };
struct group2group_rule { struct group2group_rule {
uint64_t group_id; long long group_id;
uint64_t super_group_id; long long super_group_id;
}; };
struct maat_runtime { struct maat_runtime {
@@ -254,11 +254,11 @@ size_t parse_accept_tag(const char *value, struct rule_tag **result, struct log_
int compare_accept_tag(const char *value, const struct rule_tag *accept_tags, size_t n_accept_tag); int compare_accept_tag(const char *value, const struct rule_tag *accept_tags, size_t n_accept_tag);
struct maat_item *maat_item_new(uint64_t item_id, uint64_t group_id, void *user_data); struct maat_item *maat_item_new(long long item_id, long long group_id, void *user_data);
void maat_item_free(struct maat_item *item, void (* item_user_data_free)(void *)); void maat_item_free(struct maat_item *item, void (* item_user_data_free)(void *));
struct maat_item_inner *maat_item_inner_new(uint64_t group_id, uint64_t item_id, int district_id); struct maat_item_inner *maat_item_inner_new(long long group_id, long long item_id, int district_id);
void maat_item_inner_free(void *item_inner); void maat_item_inner_free(void *item_inner);
@@ -319,4 +319,4 @@ void maat_cmd_set_serial_rule(struct serial_rule *rule, enum maat_operation op,
} }
#endif #endif
#endif #endif

View File

@@ -492,7 +492,7 @@ int maat_compile_table_ex_schema_register(struct maat *maat_instance, int table_
} }
void *maat_compile_table_get_ex_data(struct maat *maat_instance, int compile_table_id, void *maat_compile_table_get_ex_data(struct maat *maat_instance, int compile_table_id,
uint64_t compile_id, size_t idx) long long compile_id, size_t idx)
{ {
struct compile_schema *schema = (struct compile_schema *)table_manager_get_schema(maat_instance->tbl_mgr, struct compile_schema *schema = (struct compile_schema *)table_manager_get_schema(maat_instance->tbl_mgr,
compile_table_id); compile_table_id);
@@ -831,7 +831,7 @@ static inline int scan_status_should_compile_NOT(struct maat_state *state)
return 0; return 0;
} }
size_t hit_group_to_compile(void *compile_runtime, uint64_t *compile_ids, size_t compile_ids_size, size_t hit_group_to_compile(void *compile_runtime, long long *compile_ids, size_t compile_ids_size,
struct maat_state *mid) struct maat_state *mid)
{ {
size_t n_hit_compile = compile_runtime_match((struct compile_runtime *)compile_runtime, size_t n_hit_compile = compile_runtime_match((struct compile_runtime *)compile_runtime,
@@ -862,7 +862,7 @@ static int vtable_get_physical_table_ids(struct table_manager *tbl_mgr, int tabl
return physical_table_cnt; return physical_table_cnt;
} }
int flag_scan_hit_group_count(struct table_manager *tbl_mgr, int thread_id, uint64_t flag, int flag_scan_hit_group_count(struct table_manager *tbl_mgr, int thread_id, long long flag,
int physical_table_ids[], int physical_table_cnt, int vtable_id, int physical_table_ids[], int physical_table_cnt, int vtable_id,
struct maat_state *mid) struct maat_state *mid)
{ {
@@ -894,7 +894,7 @@ int flag_scan_hit_group_count(struct table_manager *tbl_mgr, int thread_id, uint
return sum_hit_group_cnt; return sum_hit_group_cnt;
} }
int interval_scan_hit_group_count(struct table_manager *tbl_mgr, int thread_id, uint64_t intval, int interval_scan_hit_group_count(struct table_manager *tbl_mgr, int thread_id, long long intval,
int physical_table_ids[], int physical_table_cnt, int vtable_id, int physical_table_ids[], int physical_table_cnt, int vtable_id,
struct maat_state *mid) struct maat_state *mid)
{ {
@@ -1035,7 +1035,7 @@ int string_scan_hit_group_count(struct table_manager *tbl_mgr, int thread_id, co
return sum_hit_group_cnt; return sum_hit_group_cnt;
} }
size_t group_to_compile(struct maat *maat_instance, uint64_t *results, size_t n_result, size_t group_to_compile(struct maat *maat_instance, long long *results, size_t n_result,
struct maat_state *mid) struct maat_state *mid)
{ {
int compile_table_id[MAX_COMPILE_TABLE_NUM] = {0}; int compile_table_id[MAX_COMPILE_TABLE_NUM] = {0};
@@ -1067,7 +1067,7 @@ size_t group_to_compile(struct maat *maat_instance, uint64_t *results, size_t n_
} }
int maat_scan_flag(struct maat *maat_instance, int table_id, int thread_id, int maat_scan_flag(struct maat *maat_instance, int table_id, int thread_id,
uint64_t flag, uint64_t *results, size_t n_result, long long flag, long long *results, size_t n_result,
size_t *n_hit_result, struct maat_state **state) size_t *n_hit_result, struct maat_state **state)
{ {
if ((NULL == maat_instance) || table_id < 0 || table_id >= MAX_TABLE_NUM if ((NULL == maat_instance) || table_id < 0 || table_id >= MAX_TABLE_NUM
@@ -1143,7 +1143,7 @@ int maat_scan_flag(struct maat *maat_instance, int table_id, int thread_id,
} }
int maat_scan_integer(struct maat *maat_instance, int table_id, int thread_id, int maat_scan_integer(struct maat *maat_instance, int table_id, int thread_id,
unsigned int intval, uint64_t *results, size_t n_result, unsigned int intval, long long *results, size_t n_result,
size_t *n_hit_result, struct maat_state **state) size_t *n_hit_result, struct maat_state **state)
{ {
if ((NULL == maat_instance) || table_id < 0 || table_id >= MAX_TABLE_NUM if ((NULL == maat_instance) || table_id < 0 || table_id >= MAX_TABLE_NUM
@@ -1219,7 +1219,7 @@ int maat_scan_integer(struct maat *maat_instance, int table_id, int thread_id,
} }
int maat_scan_ipv4(struct maat *maat_instance, int table_id, int thread_id, int maat_scan_ipv4(struct maat *maat_instance, int table_id, int thread_id,
uint32_t ip_addr, uint64_t *results, size_t n_result, uint32_t ip_addr, long long *results, size_t n_result,
size_t *n_hit_result, struct maat_state **state) size_t *n_hit_result, struct maat_state **state)
{ {
if ((NULL == maat_instance) || table_id < 0 || table_id >= MAX_TABLE_NUM if ((NULL == maat_instance) || table_id < 0 || table_id >= MAX_TABLE_NUM
@@ -1296,7 +1296,7 @@ int maat_scan_ipv4(struct maat *maat_instance, int table_id, int thread_id,
int maat_scan_ipv6(struct maat *maat_instance, int table_id, int thread_id, int maat_scan_ipv6(struct maat *maat_instance, int table_id, int thread_id,
uint8_t *ip_addr, uint64_t *results, size_t n_result, uint8_t *ip_addr, long long *results, size_t n_result,
size_t *n_hit_result, struct maat_state **state) size_t *n_hit_result, struct maat_state **state)
{ {
if ((NULL == maat_instance) || table_id < 0 || table_id >= MAX_TABLE_NUM if ((NULL == maat_instance) || table_id < 0 || table_id >= MAX_TABLE_NUM
@@ -1372,7 +1372,7 @@ int maat_scan_ipv6(struct maat *maat_instance, int table_id, int thread_id,
} }
int maat_scan_string(struct maat *maat_instance, int table_id, int thread_id, int maat_scan_string(struct maat *maat_instance, int table_id, int thread_id,
const char *data, size_t data_len, uint64_t *results, size_t n_result, const char *data, size_t data_len, long long *results, size_t n_result,
size_t *n_hit_result, struct maat_state **state) size_t *n_hit_result, struct maat_state **state)
{ {
if ((NULL == maat_instance) || table_id < 0 || table_id >= MAX_TABLE_NUM if ((NULL == maat_instance) || table_id < 0 || table_id >= MAX_TABLE_NUM
@@ -1453,7 +1453,7 @@ struct maat_stream *maat_scan_stream_open(struct maat *instance, int table_id, i
} }
int maat_scan_stream(struct maat_stream **stream, const char *data, int data_len, int maat_scan_stream(struct maat_stream **stream, const char *data, int data_len,
uint64_t *results, size_t *n_result, struct maat_state **state) long long *results, size_t *n_result, struct maat_state **state)
{ {
return 0; return 0;
} }

View File

@@ -33,7 +33,7 @@ struct bool_plugin_schema {
}; };
struct bool_plugin_item { struct bool_plugin_item {
uint64_t item_id; long long item_id;
size_t n_bool_item; size_t n_bool_item;
unsigned long long bool_item_id[MAX_ITEMS_PER_BOOL_EXPR]; unsigned long long bool_item_id[MAX_ITEMS_PER_BOOL_EXPR];
}; };
@@ -355,7 +355,7 @@ size_t ull_dedup(unsigned long long item_ids[], size_t n_item)
return index + 1; return index + 1;
} }
struct bool_expr *bool_expr_new(uint64_t item_id, struct bool_plugin_item *item) struct bool_expr *bool_expr_new(long long item_id, struct bool_plugin_item *item)
{ {
struct bool_expr *expr = ALLOC(struct bool_expr, 1); struct bool_expr *expr = ALLOC(struct bool_expr, 1);
@@ -408,7 +408,7 @@ int bool_plugin_runtime_update(void *bool_plugin_runtime, void *bool_plugin_sche
char *key = (char *)&item_id; char *key = (char *)&item_id;
int ret = bool_plugin_runtime_update_row(bool_plugin_rt, schema, line, key, int ret = bool_plugin_runtime_update_row(bool_plugin_rt, schema, line, key,
sizeof(uint64_t), expr, is_valid); sizeof(long long), expr, is_valid);
if (ret < 0) { if (ret < 0) {
if (item != NULL) { if (item != NULL) {
FREE(item); FREE(item);
@@ -519,4 +519,4 @@ int bool_plugin_runtime_get_ex_data(void *bool_plugin_runtime, unsigned long lon
} }
return n_result; return n_result;
} }

View File

@@ -60,15 +60,15 @@ struct group2compile_schema {
}; };
struct compile_item { struct compile_item {
uint64_t compile_id; long long compile_id;
char user_region[MAX_TABLE_LINE_SIZE]; char user_region[MAX_TABLE_LINE_SIZE];
int declared_clause_num; int declared_clause_num;
int evaluation_order; int evaluation_order;
}; };
struct group2compile_item { struct group2compile_item {
uint64_t group_id; long long group_id;
uint64_t compile_id; long long compile_id;
int not_flag; int not_flag;
int vtable_id; int vtable_id;
int clause_index; int clause_index;
@@ -104,7 +104,7 @@ struct maat_clause_state {
}; };
struct maat_literal_id { struct maat_literal_id {
uint64_t group_id; long long group_id;
int vtable_id; int vtable_id;
}; };
@@ -118,14 +118,14 @@ struct maat_clause {
struct compile_sort_para { struct compile_sort_para {
double evaluation_order; double evaluation_order;
int declared_clause_num; int declared_clause_num;
uint64_t compile_id; long long compile_id;
void *user; void *user;
}; };
#define MAAT_COMPILE_MAGIC 0x4a5b6c7d #define MAAT_COMPILE_MAGIC 0x4a5b6c7d
struct maat_compile { struct maat_compile {
unsigned int magic; unsigned int magic;
uint64_t compile_id; long long compile_id;
int actual_clause_num; int actual_clause_num;
int declared_clause_num; int declared_clause_num;
int not_clause_cnt; int not_clause_cnt;
@@ -138,8 +138,8 @@ struct maat_compile {
struct maat_internal_hit_path { struct maat_internal_hit_path {
int Nth_scan; int Nth_scan;
int Nth_hit_item; int Nth_hit_item;
uint64_t item_id; long long item_id;
uint64_t group_id; long long group_id;
int vtable_id; int vtable_id;
}; };
@@ -184,13 +184,13 @@ int compile_table_set_rule_ex_data_schema(struct compile_schema *compile_schema,
return idx; return idx;
} }
void *compile_runtime_get_user_data(struct compile_runtime *compile_rt, uint64_t compile_id, int is_dettach) void *compile_runtime_get_user_data(struct compile_runtime *compile_rt, long long compile_id, int is_dettach)
{ {
struct maat_compile *compile = NULL; struct maat_compile *compile = NULL;
void *ret = NULL; void *ret = NULL;
pthread_rwlock_rdlock(&compile_rt->rwlock); pthread_rwlock_rdlock(&compile_rt->rwlock);
HASH_FIND(hh, compile_rt->compile_hash, &compile_id, sizeof(uint64_t), compile); HASH_FIND(hh, compile_rt->compile_hash, &compile_id, sizeof(long long), compile);
if (compile != NULL) { if (compile != NULL) {
ret = compile->user_data; ret = compile->user_data;
if (is_dettach) { if (is_dettach) {
@@ -278,7 +278,7 @@ void compile_table_rule_ex_data_iterate(struct compile_schema *compile_schema, i
compile_runtime_user_data_iterate(compile_rt, rule_ex_data_new_cb, ex_schema); compile_runtime_user_data_iterate(compile_rt, rule_ex_data_new_cb, ex_schema);
} }
void *compile_table_get_rule_ex_data(struct compile_schema *compile_schema, uint64_t compile_id, size_t idx) void *compile_table_get_rule_ex_data(struct compile_schema *compile_schema, long long compile_id, size_t idx)
{ {
if (NULL == compile_schema) { if (NULL == compile_schema) {
return NULL; return NULL;
@@ -312,7 +312,7 @@ size_t compile_table_rule_ex_data_schema_count(struct compile_schema *compile_sc
} }
UT_icd ut_literal_id_icd = {sizeof(struct maat_literal_id), NULL, NULL, NULL}; UT_icd ut_literal_id_icd = {sizeof(struct maat_literal_id), NULL, NULL, NULL};
UT_icd ut_clause_id_icd = {sizeof(uint64_t), NULL, NULL, NULL}; UT_icd ut_clause_id_icd = {sizeof(long long), NULL, NULL, NULL};
UT_icd ut_hit_path_icd = {sizeof(struct maat_internal_hit_path), NULL, NULL, NULL}; UT_icd ut_hit_path_icd = {sizeof(struct maat_internal_hit_path), NULL, NULL, NULL};
void *compile_schema_new(cJSON *json, struct table_manager *tbl_mgr, void *compile_schema_new(cJSON *json, struct table_manager *tbl_mgr,
@@ -790,7 +790,7 @@ void group2compile_item_free(struct group2compile_item *g2c_item)
} }
#define MAAT_HIER_COMPILE_MAGIC 0x4a5b6c7d #define MAAT_HIER_COMPILE_MAGIC 0x4a5b6c7d
struct maat_compile *maat_compile_new(uint64_t compile_id) struct maat_compile *maat_compile_new(long long compile_id)
{ {
struct maat_compile *compile = ALLOC(struct maat_compile, 1); struct maat_compile *compile = ALLOC(struct maat_compile, 1);
@@ -819,13 +819,13 @@ int maat_compile_set(struct maat_compile *compile, int declared_clause_num,
return 0; return 0;
} }
int maat_compile_hash_add(struct maat_compile **compile_hash, uint64_t compile_id, int maat_compile_hash_add(struct maat_compile **compile_hash, long long compile_id,
struct maat_compile *compile) struct maat_compile *compile)
{ {
int ret = 0; int ret = 0;
assert(compile->declared_clause_num >= 0); assert(compile->declared_clause_num >= 0);
HASH_ADD(hh, *compile_hash, compile_id, sizeof(uint64_t), compile); HASH_ADD(hh, *compile_hash, compile_id, sizeof(long long), compile);
//TODO:mytest need to delete //TODO:mytest need to delete
#if 0 #if 0
size_t compile_cnt = HASH_COUNT(*compile_hash); size_t compile_cnt = HASH_COUNT(*compile_hash);
@@ -838,12 +838,12 @@ int maat_compile_hash_add(struct maat_compile **compile_hash, uint64_t compile_i
return ret; return ret;
} }
void maat_compile_hash_set(struct maat_compile **compile_hash, uint64_t compile_id, void maat_compile_hash_set(struct maat_compile **compile_hash, long long compile_id,
struct maat_compile *compile) struct maat_compile *compile)
{ {
struct maat_compile *tmp_compile = NULL; struct maat_compile *tmp_compile = NULL;
HASH_FIND(hh, *compile_hash, &compile_id, sizeof(uint64_t), tmp_compile); HASH_FIND(hh, *compile_hash, &compile_id, sizeof(long long), tmp_compile);
assert(tmp_compile != NULL); assert(tmp_compile != NULL);
assert(tmp_compile->user_data == NULL); assert(tmp_compile->user_data == NULL);
@@ -872,7 +872,7 @@ int maat_compile_hash_remove(struct maat_compile **compile_hash, struct maat_com
return 0; return 0;
} }
struct maat_compile *maat_compile_hash_find(struct maat_compile **compile_hash, uint64_t compile_id) struct maat_compile *maat_compile_hash_find(struct maat_compile **compile_hash, long long compile_id)
{ {
struct maat_compile *compile = NULL; struct maat_compile *compile = NULL;
@@ -1263,7 +1263,7 @@ void maat_compile_state_free(struct maat_compile_state *compile_state)
free(compile_state); free(compile_state);
} }
static int maat_compile_hit_path_add(UT_array *hit_paths, uint64_t item_id, uint64_t group_id, static int maat_compile_hit_path_add(UT_array *hit_paths, long long item_id, long long group_id,
int vtable_id, int Nth_scan, int Nth_item_result) int vtable_id, int Nth_scan, int Nth_item_result)
{ {
struct maat_internal_hit_path new_path; struct maat_internal_hit_path new_path;
@@ -1332,7 +1332,7 @@ size_t compile_runtime_get_hit_paths(struct compile_runtime *compile_rt,
/* /*
NOTE: maybe one item has been deleted, but it's item_id still exist in internal_hit_paths NOTE: maybe one item has been deleted, but it's item_id still exist in internal_hit_paths
*/ */
uint64_t top_group_ids[MAX_SCANNER_HIT_GROUP_NUM]; long long top_group_ids[MAX_SCANNER_HIT_GROUP_NUM];
memset(top_group_ids, 0, sizeof(top_group_ids)); memset(top_group_ids, 0, sizeof(top_group_ids));
int top_group_cnt = group2group_runtime_get_top_groups(g2g_rt, &(internal_path->group_id), int top_group_cnt = group2group_runtime_get_top_groups(g2g_rt, &(internal_path->group_id),
1, top_group_ids); 1, top_group_ids);
@@ -1407,7 +1407,7 @@ size_t compile_runtime_get_hit_paths(struct compile_runtime *compile_rt,
} }
void maat_compile_state_update_hit_path(struct maat_compile_state *compile_state, void maat_compile_state_update_hit_path(struct maat_compile_state *compile_state,
uint64_t item_id, uint64_t group_id, int vtable_id, long long item_id, long long group_id, int vtable_id,
int Nth_scan, int Nth_item_result) int Nth_scan, int Nth_item_result)
{ {
if (compile_state->Nth_scan != Nth_scan) { if (compile_state->Nth_scan != Nth_scan) {
@@ -1424,7 +1424,7 @@ void maat_compile_state_update_hit_path(struct maat_compile_state *compile_state
} }
void maat_compile_state_update_hit_clause(struct maat_compile_state *compile_state, void maat_compile_state_update_hit_clause(struct maat_compile_state *compile_state,
void *compile_runtime, uint64_t group_id, void *compile_runtime, long long group_id,
int vtable_id) int vtable_id)
{ {
if (NULL == compile_state || NULL == compile_runtime) { if (NULL == compile_state || NULL == compile_runtime) {
@@ -1769,7 +1769,7 @@ static int compare_compile_rule(const void *a, const void *b)
} }
int compile_runtime_match(struct compile_runtime *compile_rt, int compile_runtime_match(struct compile_runtime *compile_rt,
uint64_t *compile_ids, size_t compile_ids_size, long long *compile_ids, size_t compile_ids_size,
struct maat_state *state) struct maat_state *state)
{ {
struct maat_compile_state *compile_state = state->compile_state; struct maat_compile_state *compile_state = state->compile_state;
@@ -1796,11 +1796,11 @@ int compile_runtime_match(struct compile_runtime *compile_rt,
} }
int maat_compile_state_update(struct maat_item *item_hash, int vtable_id, int maat_compile_state_update(struct maat_item *item_hash, int vtable_id,
uint64_t *hit_item_ids, size_t hit_item_cnt, long long *hit_item_ids, size_t hit_item_cnt,
size_t *n_hit_group_id, struct maat_state *state) size_t *n_hit_group_id, struct maat_state *state)
{ {
struct maat_item *item = NULL; struct maat_item *item = NULL;
uint64_t hit_group_ids[MAX_SCANNER_HIT_GROUP_NUM]; long long hit_group_ids[MAX_SCANNER_HIT_GROUP_NUM];
memset(hit_group_ids, 0, sizeof(hit_group_ids)); memset(hit_group_ids, 0, sizeof(hit_group_ids));
size_t hit_group_cnt = 0; size_t hit_group_cnt = 0;
@@ -1811,7 +1811,7 @@ int maat_compile_state_update(struct maat_item *item_hash, int vtable_id,
} }
for (size_t i = 0; i < hit_item_cnt; i++) { for (size_t i = 0; i < hit_item_cnt; i++) {
HASH_FIND(hh, item_hash, &(hit_item_ids[i]), sizeof(uint64_t), item); HASH_FIND(hh, item_hash, &(hit_item_ids[i]), sizeof(long long), item);
//assert(item != NULL); //assert(item != NULL);
if (!item) { if (!item) {
// item config has been deleted // item config has been deleted
@@ -1849,7 +1849,7 @@ int maat_compile_state_update(struct maat_item *item_hash, int vtable_id,
void *compile_rt = table_manager_get_runtime(state->maat_instance->tbl_mgr, void *compile_rt = table_manager_get_runtime(state->maat_instance->tbl_mgr,
compile_table_ids[idx]); compile_table_ids[idx]);
for (size_t i = 0; i < hit_group_cnt; i++) { for (size_t i = 0; i < hit_group_cnt; i++) {
uint64_t top_group_ids[MAX_SCANNER_HIT_GROUP_NUM]; long long top_group_ids[MAX_SCANNER_HIT_GROUP_NUM];
memset(top_group_ids, 0, sizeof(top_group_ids)); memset(top_group_ids, 0, sizeof(top_group_ids));
int top_group_cnt = group2group_runtime_get_top_groups(g2g_rt, &hit_group_ids[i], int top_group_cnt = group2group_runtime_get_top_groups(g2g_rt, &hit_group_ids[i],
1, top_group_ids); 1, top_group_ids);
@@ -1861,4 +1861,4 @@ int maat_compile_state_update(struct maat_item *item_hash, int vtable_id,
} }
return 0; return 0;
} }

View File

@@ -58,8 +58,8 @@ enum match_method {
}; };
struct expr_item { struct expr_item {
uint64_t item_id; long long item_id;
uint64_t group_id; long long group_id;
int district_id; int district_id;
char keywords[MAX_KEYWORDS_STR]; char keywords[MAX_KEYWORDS_STR];
enum expr_type expr_type; enum expr_type expr_type;
@@ -485,7 +485,7 @@ void expr_runtime_free(void *expr_runtime)
} }
int expr_runtime_update_row(struct expr_runtime *expr_rt, char *key, int expr_runtime_update_row(struct expr_runtime *expr_rt, char *key,
size_t key_len, uint64_t item_id, and_expr_t *expr_rule, size_t key_len, long long item_id, and_expr_t *expr_rule,
int is_valid, struct log_handle *logger) int is_valid, struct log_handle *logger)
{ {
void *data = NULL; void *data = NULL;
@@ -729,7 +729,7 @@ int expr_runtime_update(void *expr_runtime, void *expr_schema,
return -1; return -1;
} else if (0 == is_valid) { } else if (0 == is_valid) {
//delete //delete
HASH_FIND(hh, expr_rt->item_hash, &item_id, sizeof(uint64_t), item); HASH_FIND(hh, expr_rt->item_hash, &item_id, sizeof(long long), item);
if (NULL == item) { if (NULL == item) {
return -1; return -1;
} }
@@ -745,7 +745,7 @@ int expr_runtime_update(void *expr_runtime, void *expr_schema,
maat_garbage_bagging(expr_rt->ref_garbage_bin, u_para, maat_item_inner_free); maat_garbage_bagging(expr_rt->ref_garbage_bin, u_para, maat_item_inner_free);
} else { } else {
//add //add
HASH_FIND(hh, expr_rt->item_hash, &item_id, sizeof(uint64_t), item); HASH_FIND(hh, expr_rt->item_hash, &item_id, sizeof(long long), item);
if (item) { if (item) {
log_error(expr_rt->logger, MODULE_EXPR, log_error(expr_rt->logger, MODULE_EXPR,
"expr runtime add item %llu to item_hash failed, already exist", "expr runtime add item %llu to item_hash failed, already exist",
@@ -760,7 +760,7 @@ int expr_runtime_update(void *expr_runtime, void *expr_schema,
u_para = maat_item_inner_new(expr_item->group_id, item_id, expr_item->district_id); u_para = maat_item_inner_new(expr_item->group_id, item_id, expr_item->district_id);
item = maat_item_new(item_id, expr_item->group_id, u_para); item = maat_item_new(item_id, expr_item->group_id, u_para);
HASH_ADD(hh, expr_rt->item_hash, item_id, sizeof(uint64_t), item); HASH_ADD(hh, expr_rt->item_hash, item_id, sizeof(long long), item);
expr_rule = expr_item_to_expr_rule(expr_item, u_para, expr_rt->logger); expr_rule = expr_item_to_expr_rule(expr_item, u_para, expr_rt->logger);
expr_item_free(expr_item); expr_item_free(expr_item);
@@ -773,7 +773,7 @@ int expr_runtime_update(void *expr_runtime, void *expr_schema,
} }
char *key = (char *)&item_id; char *key = (char *)&item_id;
ret = expr_runtime_update_row(expr_rt, key, sizeof(uint64_t), item_id, ret = expr_runtime_update_row(expr_rt, key, sizeof(long long), item_id,
expr_rule, is_valid, expr_rt->logger); expr_rule, is_valid, expr_rt->logger);
if (ret < 0) { if (ret < 0) {
if (expr_rule != NULL) { if (expr_rule != NULL) {
@@ -868,7 +868,7 @@ int expr_runtime_scan(struct expr_runtime *expr_rt, int thread_id, const char *d
n_hit_item = MAX_SCANNER_HIT_ITEM_NUM; n_hit_item = MAX_SCANNER_HIT_ITEM_NUM;
} }
uint64_t hit_item_ids[MAX_SCANNER_HIT_ITEM_NUM]; long long hit_item_ids[MAX_SCANNER_HIT_ITEM_NUM];
struct maat_item_inner *item = NULL; struct maat_item_inner *item = NULL;
int real_hit_item_cnt = 0; int real_hit_item_cnt = 0;
int district_id = state->district_id; int district_id = state->district_id;
@@ -929,7 +929,7 @@ int expr_runtime_stream_scan(struct expr_runtime *expr_rt, const char *data, siz
n_hit_item = MAX_SCANNER_HIT_ITEM_NUM; n_hit_item = MAX_SCANNER_HIT_ITEM_NUM;
} }
uint64_t hit_item_ids[MAX_SCANNER_HIT_ITEM_NUM]; long long hit_item_ids[MAX_SCANNER_HIT_ITEM_NUM];
memset(hit_item_ids, 0, sizeof(hit_item_ids)); memset(hit_item_ids, 0, sizeof(hit_item_ids));
for (size_t i = 0; i < n_hit_item; i++) { for (size_t i = 0; i < n_hit_item; i++) {
@@ -962,4 +962,4 @@ void expr_runtime_scan_hit_inc(struct expr_runtime *expr_rt, int thread_id)
long long expr_runtime_scan_hit_sum(struct expr_runtime *expr_rt, int n_thread) long long expr_runtime_scan_hit_sum(struct expr_runtime *expr_rt, int n_thread)
{ {
return alignment_int64_array_sum(expr_rt->hit_cnt, n_thread); return alignment_int64_array_sum(expr_rt->hit_cnt, n_thread);
} }

View File

@@ -34,10 +34,10 @@ struct flag_schema {
}; };
struct flag_item { struct flag_item {
uint64_t item_id; long long item_id;
uint64_t group_id; long long group_id;
uint64_t flag; long long flag;
uint64_t flag_mask; long long flag_mask;
}; };
struct flag_runtime { struct flag_runtime {
@@ -176,7 +176,7 @@ void flag_runtime_free(void *flag_runtime)
} }
int flag_runtime_update_row(struct flag_runtime *flag_rt, char *key, size_t key_len, int flag_runtime_update_row(struct flag_runtime *flag_rt, char *key, size_t key_len,
uint64_t item_id, struct flag_rule *rule, int is_valid) long long item_id, struct flag_rule *rule, int is_valid)
{ {
void *data = NULL; void *data = NULL;
@@ -301,7 +301,7 @@ int flag_runtime_update(void *flag_runtime, void *flag_schema,
return -1; return -1;
} else if (0 == is_valid) { } else if (0 == is_valid) {
//delete //delete
HASH_FIND(hh, flag_rt->item_hash, &item_id, sizeof(uint64_t), item); HASH_FIND(hh, flag_rt->item_hash, &item_id, sizeof(long long), item);
if (NULL == item) { if (NULL == item) {
return -1; return -1;
} }
@@ -317,7 +317,7 @@ int flag_runtime_update(void *flag_runtime, void *flag_schema,
maat_garbage_bagging(flag_rt->ref_garbage_bin, u_para, maat_item_inner_free); maat_garbage_bagging(flag_rt->ref_garbage_bin, u_para, maat_item_inner_free);
} else { } else {
//add //add
HASH_FIND(hh, flag_rt->item_hash, &item_id, sizeof(uint64_t), item); HASH_FIND(hh, flag_rt->item_hash, &item_id, sizeof(long long), item);
if (item) { if (item) {
log_error(flag_rt->logger, MODULE_FLAG, log_error(flag_rt->logger, MODULE_FLAG,
"flag runtime add item %d to item_hash failed, already exist", "flag runtime add item %d to item_hash failed, already exist",
@@ -332,7 +332,7 @@ int flag_runtime_update(void *flag_runtime, void *flag_schema,
u_para = maat_item_inner_new(flag_item->group_id, item_id, 0); u_para = maat_item_inner_new(flag_item->group_id, item_id, 0);
item = maat_item_new(item_id, flag_item->group_id, u_para); item = maat_item_new(item_id, flag_item->group_id, u_para);
HASH_ADD(hh, flag_rt->item_hash, item_id, sizeof(uint64_t), item); HASH_ADD(hh, flag_rt->item_hash, item_id, sizeof(long long), item);
flag_rule = flag_item_to_flag_rule(flag_item, u_para); flag_rule = flag_item_to_flag_rule(flag_item, u_para);
flag_item_free(flag_item); flag_item_free(flag_item);
@@ -345,7 +345,7 @@ int flag_runtime_update(void *flag_runtime, void *flag_schema,
} }
char *key = (char *)&item_id; char *key = (char *)&item_id;
int ret = flag_runtime_update_row(flag_rt, key, sizeof(uint64_t), item_id, flag_rule, is_valid); int ret = flag_runtime_update_row(flag_rt, key, sizeof(long long), item_id, flag_rule, is_valid);
if (ret < 0) { if (ret < 0) {
if (flag_rule != NULL) { if (flag_rule != NULL) {
flag_rule_free(flag_rule); flag_rule_free(flag_rule);
@@ -415,7 +415,7 @@ int flag_runtime_commit(void *flag_runtime, const char *table_name)
} }
int flag_runtime_scan(struct flag_runtime *flag_rt, int thread_id, int flag_runtime_scan(struct flag_runtime *flag_rt, int thread_id,
uint64_t flag, int vtable_id, struct maat_state *state) long long flag, int vtable_id, struct maat_state *state)
{ {
struct flag_result hit_results[MAX_SCANNER_HIT_ITEM_NUM] = {0}; struct flag_result hit_results[MAX_SCANNER_HIT_ITEM_NUM] = {0};
@@ -432,7 +432,7 @@ int flag_runtime_scan(struct flag_runtime *flag_rt, int thread_id,
n_hit_item = MAX_SCANNER_HIT_ITEM_NUM; n_hit_item = MAX_SCANNER_HIT_ITEM_NUM;
} }
uint64_t hit_item_ids[MAX_SCANNER_HIT_ITEM_NUM]; long long hit_item_ids[MAX_SCANNER_HIT_ITEM_NUM];
memset(hit_item_ids, 0, sizeof(hit_item_ids)); memset(hit_item_ids, 0, sizeof(hit_item_ids));
for (int i = 0; i < n_hit_item; i++) { for (int i = 0; i < n_hit_item; i++) {
@@ -457,4 +457,4 @@ void flag_runtime_scan_hit_inc(struct flag_runtime *flag_rt, int thread_id)
long long flag_runtime_scan_hit_sum(struct flag_runtime *flag_rt, int n_thread) long long flag_runtime_scan_hit_sum(struct flag_runtime *flag_rt, int n_thread)
{ {
return alignment_int64_array_sum(flag_rt->hit_cnt, n_thread); return alignment_int64_array_sum(flag_rt->hit_cnt, n_thread);
} }

View File

@@ -35,7 +35,7 @@ struct fqdn_plugin_schema {
}; };
struct fqdn_plugin_item { struct fqdn_plugin_item {
uint64_t item_id; long long item_id;
int suffix_flag; int suffix_flag;
}; };
@@ -349,7 +349,7 @@ int fqdn_plugin_runtime_update(void *fqdn_plugin_runtime, void *fqdn_plugin_sche
char *key = (char *)&item_id; char *key = (char *)&item_id;
int ret = fqdn_plugin_runtime_update_row(fqdn_plugin_rt, schema, line, key, int ret = fqdn_plugin_runtime_update_row(fqdn_plugin_rt, schema, line, key,
sizeof(uint64_t), rule, is_valid); sizeof(long long), rule, is_valid);
if (ret < 0) { if (ret < 0) {
if (item != NULL) { if (item != NULL) {
FREE(item); FREE(item);
@@ -459,4 +459,4 @@ int fqdn_plugin_runtime_get_ex_data(void *fqdn_plugin_runtime, const char *query
} }
return n_result; return n_result;
} }

View File

@@ -21,8 +21,8 @@
#define MODULE_GROUP module_name_str("maat.group") #define MODULE_GROUP module_name_str("maat.group")
struct group2group_item { struct group2group_item {
uint64_t group_id; long long group_id;
uint64_t super_group_id; long long super_group_id;
}; };
struct group2group_schema { struct group2group_schema {
@@ -34,13 +34,13 @@ struct group2group_schema {
struct maat_group { struct maat_group {
igraph_integer_t vertex_id; igraph_integer_t vertex_id;
uint64_t group_id; long long group_id;
int ref_by_compile_cnt; int ref_by_compile_cnt;
int ref_by_super_group_cnt; int ref_by_super_group_cnt;
int ref_by_sub_group_cnt; int ref_by_sub_group_cnt;
size_t top_group_cnt; size_t top_group_cnt;
uint64_t *top_group_ids; long long *top_group_ids;
UT_hash_handle hh_group_id; UT_hash_handle hh_group_id;
UT_hash_handle hh_vertex_id; UT_hash_handle hh_vertex_id;
@@ -243,7 +243,7 @@ size_t print_igraph_vector(igraph_vector_t *v, char *buff, size_t sz) {
return printed; return printed;
} }
struct maat_group *_group2group_runtime_add_group(void *g2g_runtime, uint64_t group_id, int lock_flag) struct maat_group *_group2group_runtime_add_group(void *g2g_runtime, long long group_id, int lock_flag)
{ {
struct group2group_runtime *g2g_rt = (struct group2group_runtime *)g2g_runtime; struct group2group_runtime *g2g_rt = (struct group2group_runtime *)g2g_runtime;
@@ -270,7 +270,7 @@ struct maat_group *_group2group_runtime_add_group(void *g2g_runtime, uint64_t gr
return group; return group;
} }
struct maat_group *group2group_runtime_add_group(void *g2g_runtime, uint64_t group_id) struct maat_group *group2group_runtime_add_group(void *g2g_runtime, long long group_id)
{ {
if (NULL == g2g_runtime) { if (NULL == g2g_runtime) {
return NULL; return NULL;
@@ -326,7 +326,7 @@ void group2group_runtime_remove_group(void *g2g_runtime, struct maat_group *grou
_group2group_runtime_remove_group(g2g_runtime, group, 1); _group2group_runtime_remove_group(g2g_runtime, group, 1);
} }
struct maat_group *_group2group_runtime_find_group(void *g2g_runtime, uint64_t group_id, int lock_flag) struct maat_group *_group2group_runtime_find_group(void *g2g_runtime, long long group_id, int lock_flag)
{ {
if (NULL == g2g_runtime) { if (NULL == g2g_runtime) {
return NULL; return NULL;
@@ -350,7 +350,7 @@ struct maat_group *_group2group_runtime_find_group(void *g2g_runtime, uint64_t g
return group; return group;
} }
struct maat_group *group2group_runtime_find_group(void *g2g_runtime, uint64_t group_id) struct maat_group *group2group_runtime_find_group(void *g2g_runtime, long long group_id)
{ {
if (NULL == g2g_runtime) { if (NULL == g2g_runtime) {
return NULL; return NULL;
@@ -359,8 +359,8 @@ struct maat_group *group2group_runtime_find_group(void *g2g_runtime, uint64_t gr
return _group2group_runtime_find_group(g2g_runtime, group_id, 1); return _group2group_runtime_find_group(g2g_runtime, group_id, 1);
} }
int group2group_runtime_add_group_to_group(void *g2g_runtime, uint64_t group_id, int group2group_runtime_add_group_to_group(void *g2g_runtime, long long group_id,
uint64_t super_group_id) long long super_group_id)
{ {
if (NULL == g2g_runtime) { if (NULL == g2g_runtime) {
return -1; return -1;
@@ -406,8 +406,8 @@ int group2group_runtime_add_group_to_group(void *g2g_runtime, uint64_t group_id,
return ret; return ret;
} }
int group2group_runtime_remove_group_from_group(void *g2g_runtime, uint64_t group_id, int group2group_runtime_remove_group_from_group(void *g2g_runtime, long long group_id,
uint64_t super_group_id) long long super_group_id)
{ {
if (NULL == g2g_runtime) { if (NULL == g2g_runtime) {
return -1; return -1;
@@ -560,8 +560,8 @@ int group2group_runtime_build_top_groups(void *g2g_runtime)
free(group->top_group_ids); free(group->top_group_ids);
group->top_group_cnt = top_group_cnt; group->top_group_cnt = top_group_cnt;
group->top_group_ids = ALLOC(uint64_t, group->top_group_cnt); group->top_group_ids = ALLOC(long long, group->top_group_cnt);
memcpy(group->top_group_ids, temp_group_ids, sizeof(uint64_t)*group->top_group_cnt); memcpy(group->top_group_ids, temp_group_ids, sizeof(long long)*group->top_group_cnt);
FREE(temp_group_ids); FREE(temp_group_ids);
} }
@@ -622,8 +622,8 @@ int group2group_runtime_commit(void *g2g_runtime, const char *table_name)
return ret; return ret;
} }
int group2group_runtime_get_top_groups(void *g2g_runtime, uint64_t *group_ids, int group2group_runtime_get_top_groups(void *g2g_runtime, long long *group_ids,
size_t n_group_ids, uint64_t *top_group_ids) size_t n_group_ids, long long *top_group_ids)
{ {
if (NULL == g2g_runtime || NULL == group_ids || 0 == n_group_ids) { if (NULL == g2g_runtime || NULL == group_ids || 0 == n_group_ids) {
return -1; return -1;

View File

@@ -34,8 +34,8 @@ struct interval_schema {
}; };
struct interval_item { struct interval_item {
uint64_t item_id; long long item_id;
uint64_t group_id; long long group_id;
int district_id; int district_id;
int low_bound; int low_bound;
int up_bound; int up_bound;
@@ -276,7 +276,7 @@ void interval_rule_free(struct interval_rule *rule)
} }
int interval_runtime_update_row(struct interval_runtime *interval_rt, char *key, size_t key_len, int interval_runtime_update_row(struct interval_runtime *interval_rt, char *key, size_t key_len,
uint64_t item_id, struct interval_rule *rule, int is_valid) long long item_id, struct interval_rule *rule, int is_valid)
{ {
void *data = NULL; void *data = NULL;
@@ -329,7 +329,7 @@ int interval_runtime_update(void *interval_runtime, void *interval_schema,
return -1; return -1;
} else if (0 == is_valid) { } else if (0 == is_valid) {
//delete //delete
HASH_FIND(hh, interval_rt->item_hash, &item_id, sizeof(uint64_t), item); HASH_FIND(hh, interval_rt->item_hash, &item_id, sizeof(long long), item);
if (NULL == item) { if (NULL == item) {
return -1; return -1;
} }
@@ -345,7 +345,7 @@ int interval_runtime_update(void *interval_runtime, void *interval_schema,
maat_garbage_bagging(interval_rt->ref_garbage_bin, u_para, maat_item_inner_free); maat_garbage_bagging(interval_rt->ref_garbage_bin, u_para, maat_item_inner_free);
} else { } else {
//add //add
HASH_FIND(hh, interval_rt->item_hash, &item_id, sizeof(uint64_t), item); HASH_FIND(hh, interval_rt->item_hash, &item_id, sizeof(long long), item);
if (item) { if (item) {
log_error(interval_rt->logger, MODULE_INTERVAL, log_error(interval_rt->logger, MODULE_INTERVAL,
"interval runtime add item %llu to item_hash failed, already exist", "interval runtime add item %llu to item_hash failed, already exist",
@@ -360,7 +360,7 @@ int interval_runtime_update(void *interval_runtime, void *interval_schema,
u_para = maat_item_inner_new(interval_item->group_id, item_id, interval_item->district_id); u_para = maat_item_inner_new(interval_item->group_id, item_id, interval_item->district_id);
item = maat_item_new(item_id, interval_item->group_id, u_para); item = maat_item_new(item_id, interval_item->group_id, u_para);
HASH_ADD(hh, interval_rt->item_hash, item_id, sizeof(uint64_t), item); HASH_ADD(hh, interval_rt->item_hash, item_id, sizeof(long long), item);
interval_rule = interval_item_to_interval_rule(interval_item, u_para); interval_rule = interval_item_to_interval_rule(interval_item, u_para);
interval_item_free(interval_item); interval_item_free(interval_item);
@@ -373,7 +373,7 @@ int interval_runtime_update(void *interval_runtime, void *interval_schema,
} }
char *key = (char *)&item_id; char *key = (char *)&item_id;
int ret = interval_runtime_update_row(interval_rt, key, sizeof(uint64_t), item_id, interval_rule, is_valid); int ret = interval_runtime_update_row(interval_rt, key, sizeof(long long), item_id, interval_rule, is_valid);
if (ret < 0) { if (ret < 0) {
if (interval_rule != NULL) { if (interval_rule != NULL) {
interval_rule_free(interval_rule); interval_rule_free(interval_rule);
@@ -444,7 +444,7 @@ int interval_runtime_commit(void *interval_runtime, const char *table_name)
} }
int interval_runtime_scan(struct interval_runtime *interval_rt, int thread_id, int interval_runtime_scan(struct interval_runtime *interval_rt, int thread_id,
uint64_t integer, int vtable_id, struct maat_state *state) long long integer, int vtable_id, struct maat_state *state)
{ {
struct interval_result hit_results[MAX_SCANNER_HIT_ITEM_NUM] = {0}; struct interval_result hit_results[MAX_SCANNER_HIT_ITEM_NUM] = {0};
@@ -461,7 +461,7 @@ int interval_runtime_scan(struct interval_runtime *interval_rt, int thread_id,
n_hit_item = MAX_SCANNER_HIT_ITEM_NUM; n_hit_item = MAX_SCANNER_HIT_ITEM_NUM;
} }
uint64_t hit_item_ids[MAX_SCANNER_HIT_ITEM_NUM]; long long hit_item_ids[MAX_SCANNER_HIT_ITEM_NUM];
struct maat_item_inner *item = NULL; struct maat_item_inner *item = NULL;
int real_hit_item_cnt = 0; int real_hit_item_cnt = 0;
int district_id = state->district_id; int district_id = state->district_id;
@@ -493,4 +493,4 @@ void interval_runtime_scan_hit_inc(struct interval_runtime *interval_rt, int thr
long long interval_runtime_scan_hit_sum(struct interval_runtime *interval_rt, int n_thread) long long interval_runtime_scan_hit_sum(struct interval_runtime *interval_rt, int n_thread)
{ {
return alignment_int64_array_sum(interval_rt->hit_cnt, n_thread); return alignment_int64_array_sum(interval_rt->hit_cnt, n_thread);
} }

View File

@@ -45,8 +45,8 @@ struct ipv6_item_rule {
}; };
struct ip_item { struct ip_item {
uint64_t item_id; long long item_id;
uint64_t group_id; long long group_id;
int addr_type; int addr_type;
union { union {
struct ipv4_item_rule ipv4; struct ipv4_item_rule ipv4;
@@ -375,7 +375,7 @@ int ip_runtime_update(void *ip_runtime, void *ip_schema,
return -1; return -1;
} else if (0 == is_valid) { } else if (0 == is_valid) {
//delete //delete
HASH_FIND(hh, ip_rt->item_hash, &item_id, sizeof(uint64_t), item); HASH_FIND(hh, ip_rt->item_hash, &item_id, sizeof(long long), item);
if (NULL == item) { if (NULL == item) {
return -1; return -1;
} }
@@ -392,7 +392,7 @@ int ip_runtime_update(void *ip_runtime, void *ip_schema,
(void (*)(void *))maat_item_inner_free); (void (*)(void *))maat_item_inner_free);
} else { } else {
//add //add
HASH_FIND(hh, ip_rt->item_hash, &item_id, sizeof(uint64_t), item); HASH_FIND(hh, ip_rt->item_hash, &item_id, sizeof(long long), item);
if (item) { if (item) {
log_error(ip_rt->logger, MODULE_IP, log_error(ip_rt->logger, MODULE_IP,
"ip runtime add item %llu to item_hash failed, already exist", "ip runtime add item %llu to item_hash failed, already exist",
@@ -407,11 +407,11 @@ int ip_runtime_update(void *ip_runtime, void *ip_schema,
u_para = maat_item_inner_new(ip_item->group_id, item_id, 0); u_para = maat_item_inner_new(ip_item->group_id, item_id, 0);
item = maat_item_new(item_id, ip_item->group_id, u_para); item = maat_item_new(item_id, ip_item->group_id, u_para);
HASH_ADD(hh, ip_rt->item_hash, item_id, sizeof(uint64_t), item); HASH_ADD(hh, ip_rt->item_hash, item_id, sizeof(long long), item);
} }
char *key = (char *)&item_id; char *key = (char *)&item_id;
int ret = ip_runtime_update_row(ip_rt, key, sizeof(uint64_t), ip_item, is_valid); int ret = ip_runtime_update_row(ip_rt, key, sizeof(long long), ip_item, is_valid);
if (ret < 0) { if (ret < 0) {
if (ip_item != NULL) { if (ip_item != NULL) {
ip_item_free(ip_item); ip_item_free(ip_item);
@@ -510,7 +510,7 @@ int ip_runtime_scan(struct ip_runtime *ip_rt, int thread_id, int ip_type,
n_hit_item = MAX_SCANNER_HIT_ITEM_NUM; n_hit_item = MAX_SCANNER_HIT_ITEM_NUM;
} }
uint64_t hit_item_ids[MAX_SCANNER_HIT_ITEM_NUM]; long long hit_item_ids[MAX_SCANNER_HIT_ITEM_NUM];
memset(hit_item_ids, 0, sizeof(hit_item_ids)); memset(hit_item_ids, 0, sizeof(hit_item_ids));
for (int i = 0; i < n_hit_item; i++) { for (int i = 0; i < n_hit_item; i++) {
@@ -535,4 +535,4 @@ void ip_runtime_scan_hit_inc(struct ip_runtime *ip_rt, int thread_id)
long long ip_runtime_scan_hit_sum(struct ip_runtime *ip_rt, int n_thread) long long ip_runtime_scan_hit_sum(struct ip_runtime *ip_rt, int n_thread)
{ {
return alignment_int64_array_sum(ip_rt->hit_cnt, n_thread); return alignment_int64_array_sum(ip_rt->hit_cnt, n_thread);
} }

View File

@@ -33,7 +33,7 @@ struct ipv6_item_rule {
}; };
struct ip_plugin_item { struct ip_plugin_item {
uint64_t item_id; long long item_id;
int ip_type; int ip_type;
union { union {
struct ipv4_item_rule ipv4; struct ipv4_item_rule ipv4;
@@ -440,7 +440,7 @@ int ip_plugin_runtime_update(void *ip_plugin_runtime, void *ip_plugin_schema,
} }
char *key = (char *)&item_id; char *key = (char *)&item_id;
int ret = ip_plugin_runtime_update_row(ip_plugin_rt, line, key, sizeof(uint64_t), int ret = ip_plugin_runtime_update_row(ip_plugin_rt, line, key, sizeof(long long),
ip_plugin_item, is_valid); ip_plugin_item, is_valid);
if (ret < 0) { if (ret < 0) {
if (ip_plugin_item != NULL) { if (ip_plugin_item != NULL) {

View File

@@ -28,7 +28,7 @@ struct plugin_callback_schema {
}; };
struct plugin_runtime { struct plugin_runtime {
uint64_t acc_line_num; long long acc_line_num;
struct ex_data_runtime *ex_data_rt; struct ex_data_runtime *ex_data_rt;
uint32_t rule_num; uint32_t rule_num;
@@ -364,7 +364,7 @@ int plugin_runtime_update(void *plugin_runtime, void *plugin_schema,
long long item_id = get_column_value(line, schema->key_column); long long item_id = get_column_value(line, schema->key_column);
char *key = (char *)&item_id; char *key = (char *)&item_id;
ret = plugin_runtime_update_row(plugin_rt, schema, line, key, sizeof(uint64_t), is_valid); ret = plugin_runtime_update_row(plugin_rt, schema, line, key, sizeof(long long), is_valid);
if (ret < 0) { if (ret < 0) {
schema->update_err_cnt++; schema->update_err_cnt++;
return -1; return -1;
@@ -435,6 +435,6 @@ void *plugin_runtime_get_ex_data(void *plugin_runtime, void *plugin_schema, cons
if (NULL == schema->ex_schema) { if (NULL == schema->ex_schema) {
return NULL; return NULL;
} }
return ex_data_runtime_get_ex_data_by_key(plugin_rt->ex_data_rt, key, strlen(key)); return ex_data_runtime_get_ex_data_by_key(plugin_rt->ex_data_rt, key, strlen(key));
} }

View File

@@ -1,5 +1,4 @@
/* /**********************************************************************************************
**********************************************************************************************
* File: maat_rule.cpp * File: maat_rule.cpp
* Description: * Description:
* Authors: Liu WenTan <liuwentan@geedgenetworks.com> * Authors: Liu WenTan <liuwentan@geedgenetworks.com>
@@ -32,7 +31,7 @@
#define MODULE_MAAT_RULE module_name_str("maat.rule") #define MODULE_MAAT_RULE module_name_str("maat.rule")
struct maat_item *maat_item_new(uint64_t item_id, uint64_t group_id, void *user_data) struct maat_item *maat_item_new(long long item_id, long long group_id, void *user_data)
{ {
struct maat_item *item = NULL; struct maat_item *item = NULL;
item = ALLOC(struct maat_item, 1); item = ALLOC(struct maat_item, 1);
@@ -206,7 +205,7 @@ error:
return ret; return ret;
} }
struct maat_item_inner *maat_item_inner_new(uint64_t group_id, uint64_t item_id, int district_id) struct maat_item_inner *maat_item_inner_new(long long group_id, long long item_id, int district_id)
{ {
struct maat_item_inner *item = ALLOC(struct maat_item_inner, 1); struct maat_item_inner *item = ALLOC(struct maat_item_inner, 1);
item->magic_num = ITEM_RULE_MAGIC; item->magic_num = ITEM_RULE_MAGIC;
@@ -524,4 +523,4 @@ void *rule_monitor_loop(void *arg)
FREE(maat_instance); FREE(maat_instance);
return NULL; return NULL;
} }

View File

@@ -39,8 +39,8 @@ TEST_F(MaatFlagScan, basic) {
int flag_table_id = maat_table_get_id(g_maat_instance, flag_table_name); int flag_table_id = maat_table_get_id(g_maat_instance, flag_table_name);
//compile_id:192 flag: 0000 0001 mask: 0000 0011 //compile_id:192 flag: 0000 0001 mask: 0000 0011
//scan_data: 0000 1001 or 0000 1101 should hit //scan_data: 0000 1001 or 0000 1101 should hit
uint64_t scan_data = 9; long long scan_data = 9;
uint64_t results[ARRAY_SIZE] = {0}; long long results[ARRAY_SIZE] = {0};
size_t n_hit_result = 0; size_t n_hit_result = 0;
struct maat_state *state = NULL; struct maat_state *state = NULL;
int ret = maat_scan_flag(g_maat_instance, flag_table_id, 0, scan_data, results, int ret = maat_scan_flag(g_maat_instance, flag_table_id, 0, scan_data, results,
@@ -82,8 +82,8 @@ TEST_F(MaatFlagScan, withExprRegion) {
int expr_table_id = maat_table_get_id(g_maat_instance, expr_table_name); int expr_table_id = maat_table_get_id(g_maat_instance, expr_table_name);
//compile_id:193 flag: 0000 0010 mask: 0000 0011 //compile_id:193 flag: 0000 0010 mask: 0000 0011
//scan_data: 0000 0010 or 0000 0100 should hit //scan_data: 0000 0010 or 0000 0100 should hit
uint64_t flag_scan_data = 2; long long flag_scan_data = 2;
uint64_t results[ARRAY_SIZE] = {0}; long long results[ARRAY_SIZE] = {0};
size_t n_hit_result = 0; size_t n_hit_result = 0;
struct maat_state *state = NULL; struct maat_state *state = NULL;
@@ -113,8 +113,8 @@ TEST_F(MaatFlagScan, hitMultiCompile) {
//compile_id:192 flag: 0000 0001 mask: 0000 0011 //compile_id:192 flag: 0000 0001 mask: 0000 0011
//compile_id:194 flag: 0001 0101 mask: 0001 1111 //compile_id:194 flag: 0001 0101 mask: 0001 1111
//scan_data: 0001 0101 should hit compile192 and compile194 //scan_data: 0001 0101 should hit compile192 and compile194
uint64_t flag_scan_data = 21; long long flag_scan_data = 21;
uint64_t results[ARRAY_SIZE] = {0}; long long results[ARRAY_SIZE] = {0};
size_t n_hit_result = 0; size_t n_hit_result = 0;
struct maat_state *state = NULL; struct maat_state *state = NULL;
@@ -148,7 +148,7 @@ TEST_F(MaatStringScan, Expr8) {
const char *table_name = "KEYWORDS_TABLE"; const char *table_name = "KEYWORDS_TABLE";
int table_id = maat_table_get_id(g_maat_instance, table_name); int table_id = maat_table_get_id(g_maat_instance, table_name);
char scan_data[128] = "string1, string2, string3, string4, string5, string6, string7, string8"; char scan_data[128] = "string1, string2, string3, string4, string5, string6, string7, string8";
uint64_t results[ARRAY_SIZE] = {0}; long long results[ARRAY_SIZE] = {0};
size_t n_hit_result = 0; size_t n_hit_result = 0;
struct maat_state *state = NULL; struct maat_state *state = NULL;
int ret = maat_scan_string(g_maat_instance, table_id, 0, scan_data, strlen(scan_data), int ret = maat_scan_string(g_maat_instance, table_id, 0, scan_data, strlen(scan_data),
@@ -166,7 +166,7 @@ TEST_F(MaatStringScan, Expr8) {
TEST_F(MaatStringScan, Regex) { TEST_F(MaatStringScan, Regex) {
int ret = 0; int ret = 0;
uint64_t results[ARRAY_SIZE] = {0}; long long results[ARRAY_SIZE] = {0};
size_t n_hit_result = 0; size_t n_hit_result = 0;
struct maat_state *state = NULL; struct maat_state *state = NULL;
const char *cookie = "Cookie: Txa123aheadBCAxd"; const char *cookie = "Cookie: Txa123aheadBCAxd";
@@ -203,7 +203,7 @@ TEST_F(MaatStringScan, Regex) {
} }
TEST_F(MaatStringScan, ExprPlus) { TEST_F(MaatStringScan, ExprPlus) {
uint64_t results[ARRAY_SIZE] = {0}; long long results[ARRAY_SIZE] = {0};
size_t n_hit_result = 0; size_t n_hit_result = 0;
struct maat_state *state = NULL; struct maat_state *state = NULL;
const char *region_name1 ="HTTP URL"; const char *region_name1 ="HTTP URL";
@@ -237,7 +237,7 @@ TEST_F(MaatStringScan, ExprPlus) {
//TODO: //TODO:
#if 0 #if 0
TEST_F(MaatStringScan, ShouldNotHitExprPlus) { TEST_F(MaatStringScan, ShouldNotHitExprPlus) {
uint64_t results[ARRAY] = {0}; long long results[ARRAY] = {0};
size_t n_hit_result = 0; size_t n_hit_result = 0;
struct maat_state *state = NULL; struct maat_state *state = NULL;
const char *region_name = "tcp.payload"; const char *region_name = "tcp.payload";
@@ -268,7 +268,7 @@ TEST_F(MaatStringScan, ShouldNotHitExprPlus) {
} }
TEST_F(MaatStringScan, ExprPlusWithHex) { TEST_F(MaatStringScan, ExprPlusWithHex) {
uint64_t results[ARRAY_SIZE] = {0}; long long results[ARRAY_SIZE] = {0};
size_t n_hit_result = 0; size_t n_hit_result = 0;
struct maat_state *state = NULL; struct maat_state *state = NULL;
const char *scan_data1 = "text/html; charset=UTF-8"; const char *scan_data1 = "text/html; charset=UTF-8";
@@ -302,7 +302,7 @@ TEST_F(MaatStringScan, ExprPlusWithHex) {
TEST_F(MaatStringScan, ExprPlusWithOffset) TEST_F(MaatStringScan, ExprPlusWithOffset)
{ {
uint64_t results[ARRAY_SIZE] = {0}; long long results[ARRAY_SIZE] = {0};
size_t n_hit_result = 0; size_t n_hit_result = 0;
struct maat_state *state = NULL; struct maat_state *state = NULL;
const char *region_name = "Payload"; const char *region_name = "Payload";
@@ -355,7 +355,7 @@ TEST_F(MaatStringScan, dynamic_config) {
const char *table_name = "HTTP_URL_LITERAL"; const char *table_name = "HTTP_URL_LITERAL";
int table_id = maat_table_get_id(g_maat_instance, table_name); int table_id = maat_table_get_id(g_maat_instance, table_name);
char data[128] = "hello world"; char data[128] = "hello world";
uint64_t results[ARRAY_SIZE] = {0}; long long results[ARRAY_SIZE] = {0};
size_t n_hit_result = 0; size_t n_hit_result = 0;
struct maat_state *state = NULL; struct maat_state *state = NULL;
int ret = maat_scan_string(g_maat_instance, table_id, 0, data, strlen(data), results, int ret = maat_scan_string(g_maat_instance, table_id, 0, data, strlen(data), results,
@@ -458,7 +458,7 @@ TEST_F(MaatIPScan, IPv4) {
int ret = inet_pton(AF_INET, ip_str, &sip); int ret = inet_pton(AF_INET, ip_str, &sip);
EXPECT_EQ(ret, 1); EXPECT_EQ(ret, 1);
uint64_t results[ARRAY_SIZE] = {0}; long long results[ARRAY_SIZE] = {0};
size_t n_hit_result = 0; size_t n_hit_result = 0;
struct maat_state *state = NULL; struct maat_state *state = NULL;
ret = maat_scan_ipv4(g_maat_instance, table_id, 0, sip, results, ARRAY_SIZE, ret = maat_scan_ipv4(g_maat_instance, table_id, 0, sip, results, ARRAY_SIZE,
@@ -478,7 +478,7 @@ TEST_F(MaatIPScan, IPv6) {
int ret = inet_pton(AF_INET6, ip_str, &sip); int ret = inet_pton(AF_INET6, ip_str, &sip);
EXPECT_EQ(ret, 1); EXPECT_EQ(ret, 1);
uint64_t results[ARRAY_SIZE] = {0}; long long results[ARRAY_SIZE] = {0};
size_t n_hit_result = 0; size_t n_hit_result = 0;
struct maat_state *state = NULL; struct maat_state *state = NULL;
ret = maat_scan_ipv6(g_maat_instance, table_id, 0, sip, results, ARRAY_SIZE, ret = maat_scan_ipv6(g_maat_instance, table_id, 0, sip, results, ARRAY_SIZE,
@@ -498,7 +498,7 @@ TEST_F(MaatIPScan, dynamic_config) {
int ret = inet_pton(AF_INET, ip_str, &sip); int ret = inet_pton(AF_INET, ip_str, &sip);
EXPECT_EQ(ret, 1); EXPECT_EQ(ret, 1);
uint64_t results[ARRAY_SIZE] = {0}; long long results[ARRAY_SIZE] = {0};
size_t n_hit_result = 0; size_t n_hit_result = 0;
struct maat_state *state = NULL; struct maat_state *state = NULL;
ret = maat_scan_ipv4(g_maat_instance, table_id, 0, sip, results, ARRAY_SIZE, ret = maat_scan_ipv4(g_maat_instance, table_id, 0, sip, results, ARRAY_SIZE,
@@ -588,7 +588,7 @@ protected:
}; };
TEST_F(MaatIntervalScan, Pure) { TEST_F(MaatIntervalScan, Pure) {
uint64_t results[ARRAY_SIZE] = {0}; long long results[ARRAY_SIZE] = {0};
size_t n_hit_result = 0; size_t n_hit_result = 0;
struct maat_state *state = NULL; struct maat_state *state = NULL;
const char *table_name = "CONTENT_SIZE"; const char *table_name = "CONTENT_SIZE";
@@ -609,7 +609,7 @@ TEST_F(MaatIntervalScan, Pure) {
} }
TEST_F(MaatIntervalScan, IntervalPlus) { TEST_F(MaatIntervalScan, IntervalPlus) {
uint64_t results[ARRAY_SIZE] = {0}; long long results[ARRAY_SIZE] = {0};
size_t n_hit_result = 0; size_t n_hit_result = 0;
struct maat_state *state = NULL; struct maat_state *state = NULL;
const char *table_name = "INTERGER_PLUS"; const char *table_name = "INTERGER_PLUS";
@@ -644,7 +644,7 @@ TEST_F(NOTLogic, ScanNotAtLast) {
const char *string_should_hit = "This string ONLY contains must-contained-string-of-rule-144."; const char *string_should_hit = "This string ONLY contains must-contained-string-of-rule-144.";
const char *string_should_not_hit = "This string contains both must-contained-string-of-rule-144 and must-not-contained-string-of-rule-144."; const char *string_should_not_hit = "This string contains both must-contained-string-of-rule-144 and must-not-contained-string-of-rule-144.";
uint64_t results[ARRAY_SIZE] = {0}; long long results[ARRAY_SIZE] = {0};
size_t n_hit_result = 0; size_t n_hit_result = 0;
struct maat_state *state = NULL; struct maat_state *state = NULL;
const char *hit_table_name = "HTTP_URL_LITERAL"; const char *hit_table_name = "HTTP_URL_LITERAL";
@@ -740,7 +740,7 @@ protected:
}; };
struct ip_plugin_ud { struct ip_plugin_ud {
uint64_t rule_id; long long rule_id;
char *buffer; char *buffer;
int ref_cnt; int ref_cnt;
}; };
@@ -848,7 +848,7 @@ protected:
}; };
TEST_F(VirtualTable, basic) { TEST_F(VirtualTable, basic) {
uint64_t results[ARRAY_SIZE] = {0}; long long results[ARRAY_SIZE] = {0};
size_t n_hit_result = 0; size_t n_hit_result = 0;
struct maat_state *state = NULL; struct maat_state *state = NULL;
const char *table_name = "HTTP_RESPONSE_KEYWORDS"; const char *table_name = "HTTP_RESPONSE_KEYWORDS";
@@ -925,7 +925,7 @@ void compile_ex_param_dup(int idx, void **to, void **from, long argl, void *argp
} }
TEST_F(CompileTable, CompileEXData) { TEST_F(CompileTable, CompileEXData) {
uint64_t results[ARRAY_SIZE] = {0}; long long results[ARRAY_SIZE] = {0};
size_t n_hit_result = 0; size_t n_hit_result = 0;
struct maat_state *state = NULL; struct maat_state *state = NULL;
const char *url = "i.ytimg.com/vi/OtCNcustg_I/hqdefault.jpg?sqp=-oaymwEZCNACELwBSFXyq4qpAwsIARUAAIhCGAFwAQ==&rs=AOn4CLDOp_5fHMaCA9XZuJdCRv4DNDorMg"; const char *url = "i.ytimg.com/vi/OtCNcustg_I/hqdefault.jpg?sqp=-oaymwEZCNACELwBSFXyq4qpAwsIARUAAIhCGAFwAQ==&rs=AOn4CLDOp_5fHMaCA9XZuJdCRv4DNDorMg";

View File

@@ -39,7 +39,7 @@ TEST(json_mode, maat_scan_string) {
const char *table_name = "KEYWORDS_TABLE"; const char *table_name = "KEYWORDS_TABLE";
int table_id = maat_table_get_id(maat_instance, table_name); int table_id = maat_table_get_id(maat_instance, table_name);
char scan_data[128] = "string1, string2, string3, string4, string5, string6, string7, string8"; char scan_data[128] = "string1, string2, string3, string4, string5, string6, string7, string8";
uint64_t results[5] = {0}; long long results[5] = {0};
size_t n_hit_result = 0; size_t n_hit_result = 0;
struct maat_state *state = NULL; struct maat_state *state = NULL;
int ret = maat_scan_string(maat_instance, table_id, 0, scan_data, strlen(scan_data), int ret = maat_scan_string(maat_instance, table_id, 0, scan_data, strlen(scan_data),
@@ -84,7 +84,7 @@ TEST(iris_mode, maat_scan_string) {
const char *table_name = "KEYWORDS_TABLE"; const char *table_name = "KEYWORDS_TABLE";
int table_id = maat_table_get_id(maat_instance, table_name); int table_id = maat_table_get_id(maat_instance, table_name);
char scan_data[128] = "string1, string2, string3, string4, string5, string6, string7, string8"; char scan_data[128] = "string1, string2, string3, string4, string5, string6, string7, string8";
uint64_t results[5] = {0}; long long results[5] = {0};
size_t n_hit_result = 0; size_t n_hit_result = 0;
struct maat_state *state = NULL; struct maat_state *state = NULL;
int ret = maat_scan_string(maat_instance, table_id, 0, scan_data, strlen(scan_data), int ret = maat_scan_string(maat_instance, table_id, 0, scan_data, strlen(scan_data),
@@ -206,7 +206,7 @@ TEST(redis_mode, maat_scan_string) {
const char *table_name = "KEYWORDS_TABLE"; const char *table_name = "KEYWORDS_TABLE";
int table_id = maat_table_get_id(maat_instance, table_name); int table_id = maat_table_get_id(maat_instance, table_name);
char scan_data[128] = "string1, string2, string3, string4, string5, string6, string7, string8"; char scan_data[128] = "string1, string2, string3, string4, string5, string6, string7, string8";
uint64_t results[5] = {0}; long long results[5] = {0};
size_t n_hit_result = 0; size_t n_hit_result = 0;
struct maat_state *state = NULL; struct maat_state *state = NULL;
int ret = maat_scan_string(maat_instance, table_id, 0, scan_data, strlen(scan_data), int ret = maat_scan_string(maat_instance, table_id, 0, scan_data, strlen(scan_data),