secgateway/Platform/user/configm/config-server/include/configm.h

385 lines
11 KiB
C
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#ifndef CONFIGM_H_
#define CONFIGM_H_
#include "config_manager.h"
#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"
#include "../user_manager_config/user_recover_config.h"
#include "netconfig.h"
#include "log_config.h"
#include "../web_config/authfree.h"
#include "../web_config/auth_parameters.h"
#include "../web_config/auth_recover_config.h"
#include "natconfig.h"
#include "vlan_config.h"
#include "dhcp_lib.h"
#include "static_routing.h"
#include "LTE_config.h"
#include "../object_manager/object_manager.h"
#define RET_CODE_LEN 16
#define RET_MSG_LEN 128
#define CONFIG_INIT_ARRAY \
{\
{ \
NETCONFIG_MODULE, \
net_main \
}, \
{ \
LOG_CONFIG_MODULE, \
log_config_init \
}, \
{ \
VLAN_CONFIG_MODULE, \
vlan_config_init \
}, \
{ \
DHCP_CONFIG_MODULE, \
dhcp_config_init \
}, \
{ \
OBJECT_MANAGER_CONFIG_MODULE, \
object_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 \
},\
{\
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 \
},\
{\
BRFDB_CONFIG, \
CONFIG_FROM_WEB|CONFIG_FROM_NETOPEER, \
FALSE, \
br_fdb_config_chk, \
NULL, \
br_fdb_config_get, \
NULL \
},\
{\
USER_MANAGER_CONFIG_GROUP, \
CONFIG_FROM_WEB, \
FALSE, \
usergroup_config_chk, \
usergroup_config_proc, \
usergroup_config_get, \
usergroup_config_get_all \
},\
{\
USER_MANAGER_CONFIG_RECOVER, \
CONFIG_FROM_RECOVER1, \
TRUE, \
userecover_config_chk, \
userecover_config_proc, \
userecover_config_get, \
userecover_config_get_all \
},\
{ \
AUTHFREE_CONFIG, \
CONFIG_FROM_WEB|CONFIG_FROM_NETOPEER, \
FALSE, \
freeauth_config_chk, \
freeauth_config_proc, \
NULL, \
NULL \
},\
{\
FREEPARAMETERS_CONFIG, \
CONFIG_FROM_WEB|CONFIG_FROM_NETOPEER, \
FALSE, \
authpara_config_chk, \
authpara_config_proc, \
NULL, \
NULL \
},\
{\
AUTH_CONFIG_RECOVER, \
CONFIG_FROM_RECOVER1, \
TRUE, \
auth_recover_chk, \
auth_recover_proc, \
auth_recover_get, \
auth_recover_get_all \
},\
{\
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, \
log_console_config_get, \
log_console_config_getall \
},\
{\
LOG_CONFIG_MONITOR, \
CONFIG_FROM_WEB, \
FALSE, \
log_monitor_config_chk, \
log_monitor_config_proc, \
log_monitor_config_get, \
log_monitor_config_getall \
},\
{\
LOG_CONFIG_REMOTE_ADD_HOST, \
CONFIG_FROM_WEB, \
FALSE, \
log_remote_host_config_chk, \
log_remote_add_host_config_proc, \
NULL, \
NULL \
},\
{\
LOG_CONFIG_REMOTE_DEL_HOST, \
CONFIG_FROM_WEB, \
FALSE, \
log_remote_host_config_chk, \
log_remote_del_host_config_proc, \
NULL, \
NULL \
},\
{\
LOG_CONFIG_REMOTE_LEVEL, \
CONFIG_FROM_WEB, \
FALSE, \
log_remote_level_config_chk, \
log_remote_level_config_proc, \
log_remote_level_config_get, \
log_remote_level_config_getall \
},\
{\
LOG_CONFIG_FILE, \
CONFIG_FROM_WEB, \
FALSE, \
log_file_config_chk, \
log_file_config_proc, \
log_file_config_get, \
log_file_config_getall \
},\
{\
LOG_CONFIG_REMOTE_GET_HOST, \
CONFIG_FROM_WEB, \
FALSE, \
log_remote_host_x_config_chk, \
NULL, \
log_remote_host_x_config_get, \
log_remote_host_x_config_getall \
},\
{\
NAT4_CONFIG, \
CONFIG_FROM_WEB, \
TRUE, \
nat_config_chk, \
nat_config_proc, \
NULL, \
nat_config_get_all \
},\
{\
VLAN_CONFIG, \
CONFIG_FROM_WEB|CONFIG_FROM_NETOPEER, \
FALSE, \
vlan_config_chk, \
vlan_config_proc, \
vlan_config_get, \
vlan_config_get_all \
},\
{\
DHCP_HOST_CONFIG, \
CONFIG_FROM_WEB, \
FALSE, \
dhcp_host_config_chk, \
dhcp_host_config_proc, \
dhcp_host_config_get, \
dhcp_host_config_get_all \
},\
{\
DHCP_SUBNET_CONFIG, \
CONFIG_FROM_WEB, \
FALSE, \
dhcp_subnet_config_chk, \
dhcp_subnet_config_proc, \
dhcp_subnet_config_get, \
dhcp_subnet_config_get_all \
},\
{\
DHCP_RELAY_CONFIG, \
CONFIG_FROM_WEB, \
FALSE, \
dhcp_relay_config_chk, \
dhcp_relay_config_proc, \
NULL, \
dhcp_relay_config_get_all \
},\
{\
DHCP_CLIENT_CONFIG, \
CONFIG_FROM_WEB, \
FALSE, \
dhcp_client_config_chk, \
dhcp_client_config_proc, \
dhcp_client_get, \
NULL \
},\
{\
DHCP_DHCPD_LEASE, \
CONFIG_FROM_WEB, \
FALSE, \
dhcp_dhcpd_lease_config_chk, \
NULL, \
NULL, \
dhcp_dhcpd_lease_get_all \
},\
{\
DHCP_SHARED_NETWORK_CONFIG, \
CONFIG_FROM_WEB, \
FALSE, \
dhcp_shared_network_config_chk, \
dhcp_shared_network_config_proc, \
NULL, \
dhcp_shared_network_config_get_all \
},\
{\
STATIC_ROUTING_CONFIG, \
CONFIG_FROM_WEB|CONFIG_FROM_NETOPEER, \
TRUE, \
routing_config_chk, \
routing_config_proc, \
NULL, \
routing_config_get_all \
},\
{\
GET_ALL_ROUTING_INFO, \
CONFIG_FROM_WEB|CONFIG_FROM_NETOPEER, \
FALSE, \
all_routing_config_chk, \
NULL, \
NULL, \
all_routing_get_all \
},\
{\
LTE_CONFIG, \
CONFIG_FROM_WEB|CONFIG_FROM_NETOPEER, \
FALSE, \
LTE_config_chk, \
LTE_config_proc, \
NULL, \
LTE_config_get_all \
}, \
{ \
OBJECT_CONFIG, \
CONFIG_FROM_WEB, \
FALSE, \
object_config_chk, \
object_config_proc, \
NULL, \
NULL, \
}, \
{ \
OBJECT_GETALL_CONFIG, \
CONFIG_FROM_WEB, \
FALSE, \
object_config_chk, \
NULL, \
object_config_get, \
object_config_get_all, \
} \
}
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;
struct _config_result {
char resultCode[RET_CODE_LEN];
char *message;
char *data;
};
typedef struct _config_result config_result_t;
int cm_format_data(ret_code ret_code, cJSON *json_obj, char *output);
#endif /* RPC_COMMON_H_ */