]> git.ipfire.org Git - thirdparty/squid.git/blame - src/esi/Segment.h
Source Format Enforcement (#532)
[thirdparty/squid.git] / src / esi / Segment.h
CommitLineData
43ae1d95 1/*
77b1029d 2 * Copyright (C) 1996-2020 The Squid Software Foundation and contributors
43ae1d95 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.
43ae1d95 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
8bf217bd 16#include "base/RefCount.h"
aa839030 17#include "cbdata.h"
582c2af2 18#include "defines.h"
924f73bc 19#include "SquidString.h"
43ae1d95 20
21class ESISegment : public RefCountable
22{
8c41d298 23 CBDATA_CLASS(ESISegment);
43ae1d95 24
25public:
26 typedef RefCount<ESISegment> Pointer;
27 static void ListAppend (Pointer &, char const *, size_t);
28 static void ListTransfer (Pointer &from, Pointer &to);
43ae1d95 29
8c41d298 30 ESISegment() : len(0), next(NULL) {*buf = 0;}
43ae1d95 31 ESISegment(ESISegment const &);
8c41d298
AJ
32 ~ESISegment() {}
33
43ae1d95 34 ESISegment::Pointer cloneList() const;
35 char *listToChar() const;
36 void listAppend (char const *s, size_t length);
37 void adsorbList (ESISegment::Pointer from);
38 size_t space() const;
39
43ae1d95 40 char buf[HTTP_REQBUF_SZ];
41 size_t len; /* how much data has been pushed into this */
42 Pointer next;
43 size_t append(char const *, size_t);
44 size_t append (Pointer);
45 ESISegment const *tail() const;
46 ESISegment *tail();
47 void dumpToLog() const;
48
49private:
50 size_t listLength()const;
51 void dumpOne() const;
52};
53
8a648e8d 54void ESISegmentFreeList (ESISegment::Pointer &head);
43ae1d95 55
56#endif /* SQUID_ESISEGMENT_H */
f53969cc 57