/usr/src/redhat/BUILD/httpd-2.2.3/include/http_core.h

説明を見る。
00001 /* Licensed to the Apache Software Foundation (ASF) under one or more
00002  * contributor license agreements.  See the NOTICE file distributed with
00003  * this work for additional information regarding copyright ownership.
00004  * The ASF licenses this file to You under the Apache License, Version 2.0
00005  * (the "License"); you may not use this file except in compliance with
00006  * the License.  You may obtain a copy of the License at
00007  *
00008  *     http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00026 #ifndef APACHE_HTTP_CORE_H
00027 #define APACHE_HTTP_CORE_H
00028 
00029 #include "apr.h"
00030 #include "apr_hash.h"
00031 #include "apr_optional.h"
00032 #include "util_filter.h"
00033 
00034 #if APR_HAVE_STRUCT_RLIMIT
00035 #include <sys/time.h>
00036 #include <sys/resource.h>
00037 #endif
00038 
00039 
00040 #ifdef __cplusplus
00041 extern "C" {
00042 #endif
00043 
00044 /* ****************************************************************
00045  *
00046  * The most basic server code is encapsulated in a single module
00047  * known as the core, which is just *barely* functional enough to
00048  * serve documents, though not terribly well.
00049  *
00050  * Largely for NCSA back-compatibility reasons, the core needs to
00051  * make pieces of its config structures available to other modules.
00052  * The accessors are declared here, along with the interpretation
00053  * of one of them (allow_options).
00054  */
00055 
00065 #define OPT_NONE 0
00066 
00067 #define OPT_INDEXES 1
00068 
00069 #define OPT_INCLUDES 2
00070 
00071 #define OPT_SYM_LINKS 4
00072 
00073 #define OPT_EXECCGI 8
00074 
00075 #define OPT_UNSET 16
00076 
00077 #define OPT_INCNOEXEC 32
00078 
00079 #define OPT_SYM_OWNER 64
00080 
00081 #define OPT_MULTI 128
00082 
00083 #define OPT_ALL (OPT_INDEXES|OPT_INCLUDES|OPT_SYM_LINKS|OPT_EXECCGI)
00084 
00095 #define REMOTE_HOST (0)
00096 
00101 #define REMOTE_NAME (1)
00102 
00106 #define REMOTE_NOLOOKUP (2)
00107 
00113 #define REMOTE_DOUBLE_REV (3)
00114 
00118 #define SATISFY_ALL 0
00119 
00120 #define SATISFY_ANY 1
00121 
00122 #define SATISFY_NOSPEC 2
00123 
00126 #define AP_MIN_BYTES_TO_WRITE  8000
00127 
00129 # define AP_DEFAULT_MAX_INTERNAL_REDIRECTS 10
00130 
00132 # define AP_DEFAULT_MAX_SUBREQ_DEPTH 10
00133 
00139 AP_DECLARE(int) ap_allow_options(request_rec *r);
00140 
00146 AP_DECLARE(int) ap_allow_overrides(request_rec *r);
00147 
00153 AP_DECLARE(const char *) ap_default_type(request_rec *r);     
00154 
00162 AP_DECLARE(const char *) ap_document_root(request_rec *r);
00163 
00188 AP_DECLARE(const char *) ap_get_remote_host(conn_rec *conn, void *dir_config, int type, int *str_is_ip);
00189 
00196 AP_DECLARE(const char *) ap_get_remote_logname(request_rec *r);
00197 
00198 /* Used for constructing self-referencing URLs, and things like SERVER_PORT,
00199  * and SERVER_NAME.
00200  */
00208 AP_DECLARE(char *) ap_construct_url(apr_pool_t *p, const char *uri, request_rec *r);
00209 
00215 AP_DECLARE(const char *) ap_get_server_name(request_rec *r);
00216 
00222 AP_DECLARE(apr_port_t) ap_get_server_port(const request_rec *r);
00223 
00229 AP_DECLARE(apr_off_t) ap_get_limit_req_body(const request_rec *r);
00230 
00236 AP_DECLARE(size_t) ap_get_limit_xml_body(const request_rec *r);
00237 
00245 AP_DECLARE(void) ap_custom_response(request_rec *r, int status, const char *string);
00246 
00252 AP_DECLARE(int) ap_is_recursion_limit_exceeded(const request_rec *r);
00253 
00259 AP_DECLARE(int) ap_exists_config_define(const char *name);
00260 /* FIXME! See STATUS about how */
00261 AP_DECLARE_NONSTD(int) ap_core_translate(request_rec *r);
00262 
00263 /* Authentication stuff.  This is one of the places where compatibility
00264  * with the old config files *really* hurts; they don't discriminate at
00265  * all between different authentication schemes, meaning that we need
00266  * to maintain common state for all of them in the core, and make it
00267  * available to the other modules through interfaces.
00268  */
00269 
00271 typedef struct require_line require_line;
00272 
00276 struct require_line {
00278     apr_int64_t method_mask;
00280     char *requirement;
00281 };
00282      
00288 AP_DECLARE(const char *) ap_auth_type(request_rec *r);
00289 
00295 AP_DECLARE(const char *) ap_auth_name(request_rec *r);     
00296 
00307 AP_DECLARE(int) ap_satisfies(request_rec *r);
00308 
00314 AP_DECLARE(const apr_array_header_t *) ap_requires(request_rec *r);    
00315 
00316 #ifdef CORE_PRIVATE
00317 
00323 AP_DECLARE_DATA extern module core_module;
00324 
00328 typedef struct {
00331     struct apr_bucket_brigade *bb;
00332 
00338     void **notes;
00339 
00348     int deliver_script;
00349 
00353     char **response_code_strings; /* from ap_custom_response(), not from
00354                                    * ErrorDocument
00355                                    */
00358     int suppress_charset;
00359 } core_request_config;
00360 
00361 /* Standard entries that are guaranteed to be accessible via
00362  * ap_get_request_note() for each request (additional entries
00363  * can be added with ap_register_request_note())
00364  */
00365 #define AP_NOTE_DIRECTORY_WALK 0
00366 #define AP_NOTE_LOCATION_WALK  1
00367 #define AP_NOTE_FILE_WALK      2
00368 #define AP_NUM_STD_NOTES       3
00369 
00377 AP_DECLARE(apr_size_t) ap_register_request_note(void);
00378 
00393 AP_DECLARE(void **) ap_get_request_note(request_rec *r, apr_size_t note_num);
00394 
00395 
00396 typedef unsigned char allow_options_t;
00397 typedef unsigned char overrides_t;
00398 
00399 /*
00400  * Bits of info that go into making an ETag for a file
00401  * document.  Why a long?  Because char historically
00402  * proved too short for Options, and int can be different
00403  * sizes on different platforms.
00404  */
00405 typedef unsigned long etag_components_t;
00406 
00407 #define ETAG_UNSET 0
00408 #define ETAG_NONE  (1 << 0)
00409 #define ETAG_MTIME (1 << 1)
00410 #define ETAG_INODE (1 << 2)
00411 #define ETAG_SIZE  (1 << 3)
00412 #define ETAG_BACKWARD (ETAG_MTIME | ETAG_INODE | ETAG_SIZE)
00413 #define ETAG_ALL   (ETAG_MTIME | ETAG_INODE | ETAG_SIZE)
00414 
00418 typedef enum {
00419     srv_sig_unset,
00420     srv_sig_off,
00421     srv_sig_on,
00422     srv_sig_withmail
00423 } server_signature_e;
00424 
00428 typedef struct {
00430     char *d;
00432     unsigned d_components;
00433 
00441     allow_options_t opts;
00442     allow_options_t opts_add;
00443     allow_options_t opts_remove;
00444     overrides_t override;
00445     allow_options_t override_opts;
00446     
00447     /* MIME typing --- the core doesn't do anything at all with this,
00448      * but it does know what to slap on a request for a document which
00449      * goes untyped by other mechanisms before it slips out the door...
00450      */
00451     
00452     char *ap_default_type;
00453   
00454     /* Authentication stuff.  Groan... */
00455     
00456     int *satisfy; /* for every method one */
00457     char *ap_auth_type;
00458     char *ap_auth_name;
00459     apr_array_header_t *ap_requires;
00460 
00461     /* Custom response config. These can contain text or a URL to redirect to.
00462      * if response_code_strings is NULL then there are none in the config,
00463      * if it's not null then it's allocated to sizeof(char*)*RESPONSE_CODES.
00464      * This lets us do quick merges in merge_core_dir_configs().
00465      */
00466   
00467     char **response_code_strings; /* from ErrorDocument, not from
00468                                    * ap_custom_response() */
00469 
00470     /* Hostname resolution etc */
00471 #define HOSTNAME_LOOKUP_OFF     0
00472 #define HOSTNAME_LOOKUP_ON      1
00473 #define HOSTNAME_LOOKUP_DOUBLE  2
00474 #define HOSTNAME_LOOKUP_UNSET   3
00475     unsigned int hostname_lookups : 4;
00476 
00477     signed int content_md5 : 2;  /* calculate Content-MD5? */
00478 
00479 #define USE_CANONICAL_NAME_OFF   (0)
00480 #define USE_CANONICAL_NAME_ON    (1)
00481 #define USE_CANONICAL_NAME_DNS   (2)
00482 #define USE_CANONICAL_NAME_UNSET (3)
00483     unsigned use_canonical_name : 2;
00484 
00485     /* since is_fnmatch(conf->d) was being called so frequently in
00486      * directory_walk() and its relatives, this field was created and
00487      * is set to the result of that call.
00488      */
00489     unsigned d_is_fnmatch : 1;
00490 
00491     /* should we force a charset on any outgoing parameterless content-type?
00492      * if so, which charset?
00493      */
00494 #define ADD_DEFAULT_CHARSET_OFF   (0)
00495 #define ADD_DEFAULT_CHARSET_ON    (1)
00496 #define ADD_DEFAULT_CHARSET_UNSET (2)
00497     unsigned add_default_charset : 2;
00498     const char *add_default_charset_name;
00499 
00500     /* System Resource Control */
00501 #ifdef RLIMIT_CPU
00502     struct rlimit *limit_cpu;
00503 #endif
00504 #if defined (RLIMIT_DATA) || defined (RLIMIT_VMEM) || defined(RLIMIT_AS)
00505     struct rlimit *limit_mem;
00506 #endif
00507 #ifdef RLIMIT_NPROC
00508     struct rlimit *limit_nproc;
00509 #endif
00510     apr_off_t limit_req_body;      /* limit on bytes in request msg body */
00511     long limit_xml_body;           /* limit on bytes in XML request msg body */
00512 
00513     /* logging options */
00514 
00515     server_signature_e server_signature;
00516 
00517     int loglevel;
00518     
00519     /* Access control */
00520     apr_array_header_t *sec_file;
00521     ap_regex_t *r;
00522 
00523     const char *mime_type;       /* forced with ForceType  */
00524     const char *handler;         /* forced with SetHandler */
00525     const char *output_filters;  /* forced with SetOutputFilters */
00526     const char *input_filters;   /* forced with SetInputFilters */
00527     int accept_path_info;        /* forced with AcceptPathInfo */
00528 
00529     apr_hash_t *ct_output_filters; /* added with AddOutputFilterByType */
00530 
00531     /*
00532      * What attributes/data should be included in ETag generation?
00533      */
00534     etag_components_t etag_bits;
00535     etag_components_t etag_add;
00536     etag_components_t etag_remove;
00537 
00538     /*
00539      * Run-time performance tuning
00540      */
00541 #define ENABLE_MMAP_OFF    (0)
00542 #define ENABLE_MMAP_ON     (1)
00543 #define ENABLE_MMAP_UNSET  (2)
00544     unsigned int enable_mmap : 2;  /* whether files in this dir can be mmap'ed */
00545 
00546 #define ENABLE_SENDFILE_OFF    (0)
00547 #define ENABLE_SENDFILE_ON     (1)
00548 #define ENABLE_SENDFILE_UNSET  (2)
00549     unsigned int enable_sendfile : 2;  /* files in this dir can be mmap'ed */
00550     unsigned int allow_encoded_slashes : 1; /* URLs may contain %2f w/o being
00551                                              * pitched indiscriminately */
00552 
00553 #define USE_CANONICAL_PHYS_PORT_OFF   (0)
00554 #define USE_CANONICAL_PHYS_PORT_ON    (1)
00555 #define USE_CANONICAL_PHYS_PORT_UNSET (2)
00556     unsigned use_canonical_phys_port : 2;
00557 
00558 } core_dir_config;
00559 
00560 /* Per-server core configuration */
00561 
00562 typedef struct {
00563   
00564 #ifdef GPROF
00565     char *gprof_dir;
00566 #endif
00567 
00568     /* Name translations --- we want the core to be able to do *something*
00569      * so it's at least a minimally functional web server on its own (and
00570      * can be tested that way).  But let's keep it to the bare minimum:
00571      */
00572     const char *ap_document_root;
00573   
00574     /* Access control */
00575 
00576     char *access_name;
00577     apr_array_header_t *sec_dir;
00578     apr_array_header_t *sec_url;
00579 
00580     /* recursion backstopper */
00581     int redirect_limit; /* maximum number of internal redirects */
00582     int subreq_limit;   /* maximum nesting level of subrequests */
00583 
00584     const char *protocol;
00585     apr_table_t *accf_map;
00586 
00587     /* TRACE control */
00588 #define AP_TRACE_UNSET    -1
00589 #define AP_TRACE_DISABLE   0
00590 #define AP_TRACE_ENABLE    1
00591 #define AP_TRACE_EXTENDED  2
00592     int trace_enable;
00593 
00594 } core_server_config;
00595 
00596 /* for AddOutputFiltersByType in core.c */
00597 void ap_add_output_filters_by_type(request_rec *r);
00598 
00599 /* for http_config.c */
00600 void ap_core_reorder_directories(apr_pool_t *, server_rec *);
00601 
00602 /* for mod_perl */
00603 AP_CORE_DECLARE(void) ap_add_per_dir_conf(server_rec *s, void *dir_config);
00604 AP_CORE_DECLARE(void) ap_add_per_url_conf(server_rec *s, void *url_config);
00605 AP_CORE_DECLARE(void) ap_add_file_conf(core_dir_config *conf, void *url_config);
00606 AP_CORE_DECLARE_NONSTD(const char *) ap_limit_section(cmd_parms *cmd, void *dummy, const char *arg);
00607 
00608 /* Core filters; not exported. */
00609 int ap_core_input_filter(ap_filter_t *f, apr_bucket_brigade *b,
00610                          ap_input_mode_t mode, apr_read_type_e block,
00611                          apr_off_t readbytes);
00612 apr_status_t ap_core_output_filter(ap_filter_t *f, apr_bucket_brigade *b);
00613 
00614 #endif /* CORE_PRIVATE */
00615 
00616 AP_DECLARE(const char*) ap_get_server_protocol(server_rec* s);
00617 AP_DECLARE(void) ap_set_server_protocol(server_rec* s, const char* proto);
00618 
00619 /* ----------------------------------------------------------------------
00620  *
00621  * Runtime status/management
00622  */
00623 
00624 typedef enum {
00625     ap_mgmt_type_string,
00626     ap_mgmt_type_long,
00627     ap_mgmt_type_hash
00628 } ap_mgmt_type_e;
00629 
00630 typedef union {
00631     const char *s_value;
00632     long i_value;
00633     apr_hash_t *h_value;
00634 } ap_mgmt_value;
00635 
00636 typedef struct {
00637     const char *description;
00638     const char *name;
00639     ap_mgmt_type_e vtype;
00640     ap_mgmt_value v;
00641 } ap_mgmt_item_t;
00642 
00643 /* Handles for core filters */
00644 extern AP_DECLARE_DATA ap_filter_rec_t *ap_subreq_core_filter_handle;
00645 extern AP_DECLARE_DATA ap_filter_rec_t *ap_core_output_filter_handle;
00646 extern AP_DECLARE_DATA ap_filter_rec_t *ap_content_length_filter_handle;
00647 extern AP_DECLARE_DATA ap_filter_rec_t *ap_core_input_filter_handle;
00648 
00662 AP_DECLARE_HOOK(int, get_mgmt_items,
00663                 (apr_pool_t *p, const char * val, apr_hash_t *ht))
00664 
00665 /* ---------------------------------------------------------------------- */
00666 
00667 /* ----------------------------------------------------------------------
00668  *
00669  * I/O logging with mod_logio
00670  */
00671 
00672 APR_DECLARE_OPTIONAL_FN(void, ap_logio_add_bytes_out,
00673                         (conn_rec *c, apr_off_t bytes));
00674 
00675 /* ----------------------------------------------------------------------
00676  *
00677  * ident lookups with mod_ident
00678  */
00679 
00680 APR_DECLARE_OPTIONAL_FN(const char *, ap_ident_lookup,
00681                         (request_rec *r));
00682 
00683 /* ---------------------------------------------------------------------- */
00684 
00685 #ifdef __cplusplus
00686 }
00687 #endif
00688 
00689 #endif  /* !APACHE_HTTP_CORE_H */
00690 

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