Annotation of win32/apache13/src/include/http_config.h, revision 1.1

1.1     ! parser      1: /* ====================================================================
        !             2:  * Copyright (c) 1995-1999 The Apache Group.  All rights reserved.
        !             3:  *
        !             4:  * Redistribution and use in source and binary forms, with or without
        !             5:  * modification, are permitted provided that the following conditions
        !             6:  * are met:
        !             7:  *
        !             8:  * 1. Redistributions of source code must retain the above copyright
        !             9:  *    notice, this list of conditions and the following disclaimer. 
        !            10:  *
        !            11:  * 2. Redistributions in binary form must reproduce the above copyright
        !            12:  *    notice, this list of conditions and the following disclaimer in
        !            13:  *    the documentation and/or other materials provided with the
        !            14:  *    distribution.
        !            15:  *
        !            16:  * 3. All advertising materials mentioning features or use of this
        !            17:  *    software must display the following acknowledgment:
        !            18:  *    "This product includes software developed by the Apache Group
        !            19:  *    for use in the Apache HTTP server project (http://www.apache.org/)."
        !            20:  *
        !            21:  * 4. The names "Apache Server" and "Apache Group" must not be used to
        !            22:  *    endorse or promote products derived from this software without
        !            23:  *    prior written permission. For written permission, please contact
        !            24:  *    apache@apache.org.
        !            25:  *
        !            26:  * 5. Products derived from this software may not be called "Apache"
        !            27:  *    nor may "Apache" appear in their names without prior written
        !            28:  *    permission of the Apache Group.
        !            29:  *
        !            30:  * 6. Redistributions of any form whatsoever must retain the following
        !            31:  *    acknowledgment:
        !            32:  *    "This product includes software developed by the Apache Group
        !            33:  *    for use in the Apache HTTP server project (http://www.apache.org/)."
        !            34:  *
        !            35:  * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY
        !            36:  * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
        !            37:  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
        !            38:  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE APACHE GROUP OR
        !            39:  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
        !            40:  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
        !            41:  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
        !            42:  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
        !            43:  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
        !            44:  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
        !            45:  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
        !            46:  * OF THE POSSIBILITY OF SUCH DAMAGE.
        !            47:  * ====================================================================
        !            48:  *
        !            49:  * This software consists of voluntary contributions made by many
        !            50:  * individuals on behalf of the Apache Group and was originally based
        !            51:  * on public domain software written at the National Center for
        !            52:  * Supercomputing Applications, University of Illinois, Urbana-Champaign.
        !            53:  * For more information on the Apache Group and the Apache HTTP server
        !            54:  * project, please see <http://www.apache.org/>.
        !            55:  *
        !            56:  */
        !            57: 
        !            58: #ifndef APACHE_HTTP_CONFIG_H
        !            59: #define APACHE_HTTP_CONFIG_H
        !            60: 
        !            61: #ifdef __cplusplus
        !            62: extern "C" {
        !            63: #endif
        !            64: 
        !            65: /*
        !            66:  * The central data structures around here...
        !            67:  */
        !            68: 
        !            69: /* Command dispatch structures... */
        !            70: 
        !            71: /* Note that for all of these except RAW_ARGS, the config routine is
        !            72:  * passed a freshly allocated string which can be modified or stored
        !            73:  * or whatever... it's only necessary to do pstrdup() stuff with
        !            74:  * RAW_ARGS.
        !            75:  */
        !            76: enum cmd_how {
        !            77:     RAW_ARGS,                  /* cmd_func parses command line itself */
        !            78:     TAKE1,                     /* one argument only */
        !            79:     TAKE2,                     /* two arguments only */
        !            80:     ITERATE,                   /* one argument, occuring multiple times
        !            81:                                 * (e.g., IndexIgnore)
        !            82:                                 */
        !            83:     ITERATE2,                  /* two arguments, 2nd occurs multiple times
        !            84:                                 * (e.g., AddIcon)
        !            85:                                 */
        !            86:     FLAG,                      /* One of 'On' or 'Off' */
        !            87:     NO_ARGS,                   /* No args at all, e.g. </Directory> */
        !            88:     TAKE12,                    /* one or two arguments */
        !            89:     TAKE3,                     /* three arguments only */
        !            90:     TAKE23,                    /* two or three arguments */
        !            91:     TAKE123,                   /* one, two or three arguments */
        !            92:     TAKE13                     /* one or three arguments */
        !            93: };
        !            94: 
        !            95: typedef struct command_struct {
        !            96:     const char *name;          /* Name of this command */
        !            97:     const char *(*func) ();    /* Function invoked */
        !            98:     void *cmd_data;            /* Extra data, for functions which
        !            99:                                 * implement multiple commands...
        !           100:                                 */
        !           101:     int req_override;          /* What overrides need to be allowed to
        !           102:                                 * enable this command.
        !           103:                                 */
        !           104:     enum cmd_how args_how;     /* What the command expects as arguments */
        !           105: 
        !           106:     const char *errmsg;                /* 'usage' message, in case of syntax errors */
        !           107: } command_rec;
        !           108: 
        !           109: /* The allowed locations for a configuration directive are the union of
        !           110:  * those indicated by each set bit in the req_override mask.
        !           111:  *
        !           112:  * (req_override & RSRC_CONF)   => *.conf outside <Directory> or <Location>
        !           113:  * (req_override & ACCESS_CONF) => *.conf inside <Directory> or <Location>
        !           114:  * (req_override & OR_AUTHCFG)  => *.conf inside <Directory> or <Location>
        !           115:  *                                 and .htaccess when AllowOverride AuthConfig
        !           116:  * (req_override & OR_LIMIT)    => *.conf inside <Directory> or <Location>
        !           117:  *                                 and .htaccess when AllowOverride Limit
        !           118:  * (req_override & OR_OPTIONS)  => *.conf anywhere
        !           119:  *                                 and .htaccess when AllowOverride Options
        !           120:  * (req_override & OR_FILEINFO) => *.conf anywhere
        !           121:  *                                 and .htaccess when AllowOverride FileInfo
        !           122:  * (req_override & OR_INDEXES)  => *.conf anywhere
        !           123:  *                                 and .htaccess when AllowOverride Indexes
        !           124:  */
        !           125: #define OR_NONE 0
        !           126: #define OR_LIMIT 1
        !           127: #define OR_OPTIONS 2
        !           128: #define OR_FILEINFO 4
        !           129: #define OR_AUTHCFG 8
        !           130: #define OR_INDEXES 16
        !           131: #define OR_UNSET 32
        !           132: #define ACCESS_CONF 64
        !           133: #define RSRC_CONF 128
        !           134: #define OR_ALL (OR_LIMIT|OR_OPTIONS|OR_FILEINFO|OR_AUTHCFG|OR_INDEXES)
        !           135: 
        !           136: /* This can be returned by a function if they don't wish to handle
        !           137:  * a command. Make it something not likely someone will actually use
        !           138:  * as an error code.
        !           139:  */
        !           140: 
        !           141: #define DECLINE_CMD "\a\b"
        !           142: 
        !           143: /*
        !           144:  * This structure is passed to a command which is being invoked,
        !           145:  * to carry a large variety of miscellaneous data which is all of
        !           146:  * use to *somebody*...
        !           147:  */
        !           148: 
        !           149: typedef struct {
        !           150:     void *info;                        /* Argument to command from cmd_table */
        !           151:     int override;              /* Which allow-override bits are set */
        !           152:     int limited;               /* Which methods are <Limit>ed */
        !           153: 
        !           154:     configfile_t *config_file; /* Config file structure from pcfg_openfile() */
        !           155: 
        !           156:     ap_pool *pool;                     /* Pool to allocate new storage in */
        !           157:     struct pool *temp_pool;            /* Pool for scratch memory; persists during
        !           158:                                 * configuration, but wiped before the first
        !           159:                                 * request is served...
        !           160:                                 */
        !           161:     server_rec *server;                /* Server_rec being configured for */
        !           162:     char *path;                        /* If configuring for a directory,
        !           163:                                 * pathname of that directory.
        !           164:                                 * NOPE!  That's what it meant previous to the
        !           165:                                 * existance of <Files>, <Location> and regex
        !           166:                                 * matching.  Now the only usefulness that can
        !           167:                                 * be derived from this field is whether a command
        !           168:                                 * is being called in a server context (path == NULL)
        !           169:                                 * or being called in a dir context (path != NULL).
        !           170:                                 */
        !           171:     const command_rec *cmd;    /* configuration command */
        !           172:     const char *end_token;     /* end token required to end a nested section */
        !           173:     void *context;             /* per_dir_config vector passed 
        !           174:                                 * to handle_command */
        !           175: } cmd_parms;
        !           176: 
        !           177: /* This structure records the existence of handlers in a module... */
        !           178: 
        !           179: typedef struct {
        !           180:     const char *content_type;  /* MUST be all lower case */
        !           181:     int (*handler) (request_rec *);
        !           182: } handler_rec;
        !           183: 
        !           184: /*
        !           185:  * Module structures.  Just about everything is dispatched through
        !           186:  * these, directly or indirectly (through the command and handler
        !           187:  * tables).
        !           188:  */
        !           189: 
        !           190: typedef struct module_struct {
        !           191:     int version;               /* API version, *not* module version;
        !           192:                                 * check that module is compatible with this
        !           193:                                 * version of the server.
        !           194:                                 */
        !           195:     int minor_version;          /* API minor version. Provides API feature
        !           196:                                  * milestones. Not checked during module init
        !           197:                                 */
        !           198:     int module_index;          /* Index to this modules structures in
        !           199:                                 * config vectors.
        !           200:                                 */
        !           201: 
        !           202:     const char *name;
        !           203:     void *dynamic_load_handle;
        !           204: 
        !           205:     struct module_struct *next;
        !           206: 
        !           207:     unsigned long magic;        /* Magic Cookie to identify a module structure;
        !           208:                                  * It's mainly important for the DSO facility
        !           209:                                  * (see also mod_so).
        !           210:                                  */
        !           211: 
        !           212:     /* init() occurs after config parsing, but before any children are
        !           213:      * forked.
        !           214:      * Modules should not rely on the order in which create_server_config
        !           215:      * and create_dir_config are called.
        !           216:      */
        !           217: #ifdef ULTRIX_BRAIN_DEATH
        !           218:     void (*init) ();
        !           219:     void *(*create_dir_config) ();
        !           220:     void *(*merge_dir_config) ();
        !           221:     void *(*create_server_config) ();
        !           222:     void *(*merge_server_config) ();
        !           223: #else
        !           224:     void (*init) (server_rec *, pool *);
        !           225:     void *(*create_dir_config) (pool *p, char *dir);
        !           226:     void *(*merge_dir_config) (pool *p, void *base_conf, void *new_conf);
        !           227:     void *(*create_server_config) (pool *p, server_rec *s);
        !           228:     void *(*merge_server_config) (pool *p, void *base_conf, void *new_conf);
        !           229: #endif
        !           230: 
        !           231:     const command_rec *cmds;
        !           232:     const handler_rec *handlers;
        !           233: 
        !           234:     /* Hooks for getting into the middle of server ops...
        !           235: 
        !           236:      * translate_handler --- translate URI to filename
        !           237:      * access_checker --- check access by host address, etc.   All of these
        !           238:      *                    run; if all decline, that's still OK.
        !           239:      * check_user_id --- get and validate user id from the HTTP request
        !           240:      * auth_checker --- see if the user (from check_user_id) is OK *here*.
        !           241:      *                  If all of *these* decline, the request is rejected
        !           242:      *                  (as a SERVER_ERROR, since the module which was
        !           243:      *                  supposed to handle this was configured wrong).
        !           244:      * type_checker --- Determine MIME type of the requested entity;
        !           245:      *                  sets content_type, _encoding and _language fields.
        !           246:      * logger --- log a transaction.
        !           247:      * post_read_request --- run right after read_request or internal_redirect,
        !           248:      *                  and not run during any subrequests.
        !           249:      */
        !           250: 
        !           251:     int (*translate_handler) (request_rec *);
        !           252:     int (*ap_check_user_id) (request_rec *);
        !           253:     int (*auth_checker) (request_rec *);
        !           254:     int (*access_checker) (request_rec *);
        !           255:     int (*type_checker) (request_rec *);
        !           256:     int (*fixer_upper) (request_rec *);
        !           257:     int (*logger) (request_rec *);
        !           258:     int (*header_parser) (request_rec *);
        !           259: 
        !           260:     /* Regardless of the model the server uses for managing "units of
        !           261:      * execution", i.e. multi-process, multi-threaded, hybrids of those,
        !           262:      * there is the concept of a "heavy weight process".  That is, a
        !           263:      * process with its own memory space, file spaces, etc.  This method,
        !           264:      * child_init, is called once for each heavy-weight process before
        !           265:      * any requests are served.  Note that no provision is made yet for
        !           266:      * initialization per light-weight process (i.e. thread).  The
        !           267:      * parameters passed here are the same as those passed to the global
        !           268:      * init method above.
        !           269:      */
        !           270: #ifdef ULTRIX_BRAIN_DEATH
        !           271:     void (*child_init) ();
        !           272:     void (*child_exit) ();
        !           273: #else
        !           274:     void (*child_init) (server_rec *, pool *);
        !           275:     void (*child_exit) (server_rec *, pool *);
        !           276: #endif
        !           277:     int (*post_read_request) (request_rec *);
        !           278: } module;
        !           279: 
        !           280: /* Initializer for the first few module slots, which are only
        !           281:  * really set up once we start running.  Note that the first two slots
        !           282:  * provide a version check; this should allow us to deal with changes to
        !           283:  * the API. The major number should reflect changes to the API handler table
        !           284:  * itself or removal of functionality. The minor number should reflect
        !           285:  * additions of functionality to the existing API. (the server can detect
        !           286:  * an old-format module, and either handle it back-compatibly, or at least
        !           287:  * signal an error). See src/include/ap_mmn.h for MMN version history.
        !           288:  */
        !           289: 
        !           290: #define STANDARD_MODULE_STUFF  MODULE_MAGIC_NUMBER_MAJOR, \
        !           291:                                MODULE_MAGIC_NUMBER_MINOR, \
        !           292:                                -1, \
        !           293:                                __FILE__, \
        !           294:                                NULL, \
        !           295:                                NULL, \
        !           296:                                MODULE_MAGIC_COOKIE
        !           297: 
        !           298: /* Generic accessors for other modules to get at their own module-specific
        !           299:  * data
        !           300:  */
        !           301: 
        !           302: API_EXPORT(void *) ap_get_module_config(void *conf_vector, module *m);
        !           303: API_EXPORT(void) ap_set_module_config(void *conf_vector, module *m, void *val);
        !           304: 
        !           305: #define ap_get_module_config(v,m)      \
        !           306:     (((void **)(v))[(m)->module_index])
        !           307: #define ap_set_module_config(v,m,val)  \
        !           308:     ((((void **)(v))[(m)->module_index]) = (val))
        !           309: 
        !           310: /* Generic command handling function... */
        !           311: 
        !           312: API_EXPORT_NONSTD(const char *) ap_set_string_slot(cmd_parms *, char *, char *);
        !           313: API_EXPORT_NONSTD(const char *) ap_set_string_slot_lower(cmd_parms *, char *, char *);
        !           314: API_EXPORT_NONSTD(const char *) ap_set_flag_slot(cmd_parms *, char *, int);
        !           315: API_EXPORT_NONSTD(const char *) ap_set_file_slot(cmd_parms *, char *, char *);
        !           316: 
        !           317: /* For modules which need to read config files, open logs, etc. ...
        !           318:  * this returns the fname argument if it begins with '/'; otherwise
        !           319:  * it relativizes it wrt server_root.
        !           320:  */
        !           321: 
        !           322: API_EXPORT(char *) ap_server_root_relative(pool *p, char *fname);
        !           323: 
        !           324: /* Finally, the hook for dynamically loading modules in... */
        !           325: 
        !           326: API_EXPORT(void) ap_add_module(module *m);
        !           327: API_EXPORT(void) ap_remove_module(module *m);
        !           328: API_EXPORT(void) ap_add_loaded_module(module *mod);
        !           329: API_EXPORT(void) ap_remove_loaded_module(module *mod);
        !           330: API_EXPORT(int) ap_add_named_module(const char *name);
        !           331: API_EXPORT(void) ap_clear_module_list(void);
        !           332: API_EXPORT(const char *) ap_find_module_name(module *m);
        !           333: API_EXPORT(module *) ap_find_linked_module(const char *name);
        !           334: 
        !           335: /* for implementing subconfigs and customized config files */
        !           336: API_EXPORT(const char *) ap_srm_command_loop(cmd_parms *parms, void *config);
        !           337: 
        !           338: #ifdef CORE_PRIVATE
        !           339: 
        !           340: extern API_VAR_EXPORT module *top_module;
        !           341: 
        !           342: extern module *ap_prelinked_modules[];
        !           343: extern module *ap_preloaded_modules[];
        !           344: extern API_VAR_EXPORT module **ap_loaded_modules;
        !           345: 
        !           346: /* For mod_so.c... */
        !           347: 
        !           348: void ap_single_module_configure(pool *p, server_rec *s, module *m);
        !           349: 
        !           350: /* For http_main.c... */
        !           351: 
        !           352: server_rec *ap_read_config(pool *conf_pool, pool *temp_pool, char *config_name);
        !           353: void ap_init_modules(pool *p, server_rec *s);
        !           354: void ap_child_init_modules(pool *p, server_rec *s);
        !           355: void ap_child_exit_modules(pool *p, server_rec *s);
        !           356: void ap_setup_prelinked_modules(void);
        !           357: void ap_show_directives(void);
        !           358: void ap_show_modules(void);
        !           359: void ap_cleanup_method_ptrs(void);
        !           360: 
        !           361: /* For http_request.c... */
        !           362: 
        !           363: void *ap_create_request_config(pool *p);
        !           364: CORE_EXPORT(void *) ap_create_per_dir_config(pool *p);
        !           365: void *ap_merge_per_dir_configs(pool *p, void *base, void *new);
        !           366: 
        !           367: /* For http_core.c... (<Directory> command and virtual hosts) */
        !           368: 
        !           369: int ap_parse_htaccess(void **result, request_rec *r, int override,
        !           370:                const char *path, const char *access_name);
        !           371: 
        !           372: CORE_EXPORT(const char *) ap_init_virtual_host(pool *p, const char *hostname,
        !           373:                                server_rec *main_server, server_rec **);
        !           374: void ap_process_resource_config(server_rec *s, char *fname, pool *p, pool *ptemp);
        !           375: 
        !           376: /* ap_check_cmd_context() definitions: */
        !           377: API_EXPORT(const char *) ap_check_cmd_context(cmd_parms *cmd, unsigned forbidden);
        !           378: 
        !           379: /* ap_check_cmd_context():              Forbidden in: */
        !           380: #define  NOT_IN_VIRTUALHOST     0x01 /* <Virtualhost> */
        !           381: #define  NOT_IN_LIMIT           0x02 /* <Limit> */
        !           382: #define  NOT_IN_DIRECTORY       0x04 /* <Directory> */
        !           383: #define  NOT_IN_LOCATION        0x08 /* <Location> */
        !           384: #define  NOT_IN_FILES           0x10 /* <Files> */
        !           385: #define  NOT_IN_DIR_LOC_FILE    (NOT_IN_DIRECTORY|NOT_IN_LOCATION|NOT_IN_FILES) /* <Directory>/<Location>/<Files>*/
        !           386: #define  GLOBAL_ONLY            (NOT_IN_VIRTUALHOST|NOT_IN_LIMIT|NOT_IN_DIR_LOC_FILE)
        !           387: 
        !           388: 
        !           389: /* Module-method dispatchers, also for http_request.c */
        !           390: 
        !           391: int ap_translate_name(request_rec *);
        !           392: int ap_check_access(request_rec *);    /* check access on non-auth basis */
        !           393: int ap_check_user_id(request_rec *);   /* obtain valid username from client auth */
        !           394: int ap_check_auth(request_rec *);      /* check (validated) user is authorized here */
        !           395: int ap_find_types(request_rec *);      /* identify MIME type */
        !           396: int ap_run_fixups(request_rec *);      /* poke around for other metainfo, etc.... */
        !           397: int ap_invoke_handler(request_rec *);
        !           398: int ap_log_transaction(request_rec *r);
        !           399: int ap_header_parse(request_rec *);
        !           400: int ap_run_post_read_request(request_rec *);
        !           401: 
        !           402: /* for mod_perl */
        !           403: 
        !           404: CORE_EXPORT(const command_rec *) ap_find_command(const char *name, const command_rec *cmds);
        !           405: CORE_EXPORT(const command_rec *) ap_find_command_in_modules(const char *cmd_name, module **mod);
        !           406: CORE_EXPORT(void *) ap_set_config_vectors(cmd_parms *parms, void *config, module *mod);
        !           407: CORE_EXPORT(const char *) ap_handle_command(cmd_parms *parms, void *config, const char *l);
        !           408: 
        !           409: #endif
        !           410: 
        !           411: #ifdef __cplusplus
        !           412: }
        !           413: #endif
        !           414: 
        !           415: #endif /* !APACHE_HTTP_CONFIG_H */

E-mail: