/* Licensed to the Apache Software Foundation (ASF) under one or more *contributorlicenseagreements.SeetheNOTICEfiledistributedwith *thisworkforadditionalinformationregardingcopyrightownership. *TheASFlicensesthisfiletoYouundertheApacheLicense,Version2.0 *(the"License");youmaynotusethisfileexceptincompliancewith *theLicense.YoumayobtainacopyoftheLicenseat * *http://www.apache.org/licenses/LICENSE-2.0 * *Unlessrequiredbyapplicablelaworagreedtoinwriting,software *distributedundertheLicenseisdistributedonan"ASIS"BASIS, *WITHOUTWARRANTIESORCONDITIONSOFANYKIND,eitherexpressorimplied. *SeetheLicenseforthespecificlanguagegoverningpermissionsand *limitationsundertheLicense.
*/
/** *Howthedirectivesargumentsshouldbeparsed. *@remarkNotethatforalloftheseexceptRAW_ARGS,theconfigroutineis *passedafreshlyallocatedstringwhichcanbemodifiedorstored *orwhatever...
*/ enum cmd_how {
RAW_ARGS, /**< cmd_func parses command line itself */
TAKE1, /**< one argument only */
TAKE2, /**< two arguments only */
ITERATE, /**< one argument, occurring multiple times *(e.g.,IndexIgnore)
*/
ITERATE2, /**< two arguments, 2nd occurs multiple times *(e.g.,AddIcon)
*/
FLAG, /**< One of 'On' or 'Off' */
NO_ARGS, /**< No args at all, e.g. </Directory> */
TAKE12, /**< one or two arguments */
TAKE3, /**< three arguments only */
TAKE23, /**< two or three arguments */
TAKE123, /**< one, two or three arguments */
TAKE13, /**< one or three arguments */
TAKE_ARGV /**< an argc and argv are passed */
};
/** *Allthetypesoffunctionsthatcanbeusedindirectives *@internal
*/ typedefunion { /** function to call for a no-args */ constchar *(*no_args) (cmd_parms *parms, void *mconfig); /** function to call for a raw-args */ constchar *(*raw_args) (cmd_parms *parms, void *mconfig, constchar *args); /** function to call for a argv/argc */ constchar *(*take_argv) (cmd_parms *parms, void *mconfig, int argc, char *const argv[]); /** function to call for a take1 */ constchar *(*take1) (cmd_parms *parms, void *mconfig, constchar *w); /** function to call for a take2 */ constchar *(*take2) (cmd_parms *parms, void *mconfig, constchar *w, constchar *w2); /** function to call for a take3 */ constchar *(*take3) (cmd_parms *parms, void *mconfig, constchar *w, constchar *w2, constchar *w3); /** function to call for a flag */ constchar *(*flag) (cmd_parms *parms, void *mconfig, int on);
} cmd_func;
/** This configuration directive does not take any arguments */ # define AP_NO_ARGS func.no_args /** This configuration directive will handle its own parsing of arguments*/ # define AP_RAW_ARGS func.raw_args /** This configuration directive will handle its own parsing of arguments*/ # define AP_TAKE_ARGV func.take_argv /** This configuration directive takes 1 argument*/ # define AP_TAKE1 func.take1 /** This configuration directive takes 2 arguments */ # define AP_TAKE2 func.take2 /** This configuration directive takes 3 arguments */ # define AP_TAKE3 func.take3 /** This configuration directive takes a flag (on/off) as a argument*/ # define AP_FLAG func.flag
/** mechanism for declaring a directive with no arguments */ # define AP_INIT_NO_ARGS(directive, func, mconfig, where, help) \
{ directive, { .no_args=func }, mconfig, where, RAW_ARGS, help } /** mechanism for declaring a directive with raw argument parsing */ # define AP_INIT_RAW_ARGS(directive, func, mconfig, where, help) \
{ directive, { .raw_args=func }, mconfig, where, RAW_ARGS, help } /** mechanism for declaring a directive with raw argument parsing */ # define AP_INIT_TAKE_ARGV(directive, func, mconfig, where, help) \
{ directive, { .take_argv=func }, mconfig, where, TAKE_ARGV, help } /** mechanism for declaring a directive which takes 1 argument */ # define AP_INIT_TAKE1(directive, func, mconfig, where, help) \
{ directive, { .take1=func }, mconfig, where, TAKE1, help } /** mechanism for declaring a directive which takes multiple arguments */ # define AP_INIT_ITERATE(directive, func, mconfig, where, help) \
{ directive, { .take1=func }, mconfig, where, ITERATE, help } /** mechanism for declaring a directive which takes 2 arguments */ # define AP_INIT_TAKE2(directive, func, mconfig, where, help) \
{ directive, { .take2=func }, mconfig, where, TAKE2, help } /** mechanism for declaring a directive which takes 1 or 2 arguments */ # define AP_INIT_TAKE12(directive, func, mconfig, where, help) \
{ directive, { .take2=func }, mconfig, where, TAKE12, help } /** mechanism for declaring a directive which takes multiple 2 arguments */ # define AP_INIT_ITERATE2(directive, func, mconfig, where, help) \
{ directive, { .take2=func }, mconfig, where, ITERATE2, help } /** mechanism for declaring a directive which takes 1 or 3 arguments */ # define AP_INIT_TAKE13(directive, func, mconfig, where, help) \
{ directive, { .take3=func }, mconfig, where, TAKE13, help } /** mechanism for declaring a directive which takes 2 or 3 arguments */ # define AP_INIT_TAKE23(directive, func, mconfig, where, help) \
{ directive, { .take3=func }, mconfig, where, TAKE23, help } /** mechanism for declaring a directive which takes 1 to 3 arguments */ # define AP_INIT_TAKE123(directive, func, mconfig, where, help) \
{ directive, { .take3=func }, mconfig, where, TAKE123, help } /** mechanism for declaring a directive which takes 3 arguments */ # define AP_INIT_TAKE3(directive, func, mconfig, where, help) \
{ directive, { .take3=func }, mconfig, where, TAKE3, help } /** mechanism for declaring a directive which takes a flag (on/off) argument */ # define AP_INIT_FLAG(directive, func, mconfig, where, help) \
{ directive, { .flag=func }, mconfig, where, FLAG, help }
/** *Thecommandrecordstructure.Modulescandefineatableofthese *todefinethedirectivesitwillimplement.
*/ typedefstruct command_struct command_rec; struct command_struct { /** Name of this command */ constchar *name; /** The function to be called when this directive is parsed */
cmd_func func; /** Extra data, for functions which implement multiple commands... */ void *cmd_data; /** What overrides need to be allowed to enable this command. */ int req_override; /** What the command expects as arguments */ enum cmd_how args_how;
/** 'usage' message, in case of syntax errors */ constchar *errmsg;
};
/** *@defgroupConfigDirectivesAllowedlocationsforconfigurationdirectives. * *Theallowedlocationsforaconfigurationdirectivearetheunionof *thoseindicatedbyeachsetbitinthereq_overridemask. * *@{
*/ #define OR_NONE 0/**< *.conf is not available anywhere in this override */ #define OR_LIMIT 1/**< *.conf inside <Directory> or <Location>
and .htaccess when AllowOverride Limit */ #define OR_OPTIONS 2/**< *.conf anywhere
and .htaccess when AllowOverride Options */ #define OR_FILEINFO 4/**< *.conf anywhere
and .htaccess when AllowOverride FileInfo */ #define OR_AUTHCFG 8/**< *.conf inside <Directory> or <Location>
and .htaccess when AllowOverride AuthConfig */ #define OR_INDEXES 16/**< *.conf anywhere
and .htaccess when AllowOverride Indexes */ #define OR_UNSET 32/**< bit to indicate that AllowOverride has not been set */ #define ACCESS_CONF 64/**< *.conf inside <Directory> or <Location> */ #define RSRC_CONF 128/**< *.conf outside <Directory> or <Location> */ #define EXEC_ON_READ 256/**< force directive to execute a command whichwouldmodifytheconfiguration(likeincludinganother
file, or IFModule */ /* Flags to determine whether syntax errors in .htaccess should be *treatedasnonfatal(logandignoreerrors)
*/ #define NONFATAL_OVERRIDE 512/* Violation of AllowOverride rule */ #define NONFATAL_UNKNOWN 1024/* Unrecognised directive */ #define NONFATAL_ALL (NONFATAL_OVERRIDE|NONFATAL_UNKNOWN)
#define PROXY_CONF 2048/**< *.conf inside <Proxy> only */
/** this directive can be placed anywhere */ #define OR_ALL (OR_LIMIT|OR_OPTIONS|OR_FILEINFO|OR_AUTHCFG|OR_INDEXES)
/** Common structure for reading of config files / passwd files etc. */ typedefstruct ap_configfile_t ap_configfile_t; struct ap_configfile_t { /**< an apr_file_getc()-like function */
apr_status_t (*getch) (char *ch, void *param); /**< an apr_file_gets()-like function */
apr_status_t (*getstr) (void *buf, apr_size_t bufsiz, void *param); /**< a close handler function */
apr_status_t (*close) (void *param); /**< the argument passed to getch/getstr/close */ void *param; /**< the filename / description */ constchar *name; /**< current line number, starting at 1 */ unsigned line_number;
};
/** *Thisstructureispassedtoacommandwhichisbeinginvoked, *tocarryalargevarietyofmiscellaneousdatawhichisallof *useto*somebody*...
*/ struct cmd_parms_struct { /** Argument to command from cmd_table */ void *info; /** Which allow-override bits are set */ int override; /** Which allow-override-opts bits are set */ int override_opts; /** Table of directives allowed per AllowOverrideList */
apr_table_t *override_list; /** Which methods are <Limit>ed */
apr_int64_t limited; /** methods which are limited */
apr_array_header_t *limited_xmethods; /** methods which are xlimited */
ap_method_list_t *xlimited;
/** Config file structure. */
ap_configfile_t *config_file; /** the directive specifying this command */
ap_directive_t *directive;
/** Pool to allocate new storage in */
apr_pool_t *pool; /** Pool for scratch memory; persists during configuration, but
* wiped before the first request is served... */
apr_pool_t *temp_pool; /** Server_rec being configured for */
server_rec *server; /** If configuring for a directory, pathname of that directory. *NOPE!That'swhatitmeantprevioustotheexistenceof<Files>, *<Location>andregexmatching.Nowtheonlyusefulnessthatcanbe *derivedfromthisfieldiswhetheracommandisbeingcalledina *servercontext(path==NULL)orbeingcalledinadircontext
* (path != NULL). */ char *path; /** configuration command */ const command_rec *cmd;
/** per_dir_config vector passed to handle_command */ struct ap_conf_vector_t *context; /** directive with syntax error */ const ap_directive_t *err_directive;
/** *Modulestructures.Justabouteverythingisdispatchedthrough *these,directlyorindirectly(throughthecommandandhandler *tables).
*/ typedefstruct module_struct module; struct module_struct { /** API version, *not* module version; check that module is *compatiblewiththisversionoftheserver.
*/ int version; /** API minor version. Provides API feature milestones. Not checked
* during module init */ int minor_version; /** Index to this modules structures in config vectors. */ int module_index;
/** The name of the module's C file */ constchar *name; /** The handle for the DSO. Internal use only */ void *dynamic_load_handle;
/** A pointer to the next module in the list *@varmodule_struct*next
*/ struct module_struct *next;
/** Magic Cookie to identify a module structure; It's mainly
* important for the DSO facility (see also mod_so). */ unsignedlong magic;
/** Function to allow MPMs to re-write command line arguments. This *hookisonlyavailabletoMPMs. *@paramTheprocessthattheserverisrunningin.
*/ void (*rewrite_args) (process_rec *process); /** Function to allow all modules to create per directory configuration *structures. *@parampThepooltouseforallallocations. *@paramdirThedirectorycurrentlybeingprocessed. *@returnTheper-directorystructurecreated
*/ void *(*create_dir_config) (apr_pool_t *p, char *dir); /** Function to allow all modules to merge the per directory configuration *structuresfortwodirectories. *@parampThepooltouseforallallocations. *@parambase_confThedirectorystructurecreatedfortheparentdirectory. *@paramnew_confThedirectorystructurecurrentlybeingprocessed. *@returnThenewper-directorystructurecreated
*/ void *(*merge_dir_config) (apr_pool_t *p, void *base_conf, void *new_conf); /** Function to allow all modules to create per server configuration *structures. *@parampThepooltouseforallallocations. *@paramsTheservercurrentlybeingprocessed. *@returnTheper-serverstructurecreated
*/ void *(*create_server_config) (apr_pool_t *p, server_rec *s); /** Function to allow all modules to merge the per server configuration *structuresfortwoservers. *@parampThepooltouseforallallocations. *@parambase_confThedirectorystructurecreatedfortheparentdirectory. *@paramnew_confThedirectorystructurecurrentlybeingprocessed. *@returnThenewper-directorystructurecreated
*/ void *(*merge_server_config) (apr_pool_t *p, void *base_conf, void *new_conf);
/** A command_rec table that describes all of the directives this module
* defines. */ const command_rec *cmds;
/** A hook to allow modules to hook other points in the request processing. *Inthisfunction,modulesshouldcalltheap_hook_*()functionsto *registeraninterestinaspecificstepinprocessingthecurrent *request. *@parampthepooltouseforallallocations
*/ void (*register_hooks) (apr_pool_t *p);
/** A bitmask of AP_MODULE_FLAG_* */ int flags;
};
/** *TheAP_MAYBE_UNUSEDmacroisusedforvariabledeclarationsthat *mightpotentiallyexhibit"unusedvar"warningsonsomecompilersif *leftuntreated. *SincestaticintializersarenotpartoftheClanguage(C89),making *(void)usageisnotpossible.Howevermanycompilerhaveproprietary *mechanismtosuppressthosewarnings.
*/ #ifdef AP_MAYBE_UNUSED #elifdefined(__GNUC__) # define AP_MAYBE_UNUSED(x) x __attribute__((unused)) #elifdefined(__LCLINT__) # define AP_MAYBE_UNUSED(x) /*@unused@*/ x #else # define AP_MAYBE_UNUSED(x) x #endif
/* For mod_so.c... */ /** Run a single module's two create_config hooks *@parampthepooltoallocatefrom *@paramsTheservertoconfigurefor. *@parammThemoduletoconfigure
*/
AP_DECLARE(void) ap_single_module_configure(apr_pool_t *p, server_rec *s,
module *m);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.