cpp->c and expr support configurable generation of literal_db or regex_db

This commit is contained in:
liuwentan
2023-02-15 11:53:46 +08:00
parent d5e6808e1f
commit 379efcf027
74 changed files with 1621 additions and 927 deletions

View File

@@ -11,68 +11,24 @@
#ifndef _ALIGNMENT_H_
#define _ALIGNMENT_H_
#ifdef __cpluscplus
#ifdef __cplusplus
extern "C"
{
#endif
#include <stdlib.h>
#include <string.h>
long long *alignment_int64_array_alloc(int size);
#define CPU_CACHE_ALIGMENT 64
long long alignment_int64_array_sum(long long *array, int size);
inline long long *alignment_int64_array_alloc(int size)
{
return (long long *)calloc(CPU_CACHE_ALIGMENT, size);
}
long long alignment_int64_array_add(long long *array, int offset, long long op_val);
inline long long alignment_int64_array_sum(long long *array, int size)
{
int offset = 0;
long long sum = 0;
for (int i = 0; i < size; i++) {
offset = (CPU_CACHE_ALIGMENT / sizeof(long long)) * i;
sum += array[offset];
}
long long alignment_int64_array_cnt(long long *array, int size);
return sum;
}
void alignment_int64_array_reset(long long *array, int size);
inline long long alignment_int64_array_add(long long *array, int offset, long long op_val)
{
int idx = (CPU_CACHE_ALIGMENT / sizeof(long long)) * offset;
array[idx] += op_val;
void alignment_int64_array_free(long long *array);
return array[idx];
}
inline long long alignment_int64_array_cnt(long long *array, int size)
{
int offset = 0;
int cnt = 0;
for (int i = 0; i < size; i++) {
offset = (CPU_CACHE_ALIGMENT / sizeof(long long)) * i;
if (array[offset] > 0) {
cnt++;
}
}
return cnt;
}
inline void alignment_int64_array_reset(long long *array, int size)
{
memset(array, 0, CPU_CACHE_ALIGMENT * size);
}
inline void alignment_int64_array_free(long long *array)
{
free(array);
}
#ifdef __cpluscplus
#ifdef __cplusplus
}
#endif

View File

@@ -11,19 +11,20 @@
#ifndef _JSON2IRIS_H_
#define _JSON2IRIS_H_
#ifdef __cpluscplus
#ifdef __cplusplus
extern "C"
{
#endif
#include "hiredis/hiredis.h"
#include "log/log.h"
int json2iris(const char *json_buff, const char *json_filename,
redisContext *redis_write_ctx, char *iris_dir_buf,
int buf_len, char *encrypt_key, char *encrypt_algo,
struct log_handle *logger);
#ifdef __cpluscplus
#ifdef __cplusplus
}
#endif

View File

