1 /* Copyright 1999-2004 The Apache Software Foundation
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
7 * http://www.apache.org/licenses/LICENSE-2.0
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
16 #ifndef APACHE_HTTP_CONFIG_H
17 #define APACHE_HTTP_CONFIG_H
19 #include "apr_hooks.h"
20 #include "util_cfgtree.h"
28 * @brief Apache Configuration
32 * The central data structures around here...
35 /* Command dispatch structures... */
38 * How the directives arguments should be parsed.
39 * @remark Note that for all of these except RAW_ARGS, the config routine is
40 * passed a freshly allocated string which can be modified or stored
44 RAW_ARGS, /**< cmd_func parses command line itself */
45 TAKE1, /**< one argument only */
46 TAKE2, /**< two arguments only */
47 ITERATE, /**< one argument, occuring multiple times
50 ITERATE2, /**< two arguments, 2nd occurs multiple times
53 FLAG, /**< One of 'On' or 'Off' */
54 NO_ARGS, /**< No args at all, e.g. </Directory> */
55 TAKE12, /**< one or two arguments */
56 TAKE3, /**< three arguments only */
57 TAKE23, /**< two or three arguments */
58 TAKE123, /**< one, two or three arguments */
59 TAKE13 /**< one or three arguments */
62 * This structure is passed to a command which is being invoked,
63 * to carry a large variety of miscellaneous data which is all of
64 * use to *somebody*...
66 typedef struct cmd_parms_struct cmd_parms;
68 #if defined(AP_HAVE_DESIGNATED_INITIALIZER) || defined(DOXYGEN)
71 * All the types of functions that can be used in directives
75 /** function to call for a no-args */
76 const char *(*no_args) (cmd_parms *parms, void *mconfig);
77 /** function to call for a raw-args */
78 const char *(*raw_args) (cmd_parms *parms, void *mconfig,
80 /** function to call for a take1 */
81 const char *(*take1) (cmd_parms *parms, void *mconfig, const char *w);
82 /** function to call for a take2 */
83 const char *(*take2) (cmd_parms *parms, void *mconfig, const char *w,
85 /** function to call for a take3 */
86 const char *(*take3) (cmd_parms *parms, void *mconfig, const char *w,
87 const char *w2, const char *w3);
88 /** function to call for a flag */
89 const char *(*flag) (cmd_parms *parms, void *mconfig, int on);
92 /** This configuration directive does not take any arguments */
93 # define AP_NO_ARGS func.no_args
94 /** This configuration directive will handle it's own parsing of arguments*/
95 # define AP_RAW_ARGS func.raw_args
96 /** This configuration directive takes 1 argument*/
97 # define AP_TAKE1 func.take1
98 /** This configuration directive takes 2 arguments */
99 # define AP_TAKE2 func.take2
100 /** This configuration directive takes 3 arguments */
101 # define AP_TAKE3 func.take3
102 /** This configuration directive takes a flag (on/off) as a argument*/
103 # define AP_FLAG func.flag
105 /** method of declaring a directive with no arguments */
106 # define AP_INIT_NO_ARGS(directive, func, mconfig, where, help) \
107 { directive, { .no_args=func }, mconfig, where, RAW_ARGS, help }
108 /** method of declaring a directive with raw argument parsing */
109 # define AP_INIT_RAW_ARGS(directive, func, mconfig, where, help) \
110 { directive, { .raw_args=func }, mconfig, where, RAW_ARGS, help }
111 /** method of declaring a directive which takes 1 argument */
112 # define AP_INIT_TAKE1(directive, func, mconfig, where, help) \
113 { directive, { .take1=func }, mconfig, where, TAKE1, help }
114 /** method of declaring a directive which takes multiple arguments */
115 # define AP_INIT_ITERATE(directive, func, mconfig, where, help) \
116 { directive, { .take1=func }, mconfig, where, ITERATE, help }
117 /** method of declaring a directive which takes 2 arguments */
118 # define AP_INIT_TAKE2(directive, func, mconfig, where, help) \
119 { directive, { .take2=func }, mconfig, where, TAKE2, help }
120 /** method of declaring a directive which takes 1 or 2 arguments */
121 # define AP_INIT_TAKE12(directive, func, mconfig, where, help) \
122 { directive, { .take2=func }, mconfig, where, TAKE12, help }
123 /** method of declaring a directive which takes multiple 2 arguments */
124 # define AP_INIT_ITERATE2(directive, func, mconfig, where, help) \
125 { directive, { .take2=func }, mconfig, where, ITERATE2, help }
126 /** method of declaring a directive which takes 1 or 3 arguments */
127 # define AP_INIT_TAKE13(directive, func, mconfig, where, help) \
128 { directive, { .take3=func }, mconfig, where, TAKE13, help }
129 /** method of declaring a directive which takes 2 or 3 arguments */
130 # define AP_INIT_TAKE23(directive, func, mconfig, where, help) \
131 { directive, { .take3=func }, mconfig, where, TAKE23, help }
132 /** method of declaring a directive which takes 1 to 3 arguments */
133 # define AP_INIT_TAKE123(directive, func, mconfig, where, help) \
134 { directive, { .take3=func }, mconfig, where, TAKE123, help }
135 /** method of declaring a directive which takes 3 arguments */
136 # define AP_INIT_TAKE3(directive, func, mconfig, where, help) \
137 { directive, { .take3=func }, mconfig, where, TAKE3, help }
138 /** method of declaring a directive which takes a flag (on/off) as a argument*/
139 # define AP_INIT_FLAG(directive, func, mconfig, where, help) \
140 { directive, { .flag=func }, mconfig, where, FLAG, help }
142 #else /* AP_HAVE_DESIGNATED_INITIALIZER */
144 typedef const char *(*cmd_func) ();
146 # define AP_NO_ARGS func
147 # define AP_RAW_ARGS func
148 # define AP_TAKE1 func
149 # define AP_TAKE2 func
150 # define AP_TAKE3 func
151 # define AP_FLAG func
153 # define AP_INIT_NO_ARGS(directive, func, mconfig, where, help) \
154 { directive, func, mconfig, where, RAW_ARGS, help }
155 # define AP_INIT_RAW_ARGS(directive, func, mconfig, where, help) \
156 { directive, func, mconfig, where, RAW_ARGS, help }
157 # define AP_INIT_TAKE1(directive, func, mconfig, where, help) \
158 { directive, func, mconfig, where, TAKE1, help }
159 # define AP_INIT_ITERATE(directive, func, mconfig, where, help) \
160 { directive, func, mconfig, where, ITERATE, help }
161 # define AP_INIT_TAKE2(directive, func, mconfig, where, help) \
162 { directive, func, mconfig, where, TAKE2, help }
163 # define AP_INIT_TAKE12(directive, func, mconfig, where, help) \
164 { directive, func, mconfig, where, TAKE12, help }
165 # define AP_INIT_ITERATE2(directive, func, mconfig, where, help) \
166 { directive, func, mconfig, where, ITERATE2, help }
167 # define AP_INIT_TAKE13(directive, func, mconfig, where, help) \
168 { directive, func, mconfig, where, TAKE13, help }
169 # define AP_INIT_TAKE23(directive, func, mconfig, where, help) \
170 { directive, func, mconfig, where, TAKE23, help }
171 # define AP_INIT_TAKE123(directive, func, mconfig, where, help) \
172 { directive, func, mconfig, where, TAKE123, help }
173 # define AP_INIT_TAKE3(directive, func, mconfig, where, help) \
174 { directive, func, mconfig, where, TAKE3, help }
175 # define AP_INIT_FLAG(directive, func, mconfig, where, help) \
176 { directive, func, mconfig, where, FLAG, help }
178 #endif /* AP_HAVE_DESIGNATED_INITIALIZER */
181 * The command record structure. Each modules can define a table of these
182 * to define the directives it will implement.
184 typedef struct command_struct command_rec;
185 struct command_struct {
186 /** Name of this command */
188 /** The function to be called when this directive is parsed */
190 /** Extra data, for functions which implement multiple commands... */
192 /** What overrides need to be allowed to enable this command. */
194 /** What the command expects as arguments
195 * @defvar cmd_how args_how*/
196 enum cmd_how args_how;
198 /** 'usage' message, in case of syntax errors */
203 * @defgroup ConfigDirectives Allowed locations for configuration directives.
205 * The allowed locations for a configuration directive are the union of
206 * those indicated by each set bit in the req_override mask.
210 #define OR_NONE 0 /**< *.conf is not available anywhere in this override */
211 #define OR_LIMIT 1 /**< *.conf inside <Directory> or <Location>
212 and .htaccess when AllowOverride Limit */
213 #define OR_OPTIONS 2 /**< *.conf anywhere
214 and .htaccess when AllowOverride Options */
215 #define OR_FILEINFO 4 /**< *.conf anywhere
216 and .htaccess when AllowOverride FileInfo */
217 #define OR_AUTHCFG 8 /**< *.conf inside <Directory> or <Location>
218 and .htaccess when AllowOverride AuthConfig */
219 #define OR_INDEXES 16 /**< *.conf anywhere
220 and .htaccess when AllowOverride Indexes */
221 #define OR_UNSET 32 /**< unset a directive (in Allow) */
222 #define ACCESS_CONF 64 /**< *.conf inside <Directory> or <Location> */
223 #define RSRC_CONF 128 /**< *.conf outside <Directory> or <Location> */
224 #define EXEC_ON_READ 256 /**< force directive to execute a command
225 which would modify the configuration (like including another
227 /** this directive can be placed anywhere */
228 #define OR_ALL (OR_LIMIT|OR_OPTIONS|OR_FILEINFO|OR_AUTHCFG|OR_INDEXES)
233 * This can be returned by a function if they don't wish to handle
234 * a command. Make it something not likely someone will actually use
237 #define DECLINE_CMD "\a\b"
239 /** Common structure for reading of config files / passwd files etc. */
240 typedef struct ap_configfile_t ap_configfile_t;
241 struct ap_configfile_t {
242 int (*getch) (void *param); /**< a getc()-like function */
243 void *(*getstr) (void *buf, size_t bufsiz, void *param);
244 /**< a fgets()-like function */
245 int (*close) (void *param); /**< a close handler function */
246 void *param; /**< the argument passed to getch/getstr/close */
247 const char *name; /**< the filename / description */
248 unsigned line_number; /**< current line number, starting at 1 */
252 * This structure is passed to a command which is being invoked,
253 * to carry a large variety of miscellaneous data which is all of
254 * use to *somebody*...
256 struct cmd_parms_struct {
257 /** Argument to command from cmd_table */
259 /** Which allow-override bits are set */
261 /** Which methods are <Limit>ed */
263 /** methods which are limited */
264 apr_array_header_t *limited_xmethods;
265 /** methods which are xlimited */
266 ap_method_list_t *xlimited;
268 /** Config file structure. */
269 ap_configfile_t *config_file;
270 /** the directive specifying this command */
271 ap_directive_t *directive;
273 /** Pool to allocate new storage in */
275 /** Pool for scratch memory; persists during configuration, but
276 * wiped before the first request is served... */
277 apr_pool_t *temp_pool;
278 /** Server_rec being configured for */
280 /** If configuring for a directory, pathname of that directory.
281 * NOPE! That's what it meant previous to the existance of <Files>,
282 * <Location> and regex matching. Now the only usefulness that can be
283 * derived from this field is whether a command is being called in a
284 * server context (path == NULL) or being called in a dir context
287 /** configuration command */
288 const command_rec *cmd;
290 /** per_dir_config vector passed to handle_command */
291 struct ap_conf_vector_t *context;
292 /** directive with syntax error */
293 const ap_directive_t *err_directive;
297 * Module structures. Just about everything is dispatched through
298 * these, directly or indirectly (through the command and handler
301 typedef struct module_struct module;
302 struct module_struct {
303 /** API version, *not* module version; check that module is
304 * compatible with this version of the server.
307 /** API minor version. Provides API feature milestones. Not checked
308 * during module init */
310 /** Index to this modules structures in config vectors. */
313 /** The name of the module's C file */
315 /** The handle for the DSO. Internal use only */
316 void *dynamic_load_handle;
318 /** A pointer to the next module in the list
319 * @defvar module_struct *next */
320 struct module_struct *next;
322 /** Magic Cookie to identify a module structure; It's mainly
323 * important for the DSO facility (see also mod_so). */
326 /** Function to allow MPMs to re-write command line arguments. This
327 * hook is only available to MPMs.
328 * @param The process that the server is running in.
330 void (*rewrite_args) (process_rec *process);
331 /** Function to allow all modules to create per directory configuration
333 * @param p The pool to use for all allocations.
334 * @param dir The directory currently being processed.
335 * @return The per-directory structure created
337 void *(*create_dir_config) (apr_pool_t *p, char *dir);
338 /** Function to allow all modules to merge the per directory configuration
339 * structures for two directories.
340 * @param p The pool to use for all allocations.
341 * @param base_conf The directory structure created for the parent directory.
342 * @param new_conf The directory structure currently being processed.
343 * @return The new per-directory structure created
345 void *(*merge_dir_config) (apr_pool_t *p, void *base_conf, void *new_conf);
346 /** Function to allow all modules to create per server configuration
348 * @param p The pool to use for all allocations.
349 * @param s The server currently being processed.
350 * @return The per-server structure created
352 void *(*create_server_config) (apr_pool_t *p, server_rec *s);
353 /** Function to allow all modules to merge the per server configuration
354 * structures for two servers.
355 * @param p The pool to use for all allocations.
356 * @param base_conf The directory structure created for the parent directory.
357 * @param new_conf The directory structure currently being processed.
358 * @return The new per-directory structure created
360 void *(*merge_server_config) (apr_pool_t *p, void *base_conf,
363 /** A command_rec table that describes all of the directives this module
365 const command_rec *cmds;
367 /** A hook to allow modules to hook other points in the request processing.
368 * In this function, modules should call the ap_hook_*() functions to
369 * register an interest in a specific step in processing the current
371 * @param p the pool to use for all allocations
373 void (*register_hooks) (apr_pool_t *p);
377 * @defgroup ModuleInit Module structure initializers
379 * Initializer for the first few module slots, which are only
380 * really set up once we start running. Note that the first two slots
381 * provide a version check; this should allow us to deal with changes to
382 * the API. The major number should reflect changes to the API handler table
383 * itself or removal of functionality. The minor number should reflect
384 * additions of functionality to the existing API. (the server can detect
385 * an old-format module, and either handle it back-compatibly, or at least
386 * signal an error). See src/include/ap_mmn.h for MMN version history.
390 /** The one used in Apache 1.3, which will deliberately cause an error */
391 #define STANDARD_MODULE_STUFF this_module_needs_to_be_ported_to_apache_2_0
393 /** Use this in all standard modules */
394 #define STANDARD20_MODULE_STUFF MODULE_MAGIC_NUMBER_MAJOR, \
395 MODULE_MAGIC_NUMBER_MINOR, \
400 MODULE_MAGIC_COOKIE, \
401 NULL /* rewrite args spot */
403 /** Use this only in MPMs */
404 #define MPM20_MODULE_STUFF MODULE_MAGIC_NUMBER_MAJOR, \
405 MODULE_MAGIC_NUMBER_MINOR, \
414 /* CONFIGURATION VECTOR FUNCTIONS */
416 /** configuration vector structure */
417 typedef struct ap_conf_vector_t ap_conf_vector_t;
420 * Generic accessors for other modules to get at their own module-specific
422 * @param conf_vector The vector in which the modules configuration is stored.
423 * usually r->per_dir_config or s->module_config
424 * @param m The module to get the data for.
425 * @return The module-specific data
427 AP_DECLARE(void *) ap_get_module_config(const ap_conf_vector_t *cv,
431 * Generic accessors for other modules to set at their own module-specific
433 * @param conf_vector The vector in which the modules configuration is stored.
434 * usually r->per_dir_config or s->module_config
435 * @param m The module to set the data for.
436 * @param val The module-specific data to set
438 AP_DECLARE(void) ap_set_module_config(ap_conf_vector_t *cv, const module *m,
441 #if !defined(AP_DEBUG)
443 #define ap_get_module_config(v,m) \
444 (((void **)(v))[(m)->module_index])
445 #define ap_set_module_config(v,m,val) \
446 ((((void **)(v))[(m)->module_index]) = (val))
448 #endif /* AP_DEBUG */
452 * Generic command handling function for strings
453 * @param cmd The command parameters for this directive
454 * @param struct_ptr pointer into a given type
455 * @param arg The argument to the directive
456 * @return An error string or NULL on success
458 AP_DECLARE_NONSTD(const char *) ap_set_string_slot(cmd_parms *cmd,
463 * Generic command handling function for integers
464 * @param cmd The command parameters for this directive
465 * @param struct_ptr pointer into a given type
466 * @param arg The argument to the directive
467 * @return An error string or NULL on success
469 AP_DECLARE_NONSTD(const char *) ap_set_int_slot(cmd_parms *cmd,
474 * Return true if the specified method is limited by being listed in
475 * a <Limit> container, or by *not* being listed in a <LimiteExcept>
478 * @param method Pointer to a string specifying the method to check.
479 * @param cmd Pointer to the cmd_parms structure passed to the
481 * @return 0 if the method is not limited in the current scope
483 AP_DECLARE(int) ap_method_is_limited(cmd_parms *cmd, const char *method);
486 * Generic command handling function for strings, always sets the value
487 * to a lowercase string
488 * @param cmd The command parameters for this directive
489 * @param struct_ptr pointer into a given type
490 * @param arg The argument to the directive
491 * @return An error string or NULL on success
493 AP_DECLARE_NONSTD(const char *) ap_set_string_slot_lower(cmd_parms *cmd,
497 * Generic command handling function for flags
498 * @param cmd The command parameters for this directive
499 * @param struct_ptr pointer into a given type
500 * @param arg The argument to the directive (either 1 or 0)
501 * @return An error string or NULL on success
503 AP_DECLARE_NONSTD(const char *) ap_set_flag_slot(cmd_parms *cmd,
507 * Generic command handling function for files
508 * @param cmd The command parameters for this directive
509 * @param struct_ptr pointer into a given type
510 * @param arg The argument to the directive
511 * @return An error string or NULL on success
513 AP_DECLARE_NONSTD(const char *) ap_set_file_slot(cmd_parms *cmd,
517 * Generic command handling function to respond with cmd->help as an error
518 * @param cmd The command parameters for this directive
519 * @param struct_ptr pointer into a given type
520 * @param arg The argument to the directive
521 * @return The cmd->help value as the error string
522 * @tip This allows simple declarations such as;
524 * AP_INIT_RAW_ARGS("Foo", ap_set_deprecated, NULL, OR_ALL,
525 * "The Foo directive is no longer supported, use Bar"),
528 AP_DECLARE_NONSTD(const char *) ap_set_deprecated(cmd_parms *cmd,
532 * For modules which need to read config files, open logs, etc. this returns
533 * the canonical form of fname made absolute to ap_server_root.
534 * @param p pool to allocate data from
535 * @param fname The file name
537 AP_DECLARE(char *) ap_server_root_relative(apr_pool_t *p, const char *fname);
539 /* Finally, the hook for dynamically loading modules in... */
542 * Add a module to the server
543 * @param m The module structure of the module to add
544 * @param p The pool of the same lifetime as the module
546 AP_DECLARE(const char *) ap_add_module(module *m, apr_pool_t *p);
549 * Remove a module from the server. There are some caveats:
550 * when the module is removed, its slot is lost so all the current
551 * per-dir and per-server configurations are invalid. So we should
552 * only ever call this function when you are invalidating almost
553 * all our current data. I.e. when doing a restart.
554 * @param m the module structure of the module to remove
556 AP_DECLARE(void) ap_remove_module(module *m);
558 * Add a module to the chained modules list and the list of loaded modules
559 * @param m The module structure of the module to add
560 * @param p The pool with the same lifetime as the module
562 AP_DECLARE(const char *) ap_add_loaded_module(module *mod, apr_pool_t *p);
564 * Remove a module fromthe chained modules list and the list of loaded modules
565 * @param m the module structure of the module to remove
567 AP_DECLARE(void) ap_remove_loaded_module(module *mod);
569 * Find the name of the specified module
570 * @param m The module to get the name for
571 * @return the name of the module
573 AP_DECLARE(const char *) ap_find_module_name(module *m);
575 * Find a module based on the name of the module
576 * @param name the name of the module
577 * @return the module structure if found, NULL otherwise
579 AP_DECLARE(module *) ap_find_linked_module(const char *name);
582 * Open a ap_configfile_t as apr_file_t
583 * @param ret_cfg open ap_configfile_t struct pointer
584 * @param p The pool to allocate the structure from
585 * @param name the name of the file to open
587 AP_DECLARE(apr_status_t) ap_pcfg_openfile(ap_configfile_t **ret_cfg,
588 apr_pool_t *p, const char *name);
591 * Allocate a ap_configfile_t handle with user defined functions and params
592 * @param p The pool to allocate from
593 * @param descr The name of the file
594 * @param param The argument passed to getch/getstr/close
595 * @param getc_func The getch function
596 * @param gets_func The getstr function
597 * @param close_func The close function
599 AP_DECLARE(ap_configfile_t *) ap_pcfg_open_custom(apr_pool_t *p,
602 int(*getc_func)(void*),
603 void *(*gets_func) (void *buf, size_t bufsiz, void *param),
604 int(*close_func)(void *param));
607 * Read one line from open ap_configfile_t, strip LF, increase line number
608 * @param buf place to store the line read
609 * @param bufsize size of the buffer
610 * @param cfp File to read from
611 * @return 1 on success, 0 on failure
613 AP_DECLARE(int) ap_cfg_getline(char *buf, size_t bufsize, ap_configfile_t *cfp);
616 * Read one char from open configfile_t, increase line number upon LF
617 * @param cfp The file to read from
618 * @return the character read
620 AP_DECLARE(int) ap_cfg_getc(ap_configfile_t *cfp);
623 * Detach from open ap_configfile_t, calling the close handler
624 * @param cfp The file to close
625 * @return 1 on sucess, 0 on failure
627 AP_DECLARE(int) ap_cfg_closefile(ap_configfile_t *cfp);
630 * Read all data between the current <foo> and the matching </foo>. All
631 * of this data is forgotten immediately.
632 * @param cmd The cmd_parms to pass to the directives inside the container
633 * @param directive The directive name to read until
634 * @return Error string on failure, NULL on success
636 AP_DECLARE(const char *) ap_soak_end_container(cmd_parms *cmd, char *directive);
639 * Read all data between the current <foo> and the matching </foo> and build
640 * a config tree from it
641 * @param p pool to allocate from
642 * @param temp_pool Temporary pool to allocate from
643 * @param parms The cmd_parms to pass to all directives read
644 * @param current The current node in the tree
645 * @param curr_parent The current parent node
646 * @param orig_directive The directive to read until hit.
647 * @return Error string on failure, NULL on success
649 AP_DECLARE(const char *) ap_build_cont_config(apr_pool_t *p,
650 apr_pool_t *temp_pool,
652 ap_directive_t **current,
653 ap_directive_t **curr_parent,
654 char *orig_directive);
657 * Build a config tree from a config file
658 * @param parms The cmd_parms to pass to all of the directives in the file
659 * @param conf_pool The pconf pool
660 * @param temp_pool The temporary pool
661 * @param conftree Place to store the root node of the config tree
662 * @return Error string on erro, NULL otherwise
664 AP_DECLARE(const char *) ap_build_config(cmd_parms *parms,
665 apr_pool_t *conf_pool,
666 apr_pool_t *temp_pool,
667 ap_directive_t **conftree);
670 * Walk a config tree and setup the server's internal structures
671 * @param conftree The config tree to walk
672 * @param parms The cmd_parms to pass to all functions
673 * @param section_vector The per-section config vector.
674 * @return Error string on error, NULL otherwise
676 AP_DECLARE(const char *) ap_walk_config(ap_directive_t *conftree,
678 ap_conf_vector_t *section_vector);
681 * @defgroup ap_check_cmd_context ap_check_cmd_context
685 * Check the context a command is used in.
686 * @param cmd The command to check
687 * @param forbidden Where the command is forbidden.
688 * @return Error string on error, NULL on success
690 AP_DECLARE(const char *) ap_check_cmd_context(cmd_parms *cmd,
693 #define NOT_IN_VIRTUALHOST 0x01 /**< Forbidden in <Virtualhost> */
694 #define NOT_IN_LIMIT 0x02 /**< Forbidden in <Limit> */
695 #define NOT_IN_DIRECTORY 0x04 /**< Forbidden in <Directory> */
696 #define NOT_IN_LOCATION 0x08 /**< Forbidden in <Location> */
697 #define NOT_IN_FILES 0x10 /**< Forbidden in <Files> */
698 /** Forbidden in <Directory>/<Location>/<Files>*/
699 #define NOT_IN_DIR_LOC_FILE (NOT_IN_DIRECTORY|NOT_IN_LOCATION|NOT_IN_FILES)
700 /** Forbidden in <VirtualHost>/<Limit>/<Directory>/<Location>/<Files> */
701 #define GLOBAL_ONLY (NOT_IN_VIRTUALHOST|NOT_IN_LIMIT|NOT_IN_DIR_LOC_FILE)
708 * The topmost module in the list
709 * @defvar module *ap_top_module
711 AP_DECLARE_DATA extern module *ap_top_module;
714 * Array of all statically linked modules
715 * @defvar module *ap_prelinked_modules[]
717 AP_DECLARE_DATA extern module *ap_prelinked_modules[];
719 * Array of all preloaded modules
720 * @defvar module *ap_preloaded_modules[]
722 AP_DECLARE_DATA extern module *ap_preloaded_modules[];
724 * Array of all loaded modules
725 * @defvar module **ap_loaded_modules
727 AP_DECLARE_DATA extern module **ap_loaded_modules;
729 /* For mod_so.c... */
730 /** Run a single module's two create_config hooks
731 * @param p the pool to allocate from
732 * @param s The server to configure for.
733 * @param m The module to configure
735 AP_DECLARE(void) ap_single_module_configure(apr_pool_t *p, server_rec *s,
738 /* For http_main.c... */
740 * Add all of the prelinked modules into the loaded module list
741 * @param process The process that is currently running the server
743 AP_DECLARE(const char *) ap_setup_prelinked_modules(process_rec *process);
746 * Show the preloaded configuration directives, the help string explaining
747 * the directive arguments, in what module they are handled, and in
748 * what parts of the configuration they are allowed. Used for httpd -h.
750 AP_DECLARE(void) ap_show_directives(void);
753 * Show the preloaded module names. Used for httpd -l.
755 AP_DECLARE(void) ap_show_modules(void);
758 * Show the MPM name. Used in reporting modules such as mod_info to
759 * provide extra information to the user
761 AP_DECLARE(const char *) ap_show_mpm(void);
764 * Read all config files and setup the server
765 * @param process The process running the server
766 * @param temp_pool A pool to allocate temporary data from.
767 * @param config_name The name of the config file
768 * @param conftree Place to store the root of the config tree
769 * @return The setup server_rec list.
771 AP_DECLARE(server_rec *) ap_read_config(process_rec *process,
772 apr_pool_t *temp_pool,
773 const char *config_name,
774 ap_directive_t **conftree);
777 * Run all rewrite args hooks for loaded modules
778 * @param process The process currently running the server
780 AP_DECLARE(void) ap_run_rewrite_args(process_rec *process);
783 * Run the register hooks function for a specified module
784 * @param m The module to run the register hooks function fo
785 * @param p The pool valid for the lifetime of the module
787 AP_DECLARE(void) ap_register_hooks(module *m, apr_pool_t *p);
790 * Setup all virtual hosts
791 * @param p The pool to allocate from
792 * @param main_server The head of the server_rec list
794 AP_DECLARE(void) ap_fixup_virtual_hosts(apr_pool_t *p,
795 server_rec *main_server);
797 /* For http_request.c... */
800 * Setup the config vector for a request_rec
801 * @param p The pool to allocate the config vector from
802 * @return The config vector
804 AP_CORE_DECLARE(ap_conf_vector_t*) ap_create_request_config(apr_pool_t *p);
807 * Setup the config vector for per dir module configs
808 * @param p The pool to allocate the config vector from
809 * @return The config vector
811 AP_CORE_DECLARE(ap_conf_vector_t *) ap_create_per_dir_config(apr_pool_t *p);
814 * Run all of the modules merge per dir config functions
815 * @param p The pool to pass to the merge functions
816 * @param base The base directory config structure
817 * @param new_conf The new directory config structure
819 AP_CORE_DECLARE(ap_conf_vector_t*) ap_merge_per_dir_configs(apr_pool_t *p,
820 ap_conf_vector_t *base,
821 ap_conf_vector_t *new_conf);
823 /* For http_connection.c... */
825 * Setup the config vector for a connection_rec
826 * @param p The pool to allocate the config vector from
827 * @return The config vector
829 AP_CORE_DECLARE(ap_conf_vector_t*) ap_create_conn_config(apr_pool_t *p);
831 /* For http_core.c... (<Directory> command and virtual hosts) */
834 * parse an htaccess file
835 * @param resulting htaccess_result
836 * @param r The request currently being served
837 * @param override Which overrides are active
838 * @param path The path to the htaccess file
839 * @param access_name The list of possible names for .htaccess files
840 * int The status of the current request
842 AP_CORE_DECLARE(int) ap_parse_htaccess(ap_conf_vector_t **result,
843 request_rec *r, int override,
845 const char *access_name);
848 * Setup a virtual host
849 * @param p The pool to allocate all memory from
850 * @param hostname The hostname of the virtual hsot
851 * @param main_server The main server for this Apache configuration
852 * @param ps Place to store the new server_rec
853 * return Error string on error, NULL on success
855 AP_CORE_DECLARE(const char *) ap_init_virtual_host(apr_pool_t *p,
856 const char *hostname,
857 server_rec *main_server,
861 * Process the config file for Apache
862 * @param s The server rec to use for the command parms
863 * @param fname The name of the config file
864 * @param conftree The root node of the created config tree
865 * @param p Pool for general allocation
866 * @param ptem Pool for temporary allocation
868 AP_DECLARE(const char *) ap_process_resource_config(server_rec *s,
870 ap_directive_t **conftree,
875 * Process all directives in the config tree
876 * @param s The server rec to use in the command parms
877 * @param conftree The config tree to process
878 * @param p The pool for general allocation
879 * @param ptemp The pool for temporary allocations
880 * @return OK if no problems
882 AP_DECLARE(int) ap_process_config_tree(server_rec *s,
883 ap_directive_t *conftree,
887 /* Module-method dispatchers, also for http_request.c */
889 * Run the handler phase of each module until a module accepts the
890 * responsibility of serving the request
891 * @param r The current request
892 * @return The status of the current request
894 AP_CORE_DECLARE(int) ap_invoke_handler(request_rec *r);
899 * Find a given directive in a command_rec table
900 * @param name The directive to search for
901 * @param cmds The table to search
902 * @return The directive definition of the specified directive
904 AP_CORE_DECLARE(const command_rec *) ap_find_command(const char *name,
905 const command_rec *cmds);
908 * Find a given directive in a list module
909 * @param cmd_name The directive to search for
910 * @param mod The module list to search
911 * @return The directive definition of the specified directive
913 AP_CORE_DECLARE(const command_rec *) ap_find_command_in_modules(const char *cmd_name,
917 * Ask a module to create per-server and per-section (dir/loc/file) configs
918 * (if it hasn't happened already). The results are stored in the server's
919 * config, and the specified per-section config vector.
920 * @param server The server to operate upon.
921 * @param section_vector The per-section config vector.
922 * @param section Which section to create a config for.
923 * @param mod The module which is defining the config data.
924 * @param pconf A pool for all configuration allocations.
925 * @return The (new) per-section config data.
927 AP_CORE_DECLARE(void *) ap_set_config_vectors(server_rec *server,
928 ap_conf_vector_t *section_vector,
930 module *mod, apr_pool_t *pconf);
937 * Run the header parser functions for each module
938 * @param r The current request
939 * @return OK or DECLINED
941 AP_DECLARE_HOOK(int,header_parser,(request_rec *r))
944 * Run the pre_config function for each module
945 * @param pconf The config pool
946 * @param plog The logging streams pool
947 * @param ptemp The temporary pool
948 * @return OK or DECLINED on success anything else is a error
950 AP_DECLARE_HOOK(int,pre_config,(apr_pool_t *pconf,apr_pool_t *plog,
955 * Run the post_config function for each module
956 * @param pconf The config pool
957 * @param plog The logging streams pool
958 * @param ptemp The temporary pool
959 * @param s The list of server_recs
960 * @return OK or DECLINED on success anything else is a error
962 AP_DECLARE_HOOK(int,post_config,(apr_pool_t *pconf,apr_pool_t *plog,
963 apr_pool_t *ptemp,server_rec *s))
966 * Run the open_logs functions for each module
967 * @param pconf The config pool
968 * @param plog The logging streams pool
969 * @param ptemp The temporary pool
970 * @param s The list of server_recs
971 * @return OK or DECLINED on success anything else is a error
973 AP_DECLARE_HOOK(int,open_logs,(apr_pool_t *pconf,apr_pool_t *plog,
974 apr_pool_t *ptemp,server_rec *s))
977 * Run the child_init functions for each module
978 * @param pchild The child pool
979 * @param s The list of server_recs in this server
981 AP_DECLARE_HOOK(void,child_init,(apr_pool_t *pchild, server_rec *s))
984 * Run the handler functions for each module
985 * @param r The request_rec
986 * @remark non-wildcard handlers should HOOK_MIDDLE, wildcard HOOK_LAST
988 AP_DECLARE_HOOK(int,handler,(request_rec *r))
991 * Run the quick handler functions for each module. The quick_handler
992 * is run before any other requests hooks are called (location_walk,
993 * directory_walk, access checking, et. al.). This hook was added
994 * to provide a quick way to serve content from a URI keyed cache.
996 * @param r The request_rec
997 * @param lookup_uri Controls whether the caller actually wants content or not.
998 * lookup is set when the quick_handler is called out of
999 * ap_sub_req_lookup_uri()
1001 AP_DECLARE_HOOK(int,quick_handler,(request_rec *r, int lookup_uri))
1004 * Retrieve the optional functions for each module.
1005 * This is run immediately before the server starts. Optional functions should
1006 * be registered during the hook registration phase.
1008 AP_DECLARE_HOOK(void,optional_fn_retrieve,(void))
1014 #endif /* !APACHE_HTTP_CONFIG_H */