使用quickon/quickoff代替1/0作为快速扫描的开关。

This commit is contained in:
zhengchao
2016-06-17 15:00:28 +08:00
parent cd38bc4501
commit 26f9b8f6b0
3 changed files with 43 additions and 7 deletions

View File

@@ -405,11 +405,10 @@ int read_table_info(struct _Maat_table_info_t** p_table_info,int num,const char*
FILE*fp=NULL;
char line[MAX_TABLE_LINE_SIZE];
int i=0,j=0,ret[4]={0},table_cnt=0;
char table_type[16],src_charset[256],dst_charset[256],merge[4];
char table_type[16],src_charset[256],dst_charset[256],merge[4],quick_str_scan[32]={0};
MESA_htable_handle string2int_map=map_create();
char *token=NULL,*sub_token=NULL,*saveptr;
struct _Maat_table_info_t*p=NULL;
map_register(string2int_map,"expr", TABLE_TYPE_EXPR);
map_register(string2int_map,"ip", TABLE_TYPE_IP);
map_register(string2int_map,"compile", TABLE_TYPE_COMPILE);
@@ -418,6 +417,8 @@ int read_table_info(struct _Maat_table_info_t** p_table_info,int num,const char*
map_register(string2int_map,"digest", TABLE_TYPE_DIGEST);
map_register(string2int_map,"expr_plus", TABLE_TYPE_EXPR_PLUS);
map_register(string2int_map,"group", TABLE_TYPE_GROUP);
map_register(string2int_map,"quickoff",0);
map_register(string2int_map,"quickon",1);
for(i=0;i<MAX_CHARSET_NUM;i++)
{
if(strlen(CHARSET_STRING[i])>0)
@@ -459,18 +460,22 @@ int read_table_info(struct _Maat_table_info_t** p_table_info,int num,const char*
}
p=create_table_info(max_thread_num);
sscanf(line,"%hu\t%s\t%s\t%s\t%s\t%s\t%d\t%d",&(p->table_id)
sscanf(line,"%hu\t%s\t%s\t%s\t%s\t%s\t%d\t%s",&(p->table_id)
,p->table_name
,table_type
,src_charset
,dst_charset
,merge
,&(p->cross_cache_size)
,&(p->quick_expr_switch));
,quick_str_scan);
ret[0]=map_str2int(string2int_map,strlwr(table_type),(int*)&(p->table_type));
ret[1]=map_str2int(string2int_map,strlwr(src_charset),(int*)&(p->src_charset));
ret[2]=map_str2int(string2int_map,strlwr(merge),&(p->do_charset_merge));
for(j=0;j<3;j++)
if(strlen(quick_str_scan)>0)
{
ret[3]=map_str2int(string2int_map,strlwr(quick_str_scan),&(p->quick_expr_switch));
}
for(j=0;j<4;j++)
{
if(ret[j]<0)
{
@@ -2435,6 +2440,10 @@ void do_scanner_update(struct _Maat_scanner_t* scanner,MESA_lqueue_head garbage_
logger);
for(i=0;i<MAX_TABLE_NUM;i++)
{
if(scanner->digest_update_q[i]==NULL)
{
continue;
}
q_cnt=MESA_lqueue_get_count(scanner->digest_update_q[i]);
if(q_cnt==0)
{

View File

@@ -1,8 +1,35 @@
Load entry id 101 SUCCESS.
hit 1 rules
hit current region,but not hit compile rule.
ipv4 scan hit compile rule id 123.
hit current region,but not hit compile rule.
ipv6 scan hit region.
digest scan hit 127.
digest scan hit 127.
digest scan hit 127.
digest scan hit 127.
digest scan hit 127.
digest scan hit 127.
Hit expr_plus rule 128.
URL encode scan utf8 url hit 1 rules, hit ruleid=129
URL encode scan gb2312 url hit 1 rules, hit ruleid=129
test_unicode_esc processing ./testdata_uni2ascii/original_Uygur_webpage.html
UNI2ASCII file ./testdata_uni2ascii/original_Uygur_webpage.html,hit 2 rules, hit ruleid=130 131
UNI2ASCII file ./testdata_uni2ascii/original_Uygur_webpage.html,hit 1 rules, hit ruleid=131
UNI2ASCII file ./testdata_uni2ascii/original_Uygur_webpage.html,hit 1 rules, hit ruleid=131
UNI2ASCII file ./testdata_uni2ascii/original_Uygur_webpage.html,hit 1 rules, hit ruleid=131
UNI2ASCII file ./testdata_uni2ascii/original_Uygur_webpage.html,hit 1 rules, hit ruleid=131
UNI2ASCII file ./testdata_uni2ascii/original_Uygur_webpage.html,hit 1 rules, hit ruleid=131
UNI2ASCII file ./testdata_uni2ascii/original_Uygur_webpage.html,hit 1 rules, hit ruleid=131
UNI2ASCII file ./testdata_uni2ascii/original_Uygur_webpage.html,hit 1 rules, hit ruleid=131
UNI2ASCII file ./testdata_uni2ascii/original_Uygur_webpage.html,hit 1 rules, hit ruleid=131
UNI2ASCII file ./testdata_uni2ascii/original_Uygur_webpage.html,hit 1 rules, hit ruleid=131
test_unicode_esc processing ./testdata_uni2ascii/original_uy.txt
UNI2ASCII file ./testdata_uni2ascii/original_uy.txt,hit 2 rules, hit ruleid=130 131
test_unicode_esc processing ./testdata_uni2ascii/qq_mail_https.txt
UNI2ASCII file ./testdata_uni2ascii/qq_mail_https.txt,hit 2 rules, hit ruleid=130 131
UNI2ASCII file ./testdata_uni2ascii/qq_mail_https.txt,hit 1 rules, hit ruleid=130
test_unicode_esc processing ./testdata_uni2ascii/sina_read_mail.txt
UNI2ASCII file ./testdata_uni2ascii/sina_read_mail.txt,hit 2 rules, hit ruleid=130 131
test_unicode_esc processing ./testdata_uni2ascii/sohu_mail_unicode.txt
UNI2ASCII file ./testdata_uni2ascii/sohu_mail_unicode.txt,hit 2 rules, hit ruleid=130 131
UNI2ASCII file ./testdata_uni2ascii/sohu_mail_unicode.txt,hit 2 rules, hit ruleid=130 131

View File

@@ -8,7 +8,7 @@
#id name type src_charset dst_charset do_merge
0 COMPILE compile GBK GBK no 0
1 GROUP group GBK GBK no 0
2 HTTP_URL expr UTF8 GBK/BIG5/UNICODE/UTF8/url_encode_gb2312/url_encode_utf8 yes 128
2 HTTP_URL expr UTF8 GBK/BIG5/UNICODE/UTF8/url_encode_gb2312/url_encode_utf8 yes 128 quickon
3 KEYWORDS_TABLE expr UTF8 GBK/BIG5/UNICODE/UTF8/unicode_ascii_esc/unicode_ascii_aligned/unicode_ncr_dec/unicode_ncr_hex yes 0
4 IP_CONFIG ip GBK GBK no 0
5 CONTENT_SIZE intval GBK GBK no 0