1 /* Copyright 1999-2005 The Apache Software Foundation or its licensors, as
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #ifndef APACHE_HTTP_CONFIG_H
18 #define APACHE_HTTP_CONFIG_H
20 #include "apr_hooks.h"
21 #include "util_cfgtree.h"
29 * @brief Apache Configuration
33 * The central data structures around here...
36 /* Command dispatch structures... */
39 * How the directives arguments should be parsed.
40 * @remark Note that for all of these except RAW_ARGS, the config routine is
41 * passed a freshly allocated string which can be modified or stored
45 RAW_ARGS, /**< cmd_func parses command line itself */
46 TAKE1, /**< one argument only */
47 TAKE2, /**< two arguments only */
48 ITERATE, /**< one argument, occuring multiple times
51 ITERATE2, /**< two arguments, 2nd occurs multiple times
54 FLAG, /**< One of 'On' or 'Off' */
55 NO_ARGS, /**< No args at all, e.g. </Directory> */
56 TAKE12, /**< one or two arguments */
57 TAKE3, /**< three arguments only */
58 TAKE23, /**< two or three arguments */
59 TAKE123, /**< one, two or three arguments */
60 TAKE13 /**< one or three arguments */
63 * This structure is passed to a command which is being invoked,
64 * to carry a large variety of miscellaneous data which is all of
65 * use to *somebody*...
67 typedef struct cmd_parms_struct cmd_parms;
69 #if defined(AP_HAVE_DESIGNATED_INITIALIZER) || defined(DOXYGEN)
72 * All the types of functions that can be used in directives
76 /** function to call for a no-args */
77 const char *(*no_args) (cmd_parms *parms, void *mconfig);
78 /** function to call for a raw-args */
79 const char *(*raw_args) (cmd_parms *parms, void *mconfig,
81 /** function to call for a take1 */
82 const char *(*take1) (cmd_parms *parms, void *mconfig, const char *w);
83 /** function to call for a take2 */
84 const char *(*take2) (cmd_parms *parms, void *mconfig, const char *w,
86 /** function to call for a take3 */
87 const char *(*take3) (cmd_parms *parms, void *mconfig, const char *w,
88 const char *w2, const char *w3);
89 /** function to call for a flag */
90 const char *(*flag) (cmd_parms *parms, void *mconfig, int on);
93 /** This configuration directive does not take any arguments */
94 # define AP_NO_ARGS func.no_args
95 /** This configuration directive will handle it's own parsing of arguments*/
96 # define AP_RAW_ARGS func.raw_args
97 /** This configuration directive takes 1 argument*/
98 # define AP_TAKE1 func.take1
99 /** This configuration directive takes 2 arguments */
100 # define AP_TAKE2 func.take2
101 /** This configuration directive takes 3 arguments */
102 # define AP_TAKE3 func.take3
103 /** This configuration directive takes a flag (on/off) as a argument*/
104 # define AP_FLAG func.flag
106 /** method of declaring a directive with no arguments */
107 # define AP_INIT_NO_ARGS(directive, func, mconfig, where, help) \
108 { directive, { .no_args=func }, mconfig, where, RAW_ARGS, help }
109 /** method of declaring a directive with raw argument parsing */
110 # define AP_INIT_RAW_ARGS(directive, func, mconfig, where, help) \
111 { directive, { .raw_args=func }, mconfig, where, RAW_ARGS, help }
112 /** method of declaring a directive which takes 1 argument */
113 # define AP_INIT_TAKE1(directive, func, mconfig, where, help) \
114 { directive, { .take1=func }, mconfig, where, TAKE1, help }
115 /** method of declaring a directive which takes multiple arguments */
116 # define AP_INIT_ITERATE(directive, func, mconfig, where, help) \
117 { directive, { .take1=func }, mconfig, where, ITERATE, help }
118 /** method of declaring a directive which takes 2 arguments */
119 # define AP_INIT_TAKE2(directive, func, mconfig, where, help) \
120 { directive, { .take2=func }, mconfig, where, TAKE2, help }
121 /** method of declaring a directive which takes 1 or 2 arguments */
122 # define AP_INIT_TAKE12(directive, func, mconfig, where, help) \
123 { directive, { .take2=func }, mconfig, where, TAKE12, help }
124 /** method of declaring a directive which takes multiple 2 arguments */
125 # define AP_INIT_ITERATE2(directive, func, mconfig, where, help) \
126 { directive, { .take2=func }, mconfig, where, ITERATE2, help }
127 /** method of declaring a directive which takes 1 or 3 arguments */
128 # define AP_INIT_TAKE13(directive, func, mconfig, where, help) \
129 { directive, { .take3=func }, mconfig, where, TAKE13, help }
130 /** method of declaring a directive which takes 2 or 3 arguments */
131 # define AP_INIT_TAKE23(directive, func, mconfig, where, help) \
132 { directive, { .take3=func }, mconfig, where, TAKE23, help }
133 /** method of declaring a directive which takes 1 to 3 arguments */
134 # define AP_INIT_TAKE123(directive, func, mconfig, where, help) \
135 { directive, { .take3=func }, mconfig, where, TAKE123, help }
136 /** method of declaring a directive which takes 3 arguments */
137 # define AP_INIT_TAKE3(directive, func, mconfig, where, help) \
138 { directive, { .take3=func }, mconfig, where, TAKE3, help }
139 /** method of declaring a directive which takes a flag (on/off) as a argument*/
140 # define AP_INIT_FLAG(directive, func, mconfig, where, help) \
141 { directive, { .flag=func }, mconfig, where, FLAG, help }
143 #else /* AP_HAVE_DESIGNATED_INITIALIZER */
145 typedef const char *(*cmd_func) ();
147 # define AP_NO_ARGS func
148 # define AP_RAW_ARGS func
149 # define AP_TAKE1 func
150 # define AP_TAKE2 func
151 # define AP_TAKE3 func
152 # define AP_FLAG func
154 # define AP_INIT_NO_ARGS(directive, func, mconfig, where, help) \
155 { directive, func, mconfig, where, RAW_ARGS, help }
156 # define AP_INIT_RAW_ARGS(directive, func, mconfig, where, help) \
157 { directive, func, mconfig, where, RAW_ARGS, help }
158 # define AP_INIT_TAKE1(directive, func, mconfig, where, help) \
159 { directive, func, mconfig, where, TAKE1, help }
160 # define AP_INIT_ITERATE(directive, func, mconfig, where, help) \
161 { directive, func, mconfig, where, ITERATE, help }
162 # define AP_INIT_TAKE2(directive, func, mconfig, where, help) \
163 { directive, func, mconfig, where, TAKE2, help }
164 # define AP_INIT_TAKE12(directive, func, mconfig, where, help) \
165 { directive, func, mconfig, where, TAKE12, help }
166 # define AP_INIT_ITERATE2(directive, func, mconfig, where, help) \
167 { directive, func, mconfig, where, ITERATE2, help }
168 # define AP_INIT_TAKE13(directive, func, mconfig, where, help) \
169 { directive, func, mconfig, where, TAKE13, help }
170 # define AP_INIT_TAKE23(directive, func, mconfig, where, help) \
171 { directive, func, mconfig, where, TAKE23, help }
172 # define AP_INIT_TAKE123(directive, func, mconfig, where, help) \
173 { directive, func, mconfig, where, TAKE123, help }
174 # define AP_INIT_TAKE3(directive, func, mconfig, where, help) \
175 { directive, func, mconfig, where, TAKE3, help }
176 # define AP_INIT_FLAG(directive, func, mconfig, where, help) \
177 { directive, func, mconfig, where, FLAG, help }
179 #endif /* AP_HAVE_DESIGNATED_INITIALIZER */
182 * The command record structure. Each modules can define a table of these
183 * to define the directives it will implement.
185 typedef struct command_struct command_rec;
186 struct command_struct {
187 /** Name of this command */
189 /** The function to be called when this directive is parsed */
191 /** Extra data, for functions which implement multiple commands... */
193 /** What overrides need to be allowed to enable this command. */
195 /** What the command expects as arguments
196 * @defvar cmd_how args_how*/
197 enum cmd_how args_how;
199 /** 'usage' message, in case of syntax errors */
204 * @defgroup ConfigDirectives Allowed locations for configuration directives.
206 * The allowed locations for a configuration directive are the union of
207 * those indicated by each set bit in the req_override mask.
211 #define OR_NONE 0 /**< *.conf is not available anywhere in this override */
212 #define OR_LIMIT 1 /**< *.conf inside <Directory> or <Location>
213 and .htaccess when AllowOverride Limit */
214 #define OR_OPTIONS 2 /**< *.conf anywhere
215 and .htaccess when AllowOverride Options */
216 #define OR_FILEINFO 4 /**< *.conf anywhere
217 and .htaccess when AllowOverride FileInfo */
218 #define OR_AUTHCFG 8 /**< *.conf inside <Directory> or <Location>
219 and .htaccess when AllowOverride AuthConfig */
220 #define OR_INDEXES 16 /**< *.conf anywhere
221 and .htaccess when AllowOverride Indexes */
222 #define OR_UNSET 32 /**< unset a directive (in Allow) */
223 #define ACCESS_CONF 64 /**< *.conf inside <Directory> or <Location> */
224 #define RSRC_CONF 128 /**< *.conf outside <Directory> or <Location> */
225 #define EXEC_ON_READ 256 /**< force directive to execute a command
226 which would modify the configuration (like including another
228 /** this directive can be placed anywhere */
229 #define OR_ALL (OR_LIMIT|OR_OPTIONS|OR_FILEINFO|OR_AUTHCFG|OR_INDEXES)
234 * This can be returned by a function if they don't wish to handle
235 * a command. Make it something not likely someone will actually use
238 #define DECLINE_CMD "\a\b"
240 /** Common structure for reading of config files / passwd files etc. */
241 typedef struct ap_configfile_t ap_configfile_t;
242 struct ap_configfile_t {
243 int (*getch) (void *param); /**< a getc()-like function */
244 void *(*getstr) (void *buf, size_t bufsiz, void *param);
245 /**< a fgets()-like function */
246 int (*close) (void *param); /**< a close handler function */
247 void *param; /**< the argument passed to getch/getstr/close */
248 const char *name; /**< the filename / description */
249 unsigned line_number; /**< current line number, starting at 1 */
253 * This structure is passed to a command which is being invoked,
254 * to carry a large variety of miscellaneous data which is all of
255 * use to *somebody*...
257 struct cmd_parms_struct {
258 /** Argument to command from cmd_table */
260 /** Which allow-override bits are set */
262 /** Which methods are <Limit>ed */
264 /** methods which are limited */
265 apr_array_header_t *limited_xmethods;
266 /** methods which are xlimited */
267 ap_method_list_t *xlimited;
269 /** Config file structure. */
270 ap_configfile_t *config_file;
271 /** the directive specifying this command */
272 ap_directive_t *directive;
274 /** Pool to allocate new storage in */
276 /** Pool for scratch memory; persists during configuration, but
277 * wiped before the first request is served... */
278 apr_pool_t *temp_pool;
279 /** Server_rec being configured for */
281 /** If configuring for a directory, pathname of that directory.
282 * NOPE! That's what it meant previous to the existance of <Files>,
283 * <Location> and regex matching. Now the only usefulness that can be
284 * derived from this field is whether a command is being called in a
285 * server context (path == NULL) or being called in a dir context
288 /** configuration command */
289 const command_rec *cmd;
291 /** per_dir_config vector passed to handle_command */
292 struct ap_conf_vector_t *context;
293 /** directive with syntax error */
294 const ap_directive_t *err_directive;
296 /** Which allow-override-opts bits are set */
301 * Module structures. Just about everything is dispatched through
302 * these, directly or indirectly (through the command and handler
305 typedef struct module_struct module;
306 struct module_struct {
307 /** API version, *not* module version; check that module is
308 * compatible with this version of the server.
311 /** API minor version. Provides API feature milestones. Not checked
312 * during module init */
314 /** Index to this modules structures in config vectors. */
317 /** The name of the module's C file */
319 /** The handle for the DSO. Internal use only */
320 void *dynamic_load_handle;
322 /** A pointer to the next module in the list
323 * @defvar module_struct *next */
324 struct module_struct *next;
326 /** Magic Cookie to identify a module structure; It's mainly
327 * important for the DSO facility (see also mod_so). */
330 /** Function to allow MPMs to re-write command line arguments. This
331 * hook is only available to MPMs.
332 * @param The process that the server is running in.
334 void (*rewrite_args) (process_rec *process);
335 /** Function to allow all modules to create per directory configuration
337 * @param p The pool to use for all allocations.
338 * @param dir The directory currently being processed.
339 * @return The per-directory structure created
341 void *(*create_dir_config) (apr_pool_t *p, char *dir);
342 /** Function to allow all modules to merge the per directory configuration
343 * structures for two directories.
344 * @param p The pool to use for all allocations.
345 * @param base_conf The directory structure created for the parent directory.
346 * @param new_conf The directory structure currently being processed.
347 * @return The new per-directory structure created
349 void *(*merge_dir_config) (apr_pool_t *p, void *base_conf, void *new_conf);
350 /** Function to allow all modules to create per server configuration
352 * @param p The pool to use for all allocations.
353 * @param s The server currently being processed.
354 * @return The per-server structure created
356 void *(*create_server_config) (apr_pool_t *p, server_rec *s);
357 /** Function to allow all modules to merge the per server configuration
358 * structures for two servers.
359 * @param p The pool to use for all allocations.
360 * @param base_conf The directory structure created for the parent directory.
361 * @param new_conf The directory structure currently being processed.
362 * @return The new per-directory structure created
364 void *(*merge_server_config) (apr_pool_t *p, void *base_conf,
367 /** A command_rec table that describes all of the directives this module
369 const command_rec *cmds;
371 /** A hook to allow modules to hook other points in the request processing.
372 * In this function, modules should call the ap_hook_*() functions to
373 * register an interest in a specific step in processing the current
375 * @param p the pool to use for all allocations
377 void (*register_hooks) (apr_pool_t *p);
381 * @defgroup ModuleInit Module structure initializers
383 * Initializer for the first few module slots, which are only
384 * really set up once we start running. Note that the first two slots
385 * provide a version check; this should allow us to deal with changes to
386 * the API. The major number should reflect changes to the API handler table
387 * itself or removal of functionality. The minor number should reflect
388 * additions of functionality to the existing API. (the server can detect
389 * an old-format module, and either handle it back-compatibly, or at least
390 * signal an error). See src/include/ap_mmn.h for MMN version history.
394 /** The one used in Apache 1.3, which will deliberately cause an error */
395 #define STANDARD_MODULE_STUFF this_module_needs_to_be_ported_to_apache_2_0
397 /** Use this in all standard modules */
398 #define STANDARD20_MODULE_STUFF MODULE_MAGIC_NUMBER_MAJOR, \
399 MODULE_MAGIC_NUMBER_MINOR, \
404 MODULE_MAGIC_COOKIE, \
405 NULL /* rewrite args spot */
407 /** Use this only in MPMs */
408 #define MPM20_MODULE_STUFF MODULE_MAGIC_NUMBER_MAJOR, \
409 MODULE_MAGIC_NUMBER_MINOR, \
418 /* CONFIGURATION VECTOR FUNCTIONS */
420 /** configuration vector structure */
421 typedef struct ap_conf_vector_t ap_conf_vector_t;
424 * Generic accessors for other modules to get at their own module-specific
426 * @param conf_vector The vector in which the modules configuration is stored.
427 * usually r->per_dir_config or s->module_config
428 * @param m The module to get the data for.
429 * @return The module-specific data
431 AP_DECLARE(void *) ap_get_module_config(const ap_conf_vector_t *cv,
435 * Generic accessors for other modules to set at their own module-specific
437 * @param conf_vector The vector in which the modules configuration is stored.
438 * usually r->per_dir_config or s->module_config
439 * @param m The module to set the data for.
440 * @param val The module-specific data to set
442 AP_DECLARE(void) ap_set_module_config(ap_conf_vector_t *cv, const module *m,
445 #if !defined(AP_DEBUG)
447 #define ap_get_module_config(v,m) \
448 (((void **)(v))[(m)->module_index])
449 #define ap_set_module_config(v,m,val) \
450 ((((void **)(v))[(m)->module_index]) = (val))
452 #endif /* AP_DEBUG */
456 * Generic command handling function for strings
457 * @param cmd The command parameters for this directive
458 * @param struct_ptr pointer into a given type
459 * @param arg The argument to the directive
460 * @return An error string or NULL on success
462 AP_DECLARE_NONSTD(const char *) ap_set_string_slot(cmd_parms *cmd,
467 * Generic command handling function for integers
468 * @param cmd The command parameters for this directive
469 * @param struct_ptr pointer into a given type
470 * @param arg The argument to the directive
471 * @return An error string or NULL on success
473 AP_DECLARE_NONSTD(const char *) ap_set_int_slot(cmd_parms *cmd,
478 * Return true if the specified method is limited by being listed in
479 * a <Limit> container, or by *not* being listed in a <LimiteExcept>
482 * @param method Pointer to a string specifying the method to check.
483 * @param cmd Pointer to the cmd_parms structure passed to the
485 * @return 0 if the method is not limited in the current scope
487 AP_DECLARE(int) ap_method_is_limited(cmd_parms *cmd, const char *method);
490 * Generic command handling function for strings, always sets the value
491 * to a lowercase string
492 * @param cmd The command parameters for this directive
493 * @param struct_ptr pointer into a given type
494 * @param arg The argument to the directive
495 * @return An error string or NULL on success
497 AP_DECLARE_NONSTD(const char *) ap_set_string_slot_lower(cmd_parms *cmd,
501 * Generic command handling function for flags
502 * @param cmd The command parameters for this directive
503 * @param struct_ptr pointer into a given type
504 * @param arg The argument to the directive (either 1 or 0)
505 * @return An error string or NULL on success
507 AP_DECLARE_NONSTD(const char *) ap_set_flag_slot(cmd_parms *cmd,
511 * Generic command handling function for files
512 * @param cmd The command parameters for this directive
513 * @param struct_ptr pointer into a given type
514 * @param arg The argument to the directive
515 * @return An error string or NULL on success
517 AP_DECLARE_NONSTD(const char *) ap_set_file_slot(cmd_parms *cmd,
521 * Generic command handling function to respond with cmd->help as an error
522 * @param cmd The command parameters for this directive
523 * @param struct_ptr pointer into a given type
524 * @param arg The argument to the directive
525 * @return The cmd->help value as the error string
526 * @tip This allows simple declarations such as;
528 * AP_INIT_RAW_ARGS("Foo", ap_set_deprecated, NULL, OR_ALL,
529 * "The Foo directive is no longer supported, use Bar"),
532 AP_DECLARE_NONSTD(const char *) ap_set_deprecated(cmd_parms *cmd,
536 * For modules which need to read config files, open logs, etc. this returns
537 * the canonical form of fname made absolute to ap_server_root.
538 * @param p pool to allocate data from
539 * @param fname The file name
541 AP_DECLARE(char *) ap_server_root_relative(apr_pool_t *p, const char *fname);
543 /* Finally, the hook for dynamically loading modules in... */
546 * Add a module to the server
547 * @param m The module structure of the module to add
548 * @param p The pool of the same lifetime as the module
550 AP_DECLARE(const char *) ap_add_module(module *m, apr_pool_t *p);
553 * Remove a module from the server. There are some caveats:
554 * when the module is removed, its slot is lost so all the current
555 * per-dir and per-server configurations are invalid. So we should
556 * only ever call this function when you are invalidating almost
557 * all our current data. I.e. when doing a restart.
558 * @param m the module structure of the module to remove
560 AP_DECLARE(void) ap_remove_module(module *m);
562 * Add a module to the chained modules list and the list of loaded modules
563 * @param m The module structure of the module to add
564 * @param p The pool with the same lifetime as the module
566 AP_DECLARE(const char *) ap_add_loaded_module(module *mod, apr_pool_t *p);
568 * Remove a module fromthe chained modules list and the list of loaded modules
569 * @param m the module structure of the module to remove
571 AP_DECLARE(void) ap_remove_loaded_module(module *mod);
573 * Find the name of the specified module
574 * @param m The module to get the name for
575 * @return the name of the module
577 AP_DECLARE(const char *) ap_find_module_name(module *m);
579 * Find a module based on the name of the module
580 * @param name the name of the module
581 * @return the module structure if found, NULL otherwise
583 AP_DECLARE(module *) ap_find_linked_module(const char *name);
586 * Open a ap_configfile_t as apr_file_t
587 * @param ret_cfg open ap_configfile_t struct pointer
588 * @param p The pool to allocate the structure from
589 * @param name the name of the file to open
591 AP_DECLARE(apr_status_t) ap_pcfg_openfile(ap_configfile_t **ret_cfg,
592 apr_pool_t *p, const char *name);
595 * Allocate a ap_configfile_t handle with user defined functions and params
596 * @param p The pool to allocate from
597 * @param descr The name of the file
598 * @param param The argument passed to getch/getstr/close
599 * @param getc_func The getch function
600 * @param gets_func The getstr function
601 * @param close_func The close function
603 AP_DECLARE(ap_configfile_t *) ap_pcfg_open_custom(apr_pool_t *p,
606 int(*getc_func)(void*),
607 void *(*gets_func) (void *buf, size_t bufsiz, void *param),
608 int(*close_func)(void *param));
611 * Read one line from open ap_configfile_t, strip LF, increase line number
612 * @param buf place to store the line read
613 * @param bufsize size of the buffer
614 * @param cfp File to read from
615 * @return 1 on success, 0 on failure
617 AP_DECLARE(int) ap_cfg_getline(char *buf, size_t bufsize, ap_configfile_t *cfp);
620 * Read one char from open configfile_t, increase line number upon LF
621 * @param cfp The file to read from
622 * @return the character read
624 AP_DECLARE(int) ap_cfg_getc(ap_configfile_t *cfp);
627 * Detach from open ap_configfile_t, calling the close handler
628 * @param cfp The file to close
629 * @return 1 on sucess, 0 on failure
631 AP_DECLARE(int) ap_cfg_closefile(ap_configfile_t *cfp);
634 * Read all data between the current <foo> and the matching </foo>. All
635 * of this data is forgotten immediately.
636 * @param cmd The cmd_parms to pass to the directives inside the container
637 * @param directive The directive name to read until
638 * @return Error string on failure, NULL on success
640 AP_DECLARE(const char *) ap_soak_end_container(cmd_parms *cmd, char *directive);
643 * Read all data between the current <foo> and the matching </foo> and build
644 * a config tree from it
645 * @param p pool to allocate from
646 * @param temp_pool Temporary pool to allocate from
647 * @param parms The cmd_parms to pass to all directives read
648 * @param current The current node in the tree
649 * @param curr_parent The current parent node
650 * @param orig_directive The directive to read until hit.
651 * @return Error string on failure, NULL on success
653 AP_DECLARE(const char *) ap_build_cont_config(apr_pool_t *p,
654 apr_pool_t *temp_pool,
656 ap_directive_t **current,
657 ap_directive_t **curr_parent,
658 char *orig_directive);
661 * Build a config tree from a config file
662 * @param parms The cmd_parms to pass to all of the directives in the file
663 * @param conf_pool The pconf pool
664 * @param temp_pool The temporary pool
665 * @param conftree Place to store the root node of the config tree
666 * @return Error string on erro, NULL otherwise
668 AP_DECLARE(const char *) ap_build_config(cmd_parms *parms,
669 apr_pool_t *conf_pool,
670 apr_pool_t *temp_pool,
671 ap_directive_t **conftree);
674 * Walk a config tree and setup the server's internal structures
675 * @param conftree The config tree to walk
676 * @param parms The cmd_parms to pass to all functions
677 * @param section_vector The per-section config vector.
678 * @return Error string on error, NULL otherwise
680 AP_DECLARE(const char *) ap_walk_config(ap_directive_t *conftree,
682 ap_conf_vector_t *section_vector);
685 * @defgroup ap_check_cmd_context ap_check_cmd_context
689 * Check the context a command is used in.
690 * @param cmd The command to check
691 * @param forbidden Where the command is forbidden.
692 * @return Error string on error, NULL on success
694 AP_DECLARE(const char *) ap_check_cmd_context(cmd_parms *cmd,
697 #define NOT_IN_VIRTUALHOST 0x01 /**< Forbidden in <Virtualhost> */
698 #define NOT_IN_LIMIT 0x02 /**< Forbidden in <Limit> */
699 #define NOT_IN_DIRECTORY 0x04 /**< Forbidden in <Directory> */
700 #define NOT_IN_LOCATION 0x08 /**< Forbidden in <Location> */
701 #define NOT_IN_FILES 0x10 /**< Forbidden in <Files> */
702 /** Forbidden in <Directory>/<Location>/<Files>*/
703 #define NOT_IN_DIR_LOC_FILE (NOT_IN_DIRECTORY|NOT_IN_LOCATION|NOT_IN_FILES)
704 /** Forbidden in <VirtualHost>/<Limit>/<Directory>/<Location>/<Files> */
705 #define GLOBAL_ONLY (NOT_IN_VIRTUALHOST|NOT_IN_LIMIT|NOT_IN_DIR_LOC_FILE)
712 * This structure is used to assign symbol names to module pointers
717 } ap_module_symbol_t;
720 * The topmost module in the list
721 * @defvar module *ap_top_module
723 AP_DECLARE_DATA extern module *ap_top_module;
726 * Array of all statically linked modules
727 * @defvar module *ap_prelinked_modules[]
729 AP_DECLARE_DATA extern module *ap_prelinked_modules[];
731 * Array of all statically linked modulenames (symbols)
732 * @defvar ap_module_symbol_t ap_prelinked_modulenames[]
734 AP_DECLARE_DATA extern ap_module_symbol_t ap_prelinked_module_symbols[];
736 * Array of all preloaded modules
737 * @defvar module *ap_preloaded_modules[]
739 AP_DECLARE_DATA extern module *ap_preloaded_modules[];
741 * Array of all loaded modules
742 * @defvar module **ap_loaded_modules
744 AP_DECLARE_DATA extern module **ap_loaded_modules;
746 /* For mod_so.c... */
747 /** Run a single module's two create_config hooks
748 * @param p the pool to allocate from
749 * @param s The server to configure for.
750 * @param m The module to configure
752 AP_DECLARE(void) ap_single_module_configure(apr_pool_t *p, server_rec *s,
755 /* For http_main.c... */
757 * Add all of the prelinked modules into the loaded module list
758 * @param process The process that is currently running the server
760 AP_DECLARE(const char *) ap_setup_prelinked_modules(process_rec *process);
763 * Show the preloaded configuration directives, the help string explaining
764 * the directive arguments, in what module they are handled, and in
765 * what parts of the configuration they are allowed. Used for httpd -h.
767 AP_DECLARE(void) ap_show_directives(void);
770 * Show the preloaded module names. Used for httpd -l.
772 AP_DECLARE(void) ap_show_modules(void);
775 * Show the MPM name. Used in reporting modules such as mod_info to
776 * provide extra information to the user
778 AP_DECLARE(const char *) ap_show_mpm(void);
781 * Read all config files and setup the server
782 * @param process The process running the server
783 * @param temp_pool A pool to allocate temporary data from.
784 * @param config_name The name of the config file
785 * @param conftree Place to store the root of the config tree
786 * @return The setup server_rec list.
788 AP_DECLARE(server_rec *) ap_read_config(process_rec *process,
789 apr_pool_t *temp_pool,
790 const char *config_name,
791 ap_directive_t **conftree);
794 * Run all rewrite args hooks for loaded modules
795 * @param process The process currently running the server
797 AP_DECLARE(void) ap_run_rewrite_args(process_rec *process);
800 * Run the register hooks function for a specified module
801 * @param m The module to run the register hooks function fo
802 * @param p The pool valid for the lifetime of the module
804 AP_DECLARE(void) ap_register_hooks(module *m, apr_pool_t *p);
807 * Setup all virtual hosts
808 * @param p The pool to allocate from
809 * @param main_server The head of the server_rec list
811 AP_DECLARE(void) ap_fixup_virtual_hosts(apr_pool_t *p,
812 server_rec *main_server);
814 /* For http_request.c... */
817 * Setup the config vector for a request_rec
818 * @param p The pool to allocate the config vector from
819 * @return The config vector
821 AP_CORE_DECLARE(ap_conf_vector_t*) ap_create_request_config(apr_pool_t *p);
824 * Setup the config vector for per dir module configs
825 * @param p The pool to allocate the config vector from
826 * @return The config vector
828 AP_CORE_DECLARE(ap_conf_vector_t *) ap_create_per_dir_config(apr_pool_t *p);
831 * Run all of the modules merge per dir config functions
832 * @param p The pool to pass to the merge functions
833 * @param base The base directory config structure
834 * @param new_conf The new directory config structure
836 AP_CORE_DECLARE(ap_conf_vector_t*) ap_merge_per_dir_configs(apr_pool_t *p,
837 ap_conf_vector_t *base,
838 ap_conf_vector_t *new_conf);
840 /* For http_connection.c... */
842 * Setup the config vector for a connection_rec
843 * @param p The pool to allocate the config vector from
844 * @return The config vector
846 AP_CORE_DECLARE(ap_conf_vector_t*) ap_create_conn_config(apr_pool_t *p);
848 /* For http_core.c... (<Directory> command and virtual hosts) */
851 * parse an htaccess file
852 * @param resulting htaccess_result
853 * @param r The request currently being served
854 * @param override Which overrides are active
855 * @param path The path to the htaccess file
856 * @param access_name The list of possible names for .htaccess files
857 * int The status of the current request
859 AP_CORE_DECLARE(int) ap_parse_htaccess(ap_conf_vector_t **result,
860 request_rec *r, int override,
863 const char *access_name);
866 * Setup a virtual host
867 * @param p The pool to allocate all memory from
868 * @param hostname The hostname of the virtual hsot
869 * @param main_server The main server for this Apache configuration
870 * @param ps Place to store the new server_rec
871 * return Error string on error, NULL on success
873 AP_CORE_DECLARE(const char *) ap_init_virtual_host(apr_pool_t *p,
874 const char *hostname,
875 server_rec *main_server,
879 * Process the config file for Apache
880 * @param s The server rec to use for the command parms
881 * @param fname The name of the config file
882 * @param conftree The root node of the created config tree
883 * @param p Pool for general allocation
884 * @param ptem Pool for temporary allocation
886 AP_DECLARE(const char *) ap_process_resource_config(server_rec *s,
888 ap_directive_t **conftree,
893 * Process all directives in the config tree
894 * @param s The server rec to use in the command parms
895 * @param conftree The config tree to process
896 * @param p The pool for general allocation
897 * @param ptemp The pool for temporary allocations
898 * @return OK if no problems
900 AP_DECLARE(int) ap_process_config_tree(server_rec *s,
901 ap_directive_t *conftree,
905 /* Module-method dispatchers, also for http_request.c */
907 * Run the handler phase of each module until a module accepts the
908 * responsibility of serving the request
909 * @param r The current request
910 * @return The status of the current request
912 AP_CORE_DECLARE(int) ap_invoke_handler(request_rec *r);
917 * Find a given directive in a command_rec table
918 * @param name The directive to search for
919 * @param cmds The table to search
920 * @return The directive definition of the specified directive
922 AP_CORE_DECLARE(const command_rec *) ap_find_command(const char *name,
923 const command_rec *cmds);
926 * Find a given directive in a list module
927 * @param cmd_name The directive to search for
928 * @param mod The module list to search
929 * @return The directive definition of the specified directive
931 AP_CORE_DECLARE(const command_rec *) ap_find_command_in_modules(const char *cmd_name,
935 * Ask a module to create per-server and per-section (dir/loc/file) configs
936 * (if it hasn't happened already). The results are stored in the server's
937 * config, and the specified per-section config vector.
938 * @param server The server to operate upon.
939 * @param section_vector The per-section config vector.
940 * @param section Which section to create a config for.
941 * @param mod The module which is defining the config data.
942 * @param pconf A pool for all configuration allocations.
943 * @return The (new) per-section config data.
945 AP_CORE_DECLARE(void *) ap_set_config_vectors(server_rec *server,
946 ap_conf_vector_t *section_vector,
948 module *mod, apr_pool_t *pconf);
955 * Run the header parser functions for each module
956 * @param r The current request
957 * @return OK or DECLINED
959 AP_DECLARE_HOOK(int,header_parser,(request_rec *r))
962 * Run the pre_config function for each module
963 * @param pconf The config pool
964 * @param plog The logging streams pool
965 * @param ptemp The temporary pool
966 * @return OK or DECLINED on success anything else is a error
968 AP_DECLARE_HOOK(int,pre_config,(apr_pool_t *pconf,apr_pool_t *plog,
972 * Run the test_config function for each module; this hook is run
973 * only if the server was invoked to test the configuration syntax.
974 * @param pconf The config pool
975 * @param s The list of server_recs
977 AP_DECLARE_HOOK(void,test_config,(apr_pool_t *pconf, server_rec *s))
980 * Run the post_config function for each module
981 * @param pconf The config pool
982 * @param plog The logging streams pool
983 * @param ptemp The temporary pool
984 * @param s The list of server_recs
985 * @return OK or DECLINED on success anything else is a error
987 AP_DECLARE_HOOK(int,post_config,(apr_pool_t *pconf,apr_pool_t *plog,
988 apr_pool_t *ptemp,server_rec *s))
991 * Run the open_logs functions for each module
992 * @param pconf The config pool
993 * @param plog The logging streams pool
994 * @param ptemp The temporary pool
995 * @param s The list of server_recs
996 * @return OK or DECLINED on success anything else is a error
998 AP_DECLARE_HOOK(int,open_logs,(apr_pool_t *pconf,apr_pool_t *plog,
999 apr_pool_t *ptemp,server_rec *s))
1002 * Run the child_init functions for each module
1003 * @param pchild The child pool
1004 * @param s The list of server_recs in this server
1006 AP_DECLARE_HOOK(void,child_init,(apr_pool_t *pchild, server_rec *s))
1009 * Run the handler functions for each module
1010 * @param r The request_rec
1011 * @remark non-wildcard handlers should HOOK_MIDDLE, wildcard HOOK_LAST
1013 AP_DECLARE_HOOK(int,handler,(request_rec *r))
1016 * Run the quick handler functions for each module. The quick_handler
1017 * is run before any other requests hooks are called (location_walk,
1018 * directory_walk, access checking, et. al.). This hook was added
1019 * to provide a quick way to serve content from a URI keyed cache.
1021 * @param r The request_rec
1022 * @param lookup_uri Controls whether the caller actually wants content or not.
1023 * lookup is set when the quick_handler is called out of
1024 * ap_sub_req_lookup_uri()
1026 AP_DECLARE_HOOK(int,quick_handler,(request_rec *r, int lookup_uri))
1029 * Retrieve the optional functions for each module.
1030 * This is run immediately before the server starts. Optional functions should
1031 * be registered during the hook registration phase.
1033 AP_DECLARE_HOOK(void,optional_fn_retrieve,(void))
1039 #endif /* !APACHE_HTTP_CONFIG_H */