]>
Commit | Line | Data |
---|---|---|
5f623035 | 1 | /* |
77b1029d | 2 | * Copyright (C) 1996-2020 The Squid Software Foundation and contributors |
5f623035 AJ |
3 | * |
4 | * Squid software is distributed under GPLv2+ license and includes | |
5 | * contributions from numerous individuals and organizations. | |
6 | * Please see the COPYING and CONTRIBUTORS files for details. | |
7 | */ | |
8 | ||
0b96a9b3 | 9 | // Author: Jens-S. V?ckler <voeckler@rvs.uni-hannover.de> |
eb1f6bfa AJ |
10 | // |
11 | // File: squid-tlv.hh | |
12 | // Tue Jun 15 1999 | |
13 | // | |
14 | // (c) 1999 Lehrgebiet Rechnernetze und Verteilte Systeme | |
0b96a9b3 | 15 | // Universit?t Hannover, Germany |
eb1f6bfa AJ |
16 | // |
17 | // Permission to use, copy, modify, distribute, and sell this software | |
18 | // and its documentation for any purpose is hereby granted without fee, | |
19 | // provided that (i) the above copyright notices and this permission | |
20 | // notice appear in all copies of the software and related documentation, | |
21 | // and (ii) the names of the Lehrgebiet Rechnernetze und Verteilte | |
22 | // Systeme and the University of Hannover may not be used in any | |
23 | // advertising or publicity relating to the software without the | |
24 | // specific, prior written permission of Lehrgebiet Rechnernetze und | |
25 | // Verteilte Systeme and the University of Hannover. | |
26 | // | |
27 | // THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, | |
28 | // EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY | |
29 | // WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. | |
30 | // | |
31 | // IN NO EVENT SHALL THE LEHRGEBIET RECHNERNETZE UND VERTEILTE SYSTEME OR | |
32 | // THE UNIVERSITY OF HANNOVER BE LIABLE FOR ANY SPECIAL, INCIDENTAL, | |
33 | // INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES | |
34 | // WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT | |
35 | // ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, | |
36 | // ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS | |
37 | // SOFTWARE. | |
38 | // | |
eb1f6bfa AJ |
39 | // Revision 1.1 1999/06/15 21:10:16 voeckler |
40 | // Initial revision | |
41 | // | |
605f2c3e AJ |
42 | #ifndef SQUID_TLV_HH |
43 | #define SQUID_TLV_HH | |
eb1f6bfa | 44 | |
59a09b98 | 45 | #if !defined(__cplusplus) |
59a09b98 FC |
46 | #ifndef HAVE_BOOL |
47 | #define HAVE_BOOL | |
eb1f6bfa AJ |
48 | typedef int bool; |
49 | #define false 0 | |
50 | #define true 1 | |
51 | #endif | |
59a09b98 | 52 | #endif /* __cplusplus */ |
eb1f6bfa AJ |
53 | |
54 | #include <sys/types.h> | |
55 | #include <netinet/in.h> | |
56 | #include <arpa/inet.h> | |
57 | #include <time.h> | |
58 | ||
59 | // taken from Squid-2.x | |
60 | // NOTE! We must preserve the order of this list! | |
61 | enum SquidMetaType { | |
62 | STORE_META_VOID, // should not come up | |
63 | STORE_META_KEY_URL, // key w/ keytype | |
64 | STORE_META_KEY_SHA, | |
65 | STORE_META_KEY_MD5, | |
66 | STORE_META_URL, // the url , if not in the header | |
67 | STORE_META_STD, // standard metadata | |
68 | STORE_META_HITMETERING, // reserved for hit metering | |
69 | STORE_META_VALID, | |
a63b44c2 AJ |
70 | STORE_META_VARY_HEADERS, // Stores Vary request headers |
71 | STORE_META_STD_LFS, // standard metadata in lfs format | |
59a09b98 | 72 | STORE_META_OBJSIZE // object size, if its known |
eb1f6bfa AJ |
73 | }; |
74 | ||
75 | // taken from Squid-2.x | |
76 | struct StoreMetaStd { | |
77 | time_t timestamp; | |
78 | time_t lastref; | |
79 | time_t expires; | |
80 | time_t lastmod; | |
81 | size_t swap_file_sz; | |
f45dd259 AJ |
82 | uint16_t refcount; |
83 | uint16_t flags; | |
eb1f6bfa AJ |
84 | }; |
85 | ||
a63b44c2 AJ |
86 | struct StoreMetaStdLFS { |
87 | time_t timestamp; | |
88 | time_t lastref; | |
89 | time_t expires; | |
90 | time_t lastmod; | |
f45dd259 AJ |
91 | uint64_t swap_file_sz; |
92 | uint16_t refcount; | |
93 | uint16_t flags; | |
a63b44c2 AJ |
94 | }; |
95 | ||
eb1f6bfa AJ |
96 | struct SquidTLV { |
97 | // create a shallow reference pointing into the "buffer" variable | |
98 | // do not copy --> saves times, saves memory. | |
99 | SquidTLV( SquidMetaType _type, size_t _size = 0, void* _data = 0 ); | |
100 | ~SquidTLV() {} | |
101 | ||
102 | SquidTLV* next; | |
103 | size_t size; | |
104 | SquidMetaType type; | |
105 | char* data; | |
106 | }; | |
107 | ||
108 | class SquidMetaList { | |
109 | public: | |
110 | SquidMetaList(); | |
111 | ~SquidMetaList(); | |
112 | ||
113 | void append( SquidMetaType type, size_t size, void* data ); | |
114 | const SquidTLV* search( SquidMetaType type ) const; | |
115 | ||
116 | private: | |
117 | SquidTLV* head; | |
118 | SquidTLV* tail; | |
119 | }; | |
120 | ||
605f2c3e | 121 | #endif // SQUID_TLV_HH |