2019-08-06 12:04:23 +00:00
|
|
|
|
#ifndef CONFIGM_H_
|
|
|
|
|
#define CONFIGM_H_
|
2019-08-14 07:37:30 +00:00
|
|
|
|
#include "config_manager.h"
|
2019-08-06 12:04:23 +00:00
|
|
|
|
#include "s2j/s2j.h"
|
|
|
|
|
#include "../../../../common/rpc/rpc_common.h"
|
|
|
|
|
#include "../../../../../Common/commuapinl.h"
|
|
|
|
|
#include "../user_manager_config/user_group_config.h"
|
|
|
|
|
#include "../user_manager_config/user_account_config.h"
|
2019-08-07 03:49:31 +00:00
|
|
|
|
#include "netconfig.h"
|
2019-08-06 12:04:23 +00:00
|
|
|
|
#include "log_config.h"
|
2019-08-09 12:49:17 +00:00
|
|
|
|
#include "../web_config/authfree.h"
|
2019-08-12 02:15:23 +00:00
|
|
|
|
#include "../web_config/auth_parameters.h"
|
2019-08-21 11:42:12 +00:00
|
|
|
|
#include "natconfig.h"
|
|
|
|
|
|
2019-08-06 12:04:23 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define CONFIG_INIT_ARRAY \
|
|
|
|
|
{\
|
|
|
|
|
{ \
|
|
|
|
|
NETCONFIG_MODULE, \
|
2019-08-07 03:49:31 +00:00
|
|
|
|
net_main \
|
2019-08-06 12:04:23 +00:00
|
|
|
|
}, \
|
|
|
|
|
{ \
|
|
|
|
|
LOG_CONFIG_MODULE, \
|
|
|
|
|
log_config_init \
|
|
|
|
|
} \
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
1、配置ID,全局唯一,用于寻找对应的配置业务
|
|
|
|
|
2、配置源检查,全局唯一,用于寻找对应的配置业务,
|
|
|
|
|
从低位到高位,第一位表示WEB,后续配置扩展
|
|
|
|
|
3、是否配置恢复
|
|
|
|
|
4、是否是多实例
|
|
|
|
|
5、配置校验回调函数
|
|
|
|
|
6、配置处理接口
|
|
|
|
|
7、配置获取接口
|
|
|
|
|
8、配置全部获取接口
|
|
|
|
|
*/
|
|
|
|
|
#define CONFIG_SERVICE_ARRAY \
|
|
|
|
|
{ \
|
|
|
|
|
{\
|
|
|
|
|
IPCONFIG_V4, \
|
|
|
|
|
CONFIG_FROM_WEB|CONFIG_FROM_NETOPEER, \
|
|
|
|
|
FALSE, \
|
|
|
|
|
ip_config_chk, \
|
|
|
|
|
ip_config_proc, \
|
|
|
|
|
ip_config_get, \
|
|
|
|
|
ip_config_get_all \
|
|
|
|
|
},\
|
|
|
|
|
{\
|
|
|
|
|
BR_CONFIG, \
|
|
|
|
|
CONFIG_FROM_WEB|CONFIG_FROM_NETOPEER, \
|
|
|
|
|
FALSE, \
|
|
|
|
|
br_config_chk, \
|
|
|
|
|
br_config_proc, \
|
|
|
|
|
NULL, \
|
|
|
|
|
NULL \
|
|
|
|
|
},\
|
|
|
|
|
{\
|
2019-08-07 03:49:31 +00:00
|
|
|
|
BRIF_CONFIG, \
|
|
|
|
|
CONFIG_FROM_WEB|CONFIG_FROM_NETOPEER, \
|
|
|
|
|
FALSE, \
|
|
|
|
|
br_if_config_chk, \
|
|
|
|
|
br_if_config_proc, \
|
|
|
|
|
br_if_config_get, \
|
|
|
|
|
br_if_config_get_all \
|
2019-08-06 12:04:23 +00:00
|
|
|
|
},\
|
|
|
|
|
{\
|
2019-08-07 03:49:31 +00:00
|
|
|
|
BRFDB_CONFIG, \
|
|
|
|
|
CONFIG_FROM_WEB|CONFIG_FROM_NETOPEER, \
|
|
|
|
|
FALSE, \
|
|
|
|
|
br_fdb_config_chk, \
|
|
|
|
|
NULL, \
|
|
|
|
|
br_fdb_config_get, \
|
|
|
|
|
NULL \
|
2019-08-06 12:04:23 +00:00
|
|
|
|
},\
|
|
|
|
|
{\
|
|
|
|
|
USER_MANAGER_CONFIG_GROUP, \
|
|
|
|
|
CONFIG_FROM_WEB, \
|
|
|
|
|
FALSE, \
|
|
|
|
|
usergroup_config_chk, \
|
|
|
|
|
usergroup_config_proc, \
|
|
|
|
|
usergroup_config_get, \
|
|
|
|
|
usergroup_config_get_all \
|
|
|
|
|
},\
|
|
|
|
|
{ \
|
|
|
|
|
AUTHFREE_CONFIG, \
|
|
|
|
|
CONFIG_FROM_WEB|CONFIG_FROM_NETOPEER, \
|
|
|
|
|
FALSE, \
|
|
|
|
|
freeauth_config_chk, \
|
|
|
|
|
freeauth_config_proc, \
|
|
|
|
|
NULL, \
|
|
|
|
|
NULL \
|
|
|
|
|
},\
|
|
|
|
|
{\
|
2019-08-09 12:49:17 +00:00
|
|
|
|
FREEPARAMETERS_CONFIG, \
|
2019-08-06 12:04:23 +00:00
|
|
|
|
CONFIG_FROM_WEB|CONFIG_FROM_NETOPEER, \
|
|
|
|
|
FALSE, \
|
2019-08-09 12:49:17 +00:00
|
|
|
|
authpara_config_chk, \
|
|
|
|
|
authpara_config_proc, \
|
2019-08-06 12:04:23 +00:00
|
|
|
|
NULL, \
|
|
|
|
|
NULL \
|
|
|
|
|
},\
|
|
|
|
|
{\
|
|
|
|
|
USER_MANAGER_CONFIG_USER, \
|
|
|
|
|
CONFIG_FROM_WEB, \
|
|
|
|
|
FALSE, \
|
|
|
|
|
user_config_chk, \
|
|
|
|
|
user_config_proc, \
|
|
|
|
|
user_config_get, \
|
|
|
|
|
user_config_get_all \
|
|
|
|
|
},\
|
|
|
|
|
{\
|
|
|
|
|
LOG_CONFIG_CONSOLE, \
|
|
|
|
|
CONFIG_FROM_WEB, \
|
|
|
|
|
FALSE, \
|
|
|
|
|
log_console_config_chk, \
|
|
|
|
|
log_console_config_proc, \
|
|
|
|
|
NULL, \
|
|
|
|
|
NULL \
|
2019-08-13 08:25:43 +00:00
|
|
|
|
},\
|
|
|
|
|
{\
|
|
|
|
|
LOG_CONFIG_MONITOR, \
|
|
|
|
|
CONFIG_FROM_WEB, \
|
|
|
|
|
FALSE, \
|
|
|
|
|
log_monitor_config_chk, \
|
|
|
|
|
log_monitor_config_proc, \
|
|
|
|
|
NULL, \
|
|
|
|
|
NULL \
|
|
|
|
|
},\
|
|
|
|
|
{\
|
|
|
|
|
LOG_CONFIG_REMOTE_ADD_HOST, \
|
|
|
|
|
CONFIG_FROM_WEB, \
|
|
|
|
|
FALSE, \
|
2019-08-13 10:22:20 +00:00
|
|
|
|
log_remote_host_config_chk, \
|
|
|
|
|
log_remote_add_host_config_proc, \
|
2019-08-13 08:25:43 +00:00
|
|
|
|
NULL, \
|
|
|
|
|
NULL \
|
|
|
|
|
},\
|
|
|
|
|
{\
|
|
|
|
|
LOG_CONFIG_REMOTE_DEL_HOST, \
|
|
|
|
|
CONFIG_FROM_WEB, \
|
|
|
|
|
FALSE, \
|
2019-08-13 10:22:20 +00:00
|
|
|
|
log_remote_host_config_chk, \
|
|
|
|
|
log_remote_del_host_config_proc, \
|
2019-08-13 08:25:43 +00:00
|
|
|
|
NULL, \
|
|
|
|
|
NULL \
|
2019-08-14 09:17:18 +00:00
|
|
|
|
},\
|
|
|
|
|
{\
|
|
|
|
|
LOG_CONFIG_REMOTE_LEVEL, \
|
|
|
|
|
CONFIG_FROM_WEB, \
|
|
|
|
|
FALSE, \
|
|
|
|
|
log_remote_level_config_chk, \
|
|
|
|
|
log_remote_level_config_proc, \
|
|
|
|
|
NULL, \
|
|
|
|
|
NULL \
|
|
|
|
|
},\
|
|
|
|
|
{\
|
|
|
|
|
LOG_CONFIG_FILE, \
|
|
|
|
|
CONFIG_FROM_WEB, \
|
|
|
|
|
FALSE, \
|
|
|
|
|
log_file_config_chk, \
|
|
|
|
|
log_file_config_proc, \
|
|
|
|
|
NULL, \
|
|
|
|
|
NULL \
|
2019-08-21 11:42:12 +00:00
|
|
|
|
},\
|
|
|
|
|
{\
|
|
|
|
|
NAT4_CONFIG, \
|
|
|
|
|
CONFIG_FROM_WEB, \
|
|
|
|
|
FALSE, \
|
|
|
|
|
nat_config_chk, \
|
|
|
|
|
nat_config_proc, \
|
|
|
|
|
NULL, \
|
|
|
|
|
nat_config_get_all \
|
|
|
|
|
}\
|
2019-08-06 12:04:23 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
typedef ret_code (*cm_config_init)();
|
|
|
|
|
|
|
|
|
|
typedef ret_code (*cm_config_chk)(uint source, uint *config_type,
|
|
|
|
|
pointer input, int *input_len,
|
|
|
|
|
pointer output, int *output_len);
|
|
|
|
|
|
|
|
|
|
typedef ret_code (*cm_config_proc)(uint source, uint config_type,
|
|
|
|
|
pointer input, int input_len,
|
|
|
|
|
pointer output, int *output_len);
|
|
|
|
|
|
|
|
|
|
typedef ret_code (*cm_config_get)(uint source,
|
|
|
|
|
pointer input, int input_len,
|
|
|
|
|
pointer output, int *output_len);
|
|
|
|
|
|
|
|
|
|
typedef ret_code (*cm_config_get_all)(uint source,
|
|
|
|
|
pointer output, int *output_len);
|
|
|
|
|
|
|
|
|
|
/* 配置注册 */
|
|
|
|
|
struct _config_init {
|
|
|
|
|
uint config_mudlue;
|
|
|
|
|
cm_config_init init_callback;
|
|
|
|
|
};
|
|
|
|
|
typedef struct _config_init config_init_t;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* 配置注册 */
|
|
|
|
|
struct _config_service {
|
|
|
|
|
uint64 config_id; /* 配置ID,全局唯一,用于寻找对应的配置业务*/
|
|
|
|
|
uint config_src; /* 配置源检查,全局唯一,用于寻找对应的配置业务,从低位到高位,第一位表示web,后续配置扩展 */
|
|
|
|
|
boolean recovery; /* 配置恢复处理函数,如果为FALSE则不进行配置恢复 */
|
|
|
|
|
cm_config_chk chk_callback; /* 配置校验回调函数 */
|
|
|
|
|
cm_config_proc proc_callback; /* 配置接口 */
|
|
|
|
|
cm_config_get get_callback; /* 获取配置接口 */
|
|
|
|
|
cm_config_get_all getall_callback; /* 获取所有配置接口 */
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
typedef struct _config_service config_service_t;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif /* RPC_COMMON_H_ */
|
|
|
|
|
|