]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/StoreMeta.h
3 * SQUID Web Proxy Cache http://www.squid-cache.org/
4 * ----------------------------------------------------------
6 * Squid is the result of efforts by numerous individuals from
7 * the Internet community; see the CONTRIBUTORS file for full
8 * details. Many organizations have provided support for Squid's
9 * development; see the SPONSORS file for full details. Squid is
10 * Copyrighted (C) 2001 by the Regents of the University of
11 * California; see the COPYRIGHT file for full details. Squid
12 * incorporates software developed and/or copyrighted by other
13 * sources; see the CREDITS file for full details.
15 * This program is free software; you can redistribute it and/or modify
16 * it under the terms of the GNU General Public License as published by
17 * the Free Software Foundation; either version 2 of the License, or
18 * (at your option) any later version.
20 * This program is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
25 * You should have received a copy of the GNU General Public License
26 * along with this program; if not, write to the Free Software
27 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
30 #ifndef SQUID_TYPELENGTHVALUE_H
31 #define SQUID_TYPELENGTHVALUE_H
36 typedef class StoreMeta tlv
;
40 \todo AYJ: for critical lists like this we should use A=64,B=65 etc to enforce and reserve values.
41 \note NOTE! We must preserve the order of this list!
43 \section StoreSwapMeta Store "swap meta" Description
45 * "swap meta" refers to a section of meta data stored at the beginning
46 * of an object that is stored on disk. This meta data includes information
47 * such as the object's cache key (MD5), URL, and part of the StoreEntry
51 * The meta data is stored using a TYPE-LENGTH-VALUE format. That is,
52 * each chunk of meta information consists of a TYPE identifier, a
53 * LENGTH field, and then the VALUE (which is LENGTH octets long).
57 * Just a placeholder for the zeroth value. It is never used on disk.
63 * This represents the case when we use the URL as the cache
64 * key, as Squid-1.1 does. Currently we don't support using
65 * a URL as a cache key, so this is not used.
71 * For a brief time we considered supporting SHA (secure
72 * hash algorithm) as a cache key. Nobody liked it, and
73 * this type is not currently used.
78 * This represents the MD5 cache key that Squid currently uses.
79 * When Squid opens a disk file for reading, it can check that
80 * this MD5 matches the MD5 of the user's request. If not, then
81 * something went wrong and this is probably the wrong object.
86 * The object's URL. This also may be matched against a user's
87 * request for cache hits to make sure we got the right object.
92 * This is the "standard metadata" for an object.
93 * Really its just this middle chunk of the StoreEntry structure:
99 uint64_t swap_file_sz;
107 * Reserved for future hit-metering (RFC 2227) stuff
109 STORE_META_HITMETERING
,
111 /// \todo DOCS: document.
115 * Stores Vary request headers
117 STORE_META_VARY_HEADERS
,
120 * Updated version of STORE_META_STD, with support for >2GB objects.
121 * As STORE_META_STD except that the swap_file_sz is a 64-bit integer instead of 32-bit.
127 STORE_META_STOREURL
, /* the store url, if different to the normal URL */
128 STORE_META_VARY_ID
, /* Unique ID linking variants */
132 /// \ingroup SwapStoreAPI
136 static bool validType(char);
137 static int const MaximumTLVLength
;
138 static int const MinimumTLVLength
;
139 static StoreMeta
*Factory(char type
, size_t len
, void const *value
);
140 static StoreMeta
**Add(StoreMeta
**tail
, StoreMeta
*aNode
);
141 static void FreeList(StoreMeta
**head
);
143 virtual char getType() const = 0;
144 virtual bool validLength(int) const;
145 virtual bool checkConsistency(StoreEntry
*) const;
146 virtual ~StoreMeta() {}
153 /// \ingroup SwapStoreAPI
154 SQUIDCEXTERN
char *storeSwapMetaPack(tlv
* tlv_list
, int *length
);
155 /// \ingroup SwapStoreAPI
156 SQUIDCEXTERN tlv
*storeSwapMetaBuild(StoreEntry
* e
);
157 /// \ingroup SwapStoreAPI
158 SQUIDCEXTERN
void storeSwapTLVFree(tlv
* n
);
160 #endif /* SQUID_TYPELENGTHVALUE_H */