fix flag_matcher and interval_matcher compile error

This commit is contained in:
liuwentan
2023-02-07 11:25:31 +08:00
parent 4d2f783874
commit c1902f8deb
27 changed files with 1275 additions and 295 deletions

View File

@@ -42,13 +42,14 @@ int expr_runtime_commit(void *expr_runtime);
* @retval the num of hit group_id
*/
int expr_runtime_scan_string(struct expr_runtime *expr_rt, int thread_id,
const char *data, size_t data_len,
const char *data, size_t data_len,
int *group_ids, size_t group_ids_size,
int vtable_id, struct maat_state *state);
int vtable_ids, struct maat_state *state);
void expr_runtime_stream_open(struct expr_runtime *expr_rt, int thread_id);
int expr_runtime_scan_stream(struct expr_runtime *expr_rt, const char *data,
size_t data_len, int result[], size_t *n_result);
int expr_runtime_scan_stream(struct expr_runtime *expr_rt, const char *data,
size_t data_len, int *group_ids, size_t group_ids_size,
int vtable_id, struct maat_state *state);
void expr_runtime_stream_close(struct expr_runtime *expr_rt);
void expr_runtime_scan_hit_inc(struct expr_runtime *expr_rt, int thread_id);

View File

@@ -16,6 +16,8 @@ extern "C"
{
#endif
#include <stdint.h>
#include "log/log.h"
#include "cJSON/cJSON.h"
@@ -42,9 +44,8 @@ int flag_runtime_commit(void *flag_runtime);
* @retval the num of hit group_id
*/
int flag_runtime_scan_flag(struct flag_runtime *flag_rt, int thread_id,
const char *data, size_t data_len,
int *group_ids, size_t group_ids_size,
int vtable_id, struct maat_state *state);
uint64_t flag, int *group_ids, size_t group_ids_size,
int vtable_id, struct maat_state *state);
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);

View File

@@ -0,0 +1,57 @@
/*
**********************************************************************************************
* File: maat_interval.h
* Description:
* Authors: Liu WenTan <liuwentan@geedgenetworks.com>
* Date: 2022-10-31
* Copyright: (c) 2018-2022 Geedge Networks, Inc. All rights reserved.
***********************************************************************************************
*/
#ifndef _MAAT_INTERVAL_H_
#define _MAAT_INTERVAL_H_
#ifdef __cpluscplus
extern "C"
{
#endif
#include <stdint.h>
#include "log/log.h"
#include "cJSON/cJSON.h"
struct interval_runtime;
void *interval_schema_new(cJSON *json, struct table_manager *tbl_mgr,
const char *table_name, struct log_handle *logger);
void interval_schema_free(void *interval_schema);
/* interval runtime API */
void *interval_runtime_new(void *interval_schema, int max_thread_num,
struct maat_garbage_bin *garbage_bin,
struct log_handle *logger);
void interval_runtime_free(void *interval_runtime);
int interval_runtime_update(void *interval_runtime, void *interval_schema,
const char *line, int valid_column);
int interval_runtime_commit(void *interval_runtime);
/* interval runtime scan API */
/**
* @brief scan intval to get hit group_ids
*
* @retval the num of hit group_id
*/
int interval_runtime_scan_intval(struct interval_runtime *interval_rt, int thread_id,
uint64_t integer, int *group_ids, size_t group_ids_size,
int vtable_id, struct maat_state *state);
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);
#ifdef __cpluscplus
}
#endif
#endif

View File

@@ -1,56 +0,0 @@
/*
**********************************************************************************************
* File: maat_intval.h
* Description:
* Authors: Liu WenTan <liuwentan@geedgenetworks.com>
* Date: 2022-10-31
* Copyright: (c) 2018-2022 Geedge Networks, Inc. All rights reserved.
***********************************************************************************************
*/
#ifndef _MAAT_INTVAL_H_
#define _MAAT_INTVAL_H_
#ifdef __cpluscplus
extern "C"
{
#endif
#include "log/log.h"
#include "cJSON/cJSON.h"
struct intval_runtime;
void *intval_schema_new(cJSON *json, struct table_manager *tbl_mgr,
const char *table_name, struct log_handle *logger);
void _schema_free(void *intval_schema);
/* intval runtime API */
void *intval_runtime_new(void *intval_schema, int max_thread_num,
struct maat_garbage_bin *garbage_bin,
struct log_handle *logger);
void intval_runtime_free(void *intval_runtime);
int intval_runtime_update(void *intval_runtime, void *intval_schema,
const char *line, int valid_column);
int intval_runtime_commit(void *intval_runtime);
/* intval runtime scan API */
/**
* @brief scan intval to get hit group_ids
*
* @retval the num of hit group_id
*/
int intval_runtime_scan_intval(struct intval_runtime *intval_rt, int thread_id,
const char *data, size_t data_len,
int *group_ids, size_t group_ids_size,
int vtable_id, struct maat_state *state);
void intval_runtime_scan_hit_inc(struct intval_runtime *intval_rt, int thread_id);
long long intval_runtime_scan_hit_sum(struct intval_runtime *intval_rt, int n_thread);
#ifdef __cpluscplus
}
#endif
#endif

View File

@@ -31,6 +31,7 @@ extern "C"
#include "IPMatcher.h"
#include "maat_kv.h"
#include "maat_table.h"
#include "maat_virtual.h"
#define MAX_TABLE_NUM 256
@@ -38,6 +39,11 @@ extern "C"
#define MAAT_UPDATE_TYPE_FULL 1
#define MAAT_UPDATE_TYPE_INC 2
#define DISTRICT_ANY -1
#define DISTRICT_UNKNOWN -2
#define MAX_DISTRICT_STR 128
enum last_scan_flag {
LAST_SCAN_UNSET,
LAST_SCAN_SET,
@@ -253,6 +259,7 @@ struct maat_state {
struct maat_compile_state *compile_state;
};
enum scan_type maat_table_get_scan_type(enum table_type table_type);
size_t parse_accept_tag(const char *value, struct rule_tag **result, struct log_handle *logger);

View File

@@ -67,6 +67,7 @@ int table_manager_accept_tags_match(struct table_manager *tbl_mgr, const char *t
int table_manager_set_scan_district(struct table_manager *tbl_mgr, const char *district_str,
size_t district_str_len, int *district_id);
int table_manager_get_district_id(struct table_manager *tbl_mgr, const char *district);
void *table_manager_get_schema(struct table_manager *tbl_mgr, int table_id);
void *table_manager_get_runtime(struct table_manager *tbl_mgr, int table_id);

View File

@@ -26,6 +26,7 @@ enum scan_type {
SCAN_TYPE_IP,
SCAN_TYPE_INTERVAL,
SCAN_TYPE_STRING,
SCAN_TYPE_FLAG,
SCAN_TYPE_MAX
};
@@ -34,6 +35,7 @@ void *virtual_schema_new(cJSON *json, struct table_manager *tbl_mgr,
void virtual_schema_free(void *virtual_schema);
int virtual_table_get_physical_table_id(void *virtual_schema, enum scan_type type);
#ifdef __cpluscplus
}