]> git.ipfire.org Git - thirdparty/squid.git/blob - src/esi/Segment.h
SourceFormat Enforcement
[thirdparty/squid.git] / src / esi / Segment.h
1 /*
2 * Copyright (C) 1996-2015 The Squid Software Foundation and contributors
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
9 #ifndef SQUID_ESISEGMENT_H
10 #define SQUID_ESISEGMENT_H
11
12 /* TODO: Factor the store memory segment management into a reusable code block
13 * or perhaps use membuffers here?
14 */
15
16 #include "base/RefCount.h"
17 #include "cbdata.h"
18 #include "defines.h"
19 #include "SquidString.h"
20
21 class ESISegment : public RefCountable
22 {
23
24 public:
25 typedef RefCount<ESISegment> Pointer;
26 static void ListAppend (Pointer &, char const *, size_t);
27 static void ListTransfer (Pointer &from, Pointer &to);
28 void *operator new (size_t byteCount);
29 void operator delete (void *address);
30
31 ESISegment();
32 ESISegment(ESISegment const &);
33 ESISegment::Pointer cloneList() const;
34 char *listToChar() const;
35 void listAppend (char const *s, size_t length);
36 void adsorbList (ESISegment::Pointer from);
37 size_t space() const;
38
39 char buf[HTTP_REQBUF_SZ];
40 size_t len; /* how much data has been pushed into this */
41 Pointer next;
42 size_t append(char const *, size_t);
43 size_t append (Pointer);
44 ESISegment const *tail() const;
45 ESISegment *tail();
46 void dumpToLog() const;
47
48 private:
49 size_t listLength()const;
50 void dumpOne() const;
51 };
52
53 void ESISegmentFreeList (ESISegment::Pointer &head);
54
55 #endif /* SQUID_ESISEGMENT_H */
56