Configuration
[Apache Core]


モジュール

 Allowed locations for configuration directives.
 Module structure initializers
 Check command context
 Config Tree Package

データ構造

union  cmd_func
struct  command_struct
struct  ap_configfile_t
struct  cmd_parms_struct
struct  module_struct

マクロ定義

#define AP_NO_ARGS   func.no_args
#define AP_RAW_ARGS   func.raw_args
#define AP_TAKE_ARGV   func.take_argv
#define AP_TAKE1   func.take1
#define AP_TAKE2   func.take2
#define AP_TAKE3   func.take3
#define AP_FLAG   func.flag
#define AP_INIT_NO_ARGS(directive, func, mconfig, where, help)   { directive, { .no_args=func }, mconfig, where, RAW_ARGS, help }
#define AP_INIT_RAW_ARGS(directive, func, mconfig, where, help)   { directive, { .raw_args=func }, mconfig, where, RAW_ARGS, help }
#define AP_INIT_TAKE_ARGV(directive, func, mconfig, where, help)   { directive, { .take_argv=func }, mconfig, where, TAKE_ARGV, help }
#define AP_INIT_TAKE1(directive, func, mconfig, where, help)   { directive, { .take1=func }, mconfig, where, TAKE1, help }
#define AP_INIT_ITERATE(directive, func, mconfig, where, help)   { directive, { .take1=func }, mconfig, where, ITERATE, help }
#define AP_INIT_TAKE2(directive, func, mconfig, where, help)   { directive, { .take2=func }, mconfig, where, TAKE2, help }
#define AP_INIT_TAKE12(directive, func, mconfig, where, help)   { directive, { .take2=func }, mconfig, where, TAKE12, help }
#define AP_INIT_ITERATE2(directive, func, mconfig, where, help)   { directive, { .take2=func }, mconfig, where, ITERATE2, help }
#define AP_INIT_TAKE13(directive, func, mconfig, where, help)   { directive, { .take3=func }, mconfig, where, TAKE13, help }
#define AP_INIT_TAKE23(directive, func, mconfig, where, help)   { directive, { .take3=func }, mconfig, where, TAKE23, help }
#define AP_INIT_TAKE123(directive, func, mconfig, where, help)   { directive, { .take3=func }, mconfig, where, TAKE123, help }
#define AP_INIT_TAKE3(directive, func, mconfig, where, help)   { directive, { .take3=func }, mconfig, where, TAKE3, help }
#define AP_INIT_FLAG(directive, func, mconfig, where, help)   { directive, { .flag=func }, mconfig, where, FLAG, help }
#define DECLINE_CMD   "\a\b"
#define ap_get_module_config(v, m)   (((void **)(v))[(m)->module_index])
#define ap_set_module_config(v, m, val)   ((((void **)(v))[(m)->module_index]) = (val))

型定義

typedef cmd_parms_struct cmd_parms
typedef command_struct command_rec
typedef ap_configfile_t ap_configfile_t
typedef module_struct module
typedef ap_conf_vector_t ap_conf_vector_t

列挙型

enum  cmd_how {
  RAW_ARGS, TAKE1, TAKE2, ITERATE,
  ITERATE2, FLAG, NO_ARGS, TAKE12,
  TAKE3, TAKE23, TAKE123, TAKE13,
  TAKE_ARGV
}

関数

void * ap_get_module_config (const ap_conf_vector_t *cv, const module *m)
void ap_set_module_config (ap_conf_vector_t *cv, const module *m, void *val)
const char * ap_set_string_slot (cmd_parms *cmd, void *struct_ptr, const char *arg)
const char * ap_set_int_slot (cmd_parms *cmd, void *struct_ptr, const char *arg)
int ap_method_is_limited (cmd_parms *cmd, const char *method)
const char * ap_set_string_slot_lower (cmd_parms *cmd, void *struct_ptr, const char *arg)
const char * ap_set_flag_slot (cmd_parms *cmd, void *struct_ptr, int arg)
const char * ap_set_file_slot (cmd_parms *cmd, void *struct_ptr, const char *arg)
const char * ap_set_deprecated (cmd_parms *cmd, void *struct_ptr, const char *arg)
char * ap_server_root_relative (apr_pool_t *p, const char *fname)
const char * ap_add_module (module *m, apr_pool_t *p)
void ap_remove_module (module *m)
const char * ap_add_loaded_module (module *mod, apr_pool_t *p)
void ap_remove_loaded_module (module *mod)
const char * ap_find_module_name (module *m)
moduleap_find_linked_module (const char *name)
apr_status_t ap_pcfg_openfile (ap_configfile_t **ret_cfg, apr_pool_t *p, const char *name)
ap_configfile_tap_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))
int ap_cfg_getline (char *buf, size_t bufsize, ap_configfile_t *cfp)
int ap_cfg_getc (ap_configfile_t *cfp)
int ap_cfg_closefile (ap_configfile_t *cfp)
const char * ap_soak_end_container (cmd_parms *cmd, char *directive)
const 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)
const char * ap_build_config (cmd_parms *parms, apr_pool_t *conf_pool, apr_pool_t *temp_pool, ap_directive_t **conftree)
const char * ap_walk_config (ap_directive_t *conftree, cmd_parms *parms, ap_conf_vector_t *section_vector)
int header_parser (request_rec *r)
int pre_config (apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp)
void test_config (apr_pool_t *pconf, server_rec *s)
int post_config (apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *s)
int open_logs (apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *s)
void child_init (apr_pool_t *pchild, server_rec *s)
int handler (request_rec *r)
int quick_handler (request_rec *r, int lookup_uri)
void optional_fn_retrieve (void)

