?? http_config.h
字號:
/* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef APACHE_HTTP_CONFIG_H
#define APACHE_HTTP_CONFIG_H
#include "apr_hooks.h"
#include "util_cfgtree.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @file http_config.h
* @brief Apache Configuration
*/
/*
* The central data structures around here...
*/
/* Command dispatch structures... */
/**
* How the directives arguments should be parsed.
* @remark Note that for all of these except RAW_ARGS, the config routine is
* passed a freshly allocated string which can be modified or stored
* or whatever...
*/
enum cmd_how {
RAW_ARGS, /**< cmd_func parses command line itself */
TAKE1, /**< one argument only */
TAKE2, /**< two arguments only */
ITERATE, /**< one argument, occuring 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 */
};
/**
* This structure is passed to a command which is being invoked,
* to carry a large variety of miscellaneous data which is all of
* use to *somebody*...
*/
typedef struct cmd_parms_struct cmd_parms;
#if defined(AP_HAVE_DESIGNATED_INITIALIZER) || defined(DOXYGEN)
/**
* All the types of functions that can be used in directives
* @internal
*/
typedef union {
/** function to call for a no-args */
const char *(*no_args) (cmd_parms *parms, void *mconfig);
/** function to call for a raw-args */
const char *(*raw_args) (cmd_parms *parms, void *mconfig,
const char *args);
/** function to call for a take1 */
const char *(*take1) (cmd_parms *parms, void *mconfig, const char *w);
/** function to call for a take2 */
const char *(*take2) (cmd_parms *parms, void *mconfig, const char *w,
const char *w2);
/** function to call for a take3 */
const char *(*take3) (cmd_parms *parms, void *mconfig, const char *w,
const char *w2, const char *w3);
/** function to call for a flag */
const char *(*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 it's own parsing of arguments*/
# define AP_RAW_ARGS func.raw_args
/** 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
/** method of 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 }
/** method of 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 }
/** method of declaring a directive which takes 1 argument */
# define AP_INIT_TAKE1(directive, func, mconfig, where, help) \
{ directive, { .take1=func }, mconfig, where, TAKE1, help }
/** method of declaring a directive which takes multiple arguments */
# define AP_INIT_ITERATE(directive, func, mconfig, where, help) \
{ directive, { .take1=func }, mconfig, where, ITERATE, help }
/** method of declaring a directive which takes 2 arguments */
# define AP_INIT_TAKE2(directive, func, mconfig, where, help) \
{ directive, { .take2=func }, mconfig, where, TAKE2, help }
/** method of 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 }
/** method of declaring a directive which takes multiple 2 arguments */
# define AP_INIT_ITERATE2(directive, func, mconfig, where, help) \
{ directive, { .take2=func }, mconfig, where, ITERATE2, help }
/** method of 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 }
/** method of 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 }
/** method of 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 }
/** method of declaring a directive which takes 3 arguments */
# define AP_INIT_TAKE3(directive, func, mconfig, where, help) \
{ directive, { .take3=func }, mconfig, where, TAKE3, help }
/** method of declaring a directive which takes a flag (on/off) as a argument*/
# define AP_INIT_FLAG(directive, func, mconfig, where, help) \
{ directive, { .flag=func }, mconfig, where, FLAG, help }
#else /* AP_HAVE_DESIGNATED_INITIALIZER */
typedef const char *(*cmd_func) ();
# define AP_NO_ARGS func
# define AP_RAW_ARGS func
# define AP_TAKE1 func
# define AP_TAKE2 func
# define AP_TAKE3 func
# define AP_FLAG func
# define AP_INIT_NO_ARGS(directive, func, mconfig, where, help) \
{ directive, func, mconfig, where, RAW_ARGS, help }
# define AP_INIT_RAW_ARGS(directive, func, mconfig, where, help) \
{ directive, func, mconfig, where, RAW_ARGS, help }
# define AP_INIT_TAKE1(directive, func, mconfig, where, help) \
{ directive, func, mconfig, where, TAKE1, help }
# define AP_INIT_ITERATE(directive, func, mconfig, where, help) \
{ directive, func, mconfig, where, ITERATE, help }
# define AP_INIT_TAKE2(directive, func, mconfig, where, help) \
{ directive, func, mconfig, where, TAKE2, help }
# define AP_INIT_TAKE12(directive, func, mconfig, where, help) \
{ directive, func, mconfig, where, TAKE12, help }
# define AP_INIT_ITERATE2(directive, func, mconfig, where, help) \
{ directive, func, mconfig, where, ITERATE2, help }
# define AP_INIT_TAKE13(directive, func, mconfig, where, help) \
{ directive, func, mconfig, where, TAKE13, help }
# define AP_INIT_TAKE23(directive, func, mconfig, where, help) \
{ directive, func, mconfig, where, TAKE23, help }
# define AP_INIT_TAKE123(directive, func, mconfig, where, help) \
{ directive, func, mconfig, where, TAKE123, help }
# define AP_INIT_TAKE3(directive, func, mconfig, where, help) \
{ directive, func, mconfig, where, TAKE3, help }
# define AP_INIT_FLAG(directive, func, mconfig, where, help) \
{ directive, func, mconfig, where, FLAG, help }
#endif /* AP_HAVE_DESIGNATED_INITIALIZER */
/**
* The command record structure. Each modules can define a table of these
* to define the directives it will implement.
*/
typedef struct command_struct command_rec;
struct command_struct {
/** Name of this command */
const char *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
* @defvar cmd_how args_how*/
enum cmd_how args_how;
/** 'usage' message, in case of syntax errors */
const char *errmsg;
};
/**
* @defgroup ConfigDirectives Allowed locations for configuration directives.
*
* The allowed locations for a configuration directive are the union of
* those indicated by each set bit in the req_override mask.
*
* @{
*/
#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 /**< unset a directive (in Allow) */
#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
which would modify the configuration (like including another
file, or IFModule */
/** this directive can be placed anywhere */
#define OR_ALL (OR_LIMIT|OR_OPTIONS|OR_FILEINFO|OR_AUTHCFG|OR_INDEXES)
/** @} */
/**
* This can be returned by a function if they don't wish to handle
* a command. Make it something not likely someone will actually use
* as an error code.
*/
#define DECLINE_CMD "\a\b"
/** Common structure for reading of config files / passwd files etc. */
typedef struct ap_configfile_t ap_configfile_t;
struct ap_configfile_t {
int (*getch) (void *param); /**< a getc()-like function */
void *(*getstr) (void *buf, size_t bufsiz, void *param);
/**< a fgets()-like function */
int (*close) (void *param); /**< a close handler function */
void *param; /**< the argument passed to getch/getstr/close */
const char *name; /**< the filename / description */
unsigned line_number; /**< current line number, starting at 1 */
};
/**
* This structure is passed to a command which is being invoked,
* to carry a large variety of miscellaneous data which is all of
* use to *somebody*...
*/
struct cmd_parms_struct {
/** Argument to command from cmd_table */
void *info;
/** Which allow-override bits are set */
int override;
/** 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's what it meant previous to the existance of <Files>,
* <Location> and regex matching. Now the only usefulness that can be
* derived from this field is whether a command is being called in a
* server context (path == NULL) or being called in a dir context
* (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;
};
/**
* Module structures. Just about everything is dispatched through
* these, directly or indirectly (through the command and handler
* tables).
*/
typedef struct module_struct module;
struct module_struct {
/** API version, *not* module version; check that module is
* compatible with this version of the server.
*/
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 */
const char *name;
/** The handle for the DSO. Internal use only */
void *dynamic_load_handle;
/** A pointer to the next module in the list
* @defvar module_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). */
unsigned long magic;
/** Function to allow MPMs to re-write command line arguments. This
* hook is only available to MPMs.
* @param The process that the server is running in.
*/
void (*rewrite_args) (process_rec *process);
/** Function to allow all modules to create per directory configuration
* structures.
* @param p The pool to use for all allocations.
* @param dir The directory currently being processed.
* @return The per-directory structure created
*/
void *(*create_dir_config) (apr_pool_t *p, char *dir);
/** Function to allow all modules to merge the per directory configuration
* structures for two directories.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -