]>
Commit | Line | Data |
---|---|---|
528b2c61 | 1 | /* |
bbc27441 | 2 | * Copyright (C) 1996-2014 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 | ||
12 | class StoreMeta; | |
e1f7507e AJ |
13 | class StoreEntry; |
14 | ||
62e76326 | 15 | class StoreMetaUnpacker |
16 | { | |
17 | ||
528b2c61 | 18 | public: |
19 | StoreMetaUnpacker (const char *buf, ssize_t bufferLength, int *hdrlen); | |
20 | StoreMeta *createStoreMeta(); | |
e2851fe7 | 21 | bool isBufferZero(); ///< all-zeros buffer, implies !isBufferSane |
528b2c61 | 22 | bool isBufferSane(); |
62e76326 | 23 | |
528b2c61 | 24 | private: |
57d55dfa | 25 | static int const MinimumBufferLength; |
62e76326 | 26 | |
528b2c61 | 27 | void getBufferLength(); |
28 | void getType(); | |
29 | void getLength(); | |
30 | void getTLV(); | |
31 | bool doOneEntry(); | |
32 | bool moreToProcess() const; | |
33 | ||
34 | char const * const buf; | |
35 | ssize_t buflen; | |
36 | int *hdr_len; | |
57d55dfa | 37 | int position; |
528b2c61 | 38 | char type; |
39 | int length; | |
40 | StoreMeta **tail; | |
41 | }; | |
42 | ||
43 | /* | |
44 | * store_swapmeta.c | |
45 | */ | |
d9c252f2 FC |
46 | char *storeSwapMetaPack(StoreMeta * tlv_list, int *length); |
47 | StoreMeta *storeSwapMetaBuild(StoreEntry * e); | |
48 | StoreMeta *storeSwapMetaUnpack(const char *buf, int *hdrlen); | |
49 | void storeSwapTLVFree(StoreMeta * n); | |
528b2c61 | 50 | StoreMeta ** storeSwapTLVAdd(int type, const void *ptr, size_t len, StoreMeta ** tail); |
51 | ||
52 | #endif /* SQUID_TYPELENGTHVALUEUNPACKER_H */ |