1: !ifndef _RSK_LIBCONFIG_H 2: !define _RSK_LIBCONFIG_H 3: !ifdef __cplusplus 4: extern "C" { 5: !endif 6: 7: __BLANK_LINE__ 8: 9: typedef enum { 10: LC_CONF_SECTION, 11: LC_CONF_APACHE, 12: LC_CONF_COLON, 13: LC_CONF_EQUAL, 14: LC_CONF_SPACE, 15: LC_CONF_XML 16: } lc_conf_type_t; 17: 18: __BLANK_LINE__ 19: 20: typedef enum { 21: LC_VAR_UNKNOWN, 22: LC_VAR_NONE, 23: LC_VAR_STRING, 24: LC_VAR_LONG_LONG, 25: LC_VAR_LONG, 26: LC_VAR_INT, 27: LC_VAR_SHORT, 28: LC_VAR_BOOL, 29: LC_VAR_FILENAME, 30: LC_VAR_DIRECTORY, 31: LC_VAR_SIZE_LONG_LONG, 32: LC_VAR_SIZE_LONG, 33: LC_VAR_SIZE_INT, 34: LC_VAR_SIZE_SHORT, 35: LC_VAR_TIME, 36: LC_VAR_DATE, 37: LC_VAR_SECTION, 38: LC_VAR_SECTIONSTART, 39: LC_VAR_SECTIONEND, 40: LC_VAR_BOOL_BY_EXISTANCE, 41: LC_VAR_SIZE_SIZE_T, 42: LC_VAR_CIDR, 43: LC_VAR_IP, 44: LC_VAR_IP4, 45: LC_VAR_IP6, 46: LC_VAR_ADDR, 47: LC_VAR_ADDR4, 48: LC_VAR_ADDR6, 49: LC_VAR_HOSTNAME, 50: LC_VAR_HOSTNAME4, 51: LC_VAR_HOSTNAME6, 52: LC_VAR_DOUBLE, 53: LC_VAR_FLOAT, 54: LC_VAR_LIST = 0x80 55: } lc_var_type_t; 56: 57: __BLANK_LINE__ 58: 59: typedef enum { 60: LC_FLAGS_VAR, 61: LC_FLAGS_CMDLINE, 62: LC_FLAGS_ENVIRON, 63: LC_FLAGS_SECTIONSTART, 64: LC_FLAGS_SECTIONEND 65: } lc_flags_t; 66: 67: __BLANK_LINE__ 68: 69: typedef enum { 70: LC_ERR_NONE, 71: LC_ERR_INVCMD, 72: LC_ERR_INVSECTION, 73: LC_ERR_INVDATA, 74: LC_ERR_BADFORMAT, 75: LC_ERR_CANTOPEN, 76: LC_ERR_CALLBACK, 77: LC_ERR_ENOMEM 78: } lc_err_t; 79: 80: __BLANK_LINE__ 81: 82: int lc_process(int argc, char **argv, const char *appname, lc_conf_type_t type, const char *extra); 83: int lc_register_callback(const char *var, char opt, lc_var_type_t type, int (*callback)(const char *, const char *, const char *, const char *, lc_flags_t, void *), void *extra); 84: int lc_register_var(const char *var, lc_var_type_t type, void *data, char opt); 85: lc_err_t lc_geterrno(void); 86: void lc_seterrstr(const char *usererrstr); 87: char *lc_geterrstr(void); 88: int lc_process_file(const char *appname, const char *pathname, lc_conf_type_t type); 89: int lc_handle_type(lc_var_type_t type, const char *value, void *data); 90: void lc_cleanup(void); 91: 92: __BLANK_LINE__ 93: 94: !define LC_CBRET_IGNORESECTION (255) 95: !define LC_CBRET_OKAY (0) 96: !define LC_CBRET_ERROR (-1) 97: 98: __BLANK_LINE__ 99: 100: extern int lc_optind; 101: 102: __BLANK_LINE__ 103: 104: !ifdef __cplusplus 105: } 106: !endif 107: !endif |