]> granicus.if.org Git - apache/blob - include/http_config.h
Preset the cmd_parms->limited field to the magic 'no limit active'
[apache] / include / http_config.h
1 /* ====================================================================
2  * The Apache Software License, Version 1.1
3  *
4  * Copyright (c) 2000 The Apache Software Foundation.  All rights
5  * reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * 1. Redistributions of source code must retain the above copyright
12  *    notice, this list of conditions and the following disclaimer.
13  *
14  * 2. Redistributions in binary form must reproduce the above copyright
15  *    notice, this list of conditions and the following disclaimer in
16  *    the documentation and/or other materials provided with the
17  *    distribution.
18  *
19  * 3. The end-user documentation included with the redistribution,
20  *    if any, must include the following acknowledgment:
21  *       "This product includes software developed by the
22  *        Apache Software Foundation (http://www.apache.org/)."
23  *    Alternately, this acknowledgment may appear in the software itself,
24  *    if and wherever such third-party acknowledgments normally appear.
25  *
26  * 4. The names "Apache" and "Apache Software Foundation" must
27  *    not be used to endorse or promote products derived from this
28  *    software without prior written permission. For written
29  *    permission, please contact apache@apache.org.
30  *
31  * 5. Products derived from this software may not be called "Apache",
32  *    nor may "Apache" appear in their name, without prior written
33  *    permission of the Apache Software Foundation.
34  *
35  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
36  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
37  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
38  * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
39  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
40  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
41  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
42  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
43  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
44  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
45  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
46  * SUCH DAMAGE.
47  * ====================================================================
48  *
49  * This software consists of voluntary contributions made by many
50  * individuals on behalf of the Apache Software Foundation.  For more
51  * information on the Apache Software Foundation, please see
52  * <http://www.apache.org/>.
53  *
54  * Portions of this software are based upon public domain software
55  * originally written at the National Center for Supercomputing Applications,
56  * University of Illinois, Urbana-Champaign.
57  */
58
59 #ifndef APACHE_HTTP_CONFIG_H
60 #define APACHE_HTTP_CONFIG_H
61
62 #include "ap_hooks.h"
63 #include "util_cfgtree.h"
64
65 #ifdef __cplusplus
66 extern "C" {
67 #endif
68
69 /**
70  * @package Apache Configuration
71  */
72
73 /*
74  * The central data structures around here...
75  */
76
77 /* Command dispatch structures... */
78
79 /**
80  * How the directives arguments should be parsed.
81  * @tip Note that for all of these except RAW_ARGS, the config routine is
82  *      passed a freshly allocated string which can be modified or stored
83  *      or whatever... it's only necessary to do pstrdup() stuff with
84  * <PRE>
85  *    RAW_ARGS  --               cmd_func parses command line itself 
86  *    TAKE1     --               one argument only 
87  *    TAKE2     --               two arguments only 
88  *    ITERATE   --               one argument, occuring multiple times
89  *                               * (e.g., IndexIgnore)
90  *    ITERATE2  --               two arguments, 2nd occurs multiple times
91  *                               * (e.g., AddIcon)
92  *    FLAG      --               One of 'On' or 'Off' 
93  *    NO_ARGS   --               No args at all, e.g. </Directory> 
94  *    TAKE12    --               one or two arguments 
95  *    TAKE3     --               three arguments only 
96  *    TAKE23    --               two or three arguments
97  *    TAKE123   --               one, two or three arguments 
98  *    TAKE13    --               one or three arguments 
99  * </PRE>
100  * @defvar enum cmd_how
101  */
102 enum cmd_how {
103     RAW_ARGS,                   /* cmd_func parses command line itself */
104     TAKE1,                      /* one argument only */
105     TAKE2,                      /* two arguments only */
106     ITERATE,                    /* one argument, occuring multiple times
107                                  * (e.g., IndexIgnore)
108                                  */
109     ITERATE2,                   /* two arguments, 2nd occurs multiple times
110                                  * (e.g., AddIcon)
111                                  */
112     FLAG,                       /* One of 'On' or 'Off' */
113     NO_ARGS,                    /* No args at all, e.g. </Directory> */
114     TAKE12,                     /* one or two arguments */
115     TAKE3,                      /* three arguments only */
116     TAKE23,                     /* two or three arguments */
117     TAKE123,                    /* one, two or three arguments */
118     TAKE13                      /* one or three arguments */
119 };
120
121 typedef struct cmd_parms_struct cmd_parms;
122
123 #ifdef AP_DEBUG
124
125 typedef union {
126     const char *(*no_args) (cmd_parms *parms, void *mconfig);
127     const char *(*raw_args) (cmd_parms *parms, void *mconfig,
128                              const char *args);
129     const char *(*take1) (cmd_parms *parms, void *mconfig, const char *w);
130     const char *(*take2) (cmd_parms *parms, void *mconfig, const char *w,
131                           const char *w2);
132     const char *(*take3) (cmd_parms *parms, void *mconfig, const char *w,
133                           const char *w2, const char *w3);
134     const char *(*flag) (cmd_parms *parms, void *mconfig, int on);
135 } cmd_func;
136
137 # define AP_NO_ARGS     func.no_args
138 # define AP_RAW_ARGS    func.raw_args
139 # define AP_TAKE1       func.take1
140 # define AP_TAKE2       func.take2
141 # define AP_TAKE3       func.take3
142 # define AP_FLAG        func.flag
143
144 # define AP_INIT_NO_ARGS(directive, func, mconfig, where, help) \
145     { directive, { .no_args=func }, mconfig, where, RAW_ARGS, help }
146 # define AP_INIT_RAW_ARGS(directive, func, mconfig, where, help) \
147     { directive, { .raw_args=func }, mconfig, where, RAW_ARGS, help }
148 # define AP_INIT_TAKE1(directive, func, mconfig, where, help) \
149     { directive, { .take1=func }, mconfig, where, TAKE1, help }
150 # define AP_INIT_ITERATE(directive, func, mconfig, where, help) \
151     { directive, { .take1=func }, mconfig, where, ITERATE, help }
152 # define AP_INIT_TAKE2(directive, func, mconfig, where, help) \
153     { directive, { .take2=func }, mconfig, where, TAKE2, help }
154 # define AP_INIT_TAKE12(directive, func, mconfig, where, help) \
155     { directive, { .take2=func }, mconfig, where, TAKE12, help }
156 # define AP_INIT_ITERATE2(directive, func, mconfig, where, help) \
157     { directive, { .take2=func }, mconfig, where, ITERATE2, help }
158 # define AP_INIT_TAKE23(directive, func, mconfig, where, help) \
159     { directive, { .take3=func }, mconfig, where, TAKE23, help }
160 # define AP_INIT_TAKE3(directive, func, mconfig, where, help) \
161     { directive, { .take3=func }, mconfig, where, TAKE3, help }
162 # define AP_INIT_FLAG(directive, func, mconfig, where, help) \
163     { directive, { .flag=func }, mconfig, where, FLAG, help }
164
165 #else
166
167 typedef const char *(*cmd_func) ();
168
169 # define AP_NO_ARGS  func
170 # define AP_RAW_ARGS func
171 # define AP_TAKE1    func
172 # define AP_TAKE2    func
173 # define AP_TAKE3    func
174 # define AP_FLAG     func
175
176 # define AP_INIT_NO_ARGS(directive, func, mconfig, where, help) \
177     { directive, func, mconfig, where, RAW_ARGS, help }
178 # define AP_INIT_RAW_ARGS(directive, func, mconfig, where, help) \
179     { directive, func, mconfig, where, RAW_ARGS, help }
180 # define AP_INIT_TAKE1(directive, func, mconfig, where, help) \
181     { directive, func, mconfig, where, TAKE1, help }
182 # define AP_INIT_ITERATE(directive, func, mconfig, where, help) \
183     { directive, func, mconfig, where, ITERATE, help }
184 # define AP_INIT_TAKE2(directive, func, mconfig, where, help) \
185     { directive, func, mconfig, where, TAKE2, help }
186 # define AP_INIT_TAKE12(directive, func, mconfig, where, help) \
187     { directive, func, mconfig, where, TAKE12, help }
188 # define AP_INIT_ITERATE2(directive, func, mconfig, where, help) \
189     { directive, func, mconfig, where, ITERATE2, help }
190 # define AP_INIT_TAKE23(directive, func, mconfig, where, help) \
191     { directive, func, mconfig, where, TAKE23, help }
192 # define AP_INIT_TAKE3(directive, func, mconfig, where, help) \
193     { directive, func, mconfig, where, TAKE3, help }
194 # define AP_INIT_FLAG(directive, func, mconfig, where, help) \
195     { directive, func, mconfig, where, FLAG, help }
196
197 #endif
198
199 typedef struct command_struct command_rec; 
200 /**
201  * The command record structure.  Each modules can define a table of these
202  * to define the directives it will implement.
203  */
204 struct command_struct {
205     /** Name of this command */
206     const char *name;
207     /** The function to be called when this directive is parsed */
208     cmd_func func;
209     /** Extra data, for functions which implement multiple commands... */
210     void *cmd_data;             
211     /** What overrides need to be allowed to enable this command. */
212     int req_override;
213     /** What the command expects as arguments 
214      *  @defvar cmd_how args_how*/
215     enum cmd_how args_how;
216
217     /** 'usage' message, in case of syntax errors */
218     const char *errmsg;
219 };
220
221 /* The allowed locations for a configuration directive are the union of
222  * those indicated by each set bit in the req_override mask.
223  *
224  * (req_override & RSRC_CONF)   => *.conf outside <Directory> or <Location>
225  * (req_override & ACCESS_CONF) => *.conf inside <Directory> or <Location>
226  * (req_override & OR_AUTHCFG)  => *.conf inside <Directory> or <Location>
227  *                                 and .htaccess when AllowOverride AuthConfig
228  * (req_override & OR_LIMIT)    => *.conf inside <Directory> or <Location>
229  *                                 and .htaccess when AllowOverride Limit
230  * (req_override & OR_OPTIONS)  => *.conf anywhere
231  *                                 and .htaccess when AllowOverride Options
232  * (req_override & OR_FILEINFO) => *.conf anywhere
233  *                                 and .htaccess when AllowOverride FileInfo
234  * (req_override & OR_INDEXES)  => *.conf anywhere
235  *                                 and .htaccess when AllowOverride Indexes
236  */
237 #define OR_NONE 0
238 #define OR_LIMIT 1
239 #define OR_OPTIONS 2
240 #define OR_FILEINFO 4
241 #define OR_AUTHCFG 8
242 #define OR_INDEXES 16
243 #define OR_UNSET 32
244 #define ACCESS_CONF 64
245 #define RSRC_CONF 128
246 #define EXEC_ON_READ 256
247 #define OR_ALL (OR_LIMIT|OR_OPTIONS|OR_FILEINFO|OR_AUTHCFG|OR_INDEXES)
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  * @defvar DECLINE_CMD "\a\b"
254  */
255 #define DECLINE_CMD "\a\b"
256
257 typedef struct configfile_t configfile_t;
258 /** Common structure for reading of config files / passwd files etc. */
259 struct configfile_t {
260     /** a getc()-like function
261      *  @deffunc int getch(void *param) */
262     int (*getch) (void *param); 
263     /** a fgets()-like function 
264      *  @deffunc void *getstr(void *buf, size_t bufsize, void *param)*/
265     void *(*getstr) (void *buf, size_t bufsiz, void *param);
266     /** a close hander function 
267      *  @deffunc int close(void *param)*/
268     int (*close) (void *param); 
269     /** the argument passed to getch/getstr/close */
270     void *param;
271     /** the filename / description */
272     const char *name;
273     /** current line number, starting at 1 */
274     unsigned line_number;
275 };
276
277 /**
278  * This structure is passed to a command which is being invoked,
279  * to carry a large variety of miscellaneous data which is all of
280  * use to *somebody*...
281  */
282 struct cmd_parms_struct {
283     /** Argument to command from cmd_table */
284     void *info;
285     /** Which allow-override bits are set */
286     int override;
287     /** Which methods are <Limit>ed */
288     int limited;
289     apr_array_header_t *limited_xmethods;
290
291     /** Config file structure. */
292     configfile_t *config_file;
293     /** the directive specifying this command */
294     ap_directive_t *directive;
295
296     /** Pool to allocate new storage in */
297     apr_pool_t *pool;
298     /** Pool for scratch memory; persists during configuration, but 
299      *  wiped before the first request is served...  */
300     apr_pool_t *temp_pool;
301     /** Server_rec being configured for */
302     server_rec *server;
303     /** If configuring for a directory, pathname of that directory.  
304      *  NOPE!  That's what it meant previous to the existance of <Files>, 
305      * <Location> and regex matching.  Now the only usefulness that can be 
306      * derived from this field is whether a command is being called in a 
307      * server context (path == NULL) or being called in a dir context 
308      * (path != NULL).  */
309     char *path;
310     /** configuration command */
311     const command_rec *cmd;
312
313     /** per_dir_config vector passed to handle_command */
314     void *context;
315     /** directive with syntax error */
316     const ap_directive_t *err_directive;
317 };
318
319 typedef struct handler_rec handler_rec;
320
321 /** This structure records the existence of handlers in a module... */
322 struct handler_rec {
323     /** The type of content this handler function will handle.  
324      *  MUST be all lower case 
325      */
326     const char *content_type;
327     /** The function to call when this context-type is requested. 
328      *  @deffunc int handler(request_rec *)
329      */
330     int (*handler) (request_rec *);
331 };
332
333 typedef struct module_struct module;
334 /**
335  * Module structures.  Just about everything is dispatched through
336  * these, directly or indirectly (through the command and handler
337  * tables).
338  */
339 struct module_struct {
340     /** API version, *not* module version; check that module is 
341      * compatible with this version of the server.
342      */
343     int version;
344     /** API minor version. Provides API feature milestones. Not checked 
345      *  during module init */
346     int minor_version;
347     /** Index to this modules structures in config vectors.  */
348     int module_index;
349
350     /** The name of the module's C file */
351     const char *name;
352     /** The handle for the DSO.  Internal use only */
353     void *dynamic_load_handle;
354
355     /** A pointer to the next module in the list
356      *  @defvar module_struct *next */
357     struct module_struct *next;
358
359     /** Magic Cookie to identify a module structure;  It's mainly 
360      *  important for the DSO facility (see also mod_so).  */
361     unsigned long magic;
362
363     /** Function to allow MPMs to re-write command line arguments.  This
364      *  hook is only available to MPMs.
365      *  @param The process that the server is running in.
366      *  @deffunc void rewrite_args(process_rec *process);
367      */
368     void (*rewrite_args) (process_rec *process);
369     /** Function to allow all modules to create per directory configuration
370      *  structures.
371      *  @param p The pool to use for all allocations.
372      *  @param dir The directory currently being processed.
373      *  @return The per-directory structure created
374      *  @deffunc void *create_dir_config(apr_pool_t *p, char *dir)
375      */
376     void *(*create_dir_config) (apr_pool_t *p, char *dir);
377     /** Function to allow all modules to merge the per directory configuration
378      *  structures for two directories.
379      *  @param p The pool to use for all allocations.
380      *  @param base_conf The directory structure created for the parent directory.
381      *  @param new_conf The directory structure currently being processed.
382      *  @return The new per-directory structure created
383      *  @deffunc void *merge_dir_config(apr_pool_t *p, void *base_conf, void *new_conf)
384      */
385     void *(*merge_dir_config) (apr_pool_t *p, void *base_conf, void *new_conf);
386     /** Function to allow all modules to create per server configuration
387      *  structures.
388      *  @param p The pool to use for all allocations.
389      *  @param s The server currently being processed.
390      *  @return The per-server structure created
391      *  @deffunc void *create_server_config(apr_pool_t *p, server_rec *dir)
392      */
393     void *(*create_server_config) (apr_pool_t *p, server_rec *s);
394     /** Function to allow all modules to merge the per server configuration
395      *  structures for two servers.
396      *  @param p The pool to use for all allocations.
397      *  @param base_conf The directory structure created for the parent directory.
398      *  @param new_conf The directory structure currently being processed.
399      *  @return The new per-directory structure created
400      *  @deffunc void *merge_dir_config(apr_pool_t *p, void *base_conf, void *new_conf)
401      */
402     void *(*merge_server_config) (apr_pool_t *p, void *base_conf, void *new_conf);
403
404     /** A command_rec table that describes all of the directives this module
405      * defines. */
406     const command_rec *cmds;
407     /** A handler_rec table that describes all of the mime-types this module
408      *  will server responses for. */
409     const handler_rec *handlers;
410
411     /** A hook to allow modules to hook other points in the request processing.
412      *  In this function, modules should call the ap_hook_*() functions to
413      *  register an interest in a specific step in processing the current
414      *  request.
415      *  @deffunc void register_hooks(void)
416      */
417     void (*register_hooks) (void);
418 };
419
420 /* Initializer for the first few module slots, which are only
421  * really set up once we start running.  Note that the first two slots
422  * provide a version check; this should allow us to deal with changes to
423  * the API. The major number should reflect changes to the API handler table
424  * itself or removal of functionality. The minor number should reflect
425  * additions of functionality to the existing API. (the server can detect
426  * an old-format module, and either handle it back-compatibly, or at least
427  * signal an error). See src/include/ap_mmn.h for MMN version history.
428  */
429
430 #define STANDARD_MODULE_STUFF   this_module_needs_to_be_ported_to_apache_2_0
431
432 #define STANDARD20_MODULE_STUFF MODULE_MAGIC_NUMBER_MAJOR, \
433                                 MODULE_MAGIC_NUMBER_MINOR, \
434                                 -1, \
435                                 __FILE__, \
436                                 NULL, \
437                                 NULL, \
438                                 MODULE_MAGIC_COOKIE, \
439                                 NULL      /* rewrite args spot */
440
441 #define MPM20_MODULE_STUFF      MODULE_MAGIC_NUMBER_MAJOR, \
442                                 MODULE_MAGIC_NUMBER_MINOR, \
443                                 -1, \
444                                 __FILE__, \
445                                 NULL, \
446                                 NULL, \
447                                 MODULE_MAGIC_COOKIE
448
449 /**
450  * Generic accessors for other modules to get at their own module-specific
451  * data
452  * @param conf_vector The vector in which the modules configuration is stored.
453  *        usually r->per_dir_config or s->module_config
454  * @param m The module to get the data for.
455  * @return The module-specific data
456  * @deffunc void *ap_get_module_config(void *conf_vector, module *m)
457  */
458 API_EXPORT(void *) ap_get_module_config(void *conf_vector, module *m);
459 /**
460  * Generic accessors for other modules to set at their own module-specific
461  * data
462  * @param conf_vector The vector in which the modules configuration is stored.
463  *        usually r->per_dir_config or s->module_config
464  * @param m The module to set the data for.
465  * @param val The module-specific data to set
466  * @deffunc void ap_set_module_config(void *conf_vector, module *m, void *val)
467  */
468 API_EXPORT(void) ap_set_module_config(void *conf_vector, module *m, void *val);
469
470 #define ap_get_module_config(v,m)       \
471     (((void **)(v))[(m)->module_index])
472 #define ap_set_module_config(v,m,val)   \
473     ((((void **)(v))[(m)->module_index]) = (val))
474
475 /**
476  * Generic command handling function for strings
477  * @param cmd The command parameters for this directive
478  * @param struct_ptr pointer into a given type
479  * @param arg The argument to the directive
480  * @return An error string or NULL on success
481  * @deffunc const char *ap_set_string_slot(cmd_parms *cmd, void *struct_ptr, const char *arg)
482  */
483 API_EXPORT_NONSTD(const char *) ap_set_string_slot(cmd_parms *, void *,
484                                                    const char *);
485
486 /**
487  * Return true if the specified method is limited by being listed in
488  * a <Limit> container, or by *not* being listed in a <LimiteExcept>
489  * container.
490  *
491  * @param   method  Pointer to a string specifying the method to check.
492  * @param   cmd     Pointer to the cmd_parms structure passed to the
493  *                  directive handler.
494  * @return  0 if the method is not limited in the current scope
495  * @deffunc ap_method_is_limited(cmd_parms *cmd, const char *method)
496  */
497 API_EXPORT(int) ap_method_is_limited(cmd_parms *cmd, const char *method);
498
499 /**
500  * Generic command handling function for strings, always sets the value
501  * to a lowercase string
502  * @param cmd The command parameters for this directive
503  * @param struct_ptr pointer into a given type
504  * @param arg The argument to the directive
505  * @return An error string or NULL on success
506  * @deffunc const char *ap_set_string_slot_lower(cmd_parms *cmd, void *struct_ptr, const char *arg)
507  */
508 API_EXPORT_NONSTD(const char *) ap_set_string_slot_lower(cmd_parms *, 
509                                                          void *, const char *);
510 /**
511  * Generic command handling function for flags
512  * @param cmd The command parameters for this directive
513  * @param struct_ptr pointer into a given type
514  * @param arg The argument to the directive (either 1 or 0)
515  * @return An error string or NULL on success
516  * @deffunc const char *ap_set_flag_slot(cmd_parms *cmd, void *struct_ptr, int arg)
517  */
518 API_EXPORT_NONSTD(const char *) ap_set_flag_slot(cmd_parms *, void *, int);
519 /**
520  * Generic command handling function for files
521  * @param cmd The command parameters for this directive
522  * @param struct_ptr pointer into a given type
523  * @param arg The argument to the directive
524  * @return An error string or NULL on success
525  * @deffunc const char *ap_set_file_slot(cmd_parms *cmd, char *struct_ptr, const char *arg)
526  */
527 API_EXPORT_NONSTD(const char *) ap_set_file_slot(cmd_parms *, char *, const char *);
528
529 /**
530  * For modules which need to read config files, open logs, etc. ...
531  * this returns the fname argument if it begins with '/'; otherwise
532  * it relativizes it wrt server_root.
533  * @param p pool to allocate data out of
534  * @param fname The file name
535  * @deffunc const char *ap_server_root_relative(apr_pool_t *p, const char *fname)
536  */
537 API_EXPORT(const char *) ap_server_root_relative(apr_pool_t *p, const char *fname);
538
539 /* Finally, the hook for dynamically loading modules in... */
540
541 /**
542  * Add a module to the server
543  * @param m the module structure of the module to add
544  * @deffunc void ap_add_module(module *m)
545  */
546 API_EXPORT(void) ap_add_module(module *m);
547 /**
548  * Remove a module from the server.  There are some caveats:
549  * when the module is removed, its slot is lost so all the current
550  * per-dir and per-server configurations are invalid. So we should
551  * only ever call this function when you are invalidating almost
552  * all our current data. I.e. when doing a restart.
553  * @param m the module structure of the module to remove
554  * @deffunc void ap_remove_module(module *m)
555  */
556 API_EXPORT(void) ap_remove_module(module *m);
557 /**
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  * @deffunc void ap_add_loaded_module(module *m)
561  */
562 API_EXPORT(void) ap_add_loaded_module(module *mod);
563 /**
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
566  * @deffunc void ap_remove_loaded_module(module *m)
567  */
568 API_EXPORT(void) ap_remove_loaded_module(module *mod);
569 /**
570  * Add a module to the list of loaded module based on the name of the
571  * module
572  * @param name The name of the module
573  * @return 1 on success, 0 on failure
574  * @deffunc int ap_add_named_module(const char *name)
575  */
576 API_EXPORT(int) ap_add_named_module(const char *name);
577 /**
578  * Clear all of the modules from the loaded module list 
579  * @deffunc void ap_add_named_module(void)
580  */
581 API_EXPORT(void) ap_clear_module_list(void);
582 /**
583  * Find the name of the specified module
584  * @param m The module to get the name for
585  * @return the name of the module
586  * @deffunc const char *ap_find_module_name(module *m)
587  */
588 API_EXPORT(const char *) ap_find_module_name(module *m);
589 /**
590  * Find a module based on the name of the module
591  * @param name the name of the module
592  * @return the module structure if found, NULL otherwise
593  * @deffunc module *ap_find_linked_module(const char *name)
594  */
595 API_EXPORT(module *) ap_find_linked_module(const char *name);
596
597 /**
598  * Open a configfile_t as apr_file_t
599  * @param ret_cfg open configfile_t struct pointer
600  * @param p The pool to allocate the structure out of
601  * @param name the name of the file to open
602  * @deffunc apr_status_t ap_pcfg_openfile(configfile_t **ret_cfg, apr_pool_t *p, const char *name)
603  */
604 API_EXPORT(apr_status_t) ap_pcfg_openfile(configfile_t **, apr_pool_t *p, const char *name);
605
606 /**
607  * Allocate a configfile_t handle with user defined functions and params 
608  * @param p The pool to allocate out of
609  * @param descr The name of the file
610  * @param param The argument passed to getch/getstr/close
611  * @param getc_func The getch function
612  * @param gets_func The getstr function
613  * @param close_func The close function
614  * @deffunc configfile_t *ap_pcfg_open_custom(apr_pool_t *p, const char *descr, void *param, int(*getc_func)(void*), void *(*gets_func) (void *buf, size_t bufsiz, void *param), int(*close_func)(void *param))
615  */
616 API_EXPORT(configfile_t *) ap_pcfg_open_custom(apr_pool_t *p, const char *descr,
617     void *param,
618     int(*getc_func)(void*),
619     void *(*gets_func) (void *buf, size_t bufsiz, void *param),
620     int(*close_func)(void *param));
621
622 /**
623  * Read one line from open configfile_t, strip LF, increase line number
624  * @param buf place to store the line read
625  * @param bufsize size of the buffer
626  * @param cfp File to read from
627  * @return 1 on success, 0 on failure
628  * @deffunc int ap_cfg_getline(char *buf, size_t bufsize, configfile_t *cfp)
629  */
630 API_EXPORT(int) ap_cfg_getline(char *buf, size_t bufsize, configfile_t *cfp);
631
632 /**
633  * Read one char from open configfile_t, increase line number upon LF 
634  * @param cfp The file to read from
635  * @return the character read
636  * @deffunc int ap_cfg_getc(configfile_t *cfp)
637  */
638 API_EXPORT(int) ap_cfg_getc(configfile_t *cfp);
639
640 /**
641  * Detach from open configfile_t, calling the close handler
642  * @param cfp The file to close
643  * @return 1 on sucess, 0 on failure
644  * @deffunc int ap_cfg_closefile(configfile_t *cfp)
645  */
646 API_EXPORT(int) ap_cfg_closefile(configfile_t *cfp);
647
648 /**
649  * Read all data between the current <foo> and the matching </foo>.  All
650  * of this data is forgotten immediately.  
651  * @param cmd The cmd_parms to pass to the directives inside the container
652  * @param directive The directive name to read until
653  * @retrn Error string on failure, NULL on success
654  * @deffunc const char *ap_soak_end_container(cmd_parms *cmd, char *directive)
655  */
656 API_EXPORT(const char *) ap_soak_end_container(cmd_parms *cmd, char *directive);
657
658 /**
659  * Read all data between the current <foo> and the matching </foo> and build
660  * a config tree out of it
661  * @param p pool to allocate out of
662  * @param temp_pool Temporary pool to allocate out of
663  * @param parms The cmd_parms to pass to all directives read
664  * @param current The current node in the tree
665  * @param curr_parent The current parent node
666  * @param orig_directive The directive to read until hit.
667  * @return Error string on failure, NULL on success
668  * @deffunc char *ap_build_cont_config(apr_pool_t *p, apr_pool_t *temp_pool, cmd_parms *parms, ap_directive_t **current, ap_directive_t **curr_parent, char *orig_directive)
669 */
670 const char * ap_build_cont_config(apr_pool_t *p, apr_pool_t *temp_pool,
671                                         cmd_parms *parms,
672                                         ap_directive_t **current,
673                                         ap_directive_t **curr_parent,
674                                         char *orig_directive);
675
676 /**
677  * Build a config tree from a config file
678  * @param parms The cmd_parms to pass to all of the directives in the file
679  * @param conf_pool The pconf pool
680  * @param temp_pool The temporary pool
681  * @param conftree Place to store the root node of the config tree
682  * @return Error string on erro, NULL otherwise
683  * @deffunc const char *ap_build_config(cmd_parms *parms, apr_pool_t *conf_pool, apr_pool_t *temp_pool, ap_directive_t **conftree)
684  */
685 API_EXPORT(const char *) ap_build_config(cmd_parms *parms,
686                                          apr_pool_t *conf_pool,
687                                          apr_pool_t *temp_pool,
688                                          ap_directive_t **conftree);
689
690 /**
691  * Walk a config tree and setup the server's internal structures
692  * @param conftree The config tree to walk
693  * @param parms The cmd_parms to pass to all functions
694  * @param config The parms context
695  * @return Error string on error, NULL otherwise
696  * @deffunc const char *ap_walk_config(ap_directive_t *conftree, cmd_parms *parms, void *config)
697  */
698 API_EXPORT(const char *) ap_walk_config(ap_directive_t *conftree,
699                                         cmd_parms *parms, void *config);
700
701 /**
702  * ap_check_cmd_context() definitions: 
703  * @param cmd The cmd_context to check
704  * @param forbidden Where the command is forbidden.  One of:
705  * <PRE>
706  *                NOT_IN_VIRTUALHOST
707  *                NOT_IN_LIMIT
708  *                NOT_IN_DIRECTORY
709  *                NOT_IN_LOCATION
710  *                NOT_IN_FILES
711  *                NOT_IN_DIR_LOC_FILE
712  *                GLOBAL_ONLY
713  * </PRE>
714  * @return Error string on error, NULL on success
715  * @deffunc const char *ap_check_cmd_context(cmd_parms *cmd, unsigned forbidden)
716  */
717 API_EXPORT(const char *) ap_check_cmd_context(cmd_parms *cmd, unsigned forbidden);
718
719 /* ap_check_cmd_context():              Forbidden in: */
720 #define  NOT_IN_VIRTUALHOST     0x01 /* <Virtualhost> */
721 #define  NOT_IN_LIMIT           0x02 /* <Limit> */
722 #define  NOT_IN_DIRECTORY       0x04 /* <Directory> */
723 #define  NOT_IN_LOCATION        0x08 /* <Location> */
724 #define  NOT_IN_FILES           0x10 /* <Files> */
725 #define  NOT_IN_DIR_LOC_FILE    (NOT_IN_DIRECTORY|NOT_IN_LOCATION|NOT_IN_FILES) /* <Directory>/<Location>/<Files>*/
726 #define  GLOBAL_ONLY            (NOT_IN_VIRTUALHOST|NOT_IN_LIMIT|NOT_IN_DIR_LOC_FILE)
727
728
729 #ifdef CORE_PRIVATE
730
731 /**
732  * The topmost module in the list
733  * @defvar module *top_module
734  */
735 extern API_VAR_EXPORT module *top_module;
736
737 /**
738  * Array of all statically linked modules
739  * @defvar module *ap_prelinked_modules[]
740  */
741 extern API_VAR_EXPORT module *ap_prelinked_modules[];
742 /**
743  * Array of all preloaded modules
744  * @defvar module *ap_preloaded_modules[]
745  */
746 extern API_VAR_EXPORT module *ap_preloaded_modules[];
747 /**
748  * Array of all loaded modules
749  * @defvar module **ap_loaded_modules
750  */
751 extern API_VAR_EXPORT module **ap_loaded_modules;
752
753 /* For mod_so.c... */
754 /** Run a single module's two create_config hooks
755  *  @param p the pool to allocate out of
756  *  @param s The server to configure for.
757  *  @param m The module to configure
758  */
759 void ap_single_module_configure(apr_pool_t *p, server_rec *s, module *m);
760
761 /* For http_main.c... */
762 /**
763  * Add all of the prelinked modules into the loaded module list
764  * @param process The process that is currently running the server
765  * @deffunc void ap_setup_prelinked_modules(process_rec *process)
766  */
767 API_EXPORT(void) ap_setup_prelinked_modules(process_rec *process);
768
769 /**
770  *Show the preloaded configuration directives, the help string explaining
771  * the directive arguments, in what module they are handled, and in
772  * what parts of the configuration they are allowed.  Used for httpd -h.
773  * @deffunc void ap_show_directives(void)
774  */
775 API_EXPORT(void) ap_show_directives(void);
776
777 /** 
778  * Show the preloaded module names.  Used for httpd -l. 
779  * @deffunc void ap_show_modules(void)
780  */
781 API_EXPORT(void) ap_show_modules(void);
782
783 /**
784  * Read all config files and setup the server
785  * @param process The process running the server
786  * @param temp_pool A pool to allocate temporary data out of.
787  * @param config_name The name of the config file
788  * @param conftree Place to store the root of the config tree
789  * @return The setup server_rec list.
790  * @deffunc server_rec *ap_read_config(process_rec *process, apr_pool_t *temp_pool, const char *config_name, ap_directive_t **conftree)
791  */
792 API_EXPORT(server_rec*) ap_read_config(process_rec *process, apr_pool_t *temp_pool, const char *config_name, ap_directive_t **conftree);
793
794 /**
795  * Run all post config hooks for loaded modules.
796  * @param pconf The configuration pool
797  * @param plog The logging pool
798  * @param ptemp The temporary pool
799  * @param s The list of server_rec structures
800  * @deffunc void ap_post_config_hook(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *s)
801  */
802 API_EXPORT(void) ap_post_config_hook(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *s);
803
804 /**
805  * Run all rewrite args hooks for loaded modules
806  * @param process The process currently running the server
807  * @deffunc void ap_run_rewrite_args(process_rec *process)
808  */
809 API_EXPORT(void) ap_run_rewrite_args(process_rec *process);
810
811 /**
812  * Run the register hooks function for a specified module
813  * @param m The module to run the register hooks function fo
814  * @deffunc void ap_register_hooks(module *m)
815  */
816 API_EXPORT(void) ap_register_hooks(module *m);
817
818 /**
819  * Setup all virtual hosts
820  * @param p The pool to allocate out of
821  * @param main_server The head of the server_rec list
822  * @deffunc void ap_fixup_virtual_hosts(apr_pool_t *p, server_rec *main_server)
823  */
824 API_EXPORT(void) ap_fixup_virtual_hosts(apr_pool_t *p, server_rec *main_server);
825
826 /* For http_request.c... */
827
828 /**
829  * Setup the config vector for a request_rec
830  * @param p The pool to allocate the config vector out of
831  * @return The config vector
832  */
833 void *ap_create_request_config(apr_pool_t *p);
834
835 /**
836  * Setup the config vector for per dir module configs
837  * @param p The pool to allocate the config vector out of
838  * @return The config vector
839  * @deffunc void *ap_create_per_dir_config(apr_pool_t *p)
840  */
841 CORE_EXPORT(void *) ap_create_per_dir_config(apr_pool_t *p);
842
843 /**
844  * Run all of the modules merge per dir config functions
845  * @param p The pool to pass to the merge functions
846  * @param base The base directory config structure
847  * @param new The new directory config structure
848  */
849 void *ap_merge_per_dir_configs(apr_pool_t *p, void *base, void *new);
850
851 /* For http_connection.c... */
852 /**
853  * Setup the config vector for a connection_rec
854  * @param p The pool to allocate the config vector out of
855  * @return The config vector
856  */
857 void *ap_create_conn_config(apr_pool_t *p);
858
859 /* For http_core.c... (<Directory> command and virtual hosts) */
860
861 /**
862  * parse an htaccess file
863  * @param resulting htaccess_result
864  * @param r The request currently being served
865  * @param override Which overrides are active
866  * @param path The path to the htaccess file
867  * @param access_name The list of possible names for .htaccess files
868  * int The status of the current request
869  */
870 int ap_parse_htaccess(void **result, request_rec *r, int override,
871                 const char *path, const char *access_name);
872
873 /**
874  * Setup a virtual host
875  * @param p The pool to allocate all memory out of
876  * @param hostname The hostname of the virtual hsot
877  * @param main_server The main server for this Apache configuration
878  * @param ps Place to store the new server_rec
879  * return Error string on error, NULL on success
880  * @deffunc const char *ap_init_virtual_host(apr_pool_t *p, const char *hostname, server_rec *main_server, server_rec **ps)
881  */
882 CORE_EXPORT(const char *) ap_init_virtual_host(apr_pool_t *p, const char *hostname,
883                                 server_rec *main_server, server_rec **);
884
885 /**
886  * Process the config file for Apache
887  * @param s The server rec to use for the command parms
888  * @param fname The name of the config file
889  * @param conftree The root node of the created config tree
890  * @param p Pool for general allocation
891  * @param ptem Pool for temporary allocation
892  */
893 void ap_process_resource_config(server_rec *s, const char *fname, 
894                  ap_directive_t **conftree, apr_pool_t *p, apr_pool_t *ptemp);
895
896 /**
897  * Process all directives in the config tree
898  * @param s The server rec to use in the command parms
899  * @param conftree The config tree to process
900  * @param p The pool for general allocation
901  * @param ptemp The pool for temporary allocations
902  */
903 API_EXPORT(void) ap_process_config_tree(server_rec *s, ap_directive_t *conftree,
904                                         apr_pool_t *p, apr_pool_t *ptemp);
905
906
907 /* For individual MPMs... */
908 /**
909  * Run all child init hooks
910  * @param pchild The pool for child process allocations
911  * @param s The list of all server_recs
912  */
913 void ap_child_init_hook(apr_pool_t *pchild, server_rec *s);
914
915 /* Module-method dispatchers, also for http_request.c */
916 /**
917  * Run the handler phase of each module until a module accepts the
918  * responsibility of serving the request
919  * @param r The current request
920  * @return The status of the current request
921  */
922 int ap_invoke_handler(request_rec *);
923
924 /* for mod_perl */
925
926 /**
927  * Find a given directive in a command_rec table
928  * @param name The directive to search for
929  * @param cmds The table to search
930  * @return The directive definition of the specified directive
931  * @deffunc const command_rec *ap_find_command(const char *name, const command_rec *cmds)
932  */
933 CORE_EXPORT(const command_rec *) ap_find_command(const char *name, const command_rec *cmds);
934
935 /**
936  * Find a given directive in a list module
937  * @param cmd_name The directive to search for
938  * @param mod The module list to search
939  * @return The directive definition of the specified directive
940  * @deffunc const command_rec *ap_find_command_in_modules(const char *cmd_name,module **mod)
941  */
942 CORE_EXPORT(const command_rec *) ap_find_command_in_modules(const char *cmd_name, module **mod);
943
944 /**
945  * Add a per_dir and per_server config vector to a given module
946  * @param parms The command_parms to use
947  * @param config The config vector
948  * @param mod The module to add the vector for.
949  * @return The new config vector
950  * @deffunc void *ap_set_config_vectors(cmd_parms *parms, void *config, module *mod)
951  */
952 CORE_EXPORT(void *) ap_set_config_vectors(cmd_parms *parms, void *config, module *mod);
953
954 #endif
955
956   /* Hooks */
957
958 /**
959  * Run the header parser functions for each module
960  * @param r The current request
961  * @return OK or DECLINED
962  * @deffunc int ap_run_header_parser(request_rec *r)
963  */
964 AP_DECLARE_HOOK(int,header_parser,(request_rec *))
965
966 /**
967  * Run the pre_config function for each module
968  * @param pconf The config pool
969  * @param plog The logging streams pool
970  * @param ptemp The temporary pool
971  * @deffunc void ap_run_pre_config(apr_pool_t *pconf,apr_pool_t *plog,apr_pool_t *ptemp)
972  */
973 AP_DECLARE_HOOK(void,pre_config,
974              (apr_pool_t *pconf,apr_pool_t *plog,apr_pool_t *ptemp))
975
976 /**
977  * Run the post_config function for each module
978  * @param pconf The config pool
979  * @param plog The logging streams pool
980  * @param ptemp The temporary pool
981  * @param s The list of server_recs
982  * @deffunc void ap_run_post_config(apr_pool_t *pconf,apr_pool_t *plog,apr_pool_t *ptemp, server_rec *s)
983  */
984 AP_DECLARE_HOOK(void,post_config,
985              (apr_pool_t *pconf,apr_pool_t *plog,apr_pool_t *ptemp,server_rec *s))
986
987 /**
988  * Run the open_logs functions for each module
989  * @param pconf The config pool
990  * @param plog The logging streams pool
991  * @param ptemp The temporary pool
992  * @param s The list of server_recs
993  * @deffunc void ap_run_open_logs(apr_pool_t *pconf,apr_pool_t *plog,apr_pool_t *ptemp, server_rec *s)
994  */
995 AP_DECLARE_HOOK(void,open_logs,
996              (apr_pool_t *pconf,apr_pool_t *plog,apr_pool_t *ptemp,server_rec *s))
997
998 /**
999  * Run the child_init functions for each module
1000  * @param pchild The child pool
1001  * @param s The list of server_recs in this server 
1002  * @deffunc void ap_run_child_init(apr_pool_t *pchild, server_rec *s)
1003  */
1004 AP_DECLARE_HOOK(void,child_init,(apr_pool_t *pchild, server_rec *s))
1005
1006 #ifdef __cplusplus
1007 }
1008 #endif
1009
1010 #endif  /* !APACHE_HTTP_CONFIG_H */