@@ -11,16 +11,18 @@
#ifndef _MAAT_BOOL_PLUGIN_H_
#define _MAAT_BOOL_PLUGIN_H_
#ifdef __cpluscplus
#ifdef __cplusplus
extern "C"
{
#endif
#include "log/log.h"
#include "maat/maat.h"
#include "maat.h"
#include "cJSON/cJSON.h"
struct bool_plugin_runtime;
struct table_manager;
struct log_handle;
struct maat_garbage_bin;
/* bool plugin schema API */
void *bool_plugin_schema_new(cJSON *json, struct table_manager *tbl_mgr,
@@ -49,7 +51,7 @@ int bool_plugin_runtime_commit(void *bool_plugin_runtime, const char *table_name
struct ex_data_runtime *bool_plugin_runtime_get_ex_data_rt(void *bool_plugin_runtime);
#ifdef __cpluscplus
#ifdef __cplusplus
}
#endif

View File

@@ -11,11 +11,13 @@
#ifndef _MAAT_COMMAND_H_
#define _MAAT_COMMAND_H_
#ifdef __cpluscplus
#ifdef __cplusplus
extern "C"
{
#endif
#include "maat.h"
enum maat_operation {
MAAT_OP_DEL = 0,
MAAT_OP_ADD,
@@ -39,7 +41,7 @@ struct maat_cmd_line
*/
int maat_cmd_set_line(struct maat *maat_instance, const struct maat_cmd_line *line_rule);
#ifdef __cpluscplus
#ifdef __cplusplus
}
#endif

View File

@@ -11,7 +11,7 @@
#ifndef _MAAT_COMMON_H_
#define _MAAT_COMMON_H_
#ifdef __cpluscplus
#ifdef __cplusplus
extern "C"
{
#endif
@@ -41,7 +41,7 @@ struct maat_options {
};
};
#ifdef __cpluscplus
#ifdef __cplusplus
}
#endif

View File

@@ -11,14 +11,13 @@
#ifndef _MAAT_COMPILE_H_
#define _MAAT_COMPILE_H_
#ifdef __cpluscplus
#ifdef __cplusplus
extern "C"
{
#endif
#include "log/log.h"
#include "cJSON/cJSON.h"
#include "maat/maat.h"
#include "maat.h"
#include "maat_kv.h"
#include "maat_rule.h"
@@ -32,6 +31,11 @@ struct compile_ex_data_schema {
int table_id;
};
struct compile_schema;
struct compile_runtime;
struct maat_compile_state;
struct group2group_runtime;
/* compile schema API */
void *compile_schema_new(cJSON *json, struct table_manager *tbl_mgr,
const char *table_name, struct log_handle *logger);
@@ -93,7 +97,7 @@ int maat_compile_state_update(struct maat_item *item_hash, int vtable_id,
int maat_compile_state_has_NOT_clause(struct maat_compile_state *compile_state);
#ifdef __cpluscplus
#ifdef __cplusplus
}
#endif

View File

@@ -11,7 +11,7 @@
#ifndef _MAAT_CONFIG_MONITOR_H_
#define _MAAT_CONFIG_MONITOR_H_
#ifdef __cpluscplus
#ifdef __cplusplus
extern "C"
{
#endif
@@ -27,7 +27,7 @@ void config_monitor_traverse(long long version, const char *idx_dir,
int load_maat_json_file(struct maat *maat_instance, const char *json_filename,
char *err_str, size_t err_str_sz);
#ifdef __cpluscplus
#ifdef __cplusplus
}
#endif

View File

@@ -11,12 +11,12 @@
#ifndef _MAAT_EX_DATA_H_
#define _MAAT_EX_DATA_H_
#ifdef __cpluscplus
#ifdef __cplusplus
extern "C"
{
#endif
#include "maat/maat.h"
#include "maat.h"
#include "rcu_hash.h"
struct ex_data_container {
@@ -90,7 +90,7 @@ void *ex_data_runtime_get_custom_data(struct ex_data_runtime *ex_data_rt,
size_t ex_data_runtime_ex_container_count(struct ex_data_runtime *ex_data_rt);
#ifdef __cpluscplus
#ifdef __cplusplus
}
#endif

View File

@@ -11,15 +11,18 @@
#ifndef _MAAT_EXPR_H_
#define _MAAT_EXPR_H_
#ifdef __cpluscplus
#ifdef __cplusplus
extern "C"
{
#endif
#include "log/log.h"
#include "maat_rule.h"
#include "cJSON/cJSON.h"
struct expr_runtime;
struct table_manager;
struct log_handle;
struct maat_garbage_bin;
void *expr_schema_new(cJSON *json, struct table_manager *tbl_mgr,
const char *table_name, struct log_handle *logger);
@@ -41,13 +44,13 @@ int expr_runtime_commit(void *expr_runtime, const char *table_name);
*
* @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,
int *group_ids, size_t group_ids_size,
int vtable_ids, struct maat_state *state);
int expr_runtime_scan(struct expr_runtime *expr_rt, int thread_id,
const char *data, size_t data_len,
int *group_ids, size_t group_ids_size,
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,
int expr_runtime_stream_scan(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);
@@ -55,7 +58,7 @@ void expr_runtime_stream_close(struct expr_runtime *expr_rt);
void expr_runtime_scan_hit_inc(struct expr_runtime *expr_rt, int thread_id);
long long expr_runtime_scan_hit_sum(struct expr_runtime *expr_rt, int n_thread);
#ifdef __cpluscplus
#ifdef __cplusplus
}
#endif

View File

@@ -11,17 +11,20 @@
#ifndef _MAAT_FLAG_H_
#define _MAAT_FLAG_H_
#ifdef __cpluscplus
#ifdef __cplusplus
extern "C"
{
#endif
#include <stdint.h>
#include "log/log.h"
#include "maat_rule.h"
#include "cJSON/cJSON.h"
struct flag_runtime;
struct table_manager;
struct log_handle;
struct maat_garbage_bin;
void *flag_schema_new(cJSON *json, struct table_manager *tbl_mgr,
const char *table_name, struct log_handle *logger);
@@ -43,14 +46,14 @@ int flag_runtime_commit(void *flag_runtime, const char *table_name);
*
* @retval the num of hit group_id
*/
int flag_runtime_scan_flag(struct flag_runtime *flag_rt, int thread_id,
uint64_t flag, int *group_ids, size_t group_ids_size,
int vtable_id, struct maat_state *state);
int flag_runtime_scan(struct flag_runtime *flag_rt, int thread_id,
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);
#ifdef __cpluscplus
#ifdef __cplusplus
}
#endif

View File

@@ -0,0 +1,55 @@
/*
**********************************************************************************************
* File: maat_fqdn.h
* Description:
* Authors: Liu WenTan <liuwentan@geedgenetworks.com>
* Date: 2022-10-31
* Copyright: (c) 2018-2022 Geedge Networks, Inc. All rights reserved.
***********************************************************************************************
*/
#ifndef _MAAT_FQDN_H_
#define _MAAT_FQDN_H_
#ifdef __cplusplus
extern "C"
{
#endif
#include "maat_rule.h"
#include "cJSON/cJSON.h"
struct fqdn_runtime;
struct table_manager;
struct log_handle;
struct maat_garbage_bin;
void *fqdn_schema_new(cJSON *json, struct table_manager *tbl_mgr,
const char *table_name, struct log_handle *logger);
void fqdn_schema_free(void *fqdn_schema);
/* fqdn runtime API */
void *fqdn_runtime_new(void *fqdn_schema, int max_thread_num,
struct maat_garbage_bin *garbage_bin,
struct log_handle *logger);
void fqdn_runtime_free(void *fqdn_runtime);
int fqdn_runtime_update(void *fqdn_runtime, void *fqdn_schema,
const char *line, int valid_column);
int fqdn_runtime_commit(void *fqdn_runtime, const char *table_name);
struct ex_data_runtime *fqdn_runtime_get_ex_data_rt(struct fqdn_runtime *fqdn_rt);
/* fqdn runtime scan API */
int fqdn_runtime_scan(struct fqdn_runtime *fqdn_rt, int thread_id, int port,
int proto, int *group_ids, size_t group_id_size,
int vtable_id, struct maat_state *state);
void fqdn_runtime_scan_hit_inc(struct fqdn_runtime *fqdn_rt, int thread_id);
long long fqdn_runtime_scan_hit_sum(struct fqdn_runtime *fqdn_rt, int n_thread);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -11,16 +11,18 @@
#ifndef _MAAT_FQDN_PLUGIN_H_
#define _MAAT_FQDN_PLUGIN_H_
#ifdef __cpluscplus
#ifdef __cplusplus
extern "C"
{
#endif
#include "log/log.h"
#include "maat/maat.h"
#include "maat.h"
#include "cJSON/cJSON.h"
struct fqdn_plugin_runtime;
struct table_manager;
struct log_handle;
struct maat_garbage_bin;
/* fqdn plugin schema API */
void *fqdn_plugin_schema_new(cJSON *json, struct table_manager *tbl_mgr,
@@ -49,7 +51,7 @@ int fqdn_plugin_runtime_commit(void *fqdn_plugin_runtime, const char *table_name
struct ex_data_runtime *fqdn_plugin_runtime_get_ex_data_rt(void *fqdn_plugin_runtime);
#ifdef __cpluscplus
#ifdef __cplusplus
}
#endif

View File

@@ -11,7 +11,7 @@
#ifndef _MAAT_GARBAGE_COLLECTION_H_
#define _MAAT_GARBAGE_COLLECTION_H_
#ifdef __cpluscplus
#ifdef __cplusplus
extern "C"
{
#endif
@@ -33,7 +33,7 @@ size_t maat_garbage_bin_get_size(struct maat_garbage_bin *bin);
void maat_garbage_collect_by_force(struct maat_garbage_bin *bin);
#ifdef __cpluscplus
#ifdef __cplusplus
}
#endif

View File

@@ -11,17 +11,18 @@
#ifndef _MAAT_GROUP_H_
#define _MAAT_GROUP_H_
#ifdef __cpluscplus
#ifdef __cplusplus
extern "C"
{
#endif
#include "cJSON/cJSON.h"
#include "uthash/uthash.h"
#include "igraph/igraph.h"
#include "maat_kv.h"
struct maat_group;
struct table_manager;
struct log_handle;
struct maat_garbage_bin;
/* group2group schema API */
void *group2group_schema_new(cJSON *json, struct table_manager *tbl_mgr,
@@ -49,7 +50,7 @@ int group2group_runtime_update(void *g2g_runtime, void *g2g_schema,
const char *line, int valid_column);
int group2group_runtime_commit(void *g2g_runtime, const char *table_name);
#ifdef __cpluscplus
#ifdef __cplusplus
}
#endif

View File

@@ -11,17 +11,20 @@
#ifndef _MAAT_INTERVAL_H_
#define _MAAT_INTERVAL_H_
#ifdef __cpluscplus
#ifdef __cplusplus
extern "C"
{
#endif
#include <stdint.h>
#include "log/log.h"
#include "maat_rule.h"
#include "cJSON/cJSON.h"
struct interval_runtime;
struct table_manager;
struct log_handle;
struct maat_garbage_bin;
void *interval_schema_new(cJSON *json, struct table_manager *tbl_mgr,
const char *table_name, struct log_handle *logger);
@@ -43,14 +46,14 @@ int interval_runtime_commit(void *interval_runtime, const char *table_name);
*
* @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);
int interval_runtime_scan(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
#ifdef __cplusplus
}
#endif

View File

@@ -11,12 +11,17 @@
#ifndef _MAAT_IP_H_
#define _MAAT_IP_H_
#ifdef __cpluscplus
#ifdef __cplusplus
extern "C"
{
#endif
#include "cJSON/cJSON.h"
struct ip_runtime;
struct table_manager;
struct log_handle;
struct maat_garbage_bin;
void *ip_schema_new(cJSON *json, struct table_manager *tbl_mgr,
const char *table_name, struct log_handle *logger);
@@ -35,14 +40,14 @@ int ip_runtime_commit(void *ip_runtime, const char *table_name);
struct ex_data_runtime *ip_runtime_get_ex_data_rt(struct ip_runtime *ip_rt);
/* ip runtime scan API */
int ip_runtime_scan_ip(struct ip_runtime *ip_rt, int thread_id, int ip_type,
int ip_runtime_scan(struct ip_runtime *ip_rt, int thread_id, int ip_type,
uint8_t *ip_addr, int *group_ids, size_t group_id_size,
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);
#ifdef __cpluscplus
#ifdef __cplusplus
}
#endif

View File

@@ -11,16 +11,18 @@
#ifndef _MAAT_IP_PLUGIN_H_
#define _MAAT_IP_PLUGIN_H_
#ifdef __cpluscplus
#ifdef __cplusplus
extern "C"
{
#endif
#include "log/log.h"
#include "maat/maat.h"
#include "maat.h"
#include "cJSON/cJSON.h"
struct ip_plugin_runtime;
struct table_manager;
struct log_handle;
struct maat_garbage_bin;
/* ip plugin schema API */
void *ip_plugin_schema_new(cJSON *json, struct table_manager *tbl_mgr,
@@ -49,7 +51,7 @@ int ip_plugin_runtime_commit(void *ip_plugin_runtime, const char *table_name);
struct ex_data_runtime *ip_plugin_runtime_get_ex_data_rt(void *ip_plugin_runtime);
#ifdef __cpluscplus
#ifdef __cplusplus
}
#endif

View File

@@ -11,11 +11,13 @@
#ifndef _MAAT_KV_H_
#define _MAAT_KV_H_
#ifdef __cpluscplus
#ifdef __cplusplus
extern "C"
{
#endif
#include <stddef.h>
struct maat_kv_store;
struct maat_kv_store *maat_kv_store_new(void);
@@ -30,7 +32,7 @@ int maat_kv_read_unNull(struct maat_kv_store *store, const char *key, size_t key
struct maat_kv_store *maat_kv_store_duplicate(struct maat_kv_store *store);
#ifdef __cpluscplus
#ifdef __cplusplus
}
#endif

View File

@@ -11,14 +11,14 @@
#ifndef _MAAT_LIMITS_H_
#define _MAAT_LIMITS_H_
#ifdef __cpluscplus
#ifdef __cplusplus
extern "C"
{
#endif
#define MAX_KEYWORDS_STR 1024
#ifdef __cpluscplus
#ifdef __cplusplus
}
#endif

View File

@@ -11,12 +11,13 @@
#ifndef _MAAT_PLUGIN_H_
#define _MAAT_PLUGIN_H_
#ifdef __cpluscplus
#ifdef __cplusplus
extern "C"
{
#endif
#include "maat/maat.h"
#include "cJSON/cJSON.h"
#include "maat.h"
#define MAX_FOREIGN_CLMN_NUM 8
@@ -59,7 +60,7 @@ int plugin_runtime_commit(void *plugin_runtime, const char *table_name);
struct ex_data_runtime *plugin_runtime_get_ex_data_rt(void *plugin_runtime);
#ifdef __cpluscplus
#ifdef __cplusplus
}
#endif

View File

@@ -0,0 +1,56 @@
/*
**********************************************************************************************
* File: maat_port_proto.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_PROTO_H_
#define _MAAT_PORT_PROTO_H_
#ifdef __cplusplus
extern "C"
{
#endif
#include "maat_rule.h"
#include "cJSON/cJSON.h"
/* pp is short for port proto */
struct pp_runtime;
struct table_manager;
struct log_handle;
struct maat_garbage_bin;
void *pp_schema_new(cJSON *json, struct table_manager *tbl_mgr,
const char *table_name, struct log_handle *logger);
void pp_schema_free(void *pp_schema);
/* ip runtime API */
void *pp_runtime_new(void *pp_schema, int max_thread_num,
struct maat_garbage_bin *garbage_bin,
struct log_handle *logger);
void pp_runtime_free(void *pp_runtime);
int pp_runtime_update(void *pp_runtime, void *pp_schema,
const char *line, int valid_column);
int pp_runtime_commit(void *pp_runtime, const char *table_name);
struct ex_data_runtime *pp_runtime_get_ex_data_rt(struct pp_runtime *pp_rt);
/* ip runtime scan API */
int pp_runtime_scan(struct pp_runtime *pp_rt, int thread_id, int port,
int proto, int *group_ids, size_t group_id_size,
int vtable_id, struct maat_state *state);
void pp_runtime_scan_hit_inc(struct pp_runtime *pp_rt, int thread_id);
long long pp_runtime_scan_hit_sum(struct pp_runtime *pp_rt, int n_thread);
#ifdef __cplusplus
}
#endif
#endif

View File

@@ -11,7 +11,7 @@
#ifndef _MAAT_REDIS_MONITOR_H_
#define _MAAT_REDIS_MONITOR_H_
#ifdef __cpluscplus
#ifdef __cplusplus
extern "C"
{
#endif
@@ -25,7 +25,7 @@ void redis_monitor_traverse(long long version, struct source_redis_ctx *mr_ctx,
int (*update_fn)(const char *, const char *, void *),
void (*finish_fn)(void *), void *u_param);
#ifdef __cpluscplus
#ifdef __cplusplus
}
#endif

View File

@@ -11,7 +11,7 @@
#ifndef _MAAT_RULE_H_
#define _MAAT_RULE_H_
#ifdef __cpluscplus
#ifdef __cplusplus
extern "C"
{
#endif
@@ -29,8 +29,10 @@ extern "C"
#include "uthash/uthash.h"
#include "maat_command.h"
#include "IPMatcher.h"
#include "maat.h"
#include "maat_kv.h"
#include "maat_table.h"
#include "maat_rule.h"
#include "maat_virtual.h"
#define MAX_TABLE_NUM 256
@@ -66,18 +68,6 @@ struct maat_rule_head {
int serv_def_len;
};
#define MAX_SERVICE_DEFINE_LEN 128
struct maat_rule {
int config_id;
int service_id;
uint8_t do_log;
uint8_t do_blacklist;
uint8_t action;
uint8_t reserved;
int serv_def_len;
char service_defined[MAX_SERVICE_DEFINE_LEN];
};
#define ITEM_RULE_MAGIC 0x4d3c2b1a
struct maat_item_inner {
long long magic_num;
@@ -329,7 +319,7 @@ void maat_cmd_set_serial_rule(struct serial_rule *rule, enum maat_operation op,
void fill_maat_rule(struct maat_rule *rule, const struct maat_rule_head *rule_head,
const char *srv_def, int srv_def_len);
#ifdef __cpluscplus
#ifdef __cplusplus
}
#endif

View File

@@ -11,7 +11,7 @@
#ifndef _MAAT_TABLE_H_
#define _MAAT_TABLE_H_
#ifdef __cpluscplus
#ifdef __cplusplus
extern "C"
{
#endif
@@ -19,6 +19,8 @@ extern "C"
#include <stddef.h>
#include <cJSON/cJSON.h>
#include "maat_garbage_collection.h"
enum table_type {
TABLE_TYPE_INVALID = -1,
TABLE_TYPE_FLAG = 0,
@@ -74,7 +76,7 @@ void *table_manager_get_runtime(struct table_manager *tbl_mgr, int table_id);
int table_manager_update_runtime(struct table_manager *tbl_mgr, int table_id, const char *line);
void table_manager_commit_runtime(struct table_manager *tbl_mgr, int table_id);
#ifdef __cpluscplus
#ifdef __cplusplus
}
#endif

View File

@@ -11,7 +11,7 @@
#ifndef _MAAT_UTILS_H_
#define _MAAT_UTILS_H_
#ifdef __cpluscplus
#ifdef __cplusplus
extern "C"
{
#endif
@@ -67,12 +67,7 @@ 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,
uint32_t range_begin[], uint32_t range_end[]);
inline void ipv6_ntoh(unsigned int *v6_addr)
{
for (unsigned int i = 0; i < 4; i++) {
v6_addr[i] = ntohl(v6_addr[i]);
}
}
#define UNUSED __attribute__((unused))
@@ -80,6 +75,8 @@ const char *module_name_str(const char *name);
char *maat_strdup(const char *s);
void ipv6_ntoh(unsigned int *v6_addr);
int get_column_pos(const char *line, int column_seq, size_t *offset, size_t *len);
/* the column value must be integer */
@@ -111,7 +108,7 @@ int system_cmd_mkdir(const char* path);
int system_cmd_rmdir(const char *dir);
#ifdef __cpluscplus
#ifdef __cplusplus
}
#endif

View File

@@ -11,11 +11,13 @@
#ifndef _MAAT_VIRTUAL_H_
#define _MAAT_VIRTUAL_H_
#ifdef __cpluscplus
#ifdef __cplusplus
extern "C"
{
#endif
#include "cJSON/cJSON.h"
enum scan_type {
SCAN_TYPE_INVALID = -1,
SCAN_TYPE_NONE = 0,
@@ -30,6 +32,9 @@ enum scan_type {
SCAN_TYPE_MAX
};
struct table_manager;
struct log_handle;
void *virtual_schema_new(cJSON *json, struct table_manager *tbl_mgr,
const char *table_name, struct log_handle *logger);
@@ -37,7 +42,7 @@ void virtual_schema_free(void *virtual_schema);
int virtual_table_get_physical_table_id(void *virtual_schema, enum scan_type type);
#ifdef __cpluscplus
#ifdef __cplusplus
}
#endif

View File

@@ -11,7 +11,7 @@
#ifndef _RCU_HASH_H_
#define _RCU_HASH_H_
#ifdef __cpluscplus
#ifdef __cplusplus
extern "C"
{
#endif
@@ -62,7 +62,7 @@ size_t rcu_hash_garbage_queue_len(struct rcu_hash_table *htable);
size_t rcu_hash_list_updating_data(struct rcu_hash_table *htable, void ***data_array);
#ifdef __cpluscplus
#ifdef __cplusplus
}
#endif