#ifndef CONFIGM_H_ #define CONFIGM_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 "netconfig.h" #include "log_config.h" #include "../web_config/authfree.h" #include "../web_config/auth_parameters.h" /* 类型定义 */ /* IP CONFIG */ #define NETCONFIG_MODULE 0x00000001 /* USER MANAGER CONFIG */ #define USER_MANAGER_CONFIG_MODULE 0x00000002 /*PORTAL SERVER CONFIG */ #define LOCALAUTH_CONFIG_MODULE 0x00000003 #define LOG_CONFIG_MODULE 0x00000004 /*nat config */ #define NAT_CONFIG_MODULE 0x00000008 /* config id define*/ #define IPCONFIG_V4 (uint64)((uint64)NETCONFIG_MODULE<<32|1) #define BR_CONFIG (uint64)((uint64)NETCONFIG_MODULE<<32|2) #define BRIF_CONFIG (uint64)((uint64)NETCONFIG_MODULE<<32|3) #define BRFDB_CONFIG (uint64)((uint64)NETCONFIG_MODULE<<32|4) #define USER_MANAGER_CONFIG_GROUP (uint64)((uint64)USER_MANAGER_CONFIG_MODULE<<32|1) #define USER_MANAGER_CONFIG_USER (uint64)((uint64)USER_MANAGER_CONFIG_MODULE<<32|2) #define AUTHFREE_CONFIG (uint64)((uint64)LOCALAUTH_CONFIG_MODULE<<32|1) #define FREEPARAMETERS_CONFIG (uint64)((uint64)LOCALAUTH_CONFIG_MODULE<<32|2) #define LOG_CONFIG_CONSOLE (uint64)((uint64)LOG_CONFIG_MODULE<<32|1) #define NAT4_CONFIG (uint64)((uint64)NAT_CONFIG_MODULE<<32|1) #define CONFIG_INIT_ARRAY \ {\ { \ NETCONFIG_MODULE, \ net_main \ }, \ { \ 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 \ },\ {\ 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 \ },\ { \ 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 \ },\ {\ 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 \ }\ } 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_ */