2023-01-30 21:59:35 +08:00
|
|
|
/*
|
|
|
|
|
**********************************************************************************************
|
|
|
|
|
* File: maat_ip.h
|
|
|
|
|
* Description:
|
|
|
|
|
* Authors: Liu WenTan <liuwentan@geedgenetworks.com>
|
|
|
|
|
* Date: 2022-10-31
|
|
|
|
|
* Copyright: (c) 2018-2022 Geedge Networks, Inc. All rights reserved.
|
|
|
|
|
***********************************************************************************************
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef _MAAT_IP_H_
|
|
|
|
|
#define _MAAT_IP_H_
|
|
|
|
|
|
2023-02-15 11:53:46 +08:00
|
|
|
#ifdef __cplusplus
|
2023-01-30 21:59:35 +08:00
|
|
|
extern "C"
|
|
|
|
|
{
|
|
|
|
|
#endif
|
|
|
|
|
|
2023-02-15 11:53:46 +08:00
|
|
|
#include "cJSON/cJSON.h"
|
|
|
|
|
|
2023-02-03 17:28:14 +08:00
|
|
|
struct ip_runtime;
|
2023-02-15 11:53:46 +08:00
|
|
|
struct table_manager;
|
|
|
|
|
struct log_handle;
|
|
|
|
|
struct maat_garbage_bin;
|
2023-01-30 21:59:35 +08:00
|
|
|
|
2023-02-03 17:28:14 +08:00
|
|
|
void *ip_schema_new(cJSON *json, struct table_manager *tbl_mgr,
|
|
|
|
|
const char *table_name, struct log_handle *logger);
|
|
|
|
|
void ip_schema_free(void *ip_schema);
|
2023-01-30 21:59:35 +08:00
|
|
|
|
2023-02-03 17:28:14 +08:00
|
|
|
/* ip runtime API */
|
|
|
|
|
void *ip_runtime_new(void *ip_schema, int max_thread_num,
|
|
|
|
|
struct maat_garbage_bin *garbage_bin,
|
|
|
|
|
struct log_handle *logger);
|
|
|
|
|
void ip_runtime_free(void *ip_runtime);
|
2023-01-30 21:59:35 +08:00
|
|
|
|
2023-02-03 17:28:14 +08:00
|
|
|
int ip_runtime_update(void *ip_runtime, void *ip_schema,
|
|
|
|
|
const char *line, int valid_column);
|
2023-02-09 22:13:15 +08:00
|
|
|
int ip_runtime_commit(void *ip_runtime, const char *table_name);
|
2023-01-30 21:59:35 +08:00
|
|
|
|
2023-02-03 17:28:14 +08:00
|
|
|
struct ex_data_runtime *ip_runtime_get_ex_data_rt(struct ip_runtime *ip_rt);
|
2023-01-30 21:59:35 +08:00
|
|
|
|
|
|
|
|
/* ip runtime scan API */
|
2023-02-15 11:53:46 +08:00
|
|
|
int ip_runtime_scan(struct ip_runtime *ip_rt, int thread_id, int ip_type,
|
2023-02-20 10:57:40 +08:00
|
|
|
uint8_t *ip_addr, int *group_ids, int hit_group_index,
|
|
|
|
|
size_t group_id_size, int vtable_id, struct maat_state *state);
|
2023-02-03 17:28:14 +08:00
|
|
|
|
|
|
|
|
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);
|
2023-01-30 21:59:35 +08:00
|
|
|
|
2023-02-15 11:53:46 +08:00
|
|
|
#ifdef __cplusplus
|
2023-01-30 21:59:35 +08:00
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
2023-02-03 17:28:14 +08:00
|
|
|
#endif
|