~ubuntu-branches/ubuntu/feisty/apache2/feisty

« back to all changes in this revision

Viewing changes to modules/cache/mod_disk_cache.h

  • Committer: Bazaar Package Importer
  • Author(s): Andreas Barth
  • Date: 2006-12-09 21:05:45 UTC
  • mfrom: (0.6.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20061209210545-h70s0xaqc2v8vqr2
Tags: 2.2.3-3.2
* Non-maintainer upload.
* 043_ajp_connection_reuse: Patch from upstream Bugzilla, fixing a critical
  issue with regard to connection reuse in mod_proxy_ajp.
  Closes: #396265

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Licensed to the Apache Software Foundation (ASF) under one or more
 
2
 * contributor license agreements.  See the NOTICE file distributed with
 
3
 * this work for additional information regarding copyright ownership.
 
4
 * The ASF licenses this file to You under the Apache License, Version 2.0
 
5
 * (the "License"); you may not use this file except in compliance with
 
6
 * the License.  You may obtain a copy of the License at
 
7
 *
 
8
 *     http://www.apache.org/licenses/LICENSE-2.0
 
9
 *
 
10
 * Unless required by applicable law or agreed to in writing, software
 
11
 * distributed under the License is distributed on an "AS IS" BASIS,
 
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
13
 * See the License for the specific language governing permissions and
 
14
 * limitations under the License.
 
15
 */
 
16
 
 
17
#ifndef MOD_DISK_CACHE_H
 
18
#define MOD_DISK_CACHE_H
 
19
 
 
20
/*
 
21
 * include for mod_disk_cache: Disk Based HTTP 1.1 Cache.
 
22
 */
 
23
 
 
24
#define VARY_FORMAT_VERSION 3
 
25
#define DISK_FORMAT_VERSION 4
 
26
 
 
27
#define CACHE_HEADER_SUFFIX ".header"
 
28
#define CACHE_DATA_SUFFIX   ".data"
 
29
#define CACHE_VDIR_SUFFIX   ".vary"
 
30
 
 
31
#define AP_TEMPFILE_PREFIX "/"
 
32
#define AP_TEMPFILE_BASE   "aptmp"
 
33
#define AP_TEMPFILE_SUFFIX "XXXXXX"
 
34
#define AP_TEMPFILE_BASELEN strlen(AP_TEMPFILE_BASE)
 
35
#define AP_TEMPFILE_NAMELEN strlen(AP_TEMPFILE_BASE AP_TEMPFILE_SUFFIX)
 
36
#define AP_TEMPFILE AP_TEMPFILE_PREFIX AP_TEMPFILE_BASE AP_TEMPFILE_SUFFIX
 
37
 
 
38
typedef struct {
 
39
    /* Indicates the format of the header struct stored on-disk. */
 
40
    apr_uint32_t format;
 
41
    /* The HTTP status code returned for this response.  */
 
42
    int status;
 
43
    /* The size of the entity name that follows. */
 
44
    apr_size_t name_len;
 
45
    /* The number of times we've cached this entity. */
 
46
    apr_size_t entity_version;
 
47
    /* Miscellaneous time values. */
 
48
    apr_time_t date;
 
49
    apr_time_t expire;
 
50
    apr_time_t request_time;
 
51
    apr_time_t response_time;
 
52
} disk_cache_info_t;
 
53
 
 
54
/*
 
55
 * disk_cache_object_t
 
56
 * Pointed to by cache_object_t::vobj
 
57
 */
 
58
typedef struct disk_cache_object {
 
59
    const char *root;        /* the location of the cache directory */
 
60
    apr_size_t root_len;
 
61
    char *tempfile;    /* temp file tohold the content */
 
62
    const char *prefix;
 
63
    const char *datafile;    /* name of file where the data will go */
 
64
    const char *hdrsfile;    /* name of file where the hdrs will go */
 
65
    const char *hashfile;    /* Computed hash key for this URI */
 
66
    const char *name;   /* Requested URI without vary bits - suitable for mortals. */
 
67
    const char *key;    /* On-disk prefix; URI with Vary bits (if present) */
 
68
    apr_file_t *fd;          /* data file */
 
69
    apr_file_t *hfd;         /* headers file */
 
70
    apr_file_t *tfd;         /* temporary file for data */
 
71
    apr_off_t file_size;     /*  File size of the cached data file  */
 
72
    disk_cache_info_t disk_info; /* Header information. */
 
73
} disk_cache_object_t;
 
74
 
 
75
 
 
76
/*
 
77
 * mod_disk_cache configuration
 
78
 */
 
79
/* TODO: Make defaults OS specific */
 
80
#define CACHEFILE_LEN 20        /* must be less than HASH_LEN/2 */
 
81
#define DEFAULT_DIRLEVELS 3
 
82
#define DEFAULT_DIRLENGTH 2
 
83
#define DEFAULT_MIN_FILE_SIZE 1
 
84
#define DEFAULT_MAX_FILE_SIZE 1000000
 
85
 
 
86
typedef struct {
 
87
    const char* cache_root;
 
88
    apr_size_t cache_root_len;
 
89
    int dirlevels;               /* Number of levels of subdirectories */
 
90
    int dirlength;               /* Length of subdirectory names */
 
91
    apr_size_t minfs;            /* minumum file size for cached files */
 
92
    apr_size_t maxfs;            /* maximum file size for cached files */
 
93
} disk_cache_conf;
 
94
 
 
95
#endif /*MOD_DISK_CACHE_H*/