2014-11-19 00:25:21 +08:00
|
|
|
|
#pragma once
|
2017-06-02 14:47:24 +08:00
|
|
|
|
#include "../acl_cpp_define.hpp"
|
2014-11-19 00:25:21 +08:00
|
|
|
|
|
|
|
|
|
struct ACL_XINETD_CFG_PARSER;
|
|
|
|
|
struct ACL_CFG_INT_TABLE;
|
|
|
|
|
struct ACL_CFG_INT64_TABLE;
|
|
|
|
|
struct ACL_CFG_STR_TABLE;
|
|
|
|
|
struct ACL_CFG_BOOL_TABLE;
|
|
|
|
|
|
|
|
|
|
namespace acl {
|
|
|
|
|
|
|
|
|
|
typedef struct master_int_tbl
|
|
|
|
|
{
|
|
|
|
|
const char *name;
|
|
|
|
|
int defval;
|
|
|
|
|
int *target;
|
|
|
|
|
int min;
|
|
|
|
|
int max;
|
|
|
|
|
} master_int_tbl;
|
|
|
|
|
|
|
|
|
|
typedef struct master_str_tbl
|
|
|
|
|
{
|
|
|
|
|
const char *name;
|
|
|
|
|
const char *defval;
|
|
|
|
|
char **target;
|
|
|
|
|
} master_str_tbl;
|
|
|
|
|
|
|
|
|
|
typedef struct master_bool_tbl
|
|
|
|
|
{
|
|
|
|
|
const char *name;
|
|
|
|
|
int defval;
|
|
|
|
|
int *target;
|
|
|
|
|
} master_bool_tbl;
|
|
|
|
|
|
|
|
|
|
typedef struct master_int64_tbl
|
|
|
|
|
{
|
|
|
|
|
const char *name;
|
2015-06-29 17:33:11 +08:00
|
|
|
|
#if defined(_WIN32) || defined(_WIN64)
|
2014-11-19 00:25:21 +08:00
|
|
|
|
__int64 defval;
|
|
|
|
|
__int64 *target;
|
|
|
|
|
__int64 min;
|
|
|
|
|
__int64 max;
|
|
|
|
|
#else
|
|
|
|
|
long long int defval;
|
|
|
|
|
long long int *target;
|
|
|
|
|
long long int min;
|
|
|
|
|
long long int max;
|
|
|
|
|
#endif
|
|
|
|
|
} master_int64_tbl;
|
|
|
|
|
|
|
|
|
|
class master_base;
|
|
|
|
|
|
|
|
|
|
class ACL_CPP_API master_conf
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
master_conf();
|
|
|
|
|
~master_conf();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> bool <EFBFBD><EFBFBD><EFBFBD>͵<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param table {master_bool_tbl*}
|
|
|
|
|
*/
|
|
|
|
|
void set_cfg_bool(master_bool_tbl* table);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> int <EFBFBD><EFBFBD><EFBFBD>͵<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param table {master_int_tbl*}
|
|
|
|
|
*/
|
|
|
|
|
void set_cfg_int(master_int_tbl* table);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> int64 <EFBFBD><EFBFBD><EFBFBD>͵<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param table {master_int64_tbl*}
|
|
|
|
|
*/
|
|
|
|
|
void set_cfg_int64(master_int64_tbl* table);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> <EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD> <EFBFBD><EFBFBD><EFBFBD>͵<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param table {master_str_tbl*}
|
|
|
|
|
*/
|
|
|
|
|
void set_cfg_str(master_str_tbl* table);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
|
|
|
|
|
* @param path {const char*} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>ȫ·<EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
void load(const char* path);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ý<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬<EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD>֮ǰ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Դ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ô˺<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* ֮ǰ<EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD><EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ潫<EFBFBD>ᱻ<EFBFBD>ͷţ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Խ<EFBFBD>ֹ<EFBFBD><EFBFBD><EFBFBD>ã<EFBFBD>
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD>øú<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ý<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ٴ<EFBFBD>ʹ<EFBFBD>ý<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
void reset(void);
|
|
|
|
|
|
|
|
|
|
ACL_CFG_INT_TABLE* get_int_cfg() const;
|
|
|
|
|
ACL_CFG_INT64_TABLE* get_int64_cfg() const;
|
|
|
|
|
ACL_CFG_STR_TABLE* get_str_cfg() const;
|
|
|
|
|
ACL_CFG_BOOL_TABLE* get_bool_cfg() const;
|
|
|
|
|
protected:
|
|
|
|
|
private:
|
|
|
|
|
bool cfg_loaded_;
|
|
|
|
|
|
|
|
|
|
ACL_XINETD_CFG_PARSER* cfg_;
|
|
|
|
|
ACL_CFG_INT_TABLE* int_cfg_;
|
|
|
|
|
ACL_CFG_INT64_TABLE* int64_cfg_;
|
|
|
|
|
ACL_CFG_STR_TABLE* str_cfg_;
|
|
|
|
|
ACL_CFG_BOOL_TABLE* bool_cfg_;
|
|
|
|
|
|
|
|
|
|
master_int_tbl* int_tbl_;
|
|
|
|
|
master_str_tbl* str_tbl_;
|
|
|
|
|
master_bool_tbl* bool_tbl_;
|
|
|
|
|
master_int64_tbl* int64_tbl_;
|
|
|
|
|
|
|
|
|
|
void load_str(void);
|
|
|
|
|
void load_bool(void);
|
|
|
|
|
void load_int(void);
|
|
|
|
|
void load_int64(void);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace acl
|