MOD aaa-12 config_type定义挪至config_manager.h里面
SOL config_type定义挪至config_manager.h里面 修改人:zhangliang 检视人:zhangliang
This commit is contained in:
parent
496451c9c9
commit
f7bbd461c8
|
@ -1,25 +1,34 @@
|
|||
#ifndef _CONFIG_MANAGER_H
|
||||
#define _CONFIG_MANAGER_H
|
||||
|
||||
/* 类型定义 */
|
||||
/************************ 操作类型定义 ********************/
|
||||
|
||||
/* IP CONFIG */
|
||||
#define NETCONFIG_MODULE 0x00000001
|
||||
#define CM_CONFIG_ADD 1
|
||||
#define CM_CONFIG_DEL 2
|
||||
#define CM_CONFIG_SET 3
|
||||
#define CM_CONFIG_GET 4
|
||||
#define CM_CONFIG_GET_ALL 5
|
||||
|
||||
/***********************操作类型定义结束 ********************/
|
||||
|
||||
/*************************** 模块定义 ************************/
|
||||
/* NET CONFIG */
|
||||
#define NETCONFIG_MODULE 0x00000001
|
||||
|
||||
/* USER MANAGER CONFIG */
|
||||
#define USER_MANAGER_CONFIG_MODULE 0x00000002
|
||||
#define USER_MANAGER_CONFIG_MODULE 0x00000002
|
||||
|
||||
/*PORTAL SERVER CONFIG */
|
||||
#define LOCALAUTH_CONFIG_MODULE 0x00000003
|
||||
#define LOCALAUTH_CONFIG_MODULE 0x00000003
|
||||
|
||||
#define LOG_CONFIG_MODULE 0x00000004
|
||||
#define LOG_CONFIG_MODULE 0x00000004
|
||||
|
||||
/*nat config */
|
||||
#define NAT_CONFIG_MODULE 0x00000008
|
||||
#define NAT_CONFIG_MODULE 0x00000008
|
||||
|
||||
/************************* 模块定义结束 **********************/
|
||||
|
||||
|
||||
/* config id define*/
|
||||
/************************ config id定义 **********************/
|
||||
#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)
|
||||
|
@ -42,5 +51,13 @@
|
|||
|
||||
#define NAT4_CONFIG (uint64)((uint64)NAT_CONFIG_MODULE<<32|1)
|
||||
|
||||
/************************ config id定义 end**********************/
|
||||
|
||||
#endif
|
||||
|
||||
/* error no, 32位,前16位为模块ID,后16位为模块错误码 */
|
||||
|
||||
/*0x00000000 ~ 0x0000ffff 为系统预留错误码,用于一般性系统错误,例如内存不够,输入错误等*/
|
||||
|
||||
/* NETCONFIG_MODULE */
|
||||
#define NETCONFIG_IPVALID (uint)((uint)NETCONFIG_MODULE<<16|1)
|
||||
#endif
|
||||
|
|
|
@ -8,12 +8,6 @@
|
|||
#define CONFIG_FROM_RECOVER1 0x01000000
|
||||
#define CONFIG_FROM_RECOVER2 0x02000000
|
||||
|
||||
#define CM_CONFIG_ADD 1
|
||||
#define CM_CONFIG_DEL 2
|
||||
#define CM_CONFIG_SET 3
|
||||
#define CM_CONFIG_GET 4
|
||||
#define CM_CONFIG_GET_ALL 5
|
||||
|
||||
#define CM_BUFF_SIZE BUF_MAX_SIZE
|
||||
|
||||
#define CONFIG_RECOVERY_DONE "/tmp/config_recovery"
|
||||
|
|
|
@ -27,18 +27,20 @@ void cm_return(rpc_conn *conn, ret_code err_code, char* err_message)
|
|||
cJSON *res;
|
||||
char *ret_char = NULL;
|
||||
|
||||
rpc_log_dbg("result %d:%s\n", err_code, err_message);
|
||||
|
||||
res = cJSON_CreateObject();
|
||||
if(res == NULL)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
cJSON_AddStringToObject(res, "result", err_message);
|
||||
cJSON_AddNumberToObject(res, "result", err_code);
|
||||
ret_char = cJSON_PrintUnformatted(res);
|
||||
|
||||
cJSON_Delete(res);
|
||||
|
||||
rpc_return_error(conn, err_code, ret_char);
|
||||
rpc_return(conn, ret_char, strlen(ret_char)+1);
|
||||
rpc_free(ret_char);
|
||||
|
||||
return;
|
||||
|
@ -408,7 +410,6 @@ int main(int argc, char **argv)
|
|||
|
||||
/* 注册配置处理函数 */
|
||||
rpc_server_regservice(server, "ConfigManger#0", "cm_config_process", cm_config_process);
|
||||
//rpc_server_regservice(server, "ConfigManger#0", "test_big_data", test_big_data);
|
||||
|
||||
for(;;)
|
||||
{
|
||||
|
|
|
@ -93,8 +93,11 @@ ret_code ip_config_json_parse(pointer input, uint *conf_type, ip_config_t *confi
|
|||
config_buff->family = (uchar)ip_config->family;
|
||||
config_buff->prefixlen = (uchar)ip_config->prefixlen;
|
||||
config_buff->prefix.s_addr = inet_addr(ip_config->ipaddr);
|
||||
|
||||
*conf_type = ip_config->config_type;
|
||||
|
||||
if(ip_config->config_type)
|
||||
{
|
||||
*conf_type = ip_config->config_type;
|
||||
}
|
||||
|
||||
s2j_delete_struct_obj(ip_config);
|
||||
cJSON_Delete(json_obj);
|
||||
|
|
Loading…
Reference in New Issue