00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00026 #ifndef APACHE_HTTP_CONFIG_H
00027 #define APACHE_HTTP_CONFIG_H
00028
00029 #include "apr_hooks.h"
00030 #include "util_cfgtree.h"
00031
00032 #ifdef __cplusplus
00033 extern "C" {
00034 #endif
00035
00036
00037
00038
00039
00040
00041
00048 enum cmd_how {
00049 RAW_ARGS,
00050 TAKE1,
00051 TAKE2,
00052 ITERATE,
00055 ITERATE2,
00058 FLAG,
00059 NO_ARGS,
00060 TAKE12,
00061 TAKE3,
00062 TAKE23,
00063 TAKE123,
00064 TAKE13,
00065 TAKE_ARGV
00066 };
00072 typedef struct cmd_parms_struct cmd_parms;
00073
00074 #if defined(AP_HAVE_DESIGNATED_INITIALIZER) || defined(DOXYGEN)
00075
00080 typedef union {
00082 const char *(*no_args) (cmd_parms *parms, void *mconfig);
00084 const char *(*raw_args) (cmd_parms *parms, void *mconfig,
00085 const char *args);
00087 const char *(*take_argv) (cmd_parms *parms, void *mconfig,
00088 int argc, char *const argv[]);
00090 const char *(*take1) (cmd_parms *parms, void *mconfig, const char *w);
00092 const char *(*take2) (cmd_parms *parms, void *mconfig, const char *w,
00093 const char *w2);
00095 const char *(*take3) (cmd_parms *parms, void *mconfig, const char *w,
00096 const char *w2, const char *w3);
00098 const char *(*flag) (cmd_parms *parms, void *mconfig, int on);
00099 } cmd_func;
00100
00102 # define AP_NO_ARGS func.no_args
00103
00104 # define AP_RAW_ARGS func.raw_args
00105
00106 # define AP_TAKE_ARGV func.take_argv
00107
00108 # define AP_TAKE1 func.take1
00109
00110 # define AP_TAKE2 func.take2
00111
00112 # define AP_TAKE3 func.take3
00113
00114 # define AP_FLAG func.flag
00115
00117 # define AP_INIT_NO_ARGS(directive, func, mconfig, where, help) \
00118 { directive, { .no_args=func }, mconfig, where, RAW_ARGS, help }
00119
00120 # define AP_INIT_RAW_ARGS(directive, func, mconfig, where, help) \
00121 { directive, { .raw_args=func }, mconfig, where, RAW_ARGS, help }
00122
00123 # define AP_INIT_TAKE_ARGV(directive, func, mconfig, where, help) \
00124 { directive, { .take_argv=func }, mconfig, where, TAKE_ARGV, help }
00125
00126 # define AP_INIT_TAKE1(directive, func, mconfig, where, help) \
00127 { directive, { .take1=func }, mconfig, where, TAKE1, help }
00128
00129 # define AP_INIT_ITERATE(directive, func, mconfig, where, help) \
00130 { directive, { .take1=func }, mconfig, where, ITERATE, help }
00131
00132 # define AP_INIT_TAKE2(directive, func, mconfig, where, help) \
00133 { directive, { .take2=func }, mconfig, where, TAKE2, help }
00134
00135 # define AP_INIT_TAKE12(directive, func, mconfig, where, help) \
00136 { directive, { .take2=func }, mconfig, where, TAKE12, help }
00137
00138 # define AP_INIT_ITERATE2(directive, func, mconfig, where, help) \
00139 { directive, { .take2=func }, mconfig, where, ITERATE2, help }
00140
00141 # define AP_INIT_TAKE13(directive, func, mconfig, where, help) \
00142 { directive, { .take3=func }, mconfig, where, TAKE13, help }
00143
00144 # define AP_INIT_TAKE23(directive, func, mconfig, where, help) \
00145 { directive, { .take3=func }, mconfig, where, TAKE23, help }
00146
00147 # define AP_INIT_TAKE123(directive, func, mconfig, where, help) \
00148 { directive, { .take3=func }, mconfig, where, TAKE123, help }
00149
00150 # define AP_INIT_TAKE3(directive, func, mconfig, where, help) \
00151 { directive, { .take3=func }, mconfig, where, TAKE3, help }
00152
00153 # define AP_INIT_FLAG(directive, func, mconfig, where, help) \
00154 { directive, { .flag=func }, mconfig, where, FLAG, help }
00155
00156 #else
00157
00158 typedef const char *(*cmd_func) ();
00159
00160 # define AP_NO_ARGS func
00161 # define AP_RAW_ARGS func
00162 # define AP_TAKE_ARGV func
00163 # define AP_TAKE1 func
00164 # define AP_TAKE2 func
00165 # define AP_TAKE3 func
00166 # define AP_FLAG func
00167
00168 # define AP_INIT_NO_ARGS(directive, func, mconfig, where, help) \
00169 { directive, func, mconfig, where, RAW_ARGS, help }
00170 # define AP_INIT_RAW_ARGS(directive, func, mconfig, where, help) \
00171 { directive, func, mconfig, where, RAW_ARGS, help }
00172 # define AP_INIT_TAKE_ARGV(directive, func, mconfig, where, help) \
00173 { directive, func, mconfig, where, TAKE_ARGV, help }
00174 # define AP_INIT_TAKE1(directive, func, mconfig, where, help) \
00175 { directive, func, mconfig, where, TAKE1, help }
00176 # define AP_INIT_ITERATE(directive, func, mconfig, where, help) \
00177 { directive, func, mconfig, where, ITERATE, help }
00178 # define AP_INIT_TAKE2(directive, func, mconfig, where, help) \
00179 { directive, func, mconfig, where, TAKE2, help }
00180 # define AP_INIT_TAKE12(directive, func, mconfig, where, help) \
00181 { directive, func, mconfig, where, TAKE12, help }
00182 # define AP_INIT_ITERATE2(directive, func, mconfig, where, help) \
00183 { directive, func, mconfig, where, ITERATE2, help }
00184 # define AP_INIT_TAKE13(directive, func, mconfig, where, help) \
00185 { directive, func, mconfig, where, TAKE13, help }
00186 # define AP_INIT_TAKE23(directive, func, mconfig, where, help) \
00187 { directive, func, mconfig, where, TAKE23, help }
00188 # define AP_INIT_TAKE123(directive, func, mconfig, where, help) \
00189 { directive, func, mconfig, where, TAKE123, help }
00190 # define AP_INIT_TAKE3(directive, func, mconfig, where, help) \
00191 { directive, func, mconfig, where, TAKE3, help }
00192 # define AP_INIT_FLAG(directive, func, mconfig, where, help) \
00193 { directive, func, mconfig, where, FLAG, help }
00194
00195 #endif
00196
00201 typedef struct command_struct command_rec;
00202 struct command_struct {
00204 const char *name;
00206 cmd_func func;
00208 void *cmd_data;
00210 int req_override;
00213 enum cmd_how args_how;
00214
00216 const char *errmsg;
00217 };
00218
00227 #define OR_NONE 0
00228 #define OR_LIMIT 1
00230 #define OR_OPTIONS 2
00232 #define OR_FILEINFO 4
00234 #define OR_AUTHCFG 8
00236 #define OR_INDEXES 16
00238 #define OR_UNSET 32
00239 #define ACCESS_CONF 64
00240 #define RSRC_CONF 128
00241 #define EXEC_ON_READ 256
00245 #define OR_ALL (OR_LIMIT|OR_OPTIONS|OR_FILEINFO|OR_AUTHCFG|OR_INDEXES)
00246
00254 #define DECLINE_CMD "\a\b"
00255
00257 typedef struct ap_configfile_t ap_configfile_t;
00258 struct ap_configfile_t {
00259 int (*getch) (void *param);
00260 void *(*getstr) (void *buf, size_t bufsiz, void *param);
00262 int (*close) (void *param);
00263 void *param;
00264 const char *name;
00265 unsigned line_number;
00266 };
00267
00273 struct cmd_parms_struct {
00275 void *info;
00277 int override;
00279 apr_int64_t limited;
00281 apr_array_header_t *limited_xmethods;
00283 ap_method_list_t *xlimited;
00284
00286 ap_configfile_t *config_file;
00288 ap_directive_t *directive;
00289
00291 apr_pool_t *pool;
00294 apr_pool_t *temp_pool;
00296 server_rec *server;
00303 char *path;
00305 const command_rec *cmd;
00306
00308 struct ap_conf_vector_t *context;
00310 const ap_directive_t *err_directive;
00311
00313 int override_opts;
00314 };
00315
00321 typedef struct module_struct module;
00322 struct module_struct {
00326 int version;
00329 int minor_version;
00331 int module_index;
00332
00334 const char *name;
00336 void *dynamic_load_handle;
00337
00340 struct module_struct *next;
00341
00344 unsigned long magic;
00345
00350 void (*rewrite_args) (process_rec *process);
00357 void *(*create_dir_config) (apr_pool_t *p, char *dir);
00365 void *(*merge_dir_config) (apr_pool_t *p, void *base_conf, void *new_conf);
00372 void *(*create_server_config) (apr_pool_t *p, server_rec *s);
00380 void *(*merge_server_config) (apr_pool_t *p, void *base_conf,
00381 void *new_conf);
00382
00385 const command_rec *cmds;
00386
00393 void (*register_hooks) (apr_pool_t *p);
00394 };
00395
00411 #define STANDARD_MODULE_STUFF this_module_needs_to_be_ported_to_apache_2_0
00412
00414 #define STANDARD20_MODULE_STUFF MODULE_MAGIC_NUMBER_MAJOR, \
00415 MODULE_MAGIC_NUMBER_MINOR, \
00416 -1, \
00417 __FILE__, \
00418 NULL, \
00419 NULL, \
00420 MODULE_MAGIC_COOKIE, \
00421 NULL
00422
00424 #define MPM20_MODULE_STUFF MODULE_MAGIC_NUMBER_MAJOR, \
00425 MODULE_MAGIC_NUMBER_MINOR, \
00426 -1, \
00427 __FILE__, \
00428 NULL, \
00429 NULL, \
00430 MODULE_MAGIC_COOKIE
00431
00434
00435
00437 typedef struct ap_conf_vector_t ap_conf_vector_t;
00438
00447 AP_DECLARE(void *) ap_get_module_config(const ap_conf_vector_t *cv,
00448 const module *m);
00449
00458 AP_DECLARE(void) ap_set_module_config(ap_conf_vector_t *cv, const module *m,
00459 void *val);
00460
00461 #if !defined(AP_DEBUG)
00462
00463 #define ap_get_module_config(v,m) \
00464 (((void **)(v))[(m)->module_index])
00465 #define ap_set_module_config(v,m,val) \
00466 ((((void **)(v))[(m)->module_index]) = (val))
00467
00468 #endif
00469
00470
00478 AP_DECLARE_NONSTD(const char *) ap_set_string_slot(cmd_parms *cmd,
00479 void *struct_ptr,
00480 const char *arg);
00481
00489 AP_DECLARE_NONSTD(const char *) ap_set_int_slot(cmd_parms *cmd,
00490 void *struct_ptr,
00491 const char *arg);
00492
00503 AP_DECLARE(int) ap_method_is_limited(cmd_parms *cmd, const char *method);
00504
00513 AP_DECLARE_NONSTD(const char *) ap_set_string_slot_lower(cmd_parms *cmd,
00514 void *struct_ptr,
00515 const char *arg);
00523 AP_DECLARE_NONSTD(const char *) ap_set_flag_slot(cmd_parms *cmd,
00524 void *struct_ptr,
00525 int arg);
00533 AP_DECLARE_NONSTD(const char *) ap_set_file_slot(cmd_parms *cmd,
00534 void *struct_ptr,
00535 const char *arg);
00548 AP_DECLARE_NONSTD(const char *) ap_set_deprecated(cmd_parms *cmd,
00549 void *struct_ptr,
00550 const char *arg);
00557 AP_DECLARE(char *) ap_server_root_relative(apr_pool_t *p, const char *fname);
00558
00559
00560
00566 AP_DECLARE(const char *) ap_add_module(module *m, apr_pool_t *p);
00567
00576 AP_DECLARE(void) ap_remove_module(module *m);
00582 AP_DECLARE(const char *) ap_add_loaded_module(module *mod, apr_pool_t *p);
00587 AP_DECLARE(void) ap_remove_loaded_module(module *mod);
00593 AP_DECLARE(const char *) ap_find_module_name(module *m);
00599 AP_DECLARE(module *) ap_find_linked_module(const char *name);
00600
00607 AP_DECLARE(apr_status_t) ap_pcfg_openfile(ap_configfile_t **ret_cfg,
00608 apr_pool_t *p, const char *name);
00609
00619 AP_DECLARE(ap_configfile_t *) ap_pcfg_open_custom(apr_pool_t *p,
00620 const char *descr,
00621 void *param,
00622 int(*getc_func)(void*),
00623 void *(*gets_func) (void *buf, size_t bufsiz, void *param),
00624 int(*close_func)(void *param));
00625
00633 AP_DECLARE(int) ap_cfg_getline(char *buf, size_t bufsize, ap_configfile_t *cfp);
00634
00640 AP_DECLARE(int) ap_cfg_getc(ap_configfile_t *cfp);
00641
00647 AP_DECLARE(int) ap_cfg_closefile(ap_configfile_t *cfp);
00648
00656 AP_DECLARE(const char *) ap_soak_end_container(cmd_parms *cmd, char *directive);
00657
00669 AP_DECLARE(const char *) ap_build_cont_config(apr_pool_t *p,
00670 apr_pool_t *temp_pool,
00671 cmd_parms *parms,
00672 ap_directive_t **current,
00673 ap_directive_t **curr_parent,
00674 char *orig_directive);
00675
00684 AP_DECLARE(const char *) ap_build_config(cmd_parms *parms,
00685 apr_pool_t *conf_pool,
00686 apr_pool_t *temp_pool,
00687 ap_directive_t **conftree);
00688
00696 AP_DECLARE(const char *) ap_walk_config(ap_directive_t *conftree,
00697 cmd_parms *parms,
00698 ap_conf_vector_t *section_vector);
00699
00710 AP_DECLARE(const char *) ap_check_cmd_context(cmd_parms *cmd,
00711 unsigned forbidden);
00712
00713 #define NOT_IN_VIRTUALHOST 0x01
00714 #define NOT_IN_LIMIT 0x02
00715 #define NOT_IN_DIRECTORY 0x04
00716 #define NOT_IN_LOCATION 0x08
00717 #define NOT_IN_FILES 0x10
00719 #define NOT_IN_DIR_LOC_FILE (NOT_IN_DIRECTORY|NOT_IN_LOCATION|NOT_IN_FILES)
00720
00721 #define GLOBAL_ONLY (NOT_IN_VIRTUALHOST|NOT_IN_LIMIT|NOT_IN_DIR_LOC_FILE)
00722
00725 #ifdef CORE_PRIVATE
00726
00730 typedef struct {
00731 const char *name;
00732 module *modp;
00733 } ap_module_symbol_t;
00734
00739 AP_DECLARE_DATA extern module *ap_top_module;
00740
00745 AP_DECLARE_DATA extern module *ap_prelinked_modules[];
00750 AP_DECLARE_DATA extern ap_module_symbol_t ap_prelinked_module_symbols[];
00755 AP_DECLARE_DATA extern module *ap_preloaded_modules[];
00760 AP_DECLARE_DATA extern module **ap_loaded_modules;
00761
00762
00768 AP_DECLARE(void) ap_single_module_configure(apr_pool_t *p, server_rec *s,
00769 module *m);
00770
00771
00776 AP_DECLARE(const char *) ap_setup_prelinked_modules(process_rec *process);
00777
00783 AP_DECLARE(void) ap_show_directives(void);
00784
00788 AP_DECLARE(void) ap_show_modules(void);
00789
00794 AP_DECLARE(const char *) ap_show_mpm(void);
00795
00804 AP_DECLARE(server_rec *) ap_read_config(process_rec *process,
00805 apr_pool_t *temp_pool,
00806 const char *config_name,
00807 ap_directive_t **conftree);
00808
00813 AP_DECLARE(void) ap_run_rewrite_args(process_rec *process);
00814
00820 AP_DECLARE(void) ap_register_hooks(module *m, apr_pool_t *p);
00821
00827 AP_DECLARE(void) ap_fixup_virtual_hosts(apr_pool_t *p,
00828 server_rec *main_server);
00829
00830
00831
00837 AP_CORE_DECLARE(ap_conf_vector_t*) ap_create_request_config(apr_pool_t *p);
00838
00844 AP_CORE_DECLARE(ap_conf_vector_t *) ap_create_per_dir_config(apr_pool_t *p);
00845
00852 AP_CORE_DECLARE(ap_conf_vector_t*) ap_merge_per_dir_configs(apr_pool_t *p,
00853 ap_conf_vector_t *base,
00854 ap_conf_vector_t *new_conf);
00855
00856
00862 AP_CORE_DECLARE(ap_conf_vector_t*) ap_create_conn_config(apr_pool_t *p);
00863
00864
00865
00875 AP_CORE_DECLARE(int) ap_parse_htaccess(ap_conf_vector_t **result,
00876 request_rec *r, int override,
00877 int override_opts,
00878 const char *path,
00879 const char *access_name);
00880
00889 AP_CORE_DECLARE(const char *) ap_init_virtual_host(apr_pool_t *p,
00890 const char *hostname,
00891 server_rec *main_server,
00892 server_rec **ps);
00893
00902 AP_DECLARE(const char *) ap_process_resource_config(server_rec *s,
00903 const char *fname,
00904 ap_directive_t **conftree,
00905 apr_pool_t *p,
00906 apr_pool_t *ptemp);
00907
00916 AP_DECLARE(int) ap_process_config_tree(server_rec *s,
00917 ap_directive_t *conftree,
00918 apr_pool_t *p,
00919 apr_pool_t *ptemp);
00920
00921
00928 AP_CORE_DECLARE(int) ap_invoke_handler(request_rec *r);
00929
00930
00931
00938 AP_CORE_DECLARE(const command_rec *) ap_find_command(const char *name,
00939 const command_rec *cmds);
00940
00947 AP_CORE_DECLARE(const command_rec *) ap_find_command_in_modules(const char *cmd_name,
00948 module **mod);
00949
00961 AP_CORE_DECLARE(void *) ap_set_config_vectors(server_rec *server,
00962 ap_conf_vector_t *section_vector,
00963 const char *section,
00964 module *mod, apr_pool_t *pconf);
00965
00966 #endif
00967
00968
00969
00975 AP_DECLARE_HOOK(int,header_parser,(request_rec *r))
00976
00977
00984 AP_DECLARE_HOOK(int,pre_config,(apr_pool_t *pconf,apr_pool_t *plog,
00985 apr_pool_t *ptemp))
00986
00987
00993 AP_DECLARE_HOOK(void,test_config,(apr_pool_t *pconf, server_rec *s))
00994
00995
01003 AP_DECLARE_HOOK(int,post_config,(apr_pool_t *pconf,apr_pool_t *plog,
01004 apr_pool_t *ptemp,server_rec *s))
01005
01006
01014 AP_DECLARE_HOOK(int,open_logs,(apr_pool_t *pconf,apr_pool_t *plog,
01015 apr_pool_t *ptemp,server_rec *s))
01016
01017
01022 AP_DECLARE_HOOK(void,child_init,(apr_pool_t *pchild, server_rec *s))
01023
01024
01029 AP_DECLARE_HOOK(int,handler,(request_rec *r))
01030
01031
01042 AP_DECLARE_HOOK(int,quick_handler,(request_rec *r, int lookup_uri))
01043
01044
01049 AP_DECLARE_HOOK(void,optional_fn_retrieve,(void))
01050
01051 #ifdef __cplusplus
01052 }
01053 #endif
01054
01055 #endif
01056