support parse encrypted json config
This commit is contained in:
@@ -2,9 +2,9 @@
|
||||
**********************************************************************************************
|
||||
* File: json2iris.h
|
||||
* Description: rule for transform json2iris
|
||||
* Authors: Liu WenTan <liuwentan@geedgenetworks.com>
|
||||
* Authors: Zheng chao <zhengchao@geedgenetworks.com>
|
||||
* Date: 2022-10-31
|
||||
* Copyright: (c) 2018-2022 Geedge Networks, Inc. All rights reserved.
|
||||
* Copyright: (c) Since 2022 Geedge Networks, Ltd. All rights reserved.
|
||||
***********************************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* Description:
|
||||
* Authors: Liu WenTan <liuwentan@geedgenetworks.com>
|
||||
* Date: 2022-10-31
|
||||
* Copyright: (c) 2018-2022 Geedge Networks, Inc. All rights reserved.
|
||||
* Copyright: (c) Since 2022 Geedge Networks, Ltd. All rights reserved.
|
||||
***********************************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
/*
|
||||
**********************************************************************************************
|
||||
* File: maat_common.h
|
||||
* Description: maat common entry
|
||||
* Authors: Liu WenTan <liuwentan@geedgenetworks.com>
|
||||
* Date: 2022-10-31
|
||||
* Copyright: (c) 2018-2022 Geedge Networks, Inc. All rights reserved.
|
||||
***********************************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef _MAAT_COMMON_H_
|
||||
#define _MAAT_COMMON_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include <stddef.h>
|
||||
#include <limits.h>
|
||||
|
||||
#include "log/log.h"
|
||||
#include "maat_rule.h"
|
||||
|
||||
struct maat_options {
|
||||
char instance_name[NAME_MAX];
|
||||
char foreign_cont_dir[NAME_MAX];
|
||||
char log_path[PATH_MAX];
|
||||
char stat_file[PATH_MAX];
|
||||
size_t nr_worker_threads;
|
||||
char *accept_tags;
|
||||
int rule_effect_interval_ms;
|
||||
int rule_update_checking_interval_ms;
|
||||
int gc_timeout_ms;
|
||||
int stat_on;
|
||||
int perf_on;
|
||||
int deferred_load_on;
|
||||
int log_level;
|
||||
enum data_source input_mode;
|
||||
union {
|
||||
struct source_iris_ctx iris_ctx;
|
||||
struct source_json_ctx json_ctx;
|
||||
struct source_redis_ctx redis_ctx;
|
||||
};
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -2,9 +2,9 @@
|
||||
**********************************************************************************************
|
||||
* File: maat_compile.h
|
||||
* Description:
|
||||
* Authors: Zheng Chao <zhengchao@geedgenetworks.com>
|
||||
* Authors: Liu wentan <liuwentan@geedgenetworks.com>
|
||||
* Date: 2022-10-31
|
||||
* Copyright: (c) 2018-2022 Geedge Networks, Inc. All rights reserved.
|
||||
* Copyright: (c) Since 2022 Geedge Networks, Ltd. All rights reserved.
|
||||
***********************************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ extern "C"
|
||||
void config_monitor_traverse(long long version, const char *idx_dir,
|
||||
void (*start_fn)(long long, int, void *),
|
||||
int (*update_fn)(const char *, const char *, void *),
|
||||
void (*finish_fn)(void *), void *u_param,
|
||||
void (*finish_fn)(void *), void *u_param, const char *dec_key,
|
||||
struct log_handle *logger);
|
||||
|
||||
int load_maat_json_file(struct maat *maat_instance, const char *json_filename,
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* Description: ex data
|
||||
* Authors: Liu WenTan <liuwentan@geedgenetworks.com>
|
||||
* Date: 2022-10-31
|
||||
* Copyright: (c) 2018-2022 Geedge Networks, Inc. All rights reserved.
|
||||
* Copyright: (c) Since 2022 Geedge Networks, Ltd. All rights reserved.
|
||||
***********************************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* Description:
|
||||
* Authors: Liu WenTan <liuwentan@geedgenetworks.com>
|
||||
* Date: 2022-10-31
|
||||
* Copyright: (c) 2018-2022 Geedge Networks, Inc. All rights reserved.
|
||||
* Copyright: (c) Since 2022 Geedge Networks, Ltd. All rights reserved.
|
||||
***********************************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* Description:
|
||||
* Authors: Liu WenTan <liuwentan@geedgenetworks.com>
|
||||
* Date: 2022-10-31
|
||||
* Copyright: (c) 2018-2022 Geedge Networks, Inc. All rights reserved.
|
||||
* Copyright: (c) Since 2022 Geedge Networks, Ltd. All rights reserved.
|
||||
***********************************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* Description:
|
||||
* Authors: Liu WenTan <liuwentan@geedgenetworks.com>
|
||||
* Date: 2022-10-31
|
||||
* Copyright: (c) 2018-2022 Geedge Networks, Inc. All rights reserved.
|
||||
* Copyright: (c) Since 2022 Geedge Networks, Ltd. All rights reserved.
|
||||
***********************************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* Description: maat gc
|
||||
* Authors: Zhengchao <zhengchao@geedgenetworks.com>
|
||||
* Date: 2022-10-31
|
||||
* Copyright: (c) 2018-2022 Geedge Networks, Inc. All rights reserved.
|
||||
* Copyright: (c) Since 2022 Geedge Networks, Ltd. All rights reserved.
|
||||
***********************************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* Description:
|
||||
* Authors: Liu wentan <liuwentan@geedgenetworks.com>
|
||||
* Date: 2022-10-31
|
||||
* Copyright: (c) 2018-2022 Geedge Networks, Inc. All rights reserved.
|
||||
* Copyright: (c) Since 2022 Geedge Networks, Ltd. All rights reserved.
|
||||
***********************************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* Description:
|
||||
* Authors: Liu WenTan <liuwentan@geedgenetworks.com>
|
||||
* Date: 2022-10-31
|
||||
* Copyright: (c) 2018-2022 Geedge Networks, Inc. All rights reserved.
|
||||
* Copyright: (c) Since 2022 Geedge Networks, Ltd. All rights reserved.
|
||||
***********************************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
/*
|
||||
**********************************************************************************************
|
||||
* File: maat_kv_map.h
|
||||
* File: maat_kv.h
|
||||
* Description: str2int map api
|
||||
* Authors: Zheng chao <zhengchao@geedgenetworks.com>
|
||||
* Date: 2022-10-31
|
||||
* Copyright: (c) 2018-2022 Geedge Networks, Inc. All rights reserved.
|
||||
* Copyright: (c) Since 2022 Geedge Networks, Ltd. All rights reserved.
|
||||
***********************************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* Description: maat redis monitor api
|
||||
* Authors: Liu WenTan <liuwentan@geedgenetworks.com>
|
||||
* Date: 2022-11-29
|
||||
* Copyright: (c) 2018-2022 Geedge Networks, Inc. All rights reserved.
|
||||
* Copyright: (c) Since 2022 Geedge Networks, Ltd. All rights reserved.
|
||||
***********************************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
@@ -171,6 +171,36 @@ struct rule_tag {
|
||||
char *tag_val;
|
||||
};
|
||||
|
||||
struct maat_options {
|
||||
char instance_name[NAME_MAX];
|
||||
char foreign_cont_dir[NAME_MAX];
|
||||
char decrypt_algo[MAX_KEYWORDS_STR];
|
||||
char decrypt_key[MAX_KEYWORDS_STR];
|
||||
char log_path[PATH_MAX];
|
||||
int log_level;
|
||||
char stat_file[PATH_MAX];
|
||||
size_t nr_worker_thread;
|
||||
char *accept_tags;
|
||||
|
||||
int stat_on;
|
||||
int perf_on;
|
||||
int deferred_load_on;
|
||||
|
||||
int maat_json_is_gzipped;
|
||||
int cumulative_update_off; //Default: cumulative update on
|
||||
|
||||
int gc_timeout_ms;
|
||||
int rule_effect_interval_ms;
|
||||
int rule_update_checking_interval_ms;
|
||||
|
||||
enum data_source input_mode;
|
||||
union {
|
||||
struct source_iris_ctx iris_ctx;
|
||||
struct source_json_ctx json_ctx;
|
||||
struct source_redis_ctx redis_ctx;
|
||||
};
|
||||
};
|
||||
|
||||
struct maat_stat {
|
||||
char stat_file[PATH_MAX];
|
||||
struct fieldstat_instance *fs_handle;
|
||||
@@ -197,54 +227,27 @@ struct maat_stat {
|
||||
};
|
||||
|
||||
struct maat {
|
||||
char instance_name[NAME_MAX];
|
||||
|
||||
struct maat_runtime *maat_rt;
|
||||
struct maat_runtime *creating_maat_rt;
|
||||
|
||||
struct table_manager *tbl_mgr;
|
||||
struct maat_options opts;
|
||||
|
||||
enum data_source input_mode;
|
||||
union {
|
||||
struct source_iris_ctx iris_ctx;
|
||||
struct source_json_ctx json_ctx;
|
||||
struct source_redis_ctx mr_ctx;
|
||||
};
|
||||
|
||||
struct log_handle *logger;
|
||||
int deferred_load;
|
||||
|
||||
int is_running;
|
||||
pthread_mutex_t background_update_mutex;
|
||||
size_t nr_worker_thread;
|
||||
|
||||
long long maat_version;
|
||||
long long last_full_version;
|
||||
long long load_specific_version; //Default: Load the Latest. Only valid in redis mode, and maybe failed for too old
|
||||
/* internal state */
|
||||
long long new_version;
|
||||
|
||||
int is_running;
|
||||
pthread_t cfg_mon_thread;
|
||||
pthread_mutex_t background_update_mutex;
|
||||
|
||||
int rule_effect_interval_ms;
|
||||
int rule_update_checking_interval_ms;
|
||||
int gc_timeout_ms; //garbage collection timeout_ms;
|
||||
|
||||
int cumulative_update_off; //Default: cumulative update on
|
||||
|
||||
int stat_on;
|
||||
int perf_on;
|
||||
struct log_handle *logger;
|
||||
struct maat_garbage_bin *garbage_bin;
|
||||
|
||||
int default_compile_table_id;
|
||||
int g2g_table_id; //group2group table id
|
||||
|
||||
char decrypt_key[NAME_MAX];
|
||||
char decrypt_algo[NAME_MAX];
|
||||
int maat_json_is_gzipped;
|
||||
|
||||
long long load_specific_version; //Default: Load the Latest. Only valid in redis mode, and maybe failed for too old
|
||||
char foreign_cont_dir[NAME_MAX];
|
||||
|
||||
/* internal state */
|
||||
long long new_version;
|
||||
|
||||
/* statistics */
|
||||
struct maat_stat *stat;
|
||||
};
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* Description: maat utils entry
|
||||
* Authors: Liu WenTan <liuwentan@geedgenetworks.com>
|
||||
* Date: 2022-10-31
|
||||
* Copyright: (c) 2018-2022 Geedge Networks, Inc. All rights reserved.
|
||||
* Copyright: (c) Since 2022 Geedge Networks, Ltd. All rights reserved.
|
||||
***********************************************************************************************
|
||||
*/
|
||||
|
||||
@@ -116,6 +116,10 @@ int system_cmd_mkdir(const char* path);
|
||||
|
||||
int system_cmd_rmdir(const char *dir);
|
||||
|
||||
int system_cmd_gzip(const char *src_file, const char *dst_file);
|
||||
|
||||
int system_cmd_encrypt(const char *src_file, const char *dst_file, const char *password);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* Description:
|
||||
* Authors: Liu WenTan <liuwentan@geedgenetworks.com>
|
||||
* Date: 2022-10-31
|
||||
* Copyright: (c) 2018-2022 Geedge Networks, Inc. All rights reserved.
|
||||
* Copyright: (c) Since 2022 Geedge Networks, Ltd. All rights reserved.
|
||||
***********************************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
/*
|
||||
**********************************************************************************************
|
||||
* File: rcu_hash.h
|
||||
* Description: rcu hashtable
|
||||
* Description: rcu hash table
|
||||
* Authors: Liu WenTan <liuwentan@geedgenetworks.com>
|
||||
* Date: 2022-10-31
|
||||
* Copyright: (c) 2018-2022 Geedge Networks, Inc. All rights reserved.
|
||||
* Copyright: (c) Since 2022 Geedge Networks, Ltd. All rights reserved.
|
||||
***********************************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
Reference in New Issue
Block a user