1 /* ====================================================================
2 * The Apache Software License, Version 1.1
4 * Copyright (c) 2000 The Apache Software Foundation. All rights
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in
16 * the documentation and/or other materials provided with the
19 * 3. The end-user documentation included with the redistribution,
20 * if any, must include the following acknowledgment:
21 * "This product includes software developed by the
22 * Apache Software Foundation (http://www.apache.org/)."
23 * Alternately, this acknowledgment may appear in the software itself,
24 * if and wherever such third-party acknowledgments normally appear.
26 * 4. The names "Apache" and "Apache Software Foundation" must
27 * not be used to endorse or promote products derived from this
28 * software without prior written permission. For written
29 * permission, please contact apache@apache.org.
31 * 5. Products derived from this software may not be called "Apache",
32 * nor may "Apache" appear in their name, without prior written
33 * permission of the Apache Software Foundation.
35 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
36 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
37 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
38 * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
39 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
40 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
41 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
42 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
43 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
44 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
45 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
47 * ====================================================================
49 * This software consists of voluntary contributions made by many
50 * individuals on behalf of the Apache Software Foundation. For more
51 * information on the Apache Software Foundation, please see
52 * <http://www.apache.org/>.
54 * Portions of this software are based upon public domain software
55 * originally written at the National Center for Supercomputing Applications,
56 * University of Illinois, Urbana-Champaign.
59 #ifndef APACHE_HTTP_CONFIG_H
60 #define APACHE_HTTP_CONFIG_H
62 #include "apr_hooks.h"
63 #include "util_cfgtree.h"
70 * @package Apache Configuration
74 * The central data structures around here...
77 /* Command dispatch structures... */
80 * How the directives arguments should be parsed.
81 * @tip Note that for all of these except RAW_ARGS, the config routine is
82 * passed a freshly allocated string which can be modified or stored
83 * or whatever... it's only necessary to do pstrdup() stuff with
85 * RAW_ARGS -- cmd_func parses command line itself
86 * TAKE1 -- one argument only
87 * TAKE2 -- two arguments only
88 * ITERATE -- one argument, occuring multiple times
89 * * (e.g., IndexIgnore)
90 * ITERATE2 -- two arguments, 2nd occurs multiple times
92 * FLAG -- One of 'On' or 'Off'
93 * NO_ARGS -- No args at all, e.g. </Directory>
94 * TAKE12 -- one or two arguments
95 * TAKE3 -- three arguments only
96 * TAKE23 -- two or three arguments
97 * TAKE123 -- one, two or three arguments
98 * TAKE13 -- one or three arguments
100 * @defvar enum cmd_how
103 RAW_ARGS, /* cmd_func parses command line itself */
104 TAKE1, /* one argument only */
105 TAKE2, /* two arguments only */
106 ITERATE, /* one argument, occuring multiple times
107 * (e.g., IndexIgnore)
109 ITERATE2, /* two arguments, 2nd occurs multiple times
112 FLAG, /* One of 'On' or 'Off' */
113 NO_ARGS, /* No args at all, e.g. </Directory> */
114 TAKE12, /* one or two arguments */
115 TAKE3, /* three arguments only */
116 TAKE23, /* two or three arguments */
117 TAKE123, /* one, two or three arguments */
118 TAKE13 /* one or three arguments */
121 typedef struct cmd_parms_struct cmd_parms;
126 const char *(*no_args) (cmd_parms *parms, void *mconfig);
127 const char *(*raw_args) (cmd_parms *parms, void *mconfig,
129 const char *(*take1) (cmd_parms *parms, void *mconfig, const char *w);
130 const char *(*take2) (cmd_parms *parms, void *mconfig, const char *w,
132 const char *(*take3) (cmd_parms *parms, void *mconfig, const char *w,
133 const char *w2, const char *w3);
134 const char *(*flag) (cmd_parms *parms, void *mconfig, int on);
137 # define AP_NO_ARGS func.no_args
138 # define AP_RAW_ARGS func.raw_args
139 # define AP_TAKE1 func.take1
140 # define AP_TAKE2 func.take2
141 # define AP_TAKE3 func.take3
142 # define AP_FLAG func.flag
144 # define AP_INIT_NO_ARGS(directive, func, mconfig, where, help) \
145 { directive, { .no_args=func }, mconfig, where, RAW_ARGS, help }
146 # define AP_INIT_RAW_ARGS(directive, func, mconfig, where, help) \
147 { directive, { .raw_args=func }, mconfig, where, RAW_ARGS, help }
148 # define AP_INIT_TAKE1(directive, func, mconfig, where, help) \
149 { directive, { .take1=func }, mconfig, where, TAKE1, help }
150 # define AP_INIT_ITERATE(directive, func, mconfig, where, help) \
151 { directive, { .take1=func }, mconfig, where, ITERATE, help }
152 # define AP_INIT_TAKE2(directive, func, mconfig, where, help) \
153 { directive, { .take2=func }, mconfig, where, TAKE2, help }
154 # define AP_INIT_TAKE12(directive, func, mconfig, where, help) \
155 { directive, { .take2=func }, mconfig, where, TAKE12, help }
156 # define AP_INIT_ITERATE2(directive, func, mconfig, where, help) \
157 { directive, { .take2=func }, mconfig, where, ITERATE2, help }
158 # define AP_INIT_TAKE23(directive, func, mconfig, where, help) \
159 { directive, { .take3=func }, mconfig, where, TAKE23, help }
160 # define AP_INIT_TAKE3(directive, func, mconfig, where, help) \
161 { directive, { .take3=func }, mconfig, where, TAKE3, help }
162 # define AP_INIT_FLAG(directive, func, mconfig, where, help) \
163 { directive, { .flag=func }, mconfig, where, FLAG, help }
167 typedef const char *(*cmd_func) ();
169 # define AP_NO_ARGS func
170 # define AP_RAW_ARGS func
171 # define AP_TAKE1 func
172 # define AP_TAKE2 func
173 # define AP_TAKE3 func
174 # define AP_FLAG func
176 # define AP_INIT_NO_ARGS(directive, func, mconfig, where, help) \
177 { directive, func, mconfig, where, RAW_ARGS, help }
178 # define AP_INIT_RAW_ARGS(directive, func, mconfig, where, help) \
179 { directive, func, mconfig, where, RAW_ARGS, help }
180 # define AP_INIT_TAKE1(directive, func, mconfig, where, help) \
181 { directive, func, mconfig, where, TAKE1, help }
182 # define AP_INIT_ITERATE(directive, func, mconfig, where, help) \
183 { directive, func, mconfig, where, ITERATE, help }
184 # define AP_INIT_TAKE2(directive, func, mconfig, where, help) \
185 { directive, func, mconfig, where, TAKE2, help }
186 # define AP_INIT_TAKE12(directive, func, mconfig, where, help) \
187 { directive, func, mconfig, where, TAKE12, help }
188 # define AP_INIT_ITERATE2(directive, func, mconfig, where, help) \
189 { directive, func, mconfig, where, ITERATE2, help }
190 # define AP_INIT_TAKE23(directive, func, mconfig, where, help) \
191 { directive, func, mconfig, where, TAKE23, help }
192 # define AP_INIT_TAKE3(directive, func, mconfig, where, help) \
193 { directive, func, mconfig, where, TAKE3, help }
194 # define AP_INIT_FLAG(directive, func, mconfig, where, help) \
195 { directive, func, mconfig, where, FLAG, help }
199 typedef struct command_struct command_rec;
201 * The command record structure. Each modules can define a table of these
202 * to define the directives it will implement.
204 struct command_struct {
205 /** Name of this command */
207 /** The function to be called when this directive is parsed */
209 /** Extra data, for functions which implement multiple commands... */
211 /** What overrides need to be allowed to enable this command. */
213 /** What the command expects as arguments
214 * @defvar cmd_how args_how*/
215 enum cmd_how args_how;
217 /** 'usage' message, in case of syntax errors */
221 /* The allowed locations for a configuration directive are the union of
222 * those indicated by each set bit in the req_override mask.
224 * (req_override & RSRC_CONF) => *.conf outside <Directory> or <Location>
225 * (req_override & ACCESS_CONF) => *.conf inside <Directory> or <Location>
226 * (req_override & OR_AUTHCFG) => *.conf inside <Directory> or <Location>
227 * and .htaccess when AllowOverride AuthConfig
228 * (req_override & OR_LIMIT) => *.conf inside <Directory> or <Location>
229 * and .htaccess when AllowOverride Limit
230 * (req_override & OR_OPTIONS) => *.conf anywhere
231 * and .htaccess when AllowOverride Options
232 * (req_override & OR_FILEINFO) => *.conf anywhere
233 * and .htaccess when AllowOverride FileInfo
234 * (req_override & OR_INDEXES) => *.conf anywhere
235 * and .htaccess when AllowOverride Indexes
240 #define OR_FILEINFO 4
242 #define OR_INDEXES 16
244 #define ACCESS_CONF 64
245 #define RSRC_CONF 128
246 #define EXEC_ON_READ 256
247 #define OR_ALL (OR_LIMIT|OR_OPTIONS|OR_FILEINFO|OR_AUTHCFG|OR_INDEXES)
250 * This can be returned by a function if they don't wish to handle
251 * a command. Make it something not likely someone will actually use
253 * @defvar DECLINE_CMD "\a\b"
255 #define DECLINE_CMD "\a\b"
257 typedef struct configfile_t configfile_t;
258 /** Common structure for reading of config files / passwd files etc. */
259 struct configfile_t {
260 /** a getc()-like function
261 * @deffunc int getch(void *param) */
262 int (*getch) (void *param);
263 /** a fgets()-like function
264 * @deffunc void *getstr(void *buf, size_t bufsize, void *param)*/
265 void *(*getstr) (void *buf, size_t bufsiz, void *param);
266 /** a close hander function
267 * @deffunc int close(void *param)*/
268 int (*close) (void *param);
269 /** the argument passed to getch/getstr/close */
271 /** the filename / description */
273 /** current line number, starting at 1 */
274 unsigned line_number;
278 * This structure is passed to a command which is being invoked,
279 * to carry a large variety of miscellaneous data which is all of
280 * use to *somebody*...
282 struct cmd_parms_struct {
283 /** Argument to command from cmd_table */
285 /** Which allow-override bits are set */
287 /** Which methods are <Limit>ed */
289 apr_array_header_t *limited_xmethods;
290 ap_method_list_t *xlimited;
292 /** Config file structure. */
293 configfile_t *config_file;
294 /** the directive specifying this command */
295 ap_directive_t *directive;
297 /** Pool to allocate new storage in */
299 /** Pool for scratch memory; persists during configuration, but
300 * wiped before the first request is served... */
301 apr_pool_t *temp_pool;
302 /** Server_rec being configured for */
304 /** If configuring for a directory, pathname of that directory.
305 * NOPE! That's what it meant previous to the existance of <Files>,
306 * <Location> and regex matching. Now the only usefulness that can be
307 * derived from this field is whether a command is being called in a
308 * server context (path == NULL) or being called in a dir context
311 /** configuration command */
312 const command_rec *cmd;
314 /** per_dir_config vector passed to handle_command */
316 /** directive with syntax error */
317 const ap_directive_t *err_directive;
320 typedef struct module_struct module;
322 * Module structures. Just about everything is dispatched through
323 * these, directly or indirectly (through the command and handler
326 struct module_struct {
327 /** API version, *not* module version; check that module is
328 * compatible with this version of the server.
331 /** API minor version. Provides API feature milestones. Not checked
332 * during module init */
334 /** Index to this modules structures in config vectors. */
337 /** The name of the module's C file */
339 /** The handle for the DSO. Internal use only */
340 void *dynamic_load_handle;
342 /** A pointer to the next module in the list
343 * @defvar module_struct *next */
344 struct module_struct *next;
346 /** Magic Cookie to identify a module structure; It's mainly
347 * important for the DSO facility (see also mod_so). */
350 /** Function to allow MPMs to re-write command line arguments. This
351 * hook is only available to MPMs.
352 * @param The process that the server is running in.
353 * @deffunc void rewrite_args(process_rec *process);
355 void (*rewrite_args) (process_rec *process);
356 /** Function to allow all modules to create per directory configuration
358 * @param p The pool to use for all allocations.
359 * @param dir The directory currently being processed.
360 * @return The per-directory structure created
361 * @deffunc void *create_dir_config(apr_pool_t *p, char *dir)
363 void *(*create_dir_config) (apr_pool_t *p, char *dir);
364 /** Function to allow all modules to merge the per directory configuration
365 * structures for two directories.
366 * @param p The pool to use for all allocations.
367 * @param base_conf The directory structure created for the parent directory.
368 * @param new_conf The directory structure currently being processed.
369 * @return The new per-directory structure created
370 * @deffunc void *merge_dir_config(apr_pool_t *p, void *base_conf, void *new_conf)
372 void *(*merge_dir_config) (apr_pool_t *p, void *base_conf, void *new_conf);
373 /** Function to allow all modules to create per server configuration
375 * @param p The pool to use for all allocations.
376 * @param s The server currently being processed.
377 * @return The per-server structure created
378 * @deffunc void *create_server_config(apr_pool_t *p, server_rec *dir)
380 void *(*create_server_config) (apr_pool_t *p, server_rec *s);
381 /** Function to allow all modules to merge the per server configuration
382 * structures for two servers.
383 * @param p The pool to use for all allocations.
384 * @param base_conf The directory structure created for the parent directory.
385 * @param new_conf The directory structure currently being processed.
386 * @return The new per-directory structure created
387 * @deffunc void *merge_dir_config(apr_pool_t *p, void *base_conf, void *new_conf)
389 void *(*merge_server_config) (apr_pool_t *p, void *base_conf, void *new_conf);
391 /** A command_rec table that describes all of the directives this module
393 const command_rec *cmds;
395 /** A hook to allow modules to hook other points in the request processing.
396 * In this function, modules should call the ap_hook_*() functions to
397 * register an interest in a specific step in processing the current
399 * @param p the pool to use for all allocations
400 * @deffunc void register_hooks(void)
402 void (*register_hooks) (apr_pool_t *p);
405 /* Initializer for the first few module slots, which are only
406 * really set up once we start running. Note that the first two slots
407 * provide a version check; this should allow us to deal with changes to
408 * the API. The major number should reflect changes to the API handler table
409 * itself or removal of functionality. The minor number should reflect
410 * additions of functionality to the existing API. (the server can detect
411 * an old-format module, and either handle it back-compatibly, or at least
412 * signal an error). See src/include/ap_mmn.h for MMN version history.
415 #define STANDARD_MODULE_STUFF this_module_needs_to_be_ported_to_apache_2_0
417 #define STANDARD20_MODULE_STUFF MODULE_MAGIC_NUMBER_MAJOR, \
418 MODULE_MAGIC_NUMBER_MINOR, \
423 MODULE_MAGIC_COOKIE, \
424 NULL /* rewrite args spot */
426 #define MPM20_MODULE_STUFF MODULE_MAGIC_NUMBER_MAJOR, \
427 MODULE_MAGIC_NUMBER_MINOR, \
436 * Generic accessors for other modules to get at their own module-specific
438 * @param conf_vector The vector in which the modules configuration is stored.
439 * usually r->per_dir_config or s->module_config
440 * @param m The module to get the data for.
441 * @return The module-specific data
442 * @deffunc void *ap_get_module_config(void *conf_vector, module *m)
444 AP_DECLARE(void *) ap_get_module_config(void *conf_vector, module *m);
448 * Generic accessors for other modules to set at their own module-specific
450 * @param conf_vector The vector in which the modules configuration is stored.
451 * usually r->per_dir_config or s->module_config
452 * @param m The module to set the data for.
453 * @param val The module-specific data to set
454 * @deffunc void ap_set_module_config(void *conf_vector, module *m, void *val)
456 AP_DECLARE(void) ap_set_module_config(void *conf_vector, module *m, void *val);
459 #define ap_get_module_config(v,m) \
460 (((void **)(v))[(m)->module_index])
461 #define ap_set_module_config(v,m,val) \
462 ((((void **)(v))[(m)->module_index]) = (val))
465 * Generic command handling function for strings
466 * @param cmd The command parameters for this directive
467 * @param struct_ptr pointer into a given type
468 * @param arg The argument to the directive
469 * @return An error string or NULL on success
470 * @deffunc const char *ap_set_string_slot(cmd_parms *cmd, void *struct_ptr, const char *arg)
472 AP_DECLARE_NONSTD(const char *) ap_set_string_slot(cmd_parms *, void *,
476 * Return true if the specified method is limited by being listed in
477 * a <Limit> container, or by *not* being listed in a <LimiteExcept>
480 * @param method Pointer to a string specifying the method to check.
481 * @param cmd Pointer to the cmd_parms structure passed to the
483 * @return 0 if the method is not limited in the current scope
484 * @deffunc ap_method_is_limited(cmd_parms *cmd, const char *method)
486 AP_DECLARE(int) ap_method_is_limited(cmd_parms *cmd, const char *method);
489 * Generic command handling function for strings, always sets the value
490 * to a lowercase string
491 * @param cmd The command parameters for this directive
492 * @param struct_ptr pointer into a given type
493 * @param arg The argument to the directive
494 * @return An error string or NULL on success
495 * @deffunc const char *ap_set_string_slot_lower(cmd_parms *cmd, void *struct_ptr, const char *arg)
497 AP_DECLARE_NONSTD(const char *) ap_set_string_slot_lower(cmd_parms *,
498 void *, const char *);
500 * Generic command handling function for flags
501 * @param cmd The command parameters for this directive
502 * @param struct_ptr pointer into a given type
503 * @param arg The argument to the directive (either 1 or 0)
504 * @return An error string or NULL on success
505 * @deffunc const char *ap_set_flag_slot(cmd_parms *cmd, void *struct_ptr, int arg)
507 AP_DECLARE_NONSTD(const char *) ap_set_flag_slot(cmd_parms *, void *, int);
509 * Generic command handling function for files
510 * @param cmd The command parameters for this directive
511 * @param struct_ptr pointer into a given type
512 * @param arg The argument to the directive
513 * @return An error string or NULL on success
514 * @deffunc const char *ap_set_file_slot(cmd_parms *cmd, void *struct_ptr, const char *arg)
516 AP_DECLARE_NONSTD(const char *) ap_set_file_slot(cmd_parms *, void *, const char *);
519 * For modules which need to read config files, open logs, etc. ...
520 * this returns the fname argument if it begins with '/'; otherwise
521 * it relativizes it wrt server_root.
522 * @param p pool to allocate data out of
523 * @param fname The file name
524 * @deffunc const char *ap_server_root_relative(apr_pool_t *p, const char *fname)
526 AP_DECLARE(const char *) ap_server_root_relative(apr_pool_t *p, const char *fname);
528 /* Finally, the hook for dynamically loading modules in... */
531 * Add a module to the server
532 * @param m The module structure of the module to add
533 * @param p The pool of the same lifetime as the module
534 * @deffunc void ap_add_module(module *m, apr_pool_t *p)
536 AP_DECLARE(void) ap_add_module(module *m, apr_pool_t *p);
539 * Remove a module from the server. There are some caveats:
540 * when the module is removed, its slot is lost so all the current
541 * per-dir and per-server configurations are invalid. So we should
542 * only ever call this function when you are invalidating almost
543 * all our current data. I.e. when doing a restart.
544 * @param m the module structure of the module to remove
545 * @deffunc void ap_remove_module(module *m)
547 AP_DECLARE(void) ap_remove_module(module *m);
549 * Add a module to the chained modules list and the list of loaded modules
550 * @param m The module structure of the module to add
551 * @param p The pool with the same lifetime as the module
552 * @deffunc void ap_add_loaded_module(module *m, apr_pool_t *p)
554 AP_DECLARE(void) ap_add_loaded_module(module *mod, apr_pool_t *p);
556 * Remove a module fromthe chained modules list and the list of loaded modules
557 * @param m the module structure of the module to remove
558 * @deffunc void ap_remove_loaded_module(module *m)
560 AP_DECLARE(void) ap_remove_loaded_module(module *mod);
562 * Add a module to the list of loaded module based on the name of the
564 * @param name The name of the module
565 * @param p The pool valid for the lifetime of the module
566 * @return 1 on success, 0 on failure
567 * @deffunc int ap_add_named_module(const char *name, apr_pool_t *p)
569 AP_DECLARE(int) ap_add_named_module(const char *name, apr_pool_t *p);
571 * Clear all of the modules from the loaded module list
572 * @param p The pool valid for the lifetime of the modules
573 * @deffunc void ap_add_named_module(apr_pool_t *p)
575 AP_DECLARE(void) ap_clear_module_list(apr_pool_t *p);
577 * Find the name of the specified module
578 * @param m The module to get the name for
579 * @return the name of the module
580 * @deffunc const char *ap_find_module_name(module *m)
582 AP_DECLARE(const char *) ap_find_module_name(module *m);
584 * Find a module based on the name of the module
585 * @param name the name of the module
586 * @return the module structure if found, NULL otherwise
587 * @deffunc module *ap_find_linked_module(const char *name)
589 AP_DECLARE(module *) ap_find_linked_module(const char *name);
592 * Open a configfile_t as apr_file_t
593 * @param ret_cfg open configfile_t struct pointer
594 * @param p The pool to allocate the structure out of
595 * @param name the name of the file to open
596 * @deffunc apr_status_t ap_pcfg_openfile(configfile_t **ret_cfg, apr_pool_t *p, const char *name)
598 AP_DECLARE(apr_status_t) ap_pcfg_openfile(configfile_t **, apr_pool_t *p, const char *name);
601 * Allocate a configfile_t handle with user defined functions and params
602 * @param p The pool to allocate out of
603 * @param descr The name of the file
604 * @param param The argument passed to getch/getstr/close
605 * @param getc_func The getch function
606 * @param gets_func The getstr function
607 * @param close_func The close function
608 * @deffunc configfile_t *ap_pcfg_open_custom(apr_pool_t *p, const char *descr, void *param, int(*getc_func)(void*), void *(*gets_func) (void *buf, size_t bufsiz, void *param), int(*close_func)(void *param))
610 AP_DECLARE(configfile_t *) ap_pcfg_open_custom(apr_pool_t *p, const char *descr,
612 int(*getc_func)(void*),
613 void *(*gets_func) (void *buf, size_t bufsiz, void *param),
614 int(*close_func)(void *param));
617 * Read one line from open configfile_t, strip LF, increase line number
618 * @param buf place to store the line read
619 * @param bufsize size of the buffer
620 * @param cfp File to read from
621 * @return 1 on success, 0 on failure
622 * @deffunc int ap_cfg_getline(char *buf, size_t bufsize, configfile_t *cfp)
624 AP_DECLARE(int) ap_cfg_getline(char *buf, size_t bufsize, configfile_t *cfp);
627 * Read one char from open configfile_t, increase line number upon LF
628 * @param cfp The file to read from
629 * @return the character read
630 * @deffunc int ap_cfg_getc(configfile_t *cfp)
632 AP_DECLARE(int) ap_cfg_getc(configfile_t *cfp);
635 * Detach from open configfile_t, calling the close handler
636 * @param cfp The file to close
637 * @return 1 on sucess, 0 on failure
638 * @deffunc int ap_cfg_closefile(configfile_t *cfp)
640 AP_DECLARE(int) ap_cfg_closefile(configfile_t *cfp);
643 * Read all data between the current <foo> and the matching </foo>. All
644 * of this data is forgotten immediately.
645 * @param cmd The cmd_parms to pass to the directives inside the container
646 * @param directive The directive name to read until
647 * @retrn Error string on failure, NULL on success
648 * @deffunc const char *ap_soak_end_container(cmd_parms *cmd, char *directive)
650 AP_DECLARE(const char *) ap_soak_end_container(cmd_parms *cmd, char *directive);
653 * Read all data between the current <foo> and the matching </foo> and build
654 * a config tree out of it
655 * @param p pool to allocate out of
656 * @param temp_pool Temporary pool to allocate out of
657 * @param parms The cmd_parms to pass to all directives read
658 * @param current The current node in the tree
659 * @param curr_parent The current parent node
660 * @param orig_directive The directive to read until hit.
661 * @return Error string on failure, NULL on success
662 * @deffunc char *ap_build_cont_config(apr_pool_t *p, apr_pool_t *temp_pool, cmd_parms *parms, ap_directive_t **current, ap_directive_t **curr_parent, char *orig_directive)
664 const char * ap_build_cont_config(apr_pool_t *p, apr_pool_t *temp_pool,
666 ap_directive_t **current,
667 ap_directive_t **curr_parent,
668 char *orig_directive);
671 * Build a config tree from a config file
672 * @param parms The cmd_parms to pass to all of the directives in the file
673 * @param conf_pool The pconf pool
674 * @param temp_pool The temporary pool
675 * @param conftree Place to store the root node of the config tree
676 * @return Error string on erro, NULL otherwise
677 * @deffunc const char *ap_build_config(cmd_parms *parms, apr_pool_t *conf_pool, apr_pool_t *temp_pool, ap_directive_t **conftree)
679 AP_DECLARE(const char *) ap_build_config(cmd_parms *parms,
680 apr_pool_t *conf_pool,
681 apr_pool_t *temp_pool,
682 ap_directive_t **conftree);
685 * Walk a config tree and setup the server's internal structures
686 * @param conftree The config tree to walk
687 * @param parms The cmd_parms to pass to all functions
688 * @param config The parms context
689 * @return Error string on error, NULL otherwise
690 * @deffunc const char *ap_walk_config(ap_directive_t *conftree, cmd_parms *parms, void *config)
692 AP_DECLARE(const char *) ap_walk_config(ap_directive_t *conftree,
693 cmd_parms *parms, void *config);
696 * ap_check_cmd_context() definitions:
697 * @param cmd The cmd_context to check
698 * @param forbidden Where the command is forbidden. One of:
705 * NOT_IN_DIR_LOC_FILE
708 * @return Error string on error, NULL on success
709 * @deffunc const char *ap_check_cmd_context(cmd_parms *cmd, unsigned forbidden)
711 AP_DECLARE(const char *) ap_check_cmd_context(cmd_parms *cmd, unsigned forbidden);
713 /* ap_check_cmd_context(): Forbidden in: */
714 #define NOT_IN_VIRTUALHOST 0x01 /* <Virtualhost> */
715 #define NOT_IN_LIMIT 0x02 /* <Limit> */
716 #define NOT_IN_DIRECTORY 0x04 /* <Directory> */
717 #define NOT_IN_LOCATION 0x08 /* <Location> */
718 #define NOT_IN_FILES 0x10 /* <Files> */
719 #define NOT_IN_DIR_LOC_FILE (NOT_IN_DIRECTORY|NOT_IN_LOCATION|NOT_IN_FILES) /* <Directory>/<Location>/<Files>*/
720 #define GLOBAL_ONLY (NOT_IN_VIRTUALHOST|NOT_IN_LIMIT|NOT_IN_DIR_LOC_FILE)
726 * The topmost module in the list
727 * @defvar module *top_module
729 AP_DECLARE_DATA extern module *top_module;
732 * Array of all statically linked modules
733 * @defvar module *ap_prelinked_modules[]
735 AP_DECLARE_DATA extern module *ap_prelinked_modules[];
737 * Array of all preloaded modules
738 * @defvar module *ap_preloaded_modules[]
740 AP_DECLARE_DATA extern module *ap_preloaded_modules[];
742 * Array of all loaded modules
743 * @defvar module **ap_loaded_modules
745 AP_DECLARE_DATA extern module **ap_loaded_modules;
747 /* For mod_so.c... */
748 /** Run a single module's two create_config hooks
749 * @param p the pool to allocate out of
750 * @param s The server to configure for.
751 * @param m The module to configure
753 AP_DECLARE(void) ap_single_module_configure(apr_pool_t *p, server_rec *s,
756 /* For http_main.c... */
758 * Add all of the prelinked modules into the loaded module list
759 * @param process The process that is currently running the server
760 * @deffunc void ap_setup_prelinked_modules(process_rec *process)
762 AP_DECLARE(void) ap_setup_prelinked_modules(process_rec *process);
765 *Show the preloaded configuration directives, the help string explaining
766 * the directive arguments, in what module they are handled, and in
767 * what parts of the configuration they are allowed. Used for httpd -h.
768 * @deffunc void ap_show_directives(void)
770 AP_DECLARE(void) ap_show_directives(void);
773 * Show the preloaded module names. Used for httpd -l.
774 * @deffunc void ap_show_modules(void)
776 AP_DECLARE(void) ap_show_modules(void);
779 * Read all config files and setup the server
780 * @param process The process running the server
781 * @param temp_pool A pool to allocate temporary data out of.
782 * @param config_name The name of the config file
783 * @param conftree Place to store the root of the config tree
784 * @return The setup server_rec list.
785 * @deffunc server_rec *ap_read_config(process_rec *process, apr_pool_t *temp_pool, const char *config_name, ap_directive_t **conftree)
787 AP_DECLARE(server_rec*) ap_read_config(process_rec *process, apr_pool_t *temp_pool, const char *config_name, ap_directive_t **conftree);
790 * Run all post config hooks for loaded modules.
791 * @param pconf The configuration pool
792 * @param plog The logging pool
793 * @param ptemp The temporary pool
794 * @param s The list of server_rec structures
795 * @deffunc void ap_post_config_hook(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *s)
797 AP_DECLARE(void) ap_post_config_hook(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *s);
800 * Run all rewrite args hooks for loaded modules
801 * @param process The process currently running the server
802 * @deffunc void ap_run_rewrite_args(process_rec *process)
804 AP_DECLARE(void) ap_run_rewrite_args(process_rec *process);
807 * Run the register hooks function for a specified module
808 * @param m The module to run the register hooks function fo
809 * @param p The pool valid for the lifetime of the module
810 * @deffunc void ap_register_hooks(module *m, apr_pool_t *p)
812 AP_DECLARE(void) ap_register_hooks(module *m, apr_pool_t *p);
815 * Setup all virtual hosts
816 * @param p The pool to allocate out of
817 * @param main_server The head of the server_rec list
818 * @deffunc void ap_fixup_virtual_hosts(apr_pool_t *p, server_rec *main_server)
820 AP_DECLARE(void) ap_fixup_virtual_hosts(apr_pool_t *p, server_rec *main_server);
822 /* For http_request.c... */
825 * Setup the config vector for a request_rec
826 * @param p The pool to allocate the config vector out of
827 * @return The config vector
829 void *ap_create_request_config(apr_pool_t *p);
832 * Setup the config vector for per dir module configs
833 * @param p The pool to allocate the config vector out of
834 * @return The config vector
835 * @deffunc void *ap_create_per_dir_config(apr_pool_t *p)
837 AP_CORE_DECLARE(void *) ap_create_per_dir_config(apr_pool_t *p);
840 * Run all of the modules merge per dir config functions
841 * @param p The pool to pass to the merge functions
842 * @param base The base directory config structure
843 * @param new The new directory config structure
845 void *ap_merge_per_dir_configs(apr_pool_t *p, void *base, void *new);
847 /* For http_connection.c... */
849 * Setup the config vector for a connection_rec
850 * @param p The pool to allocate the config vector out of
851 * @return The config vector
853 void *ap_create_conn_config(apr_pool_t *p);
855 /* For http_core.c... (<Directory> command and virtual hosts) */
858 * parse an htaccess file
859 * @param resulting htaccess_result
860 * @param r The request currently being served
861 * @param override Which overrides are active
862 * @param path The path to the htaccess file
863 * @param access_name The list of possible names for .htaccess files
864 * int The status of the current request
866 int ap_parse_htaccess(void **result, request_rec *r, int override,
867 const char *path, const char *access_name);
870 * Setup a virtual host
871 * @param p The pool to allocate all memory out of
872 * @param hostname The hostname of the virtual hsot
873 * @param main_server The main server for this Apache configuration
874 * @param ps Place to store the new server_rec
875 * return Error string on error, NULL on success
876 * @deffunc const char *ap_init_virtual_host(apr_pool_t *p, const char *hostname, server_rec *main_server, server_rec **ps)
878 AP_CORE_DECLARE(const char *) ap_init_virtual_host(apr_pool_t *p, const char *hostname,
879 server_rec *main_server, server_rec **);
882 * Process the config file for Apache
883 * @param s The server rec to use for the command parms
884 * @param fname The name of the config file
885 * @param conftree The root node of the created config tree
886 * @param p Pool for general allocation
887 * @param ptem Pool for temporary allocation
889 void ap_process_resource_config(server_rec *s, const char *fname,
890 ap_directive_t **conftree, apr_pool_t *p, apr_pool_t *ptemp);
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
899 AP_DECLARE(void) ap_process_config_tree(server_rec *s, ap_directive_t *conftree,
900 apr_pool_t *p, apr_pool_t *ptemp);
903 /* For individual MPMs... */
905 * Run all child init hooks
906 * @param pchild The pool for child process allocations
907 * @param s The list of all server_recs
909 void ap_child_init_hook(apr_pool_t *pchild, server_rec *s);
911 /* Module-method dispatchers, also for http_request.c */
913 * Run the handler phase of each module until a module accepts the
914 * responsibility of serving the request
915 * @param r The current request
916 * @return The status of the current request
918 int ap_invoke_handler(request_rec *);
923 * Find a given directive in a command_rec table
924 * @param name The directive to search for
925 * @param cmds The table to search
926 * @return The directive definition of the specified directive
927 * @deffunc const command_rec *ap_find_command(const char *name, const command_rec *cmds)
929 AP_CORE_DECLARE(const command_rec *) ap_find_command(const char *name, const command_rec *cmds);
932 * Find a given directive in a list module
933 * @param cmd_name The directive to search for
934 * @param mod The module list to search
935 * @return The directive definition of the specified directive
936 * @deffunc const command_rec *ap_find_command_in_modules(const char *cmd_name,module **mod)
938 AP_CORE_DECLARE(const command_rec *) ap_find_command_in_modules(const char *cmd_name, module **mod);
941 * Add a per_dir and per_server config vector to a given module
942 * @param parms The command_parms to use
943 * @param config The config vector
944 * @param mod The module to add the vector for.
945 * @return The new config vector
946 * @deffunc void *ap_set_config_vectors(cmd_parms *parms, void *config, module *mod)
948 AP_CORE_DECLARE(void *) ap_set_config_vectors(cmd_parms *parms, void *config, module *mod);
955 * Run the header parser functions for each module
956 * @param r The current request
957 * @return OK or DECLINED
958 * @deffunc int ap_run_header_parser(request_rec *r)
960 AP_DECLARE_HOOK(int,header_parser,(request_rec *))
963 * Run the pre_config function for each module
964 * @param pconf The config pool
965 * @param plog The logging streams pool
966 * @param ptemp The temporary pool
967 * @deffunc void ap_run_pre_config(apr_pool_t *pconf,apr_pool_t *plog,apr_pool_t *ptemp)
969 AP_DECLARE_HOOK(void,pre_config,
970 (apr_pool_t *pconf,apr_pool_t *plog,apr_pool_t *ptemp))
973 * Run the post_config function for each module
974 * @param pconf The config pool
975 * @param plog The logging streams pool
976 * @param ptemp The temporary pool
977 * @param s The list of server_recs
978 * @deffunc void ap_run_post_config(apr_pool_t *pconf,apr_pool_t *plog,apr_pool_t *ptemp, server_rec *s)
980 AP_DECLARE_HOOK(void,post_config,
981 (apr_pool_t *pconf,apr_pool_t *plog,apr_pool_t *ptemp,server_rec *s))
984 * Run the open_logs functions for each module
985 * @param pconf The config pool
986 * @param plog The logging streams pool
987 * @param ptemp The temporary pool
988 * @param s The list of server_recs
989 * @deffunc void ap_run_open_logs(apr_pool_t *pconf,apr_pool_t *plog,apr_pool_t *ptemp, server_rec *s)
991 AP_DECLARE_HOOK(void,open_logs,
992 (apr_pool_t *pconf,apr_pool_t *plog,apr_pool_t *ptemp,server_rec *s))
995 * Run the child_init functions for each module
996 * @param pchild The child pool
997 * @param s The list of server_recs in this server
998 * @deffunc void ap_run_child_init(apr_pool_t *pchild, server_rec *s)
1000 AP_DECLARE_HOOK(void,child_init,(apr_pool_t *pchild, server_rec *s))
1003 * Run the handler functions for each module
1004 * @param r The request_rec
1005 * @deffunc void ap_run_handler(request_rec *r)
1006 * @tip non-wildcard handlers should HOOK_MIDDLE, wildcard HOOK_LAST
1008 AP_DECLARE_HOOK(int,handler,(request_rec *))
1014 #endif /* !APACHE_HTTP_CONFIG_H */