]> granicus.if.org Git - apache/blob - include/http_config.h
aec29d3e695f8e973402b06b2e8db54f65f6ac21
[apache] / include / http_config.h
1 /* Licensed to the Apache Software Foundation (ASF) under one or more
2  * contributor license agreements.  See the NOTICE file distributed with
3  * this work for additional information regarding copyright ownership.
4  * The ASF licenses this file to You under the Apache License, Version 2.0
5  * (the "License"); you may not use this file except in compliance with
6  * the License.  You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 /**
18  * @file http_config.h
19  * @brief Apache Configuration
20  *
21  * @defgroup APACHE_CORE_CONFIG Configuration
22  * @ingroup  APACHE_CORE
23  * @{
24  */
25
26 #ifndef APACHE_HTTP_CONFIG_H
27 #define APACHE_HTTP_CONFIG_H
28
29 #include "util_cfgtree.h"
30 #include "ap_config.h"
31
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35
36 /*
37  * The central data structures around here...
38  */
39
40 /* Command dispatch structures... */
41
42 /**
43  * How the directives arguments should be parsed.
44  * @remark Note that for all of these except RAW_ARGS, the config routine is
45  *      passed a freshly allocated string which can be modified or stored
46  *      or whatever...
47  */
48 enum cmd_how {
49     RAW_ARGS,           /**< cmd_func parses command line itself */
50     TAKE1,              /**< one argument only */
51     TAKE2,              /**< two arguments only */
52     ITERATE,            /**< one argument, occuring multiple times
53                          * (e.g., IndexIgnore)
54                          */
55     ITERATE2,           /**< two arguments, 2nd occurs multiple times
56                          * (e.g., AddIcon)
57                          */
58     FLAG,               /**< One of 'On' or 'Off' */
59     NO_ARGS,            /**< No args at all, e.g. &lt;/Directory&gt; */
60     TAKE12,             /**< one or two arguments */
61     TAKE3,              /**< three arguments only */
62     TAKE23,             /**< two or three arguments */
63     TAKE123,            /**< one, two or three arguments */
64     TAKE13,             /**< one or three arguments */
65     TAKE_ARGV           /**< an argc and argv are passed */
66 };
67
68 /**
69  * This structure is passed to a command which is being invoked,
70  * to carry a large variety of miscellaneous data which is all of
71  * use to *somebody*...
72  */
73 typedef struct cmd_parms_struct cmd_parms;
74
75 #if defined(AP_HAVE_DESIGNATED_INITIALIZER) || defined(DOXYGEN)
76
77 /**
78  * All the types of functions that can be used in directives
79  * @internal
80  */
81 typedef union {
82     /** function to call for a no-args */
83     const char *(*no_args) (cmd_parms *parms, void *mconfig);
84     /** function to call for a raw-args */
85     const char *(*raw_args) (cmd_parms *parms, void *mconfig,
86                              const char *args);
87     /** function to call for a argv/argc */
88     const char *(*take_argv) (cmd_parms *parms, void *mconfig,
89                              int argc, char *const argv[]);
90     /** function to call for a take1 */
91     const char *(*take1) (cmd_parms *parms, void *mconfig, const char *w);
92     /** function to call for a take2 */
93     const char *(*take2) (cmd_parms *parms, void *mconfig, const char *w,
94                           const char *w2);
95     /** function to call for a take3 */
96     const char *(*take3) (cmd_parms *parms, void *mconfig, const char *w,
97                           const char *w2, const char *w3);
98     /** function to call for a flag */
99     const char *(*flag) (cmd_parms *parms, void *mconfig, int on);
100 } cmd_func;
101
102 /** This configuration directive does not take any arguments */
103 # define AP_NO_ARGS     func.no_args
104 /** This configuration directive will handle its own parsing of arguments*/
105 # define AP_RAW_ARGS    func.raw_args
106 /** This configuration directive will handle its own parsing of arguments*/
107 # define AP_TAKE_ARGV   func.take_argv
108 /** This configuration directive takes 1 argument*/
109 # define AP_TAKE1       func.take1
110 /** This configuration directive takes 2 arguments */
111 # define AP_TAKE2       func.take2
112 /** This configuration directive takes 3 arguments */
113 # define AP_TAKE3       func.take3
114 /** This configuration directive takes a flag (on/off) as a argument*/
115 # define AP_FLAG        func.flag
116
117 /** mechanism for declaring a directive with no arguments */
118 # define AP_INIT_NO_ARGS(directive, func, mconfig, where, help) \
119     { directive, { .no_args=func }, mconfig, where, RAW_ARGS, help }
120 /** mechanism for declaring a directive with raw argument parsing */
121 # define AP_INIT_RAW_ARGS(directive, func, mconfig, where, help) \
122     { directive, { .raw_args=func }, mconfig, where, RAW_ARGS, help }
123 /** mechanism for declaring a directive with raw argument parsing */
124 # define AP_INIT_TAKE_ARGV(directive, func, mconfig, where, help) \
125     { directive, { .take_argv=func }, mconfig, where, TAKE_ARGV, help }
126 /** mechanism for declaring a directive which takes 1 argument */
127 # define AP_INIT_TAKE1(directive, func, mconfig, where, help) \
128     { directive, { .take1=func }, mconfig, where, TAKE1, help }
129 /** mechanism for declaring a directive which takes multiple arguments */
130 # define AP_INIT_ITERATE(directive, func, mconfig, where, help) \
131     { directive, { .take1=func }, mconfig, where, ITERATE, help }
132 /** mechanism for declaring a directive which takes 2 arguments */
133 # define AP_INIT_TAKE2(directive, func, mconfig, where, help) \
134     { directive, { .take2=func }, mconfig, where, TAKE2, help }
135 /** mechanism for declaring a directive which takes 1 or 2 arguments */
136 # define AP_INIT_TAKE12(directive, func, mconfig, where, help) \
137     { directive, { .take2=func }, mconfig, where, TAKE12, help }
138 /** mechanism for declaring a directive which takes multiple 2 arguments */
139 # define AP_INIT_ITERATE2(directive, func, mconfig, where, help) \
140     { directive, { .take2=func }, mconfig, where, ITERATE2, help }
141 /** mechanism for declaring a directive which takes 1 or 3 arguments */
142 # define AP_INIT_TAKE13(directive, func, mconfig, where, help) \
143     { directive, { .take3=func }, mconfig, where, TAKE13, help }
144 /** mechanism for declaring a directive which takes 2 or 3 arguments */
145 # define AP_INIT_TAKE23(directive, func, mconfig, where, help) \
146     { directive, { .take3=func }, mconfig, where, TAKE23, help }
147 /** mechanism for declaring a directive which takes 1 to 3 arguments */
148 # define AP_INIT_TAKE123(directive, func, mconfig, where, help) \
149     { directive, { .take3=func }, mconfig, where, TAKE123, help }
150 /** mechanism for declaring a directive which takes 3 arguments */
151 # define AP_INIT_TAKE3(directive, func, mconfig, where, help) \
152     { directive, { .take3=func }, mconfig, where, TAKE3, help }
153 /** mechanism for declaring a directive which takes a flag (on/off) argument */
154 # define AP_INIT_FLAG(directive, func, mconfig, where, help) \
155     { directive, { .flag=func }, mconfig, where, FLAG, help }
156
157 #else /* AP_HAVE_DESIGNATED_INITIALIZER */
158
159 typedef const char *(*cmd_func) ();
160
161 # define AP_NO_ARGS  func
162 # define AP_RAW_ARGS func
163 # define AP_TAKE_ARGV func
164 # define AP_TAKE1    func
165 # define AP_TAKE2    func
166 # define AP_TAKE3    func
167 # define AP_FLAG     func
168
169 # define AP_INIT_NO_ARGS(directive, func, mconfig, where, help) \
170     { directive, func, mconfig, where, RAW_ARGS, help }
171 # define AP_INIT_RAW_ARGS(directive, func, mconfig, where, help) \
172     { directive, func, mconfig, where, RAW_ARGS, help }
173 # define AP_INIT_TAKE_ARGV(directive, func, mconfig, where, help) \
174     { directive, func, mconfig, where, TAKE_ARGV, help }
175 # define AP_INIT_TAKE1(directive, func, mconfig, where, help) \
176     { directive, func, mconfig, where, TAKE1, help }
177 # define AP_INIT_ITERATE(directive, func, mconfig, where, help) \
178     { directive, func, mconfig, where, ITERATE, help }
179 # define AP_INIT_TAKE2(directive, func, mconfig, where, help) \
180     { directive, func, mconfig, where, TAKE2, help }
181 # define AP_INIT_TAKE12(directive, func, mconfig, where, help) \
182     { directive, func, mconfig, where, TAKE12, help }
183 # define AP_INIT_ITERATE2(directive, func, mconfig, where, help) \
184     { directive, func, mconfig, where, ITERATE2, help }
185 # define AP_INIT_TAKE13(directive, func, mconfig, where, help) \
186     { directive, func, mconfig, where, TAKE13, help }
187 # define AP_INIT_TAKE23(directive, func, mconfig, where, help) \
188     { directive, func, mconfig, where, TAKE23, help }
189 # define AP_INIT_TAKE123(directive, func, mconfig, where, help) \
190     { directive, func, mconfig, where, TAKE123, help }
191 # define AP_INIT_TAKE3(directive, func, mconfig, where, help) \
192     { directive, func, mconfig, where, TAKE3, help }
193 # define AP_INIT_FLAG(directive, func, mconfig, where, help) \
194     { directive, func, mconfig, where, FLAG, help }
195
196 #endif /* AP_HAVE_DESIGNATED_INITIALIZER */
197
198 /**
199  * The command record structure.  Each modules can define a table of these
200  * to define the directives it will implement.
201  */
202 typedef struct command_struct command_rec;
203 struct command_struct {
204     /** Name of this command */
205     const char *name;
206     /** The function to be called when this directive is parsed */
207     cmd_func func;
208     /** Extra data, for functions which implement multiple commands... */
209     void *cmd_data;
210     /** What overrides need to be allowed to enable this command. */
211     int req_override;
212     /** What the command expects as arguments */
213     enum cmd_how args_how;
214
215     /** 'usage' message, in case of syntax errors */
216     const char *errmsg;
217 };
218
219 /**
220  * @defgroup ConfigDirectives Allowed locations for configuration directives.
221  *
222  * The allowed locations for a configuration directive are the union of
223  * those indicated by each set bit in the req_override mask.
224  *
225  * @{
226  */
227 #define OR_NONE 0             /**< *.conf is not available anywhere in this override */
228 #define OR_LIMIT 1           /**< *.conf inside &lt;Directory&gt; or &lt;Location&gt;
229                                 and .htaccess when AllowOverride Limit */
230 #define OR_OPTIONS 2         /**< *.conf anywhere
231                                 and .htaccess when AllowOverride Options */
232 #define OR_FILEINFO 4        /**< *.conf anywhere
233                                 and .htaccess when AllowOverride FileInfo */
234 #define OR_AUTHCFG 8         /**< *.conf inside &lt;Directory&gt; or &lt;Location&gt;
235                                 and .htaccess when AllowOverride AuthConfig */
236 #define OR_INDEXES 16        /**< *.conf anywhere
237                                 and .htaccess when AllowOverride Indexes */
238 #define OR_UNSET 32          /**< bit to indicate that AllowOverride has not been set */
239 #define ACCESS_CONF 64       /**< *.conf inside &lt;Directory&gt; or &lt;Location&gt; */
240 #define RSRC_CONF 128        /**< *.conf outside &lt;Directory&gt; or &lt;Location&gt; */
241 #define EXEC_ON_READ 256     /**< force directive to execute a command
242                 which would modify the configuration (like including another
243                 file, or IFModule */
244 /** this directive can be placed anywhere */
245 #define OR_ALL (OR_LIMIT|OR_OPTIONS|OR_FILEINFO|OR_AUTHCFG|OR_INDEXES)
246
247 /** @} */
248
249 /**
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
252  * as an error code.
253  */
254 #define DECLINE_CMD "\a\b"
255
256 /** Common structure for reading of config files / passwd files etc. */
257 typedef struct ap_configfile_t ap_configfile_t;
258 struct ap_configfile_t {
259     /**< an apr_file_getc()-like function */
260     apr_status_t (*getch) (char *ch, void *param);
261     /**< an apr_file_gets()-like function */
262     apr_status_t (*getstr) (void *buf, size_t bufsiz, void *param);
263     /**< a close handler function */
264     apr_status_t (*close) (void *param);
265     /**< the argument passed to getch/getstr/close */
266     void *param;
267     /**< the filename / description */
268     const char *name;
269     /**< current line number, starting at 1 */
270     unsigned line_number;
271 };
272
273 /**
274  * This structure is passed to a command which is being invoked,
275  * to carry a large variety of miscellaneous data which is all of
276  * use to *somebody*...
277  */
278 struct cmd_parms_struct {
279     /** Argument to command from cmd_table */
280     void *info;
281     /** Which allow-override bits are set */
282     int override;
283     /** Which allow-override-opts bits are set */
284     int override_opts;
285     /** Which methods are &lt;Limit&gt;ed */
286     apr_int64_t limited;
287     /** methods which are limited */
288     apr_array_header_t *limited_xmethods;
289     /** methods which are xlimited */
290     ap_method_list_t *xlimited;
291
292     /** Config file structure. */
293     ap_configfile_t *config_file;
294     /** the directive specifying this command */
295     ap_directive_t *directive;
296
297     /** Pool to allocate new storage in */
298     apr_pool_t *pool;
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 */
303     server_rec *server;
304     /** If configuring for a directory, pathname of that directory.
305      *  NOPE!  That's what it meant previous to the existence of &lt;Files&gt;,
306      * &lt;Location&gt; 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
309      * (path != NULL).  */
310     char *path;
311     /** configuration command */
312     const command_rec *cmd;
313
314     /** per_dir_config vector passed to handle_command */
315     struct ap_conf_vector_t *context;
316     /** directive with syntax error */
317     const ap_directive_t *err_directive;
318
319 };
320
321 /**
322  * Module structures.  Just about everything is dispatched through
323  * these, directly or indirectly (through the command and handler
324  * tables).
325  */
326 typedef struct module_struct module;
327 struct module_struct {
328     /** API version, *not* module version; check that module is
329      * compatible with this version of the server.
330      */
331     int version;
332     /** API minor version. Provides API feature milestones. Not checked
333      *  during module init */
334     int minor_version;
335     /** Index to this modules structures in config vectors.  */
336     int module_index;
337
338     /** The name of the module's C file */
339     const char *name;
340     /** The handle for the DSO.  Internal use only */
341     void *dynamic_load_handle;
342
343     /** A pointer to the next module in the list
344      *  @var module_struct *next
345      */
346     struct module_struct *next;
347
348     /** Magic Cookie to identify a module structure;  It's mainly
349      *  important for the DSO facility (see also mod_so).  */
350     unsigned long magic;
351
352     /** Function to allow MPMs to re-write command line arguments.  This
353      *  hook is only available to MPMs.
354      *  @param The process that the server is running in.
355      */
356     void (*rewrite_args) (process_rec *process);
357     /** Function to allow all modules to create per directory configuration
358      *  structures.
359      *  @param p The pool to use for all allocations.
360      *  @param dir The directory currently being processed.
361      *  @return The per-directory structure created
362      */
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      */
371     void *(*merge_dir_config) (apr_pool_t *p, void *base_conf, void *new_conf);
372     /** Function to allow all modules to create per server configuration
373      *  structures.
374      *  @param p The pool to use for all allocations.
375      *  @param s The server currently being processed.
376      *  @return The per-server structure created
377      */
378     void *(*create_server_config) (apr_pool_t *p, server_rec *s);
379     /** Function to allow all modules to merge the per server configuration
380      *  structures for two servers.
381      *  @param p The pool to use for all allocations.
382      *  @param base_conf The directory structure created for the parent directory.
383      *  @param new_conf The directory structure currently being processed.
384      *  @return The new per-directory structure created
385      */
386     void *(*merge_server_config) (apr_pool_t *p, void *base_conf,
387                                   void *new_conf);
388
389     /** A command_rec table that describes all of the directives this module
390      * defines. */
391     const command_rec *cmds;
392
393     /** A hook to allow modules to hook other points in the request processing.
394      *  In this function, modules should call the ap_hook_*() functions to
395      *  register an interest in a specific step in processing the current
396      *  request.
397      *  @param p the pool to use for all allocations
398      */
399     void (*register_hooks) (apr_pool_t *p);
400 };
401
402 /**
403  * The APLOG_USE_MODULE macro is used choose which module a file belongs to.
404  * This is necessary to allow per-module loglevel configuration.
405  *
406  * APLOG_USE_MODULE indirectly sets APLOG_MODULE_INDEX and APLOG_MARK.
407  *
408  * If a module should be backward compatible with versions before 2.3.6,
409  * APLOG_USE_MODULE needs to be enclosed in a ifdef APLOG_USE_MODULE block.
410  *
411  * @param foo name of the module symbol of the current module, without the
412  *            trailing "_module" part
413  * @see APLOG_MARK
414  */
415 #define APLOG_USE_MODULE(foo) \
416     extern module AP_MODULE_DECLARE_DATA foo##_module;                  \
417     static int * const aplog_module_index = &(foo##_module.module_index)
418
419 /**
420  * AP_DECLARE_MODULE is a convenience macro that combines a call of
421  * APLOG_USE_MODULE with the definition of the module symbol.
422  *
423  * If a module should be backward compatible with versions before 2.3.6,
424  * APLOG_USE_MODULE should be used explicitly instead of AP_DECLARE_MODULE.
425  */
426 #define AP_DECLARE_MODULE(foo) \
427     APLOG_USE_MODULE(foo);                         \
428     module AP_MODULE_DECLARE_DATA foo##_module
429
430 /**
431  * @defgroup ModuleInit Module structure initializers
432  *
433  * Initializer for the first few module slots, which are only
434  * really set up once we start running.  Note that the first two slots
435  * provide a version check; this should allow us to deal with changes to
436  * the API. The major number should reflect changes to the API handler table
437  * itself or removal of functionality. The minor number should reflect
438  * additions of functionality to the existing API. (the server can detect
439  * an old-format module, and either handle it back-compatibly, or at least
440  * signal an error). See src/include/ap_mmn.h for MMN version history.
441  * @{
442  */
443
444 /** The one used in Apache 1.3, which will deliberately cause an error */
445 #define STANDARD_MODULE_STUFF   this_module_needs_to_be_ported_to_apache_2_0
446
447 /** Use this in all standard modules */
448 #define STANDARD20_MODULE_STUFF MODULE_MAGIC_NUMBER_MAJOR, \
449                                 MODULE_MAGIC_NUMBER_MINOR, \
450                                 -1, \
451                                 __FILE__, \
452                                 NULL, \
453                                 NULL, \
454                                 MODULE_MAGIC_COOKIE, \
455                                 NULL      /* rewrite args spot */
456
457 /** Use this only in MPMs */
458 #define MPM20_MODULE_STUFF      MODULE_MAGIC_NUMBER_MAJOR, \
459                                 MODULE_MAGIC_NUMBER_MINOR, \
460                                 -1, \
461                                 __FILE__, \
462                                 NULL, \
463                                 NULL, \
464                                 MODULE_MAGIC_COOKIE
465
466 /** @} */
467
468 /* CONFIGURATION VECTOR FUNCTIONS */
469
470 /** configuration vector structure */
471 typedef struct ap_conf_vector_t ap_conf_vector_t;
472
473 /**
474  * Generic accessors for other modules to get at their own module-specific
475  * data
476  * @param cv The vector in which the modules configuration is stored.
477  *        usually r->per_dir_config or s->module_config
478  * @param m The module to get the data for.
479  * @return The module-specific data
480  */
481 AP_DECLARE(void *) ap_get_module_config(const ap_conf_vector_t *cv,
482                                         const module *m);
483
484 /**
485  * Generic accessors for other modules to set at their own module-specific
486  * data
487  * @param cv The vector in which the modules configuration is stored.
488  *        usually r->per_dir_config or s->module_config
489  * @param m The module to set the data for.
490  * @param val The module-specific data to set
491  */
492 AP_DECLARE(void) ap_set_module_config(ap_conf_vector_t *cv, const module *m,
493                                       void *val);
494
495 #if !defined(AP_DEBUG)
496
497 #define ap_get_module_config(v,m)       \
498     (((void **)(v))[(m)->module_index])
499 #define ap_set_module_config(v,m,val)   \
500     ((((void **)(v))[(m)->module_index]) = (val))
501
502 #endif /* AP_DEBUG */
503
504
505 /**
506  * Generic accessor for modules to get the module-specific loglevel
507  * @param s The server from which to get the loglevel.
508  * @param index The module_index of the module to get the loglevel for.
509  * @return The module-specific loglevel
510  */
511 AP_DECLARE(int) ap_get_server_module_loglevel(const server_rec *s, int index);
512
513 /**
514  * Generic accessor for modules the module-specific loglevel
515  * @param c The connection from which to get the loglevel.
516  * @param index The module_index of the module to get the loglevel for.
517  * @return The module-specific loglevel
518  */
519 AP_DECLARE(int) ap_get_conn_module_loglevel(const conn_rec *c, int index);
520
521 /**
522  * Generic accessor for modules the module-specific loglevel
523  * @param c The connection from which to get the loglevel.
524  * @param s The server from which to get the loglevel if c does not have a
525  *          specific loglevel configuration.
526  * @param index The module_index of the module to get the loglevel for.
527  * @return The module-specific loglevel
528  */
529 AP_DECLARE(int) ap_get_conn_server_module_loglevel(const conn_rec *c,
530                                                    const server_rec *s,
531                                                    int index);
532
533 /**
534  * Generic accessor for modules to get the module-specific loglevel
535  * @param r The request from which to get the loglevel.
536  * @param index The module_index of the module to get the loglevel for.
537  * @return The module-specific loglevel
538  */
539 AP_DECLARE(int) ap_get_request_module_loglevel(const request_rec *r, int index);
540
541 /**
542  * Accessor to set module-specific loglevel
543  * @param p A pool
544  * @param l The ap_logconf struct to modify.
545  * @param index The module_index of the module to set the loglevel for.
546  * @param level The new log level
547  */
548 AP_DECLARE(void) ap_set_module_loglevel(apr_pool_t *p, struct ap_logconf *l,
549                                         int index, int level);
550
551 #if !defined(AP_DEBUG)
552
553 #define ap_get_conn_logconf(c)                     \
554     ((c)->log             ? (c)->log             : \
555      &(c)->base_server->log)
556
557 #define ap_get_conn_server_logconf(c,s)                             \
558     ( ( (c)->log != &(c)->base_server->log && (c)->log != NULL )  ? \
559       (c)->log                                                    : \
560       &(s)->log )
561
562 #define ap_get_request_logconf(r)                  \
563     ((r)->log             ? (r)->log             : \
564      (r)->connection->log ? (r)->connection->log : \
565      &(r)->server->log)
566
567 #define ap_get_module_loglevel(l,i)                                     \
568     (((i) < 0 || (l)->module_levels == NULL || (l)->module_levels[i] < 0) ?  \
569      (l)->level :                                                         \
570      (l)->module_levels[i])
571
572 #define ap_get_server_module_loglevel(s,i)  \
573     (ap_get_module_loglevel(&(s)->log,i))
574
575 #define ap_get_conn_module_loglevel(c,i)  \
576     (ap_get_module_loglevel(ap_get_conn_logconf(c),i))
577
578 #define ap_get_conn_server_module_loglevel(c,s,i)  \
579     (ap_get_module_loglevel(ap_get_conn_server_logconf(c,s),i))
580
581 #define ap_get_request_module_loglevel(r,i)  \
582     (ap_get_module_loglevel(ap_get_request_logconf(r),i))
583
584 #endif /* AP_DEBUG */
585
586 /**
587  * Set all module-specific loglevels to val
588  * @param l The log config for which to set the loglevels.
589  * @param val the value to set all loglevels to
590  */
591 AP_DECLARE(void) ap_reset_module_loglevels(struct ap_logconf *l, int val);
592
593 /**
594  * Generic command handling function for strings
595  * @param cmd The command parameters for this directive
596  * @param struct_ptr pointer into a given type
597  * @param arg The argument to the directive
598  * @return An error string or NULL on success
599  */
600 AP_DECLARE_NONSTD(const char *) ap_set_string_slot(cmd_parms *cmd,
601                                                    void *struct_ptr,
602                                                    const char *arg);
603
604 /**
605  * Generic command handling function for integers
606  * @param cmd The command parameters for this directive
607  * @param struct_ptr pointer into a given type
608  * @param arg The argument to the directive
609  * @return An error string or NULL on success
610  */
611 AP_DECLARE_NONSTD(const char *) ap_set_int_slot(cmd_parms *cmd,
612                                                 void *struct_ptr,
613                                                 const char *arg);
614
615 /**
616  * Parsing function for log level
617  * @param str The string to parse
618  * @param val The parsed log level
619  * @return An error string or NULL on success
620  */
621 AP_DECLARE(const char *) ap_parse_log_level(const char *str, int *val);
622
623 /**
624  * Return true if the specified method is limited by being listed in
625  * a &lt;Limit&gt; container, or by *not* being listed in a &lt;LimitExcept&gt;
626  * container.
627  *
628  * @param   method  Pointer to a string specifying the method to check.
629  * @param   cmd     Pointer to the cmd_parms structure passed to the
630  *                  directive handler.
631  * @return  0 if the method is not limited in the current scope
632  */
633 AP_DECLARE(int) ap_method_is_limited(cmd_parms *cmd, const char *method);
634
635 /**
636  * Generic command handling function for strings, always sets the value
637  * to a lowercase string
638  * @param cmd The command parameters for this directive
639  * @param struct_ptr pointer into a given type
640  * @param arg The argument to the directive
641  * @return An error string or NULL on success
642  */
643 AP_DECLARE_NONSTD(const char *) ap_set_string_slot_lower(cmd_parms *cmd,
644                                                          void *struct_ptr,
645                                                          const char *arg);
646 /**
647  * Generic command handling function for flags stored in an int
648  * @param cmd The command parameters for this directive
649  * @param struct_ptr pointer into a given type
650  * @param arg The argument to the directive (either 1 or 0)
651  * @return An error string or NULL on success
652  */
653 AP_DECLARE_NONSTD(const char *) ap_set_flag_slot(cmd_parms *cmd,
654                                                  void *struct_ptr,
655                                                  int arg);
656 /**
657  * Generic command handling function for flags stored in a char
658  * @param cmd The command parameters for this directive
659  * @param struct_ptr pointer into a given type
660  * @param arg The argument to the directive (either 1 or 0)
661  * @return An error string or NULL on success
662  */
663 AP_DECLARE_NONSTD(const char *) ap_set_flag_slot_char(cmd_parms *cmd,
664                                                       void *struct_ptr,
665                                                       int arg);
666 /**
667  * Generic command handling function for files
668  * @param cmd The command parameters for this directive
669  * @param struct_ptr pointer into a given type
670  * @param arg The argument to the directive
671  * @return An error string or NULL on success
672  */
673 AP_DECLARE_NONSTD(const char *) ap_set_file_slot(cmd_parms *cmd,
674                                                  void *struct_ptr,
675                                                  const char *arg);
676 /**
677  * Generic command handling function to respond with cmd->help as an error
678  * @param cmd The command parameters for this directive
679  * @param struct_ptr pointer into a given type
680  * @param arg The argument to the directive
681  * @return The cmd->help value as the error string
682  * @note This allows simple declarations such as:
683  * @code
684  *     AP_INIT_RAW_ARGS("Foo", ap_set_deprecated, NULL, OR_ALL,
685  *         "The Foo directive is no longer supported, use Bar"),
686  * @endcode
687  */
688 AP_DECLARE_NONSTD(const char *) ap_set_deprecated(cmd_parms *cmd,
689                                                   void *struct_ptr,
690                                                   const char *arg);
691 /**
692  * For modules which need to read config files, open logs, etc. this returns
693  * the canonical form of fname made absolute to ap_server_root.
694  * @param p pool to allocate data from
695  * @param fname The file name
696  */
697 AP_DECLARE(char *) ap_server_root_relative(apr_pool_t *p, const char *fname);
698
699 /* Finally, the hook for dynamically loading modules in... */
700
701 /**
702  * Add a module to the server
703  * @param m The module structure of the module to add
704  * @param p The pool of the same lifetime as the module
705  * @param s The module's symbol name (used for logging)
706  */
707 AP_DECLARE(const char *) ap_add_module(module *m, apr_pool_t *p,
708                                        const char *s);
709
710 /**
711  * Remove a module from the server.  There are some caveats:
712  * when the module is removed, its slot is lost so all the current
713  * per-dir and per-server configurations are invalid. So we should
714  * only ever call this function when you are invalidating almost
715  * all our current data. I.e. when doing a restart.
716  * @param m the module structure of the module to remove
717  */
718 AP_DECLARE(void) ap_remove_module(module *m);
719 /**
720  * Add a module to the chained modules list and the list of loaded modules
721  * @param mod The module structure of the module to add
722  * @param p The pool with the same lifetime as the module
723  * @param s The module's symbol name (used for logging)
724  */
725 AP_DECLARE(const char *) ap_add_loaded_module(module *mod, apr_pool_t *p,
726                                               const char *s);
727 /**
728  * Remove a module fromthe chained modules list and the list of loaded modules
729  * @param mod the module structure of the module to remove
730  */
731 AP_DECLARE(void) ap_remove_loaded_module(module *mod);
732 /**
733  * Find the name of the specified module
734  * @param m The module to get the name for
735  * @return the name of the module
736  */
737 AP_DECLARE(const char *) ap_find_module_name(module *m);
738 /**
739  * Find the short name of the module identified by the specified module index
740  * @param module_index The module index to get the name for
741  * @return the name of the module, NULL if not found
742  */
743 AP_DECLARE(const char *) ap_find_module_short_name(int module_index);
744 /**
745  * Find a module based on the name of the module
746  * @param name the name of the module
747  * @return the module structure if found, NULL otherwise
748  */
749 AP_DECLARE(module *) ap_find_linked_module(const char *name);
750
751 /**
752  * Open a ap_configfile_t as apr_file_t
753  * @param ret_cfg open ap_configfile_t struct pointer
754  * @param p The pool to allocate the structure from
755  * @param name the name of the file to open
756  */
757 AP_DECLARE(apr_status_t) ap_pcfg_openfile(ap_configfile_t **ret_cfg,
758                                           apr_pool_t *p, const char *name);
759
760 /**
761  * Allocate a ap_configfile_t handle with user defined functions and params
762  * @param p The pool to allocate from
763  * @param descr The name of the file
764  * @param param The argument passed to getch/getstr/close
765  * @param getc_func The getch function
766  * @param gets_func The getstr function
767  * @param close_func The close function
768  */
769 AP_DECLARE(ap_configfile_t *) ap_pcfg_open_custom(apr_pool_t *p,
770     const char *descr,
771     void *param,
772     apr_status_t (*getc_func) (char *ch, void *param),
773     apr_status_t (*gets_func) (void *buf, size_t bufsiz, void *param),
774     apr_status_t (*close_func) (void *param));
775
776 /**
777  * Read one line from open ap_configfile_t, strip leading and trailing
778  * whitespace, increase line number
779  * @param buf place to store the line read
780  * @param bufsize size of the buffer
781  * @param cfp File to read from
782  * @return error status, APR_ENOSPC if bufsize is too small for the line
783  */
784 AP_DECLARE(apr_status_t) ap_cfg_getline(char *buf, size_t bufsize, ap_configfile_t *cfp);
785
786 /**
787  * Read one char from open configfile_t, increase line number upon LF
788  * @param ch place to store the char read
789  * @param cfp The file to read from
790  * @return error status
791  */
792 AP_DECLARE(apr_status_t) ap_cfg_getc(char *ch, ap_configfile_t *cfp);
793
794 /**
795  * Detach from open ap_configfile_t, calling the close handler
796  * @param cfp The file to close
797  * @return 1 on sucess, 0 on failure
798  */
799 AP_DECLARE(int) ap_cfg_closefile(ap_configfile_t *cfp);
800
801 /**
802  * Convert a return value from ap_cfg_getline or ap_cfg_getc to a user friendly
803  * string.
804  * @param p The pool to allocate the string from
805  * @param cfp The config file
806  * @return The error string, NULL if rc == APR_SUCCESS
807  */
808 AP_DECLARE(const char *) ap_pcfg_strerror(apr_pool_t *p, ap_configfile_t *cfp,
809                                           apr_status_t rc);
810
811 /**
812  * Read all data between the current &lt;foo&gt; and the matching &lt;/foo&gt;.  All
813  * of this data is forgotten immediately.
814  * @param cmd The cmd_parms to pass to the directives inside the container
815  * @param directive The directive name to read until
816  * @return Error string on failure, NULL on success
817  */
818 AP_DECLARE(const char *) ap_soak_end_container(cmd_parms *cmd, char *directive);
819
820 /**
821  * Read all data between the current &lt;foo&gt; and the matching &lt;/foo&gt; and build
822  * a config tree from it
823  * @param p pool to allocate from
824  * @param temp_pool Temporary pool to allocate from
825  * @param parms The cmd_parms to pass to all directives read
826  * @param current The current node in the tree
827  * @param curr_parent The current parent node
828  * @param orig_directive The directive to read until hit.
829  * @return Error string on failure, NULL on success
830 */
831 AP_DECLARE(const char *) ap_build_cont_config(apr_pool_t *p,
832                                               apr_pool_t *temp_pool,
833                                               cmd_parms *parms,
834                                               ap_directive_t **current,
835                                               ap_directive_t **curr_parent,
836                                               char *orig_directive);
837
838 /**
839  * Build a config tree from a config file
840  * @param parms The cmd_parms to pass to all of the directives in the file
841  * @param conf_pool The pconf pool
842  * @param temp_pool The temporary pool
843  * @param conftree Place to store the root node of the config tree
844  * @return Error string on erro, NULL otherwise
845  */
846 AP_DECLARE(const char *) ap_build_config(cmd_parms *parms,
847                                          apr_pool_t *conf_pool,
848                                          apr_pool_t *temp_pool,
849                                          ap_directive_t **conftree);
850
851 /**
852  * Walk a config tree and setup the server's internal structures
853  * @param conftree The config tree to walk
854  * @param parms The cmd_parms to pass to all functions
855  * @param section_vector The per-section config vector.
856  * @return Error string on error, NULL otherwise
857  */
858 AP_DECLARE(const char *) ap_walk_config(ap_directive_t *conftree,
859                                         cmd_parms *parms,
860                                         ap_conf_vector_t *section_vector);
861
862 /**
863  * @defgroup ap_check_cmd_context Check command context
864  * @{
865  */
866 /**
867  * Check the context a command is used in.
868  * @param cmd The command to check
869  * @param forbidden Where the command is forbidden.
870  * @return Error string on error, NULL on success
871  */
872 AP_DECLARE(const char *) ap_check_cmd_context(cmd_parms *cmd,
873                                               unsigned forbidden);
874
875 #define  NOT_IN_VIRTUALHOST     0x01 /**< Forbidden in &lt;VirtualHost&gt; */
876 #define  NOT_IN_LIMIT           0x02 /**< Forbidden in &lt;Limit&gt; */
877 #define  NOT_IN_DIRECTORY       0x04 /**< Forbidden in &lt;Directory&gt; */
878 #define  NOT_IN_LOCATION        0x08 /**< Forbidden in &lt;Location&gt; */
879 #define  NOT_IN_FILES           0x10 /**< Forbidden in &lt;Files&gt; */
880 /** Forbidden in &lt;Directory&gt;/&lt;Location&gt;/&lt;Files&gt;*/
881 #define  NOT_IN_DIR_LOC_FILE    (NOT_IN_DIRECTORY|NOT_IN_LOCATION|NOT_IN_FILES)
882 /** Forbidden in &lt;VirtualHost&gt;/&lt;Limit&gt;/&lt;Directory&gt;/&lt;Location&gt;/&lt;Files&gt; */
883 #define  GLOBAL_ONLY            (NOT_IN_VIRTUALHOST|NOT_IN_LIMIT|NOT_IN_DIR_LOC_FILE)
884
885 /** @} */
886
887 /**
888  * @brief This structure is used to assign symbol names to module pointers
889  */
890 typedef struct {
891     const char *name;
892     module *modp;
893 } ap_module_symbol_t;
894
895 /**
896  * The topmost module in the list
897  * @var module *ap_top_module
898  */
899 AP_DECLARE_DATA extern module *ap_top_module;
900
901 /**
902  * Array of all statically linked modules
903  * @var module *ap_prelinked_modules[]
904  */
905 AP_DECLARE_DATA extern module *ap_prelinked_modules[];
906 /**
907  * Array of all statically linked modulenames (symbols)
908  * @var ap_module_symbol_t ap_prelinked_module_symbols[]
909  */
910 AP_DECLARE_DATA extern ap_module_symbol_t ap_prelinked_module_symbols[];
911 /**
912  * Array of all preloaded modules
913  * @var module *ap_preloaded_modules[]
914  */
915 AP_DECLARE_DATA extern module *ap_preloaded_modules[];
916 /**
917  * Array of all loaded modules
918  * @var module **ap_loaded_modules
919  */
920 AP_DECLARE_DATA extern module **ap_loaded_modules;
921
922 /* For mod_so.c... */
923 /** Run a single module's two create_config hooks
924  *  @param p the pool to allocate from
925  *  @param s The server to configure for.
926  *  @param m The module to configure
927  */
928 AP_DECLARE(void) ap_single_module_configure(apr_pool_t *p, server_rec *s,
929                                             module *m);
930
931 /* For http_main.c... */
932 /**
933  * Add all of the prelinked modules into the loaded module list
934  * @param process The process that is currently running the server
935  */
936 AP_DECLARE(const char *) ap_setup_prelinked_modules(process_rec *process);
937
938 /**
939  * Show the preloaded configuration directives, the help string explaining
940  * the directive arguments, in what module they are handled, and in
941  * what parts of the configuration they are allowed.  Used for httpd -h.
942  */
943 AP_DECLARE(void) ap_show_directives(void);
944
945 /**
946  * Show the preloaded module names.  Used for httpd -l.
947  */
948 AP_DECLARE(void) ap_show_modules(void);
949
950 /**
951  * Show the MPM name.  Used in reporting modules such as mod_info to
952  * provide extra information to the user
953  */
954 AP_DECLARE(const char *) ap_show_mpm(void);
955
956 /**
957  * Read all config files and setup the server
958  * @param process The process running the server
959  * @param temp_pool A pool to allocate temporary data from.
960  * @param config_name The name of the config file
961  * @param conftree Place to store the root of the config tree
962  * @return The setup server_rec list.
963  */
964 AP_DECLARE(server_rec *) ap_read_config(process_rec *process,
965                                         apr_pool_t *temp_pool,
966                                         const char *config_name,
967                                         ap_directive_t **conftree);
968
969 /**
970  * Run all rewrite args hooks for loaded modules
971  * @param process The process currently running the server
972  */
973 AP_DECLARE(void) ap_run_rewrite_args(process_rec *process);
974
975 /**
976  * Run the register hooks function for a specified module
977  * @param m The module to run the register hooks function fo
978  * @param p The pool valid for the lifetime of the module
979  */
980 AP_DECLARE(void) ap_register_hooks(module *m, apr_pool_t *p);
981
982 /**
983  * Setup all virtual hosts
984  * @param p The pool to allocate from
985  * @param main_server The head of the server_rec list
986  */
987 AP_DECLARE(void) ap_fixup_virtual_hosts(apr_pool_t *p,
988                                         server_rec *main_server);
989
990 /**
991  * Reserve some modules slots for modules loaded by other means than
992  * EXEC_ON_READ directives.
993  * Relevant modules should call this in the pre_config stage.
994  * @param count The number of slots to reserve.
995  */
996 AP_DECLARE(void) ap_reserve_module_slots(int count);
997
998 /**
999  * Reserve some modules slots for modules loaded by a specific
1000  * non-EXEC_ON_READ config directive.
1001  * This counts how often the given directive is used in the config and calls
1002  * ap_reserve_module_slots() accordingly.
1003  * @param directive The name of the directive
1004  */
1005 AP_DECLARE(void) ap_reserve_module_slots_directive(const char *directive);
1006
1007 /* For http_request.c... */
1008
1009 /**
1010  * Setup the config vector for a request_rec
1011  * @param p The pool to allocate the config vector from
1012  * @return The config vector
1013  */
1014 AP_DECLARE(ap_conf_vector_t*) ap_create_request_config(apr_pool_t *p);
1015
1016 /**
1017  * Setup the config vector for per dir module configs
1018  * @param p The pool to allocate the config vector from
1019  * @return The config vector
1020  */
1021 AP_CORE_DECLARE(ap_conf_vector_t *) ap_create_per_dir_config(apr_pool_t *p);
1022
1023 /**
1024  * Run all of the modules merge per dir config functions
1025  * @param p The pool to pass to the merge functions
1026  * @param base The base directory config structure
1027  * @param new_conf The new directory config structure
1028  */
1029 AP_CORE_DECLARE(ap_conf_vector_t*) ap_merge_per_dir_configs(apr_pool_t *p,
1030                                            ap_conf_vector_t *base,
1031                                            ap_conf_vector_t *new_conf);
1032
1033 /**
1034  * Allocate new ap_logconf and make (deep) copy of old ap_logconf
1035  * @param p The pool to alloc from
1036  * @param old The ap_logconf to copy (may be NULL)
1037  * @return The new ap_logconf struct
1038  */
1039 AP_DECLARE(struct ap_logconf *) ap_new_log_config(apr_pool_t *p,
1040                                                   const struct ap_logconf *old);
1041
1042 /**
1043  * Merge old ap_logconf into new ap_logconf.
1044  * old and new must have the same life time.
1045  * @param old_conf The ap_logconf to merge from
1046  * @param new_conf The ap_logconf to merge into
1047  */
1048 AP_DECLARE(void) ap_merge_log_config(const struct ap_logconf *old_conf,
1049                                      struct ap_logconf *new_conf);
1050
1051 /* For http_connection.c... */
1052 /**
1053  * Setup the config vector for a connection_rec
1054  * @param p The pool to allocate the config vector from
1055  * @return The config vector
1056  */
1057 AP_CORE_DECLARE(ap_conf_vector_t*) ap_create_conn_config(apr_pool_t *p);
1058
1059 /* For http_core.c... (&lt;Directory&gt; command and virtual hosts) */
1060
1061 /**
1062  * parse an htaccess file
1063  * @param result htaccess_result
1064  * @param r The request currently being served
1065  * @param override Which overrides are active
1066  * @param override_opts Which allow-override-opts bits are set
1067  * @param path The path to the htaccess file
1068  * @param access_name The list of possible names for .htaccess files
1069  * int The status of the current request
1070  */
1071 AP_CORE_DECLARE(int) ap_parse_htaccess(ap_conf_vector_t **result,
1072                                        request_rec *r,
1073                                        int override,
1074                                        int override_opts,
1075                                        const char *path,
1076                                        const char *access_name);
1077
1078 /**
1079  * Setup a virtual host
1080  * @param p The pool to allocate all memory from
1081  * @param hostname The hostname of the virtual hsot
1082  * @param main_server The main server for this Apache configuration
1083  * @param ps Place to store the new server_rec
1084  * return Error string on error, NULL on success
1085  */
1086 AP_CORE_DECLARE(const char *) ap_init_virtual_host(apr_pool_t *p,
1087                                                    const char *hostname,
1088                                                    server_rec *main_server,
1089                                                    server_rec **ps);
1090
1091 /**
1092  * Process a config file for Apache
1093  * @param s The server rec to use for the command parms
1094  * @param fname The name of the config file
1095  * @param conftree The root node of the created config tree
1096  * @param p Pool for general allocation
1097  * @param ptemp Pool for temporary allocation
1098  */
1099 AP_DECLARE(const char *) ap_process_resource_config(server_rec *s,
1100                                                     const char *fname,
1101                                                     ap_directive_t **conftree,
1102                                                     apr_pool_t *p,
1103                                                     apr_pool_t *ptemp);
1104
1105 /**
1106  * Process all matching files as Apache configs
1107  * @param s The server rec to use for the command parms
1108  * @param fname The filename pattern of the config file
1109  * @param conftree The root node of the created config tree
1110  * @param p Pool for general allocation
1111  * @param ptemp Pool for temporary allocation
1112  * @param optional Whether a no-match wildcard is allowed
1113  * @see apr_fnmatch for pattern handling
1114  */
1115 AP_DECLARE(const char *) ap_process_fnmatch_configs(server_rec *s,
1116                                                     const char *fname,
1117                                                     ap_directive_t **conftree,
1118                                                     apr_pool_t *p,
1119                                                     apr_pool_t *ptemp,
1120                                                     int optional);
1121
1122 /**
1123  * Process all directives in the config tree
1124  * @param s The server rec to use in the command parms
1125  * @param conftree The config tree to process
1126  * @param p The pool for general allocation
1127  * @param ptemp The pool for temporary allocations
1128  * @return OK if no problems
1129  */
1130 AP_DECLARE(int) ap_process_config_tree(server_rec *s,
1131                                        ap_directive_t *conftree,
1132                                        apr_pool_t *p,
1133                                        apr_pool_t *ptemp);
1134
1135 /**
1136  * Store data which will be retained across unload/load of modules
1137  * @param key The unique key associated with this module's retained data
1138  * @param size in bytes of the retained data (to be allocated)
1139  * @return Address of new retained data structure, initially cleared
1140  */
1141 AP_DECLARE(void *) ap_retained_data_create(const char *key, apr_size_t size);
1142
1143 /**
1144  * Retrieve data which was stored by ap_retained_data_create()
1145  * @param key The unique key associated with this module's retained data
1146  * @return Address of previously retained data structure, or NULL if not yet saved
1147  */
1148 AP_DECLARE(void *) ap_retained_data_get(const char *key);
1149
1150 /* Module-method dispatchers, also for http_request.c */
1151 /**
1152  * Run the handler phase of each module until a module accepts the
1153  * responsibility of serving the request
1154  * @param r The current request
1155  * @return The status of the current request
1156  */
1157 AP_CORE_DECLARE(int) ap_invoke_handler(request_rec *r);
1158
1159 /* for mod_perl */
1160
1161 /**
1162  * Find a given directive in a command_rec table
1163  * @param name The directive to search for
1164  * @param cmds The table to search
1165  * @return The directive definition of the specified directive
1166  */
1167 AP_CORE_DECLARE(const command_rec *) ap_find_command(const char *name,
1168                                                      const command_rec *cmds);
1169
1170 /**
1171  * Find a given directive in a list module
1172  * @param cmd_name The directive to search for
1173  * @param mod The module list to search
1174  * @return The directive definition of the specified directive
1175  */
1176 AP_CORE_DECLARE(const command_rec *) ap_find_command_in_modules(const char *cmd_name,
1177                                                                 module **mod);
1178
1179 /**
1180  * Ask a module to create per-server and per-section (dir/loc/file) configs
1181  * (if it hasn't happened already). The results are stored in the server's
1182  * config, and the specified per-section config vector.
1183  * @param server The server to operate upon.
1184  * @param section_vector The per-section config vector.
1185  * @param section Which section to create a config for.
1186  * @param mod The module which is defining the config data.
1187  * @param pconf A pool for all configuration allocations.
1188  * @return The (new) per-section config data.
1189  */
1190 AP_CORE_DECLARE(void *) ap_set_config_vectors(server_rec *server,
1191                                               ap_conf_vector_t *section_vector,
1192                                               const char *section,
1193                                               module *mod, apr_pool_t *pconf);
1194
1195   /* Hooks */
1196
1197 /**
1198  * Run the header parser functions for each module
1199  * @param r The current request
1200  * @return OK or DECLINED
1201  */
1202 AP_DECLARE_HOOK(int,header_parser,(request_rec *r))
1203
1204 /**
1205  * Run the pre_config function for each module
1206  * @param pconf The config pool
1207  * @param plog The logging streams pool
1208  * @param ptemp The temporary pool
1209  * @return OK or DECLINED on success anything else is a error
1210  */
1211 AP_DECLARE_HOOK(int,pre_config,(apr_pool_t *pconf,apr_pool_t *plog,
1212                                 apr_pool_t *ptemp))
1213
1214 /**
1215  * Run the check_config function for each module
1216  * @param pconf The config pool
1217  * @param plog The logging streams pool
1218  * @param ptemp The temporary pool
1219  * @param s the server to operate upon
1220  * @return OK or DECLINED on success anything else is a error
1221  */
1222 AP_DECLARE_HOOK(int,check_config,(apr_pool_t *pconf, apr_pool_t *plog,
1223                                   apr_pool_t *ptemp, server_rec *s))
1224
1225 /**
1226  * Run the test_config function for each module; this hook is run
1227  * only if the server was invoked to test the configuration syntax.
1228  * @param pconf The config pool
1229  * @param s The list of server_recs
1230  */
1231 AP_DECLARE_HOOK(void,test_config,(apr_pool_t *pconf, server_rec *s))
1232
1233 /**
1234  * Run the post_config function for each module
1235  * @param pconf The config pool
1236  * @param plog The logging streams pool
1237  * @param ptemp The temporary pool
1238  * @param s The list of server_recs
1239  * @return OK or DECLINED on success anything else is a error
1240  */
1241 AP_DECLARE_HOOK(int,post_config,(apr_pool_t *pconf,apr_pool_t *plog,
1242                                  apr_pool_t *ptemp,server_rec *s))
1243
1244 /**
1245  * Run the open_logs functions for each module
1246  * @param pconf The config pool
1247  * @param plog The logging streams pool
1248  * @param ptemp The temporary pool
1249  * @param s The list of server_recs
1250  * @return OK or DECLINED on success anything else is a error
1251  */
1252 AP_DECLARE_HOOK(int,open_logs,(apr_pool_t *pconf,apr_pool_t *plog,
1253                                apr_pool_t *ptemp,server_rec *s))
1254
1255 /**
1256  * Run the child_init functions for each module
1257  * @param pchild The child pool
1258  * @param s The list of server_recs in this server
1259  */
1260 AP_DECLARE_HOOK(void,child_init,(apr_pool_t *pchild, server_rec *s))
1261
1262 /**
1263  * Run the handler functions for each module
1264  * @param r The request_rec
1265  * @remark non-wildcard handlers should HOOK_MIDDLE, wildcard HOOK_LAST
1266  */
1267 AP_DECLARE_HOOK(int,handler,(request_rec *r))
1268
1269 /**
1270  * Run the quick handler functions for each module. The quick_handler
1271  * is run before any other requests hooks are called (location_walk,
1272  * directory_walk, access checking, et. al.). This hook was added
1273  * to provide a quick way to serve content from a URI keyed cache.
1274  *
1275  * @param r The request_rec
1276  * @param lookup_uri Controls whether the caller actually wants content or not.
1277  * lookup is set when the quick_handler is called out of
1278  * ap_sub_req_lookup_uri()
1279  */
1280 AP_DECLARE_HOOK(int,quick_handler,(request_rec *r, int lookup_uri))
1281
1282 /**
1283  * Retrieve the optional functions for each module.
1284  * This is run immediately before the server starts. Optional functions should
1285  * be registered during the hook registration phase.
1286  */
1287 AP_DECLARE_HOOK(void,optional_fn_retrieve,(void))
1288
1289 /**
1290  * A generic pool cleanup that will reset a pointer to NULL. For use with
1291  * apr_pool_cleanup_register.
1292  * @param data The address of the pointer
1293  * @return APR_SUCCESS
1294  */
1295 AP_DECLARE_NONSTD(apr_status_t) ap_pool_cleanup_set_null(void *data);
1296
1297 #ifdef __cplusplus
1298 }
1299 #endif
1300
1301 #endif  /* !APACHE_HTTP_CONFIG_H */
1302 /** @} */