~clint-fewbar/ubuntu/precise/squid3/ignore-sighup-early

« back to all changes in this revision

Viewing changes to src/StoreSwapLogData.h

  • Committer: Bazaar Package Importer
  • Author(s): Luigi Gangitano
  • Date: 2009-09-24 14:51:06 UTC
  • mfrom: (1.1.12 upstream)
  • mto: (20.2.1 sid)
  • mto: This revision was merged to the branch mainline in revision 21.
  • Revision ID: james.westby@ubuntu.com-20090924145106-38jgrzmj0d73pha5
Tags: 3.1.0.13-1
* Upload to experimental

* New upstream release
  - Fixes Follow-X-Forwarded-For support (Closes: #523943)
  - Adds IPv6 support (Closes: #432351)

* debian/rules
  - Removed obsolete configuration options
  - Enable db and radius basic authentication modules

* debian/patches/01-cf.data.debian
  - Adapted to new upstream version

* debian/patches/02-makefile-defaults
  - Adapted to new upstream version

* debian/{squid.postinst,squid.rc,README.Debian,watch}
  - Updated references to squid 3.1

* debian/squid3.install
  - Install CSS file for error pages
  - Install manual pages for new authentication modules

* debian/squid3-common.install
  - Install documented version of configuration file in /usr/share/doc/squid3

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
 
2
1
/*
3
 
 * $Id: StoreSwapLogData.h,v 1.5 2007/11/15 16:47:35 wessels Exp $
 
2
 * $Id$
4
3
 *
5
4
 * SQUID Web Proxy Cache          http://www.squid-cache.org/
6
5
 * ----------------------------------------------------------
18
17
 *  it under the terms of the GNU General Public License as published by
19
18
 *  the Free Software Foundation; either version 2 of the License, or
20
19
 *  (at your option) any later version.
21
 
 *  
 
20
 *
22
21
 *  This program is distributed in the hope that it will be useful,
23
22
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
24
23
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
25
24
 *  GNU General Public License for more details.
26
 
 *  
 
25
 *
27
26
 *  You should have received a copy of the GNU General Public License
28
27
 *  along with this program; if not, write to the Free Software
29
28
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
34
33
#ifndef SQUID_STORESWAPLOGDATA_H
35
34
#define SQUID_STORESWAPLOGDATA_H
36
35
 
 
36
/**
 
37
 \defgroup FileFormatSwapStateAPI swap.state File Structure
 
38
 \ingroup FileSystems
 
39
 \section ImplementationNotes Implementation Notes
 
40
 \par
 
41
 *      When writing an object to disk, we must first write the meta data.
 
42
 *      This is done with a couple of functions.  First, storeSwapMetaPack()
 
43
 *      takes a StoreEntry as a parameter and returns a tlv linked
 
44
 *      list.  Second, storeSwapMetaPack() converts the tlv list
 
45
 *      into a character buffer that we can write.
 
46
 *
 
47
 \note  MemObject has a MemObject::swap_hdr_sz.
 
48
 *      This value is the size of that character buffer; the size of the
 
49
 *      swap file meta data.  The StoreEntry has a member
 
50
 *      StoreEntry::swap_file_sz that represents the size of the disk file.
 
51
 *      Thus, the size of the object "content" is
 
52
 \code    StoreEntry->swap_file_sz  - MemObject->swap_hdr_sz;    \endcode
 
53
 \note The swap file content includes the HTTP reply headers and the HTTP reply body (if any).
 
54
 *
 
55
 \par
 
56
 *      When reading a swap file, there is a similar process to extract
 
57
 *      the swap meta data.  First, storeSwapMetaUnpack() converts a
 
58
 *      character buffer into a tlv linked list.  It also tells us
 
59
 *      the value for MemObject->swap_hdr_sz.
 
60
 */
 
61
 
37
62
#include "squid.h"
38
63
 
39
64
/*
40
65
 * Do we need to have the dirn in here? I don't think so, since we already
41
 
 * know the dirn .. 
42
 
 */
43
 
/* Binary format on disk.
44
 
 * DO NOT randomly alter.
45
 
 * DO NOT add ANY virtual's.
46
 
 */
47
 
 
 
66
 * know the dirn ..
 
67
 */
 
68
/**
 
69
 \ingroup FielFormatSwapStateAPI
 
70
 \note This information is current as of version 2.2.STABLE4
 
71
 *
 
72
 \li            Binary format on disk.
 
73
 \li            DO NOT randomly alter.
 
74
 \li            DO NOT add ANY virtual's.
 
75
 *
 
76
 \par
 
77
 * Defines the structure of a binary swap.state file entry.
 
78
 *
 
79
 \note StoreSwapLogData entries are written in native machine byte order
 
80
 *     They are not necessarily portable across architectures.
 
81
 */
48
82
class StoreSwapLogData
49
83
{
50
84
 
51
85
public:
52
86
    MEMPROXY_CLASS(StoreSwapLogData);
53
87
    StoreSwapLogData();
 
88
 
 
89
    /**
 
90
     * Either SWAP_LOG_ADD when an object is added to the disk storage,
 
91
     * or SWAP_LOG_DEL when an object is deleted.
 
92
     */
54
93
    char op;
 
94
 
 
95
    /**
 
96
     * The 32-bit file number which maps to a pathname.
 
97
     * Only the low 24-bits are relevant. The high 8-bits are
 
98
     * used as an index to an array of storage directories, and
 
99
     * are set at run time because the order of storage directories
 
100
     * may change over time.
 
101
     */
55
102
    sfileno swap_filen;
 
103
 
 
104
    /**
 
105
     * A 32-bit Unix time value that represents the time when
 
106
     * the origin server generated this response. If the response
 
107
     * has a valid Date: header, this timestamp corresponds
 
108
     * to that time. Otherwise, it is set to the Squid process time
 
109
     * when the response is read (as soon as the end of headers are found).
 
110
     */
56
111
    time_t timestamp;
 
112
 
 
113
    /**
 
114
     * The last time that a client requested this object.
 
115
     * Strictly speaking, this time is set whenever the StoreEntry
 
116
     * is locked (via storeLockObject()).
 
117
     */
57
118
    time_t lastref;
 
119
 
 
120
    /**
 
121
     * The value of the response's Expires: header, if any.
 
122
     * If the response does not have an Expires: header, this
 
123
     * is set to -1.
 
124
     * If the response has an invalid (unparseable)
 
125
     * Expires: header, it is also set to -1.  There are some cases
 
126
     * where Squid sets expires to -2. This happens for the
 
127
     * internal "netdb" object and for FTP URL responses.
 
128
     */
58
129
    time_t expires;
 
130
 
 
131
    /**
 
132
     * The value of the response's Last-modified: header, if any.
 
133
     * This is set to -1 if there is no Last-modified: header,
 
134
     * or if it is unparseable.
 
135
     */
59
136
    time_t lastmod;
 
137
 
 
138
    /**
 
139
     * This is the number of bytes that the object occupies on
 
140
     * disk. It includes the Squid "swap file header".
 
141
     */
60
142
    uint64_t swap_file_sz;
 
143
 
 
144
    /**
 
145
     * The number of times that this object has been accessed (referenced).
 
146
     * Since its a 16-bit quantity, it is susceptible to overflow
 
147
     * if a single object is accessed 65,536 times before being replaced.
 
148
     */
61
149
    u_short refcount;
 
150
 
 
151
    /**
 
152
     * A copy of the StoreEntry flags field. Used as a sanity
 
153
     * check when rebuilding the cache at startup. Objects that
 
154
     * have the KEY_PRIVATE flag set are not added back to the cache.
 
155
     */
62
156
    u_short flags;
 
157
 
 
158
    /**
 
159
     * The 128-bit MD5 hash for this object.
 
160
     */
63
161
    unsigned char key[SQUID_MD5_DIGEST_LENGTH];
64
162
};
65
163
 
66
 
MEMPROXY_CLASS_INLINE(StoreSwapLogData)
 
164
MEMPROXY_CLASS_INLINE(StoreSwapLogData);
67
165
 
 
166
/// \ingroup FileFormatSwapStateAPI
68
167
class StoreSwapLogHeader
69
168
{
70
169
public:
71
 
     StoreSwapLogHeader();
72
 
     char op;
73
 
     int version;
74
 
     int record_size;
 
170
    StoreSwapLogHeader();
 
171
    char op;
 
172
    int version;
 
173
    int record_size;
75
174
};
76
175
 
77
176