]> git.ipfire.org Git - thirdparty/squid.git/blame - src/StoreMetaUnpacker.h
Source Format Enforcement (#532)
[thirdparty/squid.git] / src / StoreMetaUnpacker.h
CommitLineData
528b2c61 1/*
77b1029d 2 * Copyright (C) 1996-2020 The Squid Software Foundation and contributors
528b2c61 3 *
bbc27441
AJ
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.
528b2c61 7 */
bbc27441 8
528b2c61 9#ifndef SQUID_TYPELENGTHVALUEUNPACKER_H
10#define SQUID_TYPELENGTHVALUEUNPACKER_H
11
12class StoreMeta;
e1f7507e
AJ
13class StoreEntry;
14
62e76326 15class StoreMetaUnpacker
16{
17
528b2c61 18public:
19 StoreMetaUnpacker (const char *buf, ssize_t bufferLength, int *hdrlen);
20 StoreMeta *createStoreMeta();
4c2f8b72
EB
21 bool isBufferZero(); ///< all-zeros buffer, checkBuffer() would throw
22 /// validates buffer sanity and throws if validation fails
23 void checkBuffer();
62e76326 24
528b2c61 25private:
57d55dfa 26 static int const MinimumBufferLength;
62e76326 27
528b2c61 28 void getBufferLength();
29 void getType();
30 void getLength();
31 void getTLV();
32 bool doOneEntry();
33 bool moreToProcess() const;
34
35 char const * const buf;
36 ssize_t buflen;
37 int *hdr_len;
57d55dfa 38 int position;
528b2c61 39 char type;
40 int length;
41 StoreMeta **tail;
42};
43
528b2c61 44#endif /* SQUID_TYPELENGTHVALUEUNPACKER_H */
f53969cc 45