Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

configparser.h

Go to the documentation of this file.
00001 
00009 /* {{{ Initial headers */
00010 /*
00011  * $LastChangedDate: 2004-04-15 14:41:57 +0200 (Thu, 15 Apr 2004) $
00012  * $LastChangedRevision: 53 $
00013  * $LastChangedBy: ckruse $
00014  *
00015  */
00016 /* }}} */
00017 
00018 #ifndef __CONFIGPARSER_H
00019 #define __CONFIGPARSER_H
00020 
00021 struct s_conf_opt;
00022 struct s_configfile;
00023 
00025 typedef struct s_conf_opt t_conf_opt;
00026 
00028 typedef struct s_configfile t_configfile;
00029 
00038 typedef int (*t_take)(t_configfile *cfile,t_conf_opt *entry,u_char **args,int len);
00039 
00047 typedef int (*t_take_default)(t_configfile *cfile,u_char **args,int len);
00048 
00050 struct s_conf_opt {
00051   u_char *name; 
00052   t_take callback; 
00053   void *data; 
00054 };
00055 
00057 struct s_configfile {
00058   u_char *filename; 
00059   t_cf_hash *options; 
00060 };
00061 
00063 typedef struct s_name_value {
00064   u_char *name; 
00066   u_char **values; 
00067   int valnum; 
00069   struct s_name_value *next; 
00070 } t_name_value;
00071 
00072 /***** NEW config parser API *****/
00073 
00075 typedef struct s_configuration {
00076   t_name_value *directives; 
00077   t_name_value *actual; 
00078   int len; 
00079 } t_configuration;
00080 
00081 /* module API */
00082 
00084 typedef struct s_handler_config {
00085   int handler; 
00086   void *func; 
00087 } t_handler_config;
00088 
00090 typedef void (*t_finish)(void);
00091 
00093 typedef int (*t_cache_revalidator)(t_cf_hash *,t_configuration *,t_configuration *,time_t,int);
00094 
00096 typedef int (*t_header_hook)(t_cf_hash *,t_cf_hash *,t_configuration *,t_configuration *,int);
00097 
00099 typedef time_t (*t_last_modified)(t_cf_hash *,t_configuration *,t_configuration *,int);
00100 
00102 typedef struct s_module_config {
00103   t_conf_opt *cfgopts; 
00104   t_handler_config *handlers; 
00105   t_cache_revalidator revalidator; 
00106   t_last_modified last_modified; 
00107   t_header_hook header_hook; 
00108   t_finish finish; 
00109 } t_module_config;
00110 
00112 typedef struct s_module {
00113   void *module; 
00114   t_handler_config *handler; 
00115   t_module_config *cfg; 
00116 } t_module;
00117 
00118 extern t_configuration fo_default_conf; 
00119 extern t_configuration fo_server_conf; 
00120 extern t_configuration fo_view_conf; 
00121 extern t_configuration fo_arcview_conf; 
00122 extern t_configuration fo_post_conf; 
00124 extern t_conf_opt default_options[]; 
00125 extern t_conf_opt fo_view_options[]; 
00126 extern t_conf_opt fo_post_options[]; 
00127 extern t_conf_opt fo_server_options[]; 
00128 extern t_conf_opt fo_arcview_options[]; 
00130 extern t_array Modules[]; 
00132 /***** NEW config parser API ****/
00133 
00134 
00135 /* functions */
00136 
00146 t_array *get_conf_file(const u_char **which,size_t llen);
00147 
00154 int read_config(t_configfile *conf,t_take_default deflt);
00155 
00161 void cfg_init_file(t_configfile *conf,u_char *filename);
00162 
00168 int cfg_register_options(t_configfile *conf,t_conf_opt *opts);
00169 
00174 void cfg_cleanup_file(t_configfile *conf);
00175 
00180 void cleanup_modules(t_array *modules);
00181 
00190 int handle_command(t_configfile *cfile,t_conf_opt *opt,u_char **args,int argnum);
00191 
00200 int add_module(t_configfile *cfile,t_conf_opt *opt,u_char **args,int argnum);
00201 
00206 void cfg_cleanup(t_configuration *cfg);
00207 
00214 t_name_value *cfg_get_value(t_configuration *cfg,const u_char *name);
00215 
00220 void cfg_destroy_module(void *element);
00221 
00222 #endif
00223 
00224 /* eof */

Generated on Sun Apr 25 16:37:37 2004 for Classic Forum by doxygen 1.3.5