Stash for source insight

This commit is contained in:
Zheng Chao
2022-10-26 10:25:16 +08:00
parent e5c9d7a2a0
commit 18ece0b026
3 changed files with 59 additions and 25 deletions

View File

@@ -16,14 +16,23 @@ struct hs_pattern
struct hs_expression
{
void *user_tag;
enum MAAT_EXPR_TYPE type;
size_t n_sub_pattern;
void * user_tag;
int is_regex; //if is_regex==1, then n_sub_pattern must be 1
size_t n_sub_pattern; //must not exceed HSA_MAX_SUB_STRING_NUM
struct hs_pattern sub_patterns[];
};
struct hs_adapter;
#define HSA_SCAN_MODE_BLOCK 0
#define HSA_SCAN_MODE_STREAM 1
/**
* @param scan_mode
* HSA_SCAN_MODE_BLOCK or HSA_SCAN_MODE_STREAM
* @param exprs
* Expressions to match, it's life time must be longger than the hs_adapter.
*/
struct hs_adapter *hs_adapter_new(const struct hs_expression ** exprs, size_t n_expr, int scan_mode, int n_thread);
void hs_adpter_free(struct hs_adapter *adapter);
void hs_adapter_free(struct hs_adapter *adapter);
int hs_adapter_scan(struct hs_adapter *adapter, int thread_id, const char* data, unsigned int length, void **matched_tags, size_t n_tag);