support ip+port+proto scan
This commit is contained in:
@@ -59,10 +59,10 @@ int compile_runtime_commit(void *compile_runtime, const char *table_name);
|
||||
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_runtime_get_new_hit_paths(struct compile_runtime *compile_rt,
|
||||
struct maat_compile_state *compile_state,
|
||||
struct maat_hit_path *hit_path_array,
|
||||
size_t array_size, size_t hit_path_cnt);
|
||||
size_t compile_runtime_get_hit_paths(struct compile_runtime *compile_rt,
|
||||
struct maat_compile_state *compile_state,
|
||||
struct maat_hit_path *hit_path_array,
|
||||
size_t array_size, size_t hit_path_cnt);
|
||||
|
||||
void *compile_runtime_get_ex_data(struct compile_runtime *compile_rt,
|
||||
struct compile_schema *compile_schema,
|
||||
@@ -90,7 +90,7 @@ int maat_compile_state_update(struct rcu_hash_table *item_htable, int vtable_id,
|
||||
long long *hit_item_ids, size_t hit_item_cnt,
|
||||
size_t *n_hit_group_id, struct maat_state *state);
|
||||
|
||||
size_t maat_compile_state_get_hit_paths(struct maat_compile_state *compile_state,
|
||||
size_t maat_compile_state_get_internal_hit_paths(struct maat_compile_state *compile_state,
|
||||
struct group2group_runtime *g2g_rt,
|
||||
struct maat_hit_path *hit_path_array,
|
||||
size_t array_size);
|
||||
|
||||
@@ -37,7 +37,8 @@ int ip_runtime_commit(void *ip_runtime, const char *table_name);
|
||||
|
||||
/* ip runtime scan API */
|
||||
int ip_runtime_scan(struct ip_runtime *ip_rt, int thread_id, int ip_type,
|
||||
uint8_t *ip_addr, int vtable_id, struct maat_state *state);
|
||||
uint8_t *ip_addr, uint16_t port, int proto, int vtable_id,
|
||||
struct maat_state *state);
|
||||
|
||||
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);
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
/*
|
||||
**********************************************************************************************
|
||||
* File: maat_port.h
|
||||
* Description:
|
||||
* Authors: Liu WenTan <liuwentan@geedgenetworks.com>
|
||||
* Date: 2022-10-31
|
||||
* Copyright: (c) 2018-2022 Geedge Networks, Inc. All rights reserved.
|
||||
***********************************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef _MAAT_PORT_H_
|
||||
#define _MAAT_PORT_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include "cJSON/cJSON.h"
|
||||
#include "maat_table.h"
|
||||
#include "maat_rule.h"
|
||||
|
||||
/* port is short for port proto */
|
||||
struct port_runtime;
|
||||
|
||||
void *port_schema_new(cJSON *json, struct table_manager *tbl_mgr,
|
||||
const char *table_name, struct log_handle *logger);
|
||||
void port_schema_free(void *port_schema);
|
||||
|
||||
/* ip runtime API */
|
||||
void *port_runtime_new(void *port_schema, int max_thread_num,
|
||||
struct maat_garbage_bin *garbage_bin,
|
||||
struct log_handle *logger);
|
||||
void port_runtime_free(void *port_runtime);
|
||||
|
||||
int port_runtime_update(void *port_runtime, void *port_schema,
|
||||
const char *line, int valid_column);
|
||||
int port_runtime_commit(void *port_runtime, const char *table_name);
|
||||
|
||||
struct ex_data_runtime *port_runtime_get_ex_data_rt(struct port_runtime *port_rt);
|
||||
|
||||
/* ip runtime scan API */
|
||||
int port_runtime_scan(struct port_runtime *port_rt, int thread_id, int port,
|
||||
int proto, int *group_ids, size_t group_id_size,
|
||||
int vtable_id, struct maat_state *state);
|
||||
|
||||
void port_runtime_scan_hit_inc(struct port_runtime *port_rt, int thread_id);
|
||||
long long port_runtime_scan_hit_sum(struct port_runtime *port_rt, int n_thread);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -285,8 +285,7 @@ long long maat_cmd_redis_server_time_s(redisContext *c);
|
||||
|
||||
long long maat_cmd_read_redis_integer(const redisReply *reply);
|
||||
|
||||
int maat_cmd_get_valid_flag_offset(const char *line, enum table_type table_type,
|
||||
int valid_column_seq);
|
||||
int maat_cmd_get_valid_flag_offset(const char *line, int column_seq);
|
||||
|
||||
const char *maat_cmd_find_Nth_column(const char *line, int Nth, int *column_len);
|
||||
|
||||
|
||||
@@ -29,7 +29,6 @@ enum table_type {
|
||||
TABLE_TYPE_EXPR,
|
||||
TABLE_TYPE_EXPR_PLUS,
|
||||
TABLE_TYPE_IP_PLUS,
|
||||
TABLE_TYPE_PORT,
|
||||
TABLE_TYPE_INTERVAL,
|
||||
TABLE_TYPE_INTERVAL_PLUS,
|
||||
TABLE_TYPE_PLUGIN,
|
||||
|
||||
@@ -57,18 +57,25 @@ extern "C"
|
||||
#define MAX_SCANNER_HIT_ITEM_NUM 4096
|
||||
#define MAX_SCANNER_HIT_PATTERN_NUM 4096 * 8
|
||||
|
||||
enum maat_ip_format {
|
||||
enum ip_format {
|
||||
IP_FORMAT_SINGLE = 1,
|
||||
IP_FORMAT_RANGE,
|
||||
IP_FORMAT_MASK,
|
||||
IP_FORMAT_CIDR,
|
||||
IP_FORMAT_MASK,
|
||||
IP_FORMAT_UNKNOWN
|
||||
};
|
||||
|
||||
enum maat_ip_format ip_format_str2int(const char *format);
|
||||
int ip_format2range(int ip_type, enum maat_ip_format format, const char *ip1, const char *ip2,
|
||||
enum port_format {
|
||||
PORT_FORMAT_SINGLE = 1,
|
||||
PORT_FORMAT_RANGE,
|
||||
PORT_FORMAT_UNKNOWN
|
||||
};
|
||||
|
||||
enum ip_format ip_format_str2int(const char *format);
|
||||
int ip_format2range(int ip_type, enum ip_format format, const char *ip1, const char *ip2,
|
||||
uint32_t range_begin[], uint32_t range_end[]);
|
||||
|
||||
|
||||
enum port_format port_format_str2int(const char *format);
|
||||
|
||||
#define UNUSED __attribute__((unused))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user