summaryrefslogtreecommitdiff
path: root/src/config/config_parse.cpp
diff options
context:
space:
mode:
authoryangwei <[email protected]>2024-06-26 16:27:38 +0800
committeryangwei <[email protected]>2024-06-26 16:27:38 +0800
commit307c8e30481c29faae0b686e57c9d90c093441c7 (patch)
treea093b0df977e07f23f8d0af9076916a975c5728c /src/config/config_parse.cpp
parentc5b96a48f94604a0382c75363379c7d54bc06d36 (diff)
✨ feat(fast close tcp no use): default set 0
Diffstat (limited to 'src/config/config_parse.cpp')
-rw-r--r--src/config/config_parse.cpp136
1 files changed, 68 insertions, 68 deletions
diff --git a/src/config/config_parse.cpp b/src/config/config_parse.cpp
index 337520e..f6679a0 100644
--- a/src/config/config_parse.cpp
+++ b/src/config/config_parse.cpp
@@ -13,10 +13,10 @@ extern "C" {
extern int g_overlay_layer_set[__ADDR_TYPE_MAX][SAPP_SUPPORT_LAYER_NUM_MAX];
/*
- ˵��:
- _sapp_toml_sample_file_image����, _sapp_toml_sample_file_image_len�����ǿ�����xxd -i �Զ����ɵ�,
- �����ڶ�̬�������ļ�sapp.toml.hex.array.c��,
- ���ļ��������git�ֿ�.
+ ˵��:
+ _sapp_toml_sample_file_image����, _sapp_toml_sample_file_image_len�����ǿ�����xxd -i �Զ����ɵ�,
+ �����ڶ�̬�������ļ�sapp.toml.hex.array.c��,
+ ���ļ��������git�ֿ�.
*/
extern const unsigned char _sapp_toml_sample_file_image[];
extern const int _sapp_toml_sample_file_image_len;
@@ -24,14 +24,14 @@ extern const int _sapp_toml_sample_file_image_len;
#define SAPP_CFG_OBSOLETE_FLAG 99999999
typedef struct __sapp_config_check{
int global_id;
- int depend_id; /* 1:����IJ���, ��������������, Ҳ����ȱʧ; 0:��ѡ��, ����û��, ��Ӱ��sapp���幦��; >=1000:����δ����, ȡ�����������ò����Ƿ���, ����transparentģʽ��������packet_io.external.interface */
- int err_log_level; /* 10,20,30, ������־�ȼ� */
+ int depend_id; /* 1:����IJ���, ��������������, Ҳ����ȱʧ; 0:��ѡ��, ����û��, ��Ӱ��sapp���幦��; >=1000:����δ����, ȡ�����������ò����Ƿ���, ����transparentģʽ��������packet_io.external.interface */
+ int err_log_level; /* 10,20,30, ������־�ȼ� */
const char *section;
const char *cfg_key;
- const char *depend_cfg_value; /* ����depend_id>1000ʱ��Ч, ��ʾ����������ֵ����Ԥ�ȶ���ʱ, �ż�鵱ǰ�����Ƿ�Ϸ�, ����mirroģʽ�¸�������Ҫ��� packet_io.external.interface */
+ const char *depend_cfg_value; /* ����depend_id>1000ʱ��Ч, ��ʾ����������ֵ����Ԥ�ȶ���ʱ, �ż�鵱ǰ�����Ƿ�Ϸ�, ����mirroģʽ�¸�������Ҫ��� packet_io.external.interface */
int (*cfg_value_check_fun)(const struct __sapp_config_check *sapp_cfg_check_attr, int this_cfg_id, int depend_cfg_id, const char *cfg_value, const void *range_array, int array_num);
char *cfg_value; /* NULL is not found */
- const void *expect_range_array; /* ���ڼ�����ֵ�Ŀ�ѡ��Χ����, �������͵IJ�ͬ������int *, ������char **���� */
+ const void *expect_range_array; /* ���ڼ�����ֵ�Ŀ�ѡ��Χ����, �������͵IJ�ͬ������int *, ������char **���� */
int expect_array_num;
}sapp_config_check_t;
@@ -46,7 +46,7 @@ static const char *sapp_cfg_get_value_from_attr_by_id(const sapp_config_check_t
static const char *sapp_cfg_get_value_from_attr_by_section_key(const sapp_config_check_t *sapp_cfg_check_attr, const char *section, const char *key);
static int cfg_value_check_inject_mode(const sapp_config_check_t *sapp_cfg_check_attr,int this_cfg_id,int depend_cfg_id, const char *raw_cfg_value, const void *expect_range_array, int array_num);
-static int g_interger_range_array[65536]; /* һ��int�͵�����, ��ֵ�±����ֵһ��, �� g_interger_range_array[0]=0, g_interger_range_array[1]=1, �����ж���ֵ������Χ�Ϸ��� */
+static int g_interger_range_array[65536]; /* һ��int�͵�����, ��ֵ�±����ֵһ��, �� g_interger_range_array[0]=0, g_interger_range_array[1]=1, �����ж���ֵ������Χ�Ϸ��� */
static int cfg_value_check_integer_range(const sapp_config_check_t *sapp_cfg_check_attr,int this_cfg_id,int depend_cfg_id, const char *raw_cfg_value, const void *expect_range_array, int array_num)
@@ -127,11 +127,11 @@ static int cfg_value_check_bind_mask(const sapp_config_check_t *sapp_cfg_check_a
long bind_mask_array[SAPP_MAX_THREADS];
int ret;
- /* ��ʱû��ֱ�ӽ���raw_cfg_value�ĺ���, �˴��ٶ�ȡһ�������ļ� */
+ /* ��ʱû��ֱ�ӽ���raw_cfg_value�ĺ���, �˴��ٶ�ȡһ�������ļ� */
ret = tomlc99_wrap_load_long_array(ABBR_CFG_FILE_MAIN_ENTRY, (char *)"CPU", (char *)"bind_mask", bind_mask_array, &bind_mask_array_num);
if(ret < 0){
unsigned int load_profile_array[SAPP_MAX_THREADS];
- /* ����Χ������, ��1-10,10-20�Ȳ���ʹ��MESA_load_profile_uint_range����, ��ʱҪ���ַ���ģʽ!!! */
+ /* ����Χ������, ��1-10,10-20�Ȳ���ʹ��MESA_load_profile_uint_range����, ��ʱҪ���ַ���ģʽ!!! */
ret = MESA_load_profile_uint_range(
ABBR_CFG_FILE_MAIN_ENTRY, (char *)"CPU", (char *)"bind_mask",
SAPP_MAX_THREADS, (unsigned int *)load_profile_array);
@@ -143,7 +143,7 @@ static int cfg_value_check_bind_mask(const sapp_config_check_t *sapp_cfg_check_a
}
if(0 == bind_mask_array_num){
- return 0; /* ����������, ������CPU,������� */
+ return 0; /* ����������, ������CPU,������� */
}
const char *raw_cfg_worker_threads_value = sapp_cfg_get_value_from_attr_by_id(sapp_cfg_check_attr, depend_cfg_id);
@@ -173,7 +173,7 @@ static int cfg_value_check_stream_id_base_time(const sapp_config_check_t *sapp_c
struct tm local_tm;
if(NULL == raw_cfg_value || strlen(raw_cfg_value) == 0){
- return 0; /* ����ΪNULL,������� */
+ return 0; /* ����ΪNULL,������� */
}
if(strptime(raw_cfg_value, "%Y-%m-%d %H:%M:%S", &local_tm) == NULL){
@@ -207,7 +207,7 @@ static const sapp_config_check_t g_sapp_cfg_check_attr[] =
{2002,0,RLOG_LV_DEBUG, "CPU", "send_only_threads_max", NULL,NULL, NULL, NULL, 0},
{2003,2001,RLOG_LV_FATAL,"CPU", "bind_mask", "",cfg_value_check_bind_mask, NULL, NULL, 0},
- {3001,0, RLOG_LV_INFO,"MEM", "dictator_enable", NULL,cfg_value_check_integer_range, NULL, g_interger_range_array, 2}, /* ֻ����0��1, ���Ծ���ǰ2��Ԫ�� */
+ {3001,0, RLOG_LV_INFO,"MEM", "dictator_enable", NULL,cfg_value_check_integer_range, NULL, g_interger_range_array, 2}, /* ֻ����0��1, ���Ծ���ǰ2��Ԫ�� */
{4000,0,RLOG_LV_DEBUG,"PACKET_IO", NULL, NULL, NULL,NULL, NULL, 0},
@@ -352,7 +352,7 @@ static const sapp_config_check_t g_sapp_cfg_check_attr[] =
{9201,0,RLOG_LV_INFO, "LIBRARY_LINK", "marsio_library_path", NULL,NULL, NULL, NULL, 0},
/******************************************************************************************************************/
- /*********** ��������ʷ���������ֹ�������, Ҳ�������,Ҳ���㲻֧��,����澯��Ϣ��ʾ���������� *********************/
+ /*********** ��������ʷ���������ֹ�������, Ҳ�������,Ҳ���㲻֧��,����澯��Ϣ��ʾ���������� *********************/
/******************************************************************************************************************/
{SAPP_CFG_OBSOLETE_FLAG,0,RLOG_LV_INFO,"overlay_tunnel_definition","stream_compare_layer_cfg_file",NULL, NULL, NULL,NULL, 0},
{SAPP_CFG_OBSOLETE_FLAG,0,RLOG_LV_INFO,"overlay_tunnel_definition","vlan_flipping_cfg_file",NULL, NULL, NULL,NULL, 0},
@@ -437,7 +437,7 @@ static int cfg_value_check_inject_mode(const sapp_config_check_t *sapp_cfg_check
depend_cfg_index = cfg_get_index_by_depend_id(depend_cfg_id);
depend_cfg_value = sapp_cfg_check_attr[depend_cfg_index].cfg_value;
- /* raw_cfg_value������NULL, ��ʱӦ�����ж�depend_cfg_value, �������������, ��̫�����ǿ� */
+ /* raw_cfg_value������NULL, ��ʱӦ�����ж�depend_cfg_value, �������������, ��̫�����ǿ� */
if(strncasecmp(depend_cfg_value, "vxlan_by_inline_device", strlen("vxlan_by_inline_device")) == 0){
expect_cfg_index = cfg_get_index_by_key_name("inject_mode_inline_device_sport");
@@ -526,7 +526,7 @@ static inline int is_file_exist(const char *filename)
static void update_overlay_vxlan_layer_set(void);
-/* ������ͬ���͵�����, �����в�������, ����sapp.toml�е����� */
+/* ������ͬ���͵�����, �����в�������, ����sapp.toml�е����� */
void sapp_cla_override_cfg_file(void)
{
char *cmd_args;
@@ -537,7 +537,7 @@ void sapp_cla_override_cfg_file(void)
}
if (sapp_get_cla_raw("dumpfile", &cmd_args) >= 0)
- { /* dumpfileģʽ�Զ�����interface���� */
+ { /* dumpfileģʽ�Զ�����interface���� */
strncpy(pconfig->packet_io.deployment_mode_str, "dumpfile", NAME_MAX);
pconfig->packet_io.deployment_mode_bin = DEPLOYMENT_MODE_MIRROR;
sapp_global_val->individual_fixed.deployment_mode_private = NET_CONN_PARALLEL;
@@ -627,7 +627,7 @@ static int parse_vlan_flipping_map_config(void)
fp = fopen(ABBR_VLAN_FLIPPING_CONF_FILE, "r");
if(NULL == fp){
sapp_log(RLOG_LV_INFO, ~0, ~0, "[warning]can't open vlan_flipping_cfg_file:%s", ABBR_VLAN_FLIPPING_CONF_FILE);
- /* ��ǰ����, ����ļ�������, ������� */
+ /* ��ǰ����, ����ļ�������, ������� */
return 0;
}
@@ -796,7 +796,7 @@ static int parse_asymmetric_addr_layer_config(void)
fp = fopen(ABBR_ASYM_LAYER_ADDR_CONF_FILE, "r");
if(NULL == fp){
sapp_log(RLOG_LV_INFO, ~0, ~0, "[Warning]can't open asymmetric_addr_layer_cfg_file:%s", ABBR_ASYM_LAYER_ADDR_CONF_FILE);
- /* ��ǰ����, ����ļ�������, ������� */
+ /* ��ǰ����, ����ļ�������, ������� */
return 0;
}
@@ -869,7 +869,7 @@ static int parse_stream_compare_layer_config(void)
fp = fopen(ABBR_STREAM_CMP_LAYER_CONF_FILE, "r");
if(NULL == fp){
sapp_log(RLOG_LV_INFO, ~0, ~0, "[Warning]can't open stream compare layer cfg_file:%s", ABBR_STREAM_CMP_LAYER_CONF_FILE);
- /* ��ǰ����, ����ļ�������, ������� */
+ /* ��ǰ����, ����ļ�������, ������� */
return 0;
}
@@ -913,7 +913,7 @@ static void update_overlay_vxlan_layer_set(void)
g_overlay_layer_set[ADDR_TYPE_MAC][0] = 1;
g_overlay_layer_set[ADDR_TYPE_IPV4][1] = 1;
g_overlay_layer_set[__ADDR_TYPE_IP_PAIR_V4][1] = 1;
- g_overlay_layer_set[ADDR_TYPE_UDP][1] = 1; /* IP��udp�ϲ���Ϊһ��, ���Դ˴�������1 */
+ g_overlay_layer_set[ADDR_TYPE_UDP][1] = 1; /* IP��udp�ϲ���Ϊһ��, ���Դ˴�������1 */
g_overlay_layer_set[ADDR_TYPE_VXLAN][2] = 1;
}
@@ -941,7 +941,7 @@ static int parse_well_known_port_config(void)
{
FILE *fp;
char line_buf[256];
- int last_section_proto = -1; /* �����ʶ: TCP or UDP */
+ int last_section_proto = -1; /* �����ʶ: TCP or UDP */
unsigned short *port_array = NULL;
int port_array_num = 0;
int tmpnum;
@@ -949,7 +949,7 @@ static int parse_well_known_port_config(void)
fp = fopen(ABBR_WELL_KNOWN_PORT_CONF_FILE, "r");
if(NULL == fp){
- return 0; /* û�д��ļ�, ������� */
+ return 0; /* û�д��ļ�, ������� */
}
while(fgets(line_buf, sizeof(line_buf), fp)){
@@ -959,9 +959,9 @@ static int parse_well_known_port_config(void)
sapp_memmove_for_blank_table(line_buf, sizeof(line_buf));
del_last_rn(line_buf, sizeof(line_buf));
- if('[' == line_buf[0]){ /* [] һ���������ʼ */
+ if('[' == line_buf[0]){ /* [] һ���������ʼ */
if(port_array != NULL){
- /* ��һ������ս��� */
+ /* ��һ������ս��� */
update_well_known_port_array(last_section_proto, port_array, port_array_num);
port_array = NULL;
port_array_num = 0;
@@ -1053,7 +1053,7 @@ static int parse_extract_linkdir_from_mac_cfg(void)
return 0;
}
-/* ���ø�ʽת��, ���ַ�������תΪint����,���ڳ����� */
+/* ���ø�ʽת��, ���ַ�������תΪint����,���ڳ����� */
static int config_expression_convert(void)
{
sapp_config_t *pconfig;
@@ -1296,9 +1296,9 @@ static inline void old_config_file_detect(const char *old_filename, const char *
/*
- �����ļ��Ϸ��ԡ�����Լ��.
+ �����ļ��Ϸ��ԡ�����Լ��.
- TODO: ������������ g_sapp_cfg_check_attr[] ���ϲ�, ijЩ������⹦�����ظ���!!!
+ TODO: ������������ g_sapp_cfg_check_attr[] ���ϲ�, ijЩ������⹦�����ظ���!!!
return value:
0: succ;
@@ -1313,7 +1313,7 @@ static int config_sanity_check(void)
struct streaminfo_private phony_stream_pr;
phony_stream_pr.layer_index = 0xF;
- assert(SAPP_SUPPORT_LAYER_NUM_MAX == phony_stream_pr.layer_index); /* �����ж��������޸���layer_index��SAPP_SUPPORT_LAYER_NUM_MAX, ����������һ�µ���� */
+ assert(SAPP_SUPPORT_LAYER_NUM_MAX == phony_stream_pr.layer_index); /* �����ж��������޸���layer_index��SAPP_SUPPORT_LAYER_NUM_MAX, ����������һ�µ���� */
if(SAPP_SUPPORT_LAYER_NUM_MAX != phony_stream_pr.layer_index){
sapp_log(RLOG_LV_FATAL, ~0, ~0, "SAPP_SUPPORT_LAYER_NUM_MAX is:%d, but streaminfo_private->layer_index max is:%d", SAPP_SUPPORT_LAYER_NUM_MAX, phony_stream_pr.layer_index);
return -1;
@@ -1461,7 +1461,7 @@ static int config_sanity_check(void)
/*
- ֧�ֶ�д����ģʽ, ���¸��������ļ�·��, ���������ļ�·��.
+ ֧�ֶ�д����ģʽ, ���¸��������ļ�·��, ���������ļ�·��.
*/
int sapp_get_secondary_file_path(void)
{
@@ -1634,7 +1634,7 @@ int sapp_get_secondary_file_path(void)
}
-/* ��ȡ�����ļ�sapp.toml, ������ֻLoad, ���������ʹ����� */
+/* ��ȡ�����ļ�sapp.toml, ������ֻLoad, ���������ʹ����� */
int sapp_parse_config(void)
{
int ret;
@@ -1656,7 +1656,7 @@ int sapp_parse_config(void)
/******************************* SYSTEM *********************************/
ret = tomlc99_wrap_load_string_def(ABBR_CFG_FILE_MAIN_ENTRY, (char *)"SYSTEM", (char *)"instance_name", pconfig->system.instance_name, NAME_MAX, "sapp_v4.2");
if(TOMLC99_RET_PATTERN_ERROR == ret){
- /* �״ν����ж������PATTERN_ERROR, ˵��toml��ʽ������, ���ټ������� */
+ /* �״ν����ж������PATTERN_ERROR, ˵��toml��ʽ������, ���ټ������� */
sapp_log(30, ~0, ~0, "parse config file %s error!", ABBR_CFG_FILE_MAIN_ENTRY);
exit(1);
}
@@ -1679,7 +1679,7 @@ int sapp_parse_config(void)
tomlc99_wrap_load_long_array(ABBR_CFG_FILE_MAIN_ENTRY, (char *)"CPU", (char *)"bind_mask", pconfig->cpu.bind_mask_array, &pconfig->cpu.bind_mask_array_num);
- /* ����Χ������, ��1-10,10-20�Ȳ���ʹ��MESA_load_profile_uint_range����, ��ʱҪ���ַ���ģʽ!!! */
+ /* ����Χ������, ��1-10,10-20�Ȳ���ʹ��MESA_load_profile_uint_range����, ��ʱҪ���ַ���ģʽ!!! */
int tmp_bind_mask[SAPP_MAX_THREADS] = {};
ret = MESA_load_profile_uint_range(
ABBR_CFG_FILE_MAIN_ENTRY, (char *)"CPU", (char *)"bind_mask",
@@ -1752,7 +1752,7 @@ int sapp_parse_config(void)
/******************************* packet_io.under_ddos ******************************/
- tomlc99_wrap_load_int_def(ABBR_CFG_FILE_MAIN_ENTRY, (char *)"packet_io.under_ddos", (char *)"stream_bypass_enabled", &pconfig->packet_io.under_ddos_config.enabled, 0); //��ǰ����, Ĭ�ϲ�����
+ tomlc99_wrap_load_int_def(ABBR_CFG_FILE_MAIN_ENTRY, (char *)"packet_io.under_ddos", (char *)"stream_bypass_enabled", &pconfig->packet_io.under_ddos_config.enabled, 0); //��ǰ����, Ĭ�ϲ�����
tomlc99_wrap_load_int_def(ABBR_CFG_FILE_MAIN_ENTRY, (char *)"packet_io.under_ddos", (char *)"get_cpu_usage_interval", &pconfig->packet_io.under_ddos_config.get_cpu_usage_interval, 500);
tomlc99_wrap_load_int_def(ABBR_CFG_FILE_MAIN_ENTRY, (char *)"packet_io.under_ddos", (char *)"smooth_avg_window", &pconfig->packet_io.under_ddos_config.smooth_avg_window, 2);
@@ -1778,7 +1778,7 @@ int sapp_parse_config(void)
tomlc99_wrap_load_int_def(ABBR_CFG_FILE_MAIN_ENTRY, (char *)"stream.tcp", (char *)"syn_mandatory", (int *)&pconfig->stream.tcp.syn_mandatory, 1);
tomlc99_wrap_load_int_def(ABBR_CFG_FILE_MAIN_ENTRY, (char *)"stream.tcp", (char *)"reorder_pkt_max", (int *)&pconfig->stream.tcp.reorder_pkt_max, 5);
tomlc99_wrap_load_int_def(ABBR_CFG_FILE_MAIN_ENTRY, (char *)"stream.tcp", (char *)"reorder_on_closing", (int *)&pconfig->stream.tcp.reorder_on_closing, 0);
- tomlc99_wrap_load_int_def(ABBR_CFG_FILE_MAIN_ENTRY, (char *)"stream.tcp", (char *)"nouse_set_special_timeout", (int *)&pconfig->stream.tcp.nouse_set_special_timeout, 1);
+ tomlc99_wrap_load_int_def(ABBR_CFG_FILE_MAIN_ENTRY, (char *)"stream.tcp", (char *)"fast_close_nouse", (int *)&pconfig->stream.tcp.fast_close_nouse, 0);
tomlc99_wrap_load_int_def(ABBR_CFG_FILE_MAIN_ENTRY, (char *)"stream.tcp", (char *)"analyse_option_enabled", (int *)&pconfig->stream.tcp.analyse_option_enabled, 1);
tomlc99_wrap_load_int_def(ABBR_CFG_FILE_MAIN_ENTRY, (char *)"stream.tcp", (char *)"tuple4_reuse_time_interval", (int *)&pconfig->stream.tcp.tuple4_reuse_time_interval, 30);
tomlc99_wrap_load_int_def(ABBR_CFG_FILE_MAIN_ENTRY, (char *)"stream.tcp", (char *)"meaningful_statistics_minimum_pkt", (int *)&pconfig->stream.tcp.meaningful_statistics_minimum_pkt, 3);
@@ -1933,9 +1933,9 @@ int sapp_parse_config(void)
}
/*
- 0: ����ʶ�����ļ��е�key-value;
- 1: ʶ�𲢴洢�����ļ��е�key-value;
- 2: ����ijЩ�Ѿ��������IJ���.
+ 0: ����ʶ�����ļ��е�key-value;
+ 1: ʶ�𲢴洢�����ļ��е�key-value;
+ 2: ����ijЩ�Ѿ��������IJ���.
*/
static int sapp_config_check_update_option(sapp_config_check_t *local_cfg_check_attr, const char *section, const char *key, const char *value)
{
@@ -1944,7 +1944,7 @@ static int sapp_config_check_update_option(sapp_config_check_t *local_cfg_check_
int found_cfg = 0;
for(i = 0; local_cfg_check_attr[i].global_id != -1; i++){
- if(NULL == local_cfg_check_attr[i].cfg_key){ /* [PACKET_IO], []DUPLICATE_PKT] ������ֻ�и�section, ����û��key */
+ if(NULL == local_cfg_check_attr[i].cfg_key){ /* [PACKET_IO], []DUPLICATE_PKT] ������ֻ�и�section, ����û��key */
continue;
}
section_max_len = SAPP_MAX(strlen(local_cfg_check_attr[i].section), strlen(section));
@@ -1956,7 +1956,7 @@ static int sapp_config_check_update_option(sapp_config_check_t *local_cfg_check_
return 2;
}else{
if(NULL == value){
- local_cfg_check_attr[i].cfg_value = sapp_strdup(""); /* û�����������ֵ, ����bpf��������Ϊ��, ����key�Ǵ��ڵ�, Ҳ�������ҵ��� */
+ local_cfg_check_attr[i].cfg_value = sapp_strdup(""); /* û�����������ֵ, ����bpf��������Ϊ��, ����key�Ǵ��ڵ�, Ҳ�������ҵ��� */
}else{
local_cfg_check_attr[i].cfg_value = sapp_strdup(value);
}
@@ -1975,7 +1975,7 @@ extern char *sapp_memmove_for_blank_table(char *data, int max_len);
/*
- �Ƿ���Ҫ��鵱ǰ���õĺϷ���.
+ �Ƿ���Ҫ��鵱ǰ���õĺϷ���.
*/
static int cfg_value_need_be_check(const sapp_config_check_t *local_cfg_check_array, const sapp_config_check_t *this_cfg_check_attr)
{
@@ -1984,7 +1984,7 @@ static int cfg_value_need_be_check(const sapp_config_check_t *local_cfg_check_ar
if(1 == this_cfg_check_attr->depend_id){
return 1;
}
- if(0 == this_cfg_check_attr->depend_id){ /* ��ѡ������Ҳ��� */
+ if(0 == this_cfg_check_attr->depend_id){ /* ��ѡ������Ҳ��� */
return 1;
}
@@ -2002,11 +2002,11 @@ static int cfg_value_need_be_check(const sapp_config_check_t *local_cfg_check_ar
}
/*
- ��ȫ����һ�鵱ǰ��sapp.toml, ����Ƿ��в���ʶ������, �����˵��:
- 1)sapp��sapp.toml�İ汾��;
- 2)ijЩ��ʷ�ϵIJ����Ѿ�������, ����sapp.toml������;
+ ��ȫ����һ�鵱ǰ��sapp.toml, ����Ƿ��в���ʶ������, �����˵��:
+ 1)sapp��sapp.toml�İ汾��;
+ 2)ijЩ��ʷ�ϵIJ����Ѿ�������, ����sapp.toml������;
- �˴�����prof_load����������fgets���ж�ȡ, ��Ϊ���Ȳ�֪��Ҫ��ȡʲô, Ҫ�����е��ж�����һ��.
+ �˴�����prof_load����������fgets���ж�ȡ, ��Ϊ���Ȳ�֪��Ҫ��ȡʲô, Ҫ�����е��ж�����һ��.
*/
static int sapp_config_check_unsupport(sapp_config_check_t *local_cfg_check_attr)
{
@@ -2016,7 +2016,7 @@ static int sapp_config_check_unsupport(sapp_config_check_t *local_cfg_check_attr
char section_string[128] = {};
char *cfg_key;
char *cfg_value;
- const char *kname_delim = "="; /* ������ֵֻ����=�ָ�, ������key��ֵ��Ŀո�\tɾ��, ����bpf filter */
+ const char *kname_delim = "="; /* ������ֵֻ����=�ָ�, ������key��ֵ��Ŀո�\tɾ��, ����bpf filter */
const char *section_delim = "[] \t";
char *key_save_ptr, *section_save_ptr;
FILE *fp;
@@ -2034,12 +2034,12 @@ static int sapp_config_check_unsupport(sapp_config_check_t *local_cfg_check_attr
if('#' == raw_config_line[0]){
continue;
}
- if('\0' == raw_config_line[0]){ /* ������ */
+ if('\0' == raw_config_line[0]){ /* ������ */
continue;
}
memcpy(config_line, raw_config_line, sizeof(raw_config_line));
- if('[' == raw_config_line[0]){ /* ��[��ͷ��ʾ��section���俪ʼ */
+ if('[' == raw_config_line[0]){ /* ��[��ͷ��ʾ��section���俪ʼ */
char *pure_sesion_str = strtok_r(config_line, section_delim, &section_save_ptr);
strncpy(section_string, pure_sesion_str, sizeof(section_string));
while(strtok_r(NULL, section_delim, &section_save_ptr));
@@ -2062,7 +2062,7 @@ static int sapp_config_check_unsupport(sapp_config_check_t *local_cfg_check_attr
sapp_memmove_for_blank_table(cfg_value, strlen(cfg_value));
- const char *kkvalue_delim = "\"'"; /* ������ֵ���ܱ�˫���ű�����, ��ʱֻ��ȥ�����ŵ��Dz������ÿո�\t�ָ���, ����bpf_filter */
+ const char *kkvalue_delim = "\"'"; /* ������ֵ���ܱ�˫���ű�����, ��ʱֻ��ȥ�����ŵ��Dz������ÿո�\t�ָ���, ����bpf_filter */
char *pure_cfg_value_save_ptr;
char *pure_cfg_value = strtok_r(cfg_value, kkvalue_delim, &pure_cfg_value_save_ptr);
ret = sapp_config_check_update_option(local_cfg_check_attr, section_string, cfg_key, pure_cfg_value);
@@ -2080,8 +2080,8 @@ static int sapp_config_check_unsupport(sapp_config_check_t *local_cfg_check_attr
}
/*
- ��������֪�IJ�����sapp.toml���ȡһ��, ����Ƿ��в����ڵ�����, �����:
- 1)sapp��sapp.toml�İ汾��;
+ ��������֪�IJ�����sapp.toml���ȡһ��, ����Ƿ��в����ڵ�����, �����:
+ 1)sapp��sapp.toml�İ汾��;
*/
static int sapp_config_check_missing(sapp_config_check_t *local_cfg_check_attr)
{
@@ -2091,10 +2091,10 @@ static int sapp_config_check_missing(sapp_config_check_t *local_cfg_check_attr)
int fun_ret = 0;
for(i = 0; local_cfg_check_attr[i].global_id != -1; i++){
- if(NULL == local_cfg_check_attr[i].cfg_key){ /* [PACKET_IO], []DUPLICATE_PKT] ������ֻ�и�section, ����Ϊ�����ʶ, ����û��key */
+ if(NULL == local_cfg_check_attr[i].cfg_key){ /* [PACKET_IO], []DUPLICATE_PKT] ������ֻ�и�section, ����Ϊ�����ʶ, ����û��key */
continue;
}
- if(SAPP_CFG_OBSOLETE_FLAG == local_cfg_check_attr[i].global_id){ /* �Ѿ�����������, �����ڼ��missing */
+ if(SAPP_CFG_OBSOLETE_FLAG == local_cfg_check_attr[i].global_id){ /* �Ѿ�����������, �����ڼ��missing */
continue;
}
if(cfg_value_need_be_check(local_cfg_check_attr, &local_cfg_check_attr[i]) == 0){
@@ -2102,24 +2102,24 @@ static int sapp_config_check_missing(sapp_config_check_t *local_cfg_check_attr)
}
ret1 = MESA_load_profile_string_nodef(ABBR_CFG_FILE_MAIN_ENTRY, local_cfg_check_attr[i].section, local_cfg_check_attr[i].cfg_key, cfg_value, sizeof(cfg_value));
if(ret1 < 0){
- /* ��profile�ӿڶ�ȡ�����п�����toml��ʽ������, ����toml���鳢�Խ���һ�� */
+ /* ��profile�ӿڶ�ȡ�����п�����toml��ʽ������, ����toml���鳢�Խ���һ�� */
array_num = 1024;
ret2 = tomlc99_wrap_load_int_array(ABBR_CFG_FILE_MAIN_ENTRY, local_cfg_check_attr[i].section, (char *)local_cfg_check_attr[i].cfg_key, cfg_array, &array_num);
if(ret2 < 0){
- /* ʹ��toml����Ҳû�ж�ȡ������, ����Ƿ��������������� */
+ /* ʹ��toml����Ҳû�ж�ȡ������, ����Ƿ��������������� */
if((local_cfg_check_attr[i].depend_id != 0) && (local_cfg_check_attr[i].cfg_value_check_fun != NULL)){
ret3 = local_cfg_check_attr[i].cfg_value_check_fun(local_cfg_check_attr, local_cfg_check_attr[i].global_id, local_cfg_check_attr[i].depend_id,
local_cfg_check_attr[i].cfg_value, local_cfg_check_attr[i].expect_range_array, local_cfg_check_attr[i].expect_array_num);
if(ret3 != 0){
fun_ret = SAPP_MAX(local_cfg_check_attr[i].err_log_level, fun_ret);
sapp_printf_colorful(fun_ret, "missing sapp.toml config: [%s] -> %s\n", local_cfg_check_attr[i].section, local_cfg_check_attr[i].cfg_key);
- /* ע��: �˴���Ҫbreak, ������е������ļ����� */
+ /* ע��: �˴���Ҫbreak, ������е������ļ����� */
}
}else{
fun_ret = SAPP_MAX(local_cfg_check_attr[i].err_log_level, fun_ret);
sapp_printf_colorful(fun_ret, "missing sapp.toml config: [%s] -> %s\n", local_cfg_check_attr[i].section, local_cfg_check_attr[i].cfg_key);
- /* ע��: �˴���Ҫbreak, ������е������ļ����� */
+ /* ע��: �˴���Ҫbreak, ������е������ļ����� */
}
}
}
@@ -2133,7 +2133,7 @@ static int sapp_config_check_missing_and_unsupport(sapp_config_check_t *local_cf
{
int ret;
- /* ע��: check_unsupport����ǰ��, ��Ϊ���и���������, ���ǰ��������õ�ֵ��ȡ��ȫ�ֱ���: g_sapp_cfg_check_attr ��*/
+ /* ע��: check_unsupport����ǰ��, ��Ϊ���и���������, ���ǰ��������õ�ֵ��ȡ��ȫ�ֱ���: g_sapp_cfg_check_attr ��*/
ret = sapp_config_check_unsupport(local_cfg_check_attr);
if(ret != 0){
sapp_printf_colorful(ret, "maybe a typo, maybe some config is obsolete, or sapp is older than sapp.toml version!\n");
@@ -2150,7 +2150,7 @@ static int sapp_config_check_missing_and_unsupport(sapp_config_check_t *local_cf
}
/*
- ���ÿ�����������ĺϷ���, ֻ�ǵ�����������ֵ�ϲ��Ϸ�, ���������Լ��.
+ ���ÿ�����������ĺϷ���, ֻ�ǵ�����������ֵ�ϲ��Ϸ�, ���������Լ��.
*/
static int sapp_config_check_single_validity(sapp_config_check_t *local_cfg_check_attr)
{
@@ -2178,9 +2178,9 @@ static int sapp_config_check_single_validity(sapp_config_check_t *local_cfg_chec
}
/*
- ����Ӳ���֮��Ĺ����Լ��,
- ��������Ϊtransparentģʽ, ���뿪��packet_io.external.interface;
- ���翪����prometheus_enabled, ������prometheus_port��prometheus_url_path;
+ ����Ӳ���֮��Ĺ����Լ��,
+ ��������Ϊtransparentģʽ, ���뿪��packet_io.external.interface;
+ ���翪����prometheus_enabled, ������prometheus_port��prometheus_url_path;
*/
static int sapp_config_check_sanity(sapp_config_check_t *local_cfg_check_attr)
{
@@ -2194,15 +2194,15 @@ static int sapp_config_check_sanity(sapp_config_check_t *local_cfg_check_attr)
/*
check_level:
- t1: ֻ���֧�ֵIJ����ڲ���, �Ƿ��в�֧�ֵ��²���;
- t2: ���ÿ��������ֵ�Ƿ�Ϸ�, ����packet_io.mode ����mirror, inline, tansparent��;
- t3: ������鵥������, �����ܵļ�����в������������������, ����transparentģʽû������external����;
+ t1: ֻ���֧�ֵIJ����ڲ���, �Ƿ��в�֧�ֵ��²���;
+ t2: ���ÿ��������ֵ�Ƿ�Ϸ�, ����packet_io.mode ����mirror, inline, tansparent��;
+ t3: ������鵥������, �����ܵļ�����в������������������, ����transparentģʽû������external����;
*/
int sapp_config_check(void)
{
int i, ret1, ret2, final_ret = 0;
- /* ȫ�ֱ������й̶����������, Ҳ�ж�̬�������ļ���ȡ������, ���Դ˴�copyһ����ʱ���� */
+ /* ȫ�ֱ������й̶����������, Ҳ�ж�̬�������ļ���ȡ������, ���Դ˴�copyһ����ʱ���� */
sapp_config_check_t *local_cfg_check_attr = (sapp_config_check_t *)sapp_mem_calloc(SAPP_MEM_FIX_GLOBAL_VAL, MEM_STAT_GLOBAL_THREAD_ID,sizeof(g_sapp_cfg_check_attr));
memcpy(local_cfg_check_attr, g_sapp_cfg_check_attr, sizeof(g_sapp_cfg_check_attr));