マクロ定義

#define AP_FLAG   func.flag

This configuration directive takes a flag (on/off) as a argument

#define AP_INIT_FLAG ( directive,
func,
mconfig,
where,
help   )     { directive, { .flag=func }, mconfig, where, FLAG, help }

method of declaring a directive which takes a flag (on/off) as a argument

#define AP_INIT_ITERATE ( directive,
func,
mconfig,
where,
help   )     { directive, { .take1=func }, mconfig, where, ITERATE, help }

method of declaring a directive which takes multiple arguments

#define AP_INIT_ITERATE2 ( directive,
func,
mconfig,
where,
help   )     { directive, { .take2=func }, mconfig, where, ITERATE2, help }

method of declaring a directive which takes multiple 2 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 no arguments

#define AP_INIT_RAW_ARGS ( directive,
func,
mconfig,
where,
help   )     { directive, { .raw_args=func }, mconfig, where, RAW_ARGS, help }

method of declaring a directive with raw argument parsing

#define AP_INIT_TAKE1 ( directive,
func,
mconfig,
where,
help   )     { directive, { .take1=func }, mconfig, where, TAKE1, help }

method of declaring a directive which takes 1 argument

#define AP_INIT_TAKE12 ( directive,
func,
mconfig,
where,
help   )     { directive, { .take2=func }, mconfig, where, TAKE12, help }

method of declaring a directive which takes 1 or 2 arguments

#define AP_INIT_TAKE123 ( directive,
func,
mconfig,
where,
help   )     { directive, { .take3=func }, mconfig, where, TAKE123, help }

method of declaring a directive which takes 1 to 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 1 or 3 arguments

#define AP_INIT_TAKE2 ( directive,
func,
mconfig,
where,
help   )     { directive, { .take2=func }, mconfig, where, TAKE2, help }

method of declaring a directive which takes 2 arguments

#define AP_INIT_TAKE23 ( directive,
func,
mconfig,
where,
help   )     { directive, { .take3=func }, mconfig, where, TAKE23, help }

method of declaring a directive which takes 2 or 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 3 arguments

#define AP_INIT_TAKE_ARGV ( directive,
func,
mconfig,
where,
help   )     { directive, { .take_argv=func }, mconfig, where, TAKE_ARGV, help }

method of declaring a directive with raw argument parsing

#define AP_NO_ARGS   func.no_args

This configuration directive does not take any arguments

#define AP_RAW_ARGS   func.raw_args

This configuration directive will handle it's own parsing of arguments

#define AP_TAKE1   func.take1

This configuration directive takes 1 argument

#define AP_TAKE2   func.take2

This configuration directive takes 2 arguments

#define AP_TAKE3   func.take3

This configuration directive takes 3 arguments

#define AP_TAKE_ARGV   func.take_argv

This configuration directive will handle it's own parsing of arguments

#define DECLINE_CMD   "\a\b"

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.


型定義

typedef struct ap_conf_vector_t ap_conf_vector_t

configuration vector structure

typedef struct ap_configfile_t ap_configfile_t

Common structure for reading of config files / passwd files etc.

typedef struct cmd_parms_struct cmd_parms

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 command_struct command_rec

The command record structure. Each modules can define a table of these to define the directives it will implement.

typedef struct module_struct module

Module structures. Just about everything is dispatched through these, directly or indirectly (through the command and handler tables).


列挙型

enum cmd_how

How the directives arguments should be parsed.

意見:
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...
列挙型の値:
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
TAKE_ARGV  an argc and argv are passed


関数

const char* ap_add_loaded_module ( module mod,
apr_pool_t p 
)

Add a module to the chained modules list and the list of loaded modules

引数:
m The module structure of the module to add
p The pool with the same lifetime as the module

