This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
tango-maat/src/inc_internal/maat_ip.h

66 lines
1.9 KiB
C
Raw Normal View History

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) Since 2022 Geedge Networks, Ltd. All rights reserved.
2023-01-30 21:59:35 +08:00
***********************************************************************************************
*/
#ifndef _MAAT_IP_H_
#define _MAAT_IP_H_
#ifdef __cplusplus
2023-01-30 21:59:35 +08:00
extern "C"
{
#endif
#include "cJSON/cJSON.h"
#include "maat_table.h"
2023-02-03 17:28:14 +08:00
struct ip_runtime;
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 */
2023-04-20 15:34:56 +08:00
void *ip_runtime_new(void *ip_schema, size_t max_thread_num,
struct maat_garbage_bin *garbage_bin,
2023-02-03 17:28:14 +08:00
struct log_handle *logger);
void ip_runtime_free(void *ip_runtime);
2023-01-30 21:59:35 +08:00
int ip_runtime_update(void *ip_runtime, void *ip_schema, const char *table_name,
const char *line, int valid_column);
int ip_runtime_commit(void *ip_runtime, const char *table_name, long long maat_rt_version);
2023-01-30 21:59:35 +08:00
2023-04-12 19:20:05 +08:00
long long ip_runtime_rule_count(void *ip_runtime);
2023-04-20 15:34:56 +08:00
long long ip_runtime_ipv6_rule_count(void *ip_runtime);
2023-01-30 21:59:35 +08:00
/* ip runtime scan API */
int ip_runtime_scan(struct ip_runtime *ip_rt, int thread_id, int ip_type,
2023-03-27 15:52:47 +08:00
uint8_t *ip_addr, uint16_t port, int proto, int vtable_id,
struct maat_state *state);
2023-02-03 17:28:14 +08:00
2023-04-20 15:34:56 +08:00
void ip_runtime_hit_inc(struct ip_runtime *ip_rt, int thread_id);
void ip_runtime_perf_stat(struct ip_runtime *ip_rt, struct timespec *start,
struct timespec *end, int thread_id);
long long ip_runtime_scan_count(void *ip_runtime);
long long ip_runtime_scan_cpu_time(void *ip_runtime);
long long ip_runtime_hit_count(void *ip_runtime);
long long ip_runtime_update_err_count(void *ip_runtime);
2023-01-30 21:59:35 +08:00
#ifdef __cplusplus
2023-01-30 21:59:35 +08:00
}
#endif
2023-02-03 17:28:14 +08:00
#endif