#ifndef CONFIGMAPI_H_
#define CONFIGMAPI_H_

#include "rpc_common.h"

#define CONFIG_FROM_WEB      0x00000001
#define CONFIG_FROM_NETOPEER 0x00000010
#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 BUFFER_SIZE

#define CONFIG_RECOVERY_DONE "/tmp/config_recovery"

/* 结构体定义 */

/* 配置消息 */
struct _config_message {
    uint64 config_id;               /*配置ID*/ 
    uint   source;                  /*配置来源*/
    uint   config_type;             /*配置类型:add,del,set*/
    char   config_buff[0];          /*配置数据缓存*/
};
typedef struct _config_message config_msg_t;
/* 函数声明 */

ret_code web_config_exec_sync(uint config_type, uint64 config_id,  
                              char* config_data, int config_len,
                              char**output, int *output_len);

ret_code web_config_exec_async(uint config_type, uint64 config_id,  
                               char* config_data, int config_len,
                               rpc_callback callback, pointer data);

#endif /* RPC_COMMON_H_ */