const char* ap_add_module ( module m,
apr_pool_t p 
)

Add a module to the server

引数:
m The module structure of the module to add
p The pool of the same lifetime as the module

const char* ap_build_config ( cmd_parms parms,
apr_pool_t conf_pool,
apr_pool_t temp_pool,
ap_directive_t **  conftree 
)

Build a config tree from a config file

引数:
parms The cmd_parms to pass to all of the directives in the file
conf_pool The pconf pool
temp_pool The temporary pool
conftree Place to store the root node of the config tree
戻り値:
Error string on erro, NULL otherwise

const 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 
)

Read all data between the current <foo> and the matching </foo> and build a config tree from it

引数:
p pool to allocate from
temp_pool Temporary pool to allocate from
parms The cmd_parms to pass to all directives read
current The current node in the tree
curr_parent The current parent node
orig_directive The directive to read until hit.
戻り値:
Error string on failure, NULL on success

int ap_cfg_closefile ( ap_configfile_t cfp  ) 

Detach from open ap_configfile_t, calling the close handler

引数:
cfp The file to close
戻り値:
1 on sucess, 0 on failure

int ap_cfg_getc ( ap_configfile_t cfp  ) 

Read one char from open configfile_t, increase line number upon LF

引数:
cfp The file to read from
戻り値:
the character read

int ap_cfg_getline ( char *  buf,
size_t  bufsize,
ap_configfile_t cfp 
)

Read one line from open ap_configfile_t, strip LF, increase line number

引数:
buf place to store the line read
bufsize size of the buffer
cfp File to read from
戻り値:
1 on success, 0 on failure

module* ap_find_linked_module ( const char *  name  ) 

Find a module based on the name of the module

引数:
name the name of the module
戻り値:
the module structure if found, NULL otherwise

const char* ap_find_module_name ( module m  ) 

Find the name of the specified module

引数:
m The module to get the name for
戻り値:
the name of the module

void* ap_get_module_config ( const ap_conf_vector_t cv,
const module m 
)

Generic accessors for other modules to get at their own module-specific data

引数:
conf_vector The vector in which the modules configuration is stored. usually r->per_dir_config or s->module_config
m The module to get the data for.
戻り値:
The module-specific data

int ap_method_is_limited ( cmd_parms cmd,
const char *  method 
)

Return true if the specified method is limited by being listed in a <Limit> container, or by *not* being listed in a <LimiteExcept> container.

引数:
method Pointer to a string specifying the method to check.
cmd Pointer to the cmd_parms structure passed to the directive handler.
戻り値:
0 if the method is not limited in the current scope

ap_configfile_t* ap_pcfg_open_custom ( apr_pool_t p,
const char *  descr,
void *  param,
int(*)(void *)  getc_func,
void *(*)(void *buf, size_t bufsiz, void *param)  gets_func,
int(*)(void *param)  close_func 
)

Allocate a ap_configfile_t handle with user defined functions and params

引数:
p The pool to allocate from
descr The name of the file
param The argument passed to getch/getstr/close
getc_func The getch function
gets_func The getstr function
close_func The close function

apr_status_t ap_pcfg_openfile ( ap_configfile_t **  ret_cfg,
apr_pool_t p,
const char *  name 
)

Open a ap_configfile_t as apr_file_t

引数:
ret_cfg open ap_configfile_t struct pointer
p The pool to allocate the structure from
name the name of the file to open

void ap_remove_loaded_module ( module mod  ) 

Remove a module fromthe chained modules list and the list of loaded modules

引数:
m the module structure of the module to remove

void ap_remove_module ( module m  ) 

Remove a module from the server. There are some caveats: when the module is removed, its slot is lost so all the current per-dir and per-server configurations are invalid. So we should only ever call this function when you are invalidating almost all our current data. I.e. when doing a restart.

引数:
m the module structure of the module to remove

char* ap_server_root_relative ( apr_pool_t p,
const char *  fname 
)

For modules which need to read config files, open logs, etc. this returns the canonical form of fname made absolute to ap_server_root.

引数:
p pool to allocate data from
fname The file name

const char* ap_set_deprecated ( cmd_parms cmd,
void *  struct_ptr,
const char *  arg 
)

Generic command handling function to respond with cmd->help as an error

引数:
cmd The command parameters for this directive
struct_ptr pointer into a given type
arg The argument to the directive
戻り値:
The cmd->help value as the error string This allows simple declarations such as;
     AP_INIT_RAW_ARGS("Foo", ap_set_deprecated, NULL, OR_ALL, 
         "The Foo directive is no longer supported, use Bar"),
 

const char* ap_set_file_slot ( cmd_parms cmd,
void *  struct_ptr,
const char *  arg 
)

Generic command handling function for files

引数:
cmd The command parameters for this directive
struct_ptr pointer into a given type
arg The argument to the directive
戻り値:
An error string or NULL on success

const char* ap_set_flag_slot ( cmd_parms cmd,
void *  struct_ptr,
int  arg 
)

Generic command handling function for flags

引数:
cmd The command parameters for this directive
struct_ptr pointer into a given type
arg The argument to the directive (either 1 or 0)
戻り値:
An error string or NULL on success

const char* ap_set_int_slot ( cmd_parms cmd,
void *  struct_ptr,
const char *  arg 
)

Generic command handling function for integers

引数:
cmd The command parameters for this directive
struct_ptr pointer into a given type
arg The argument to the directive
戻り値:
An error string or NULL on success

void ap_set_module_config ( ap_conf_vector_t cv,
const module m,
void *  val 
)

Generic accessors for other modules to set at their own module-specific data

引数:
conf_vector The vector in which the modules configuration is stored. usually r->per_dir_config or s->module_config
m The module to set the data for.
val The module-specific data to set

const char* ap_set_string_slot ( cmd_parms cmd,
void *  struct_ptr,
const char *  arg 
)

Generic command handling function for strings

引数:
cmd The command parameters for this directive
struct_ptr pointer into a given type
arg The argument to the directive
戻り値:
An error string or NULL on success

const char* ap_set_string_slot_lower ( cmd_parms cmd,
void *  struct_ptr,
const char *  arg 
)

Generic command handling function for strings, always sets the value to a lowercase string

引数:
cmd The command parameters for this directive
struct_ptr pointer into a given type
arg The argument to the directive
戻り値:
An error string or NULL on success

const char* ap_soak_end_container ( cmd_parms cmd,
char *  directive 
)

Read all data between the current <foo> and the matching </foo>. All of this data is forgotten immediately.

引数:
cmd The cmd_parms to pass to the directives inside the container
directive The directive name to read until
戻り値:
Error string on failure, NULL on success

const char* ap_walk_config ( ap_directive_t conftree,
cmd_parms parms,
ap_conf_vector_t section_vector 
)

Walk a config tree and setup the server's internal structures

引数:
conftree The config tree to walk
parms The cmd_parms to pass to all functions
section_vector The per-section config vector.
戻り値:
Error string on error, NULL otherwise

void child_init ( apr_pool_t pchild,
server_rec s 
)

Run the child_init functions for each module

引数:
pchild The child pool
s The list of server_recs in this server

int handler ( request_rec r  ) 

Run the handler functions for each module

引数:
r The request_rec
意見:
non-wildcard handlers should HOOK_MIDDLE, wildcard HOOK_LAST

int header_parser ( request_rec r  ) 

Run the header parser functions for each module

引数:
r The current request
戻り値:
OK or DECLINED

int open_logs ( apr_pool_t pconf,
apr_pool_t plog,
apr_pool_t ptemp,
server_rec s 
)

Run the open_logs functions for each module

引数:
pconf The config pool
plog The logging streams pool
ptemp The temporary pool
s The list of server_recs
戻り値:
OK or DECLINED on success anything else is a error

void optional_fn_retrieve ( void   ) 

Retrieve the optional functions for each module. This is run immediately before the server starts. Optional functions should be registered during the hook registration phase.

int post_config ( apr_pool_t pconf,
apr_pool_t plog,
apr_pool_t ptemp,
server_rec s 
)

Run the post_config function for each module

引数:
pconf The config pool
plog The logging streams pool
ptemp The temporary pool
s The list of server_recs
戻り値:
OK or DECLINED on success anything else is a error

int pre_config ( apr_pool_t pconf,
apr_pool_t plog,
apr_pool_t ptemp 
)

Run the pre_config function for each module

引数:
pconf The config pool
plog The logging streams pool
ptemp The temporary pool
戻り値:
OK or DECLINED on success anything else is a error

int quick_handler ( request_rec r,
int  lookup_uri 
)

Run the quick handler functions for each module. The quick_handler is run before any other requests hooks are called (location_walk, directory_walk, access checking, et. al.). This hook was added to provide a quick way to serve content from a URI keyed cache.

引数:
r The request_rec
lookup_uri Controls whether the caller actually wants content or not. lookup is set when the quick_handler is called out of ap_sub_req_lookup_uri()

void test_config ( apr_pool_t pconf,
server_rec s 
)

Run the test_config function for each module; this hook is run only if the server was invoked to test the configuration syntax.

引数:
pconf The config pool
s The list of server_recs


Apacheに対してSun Jul 19 22:05:27 2009に生成されました。  doxygen 1.4.7