]> git.ipfire.org Git - thirdparty/squid.git/blob - src/adaptation/Message.h
Source Format Enforcement (#532)
[thirdparty/squid.git] / src / adaptation / Message.h
1 /*
2 * Copyright (C) 1996-2020 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__ADAPTATION__MESSAGE_H
10 #define SQUID__ADAPTATION__MESSAGE_H
11
12 #include "base/RefCount.h"
13 #include "http/forward.h"
14
15 class BodyPipe;
16 typedef RefCount<BodyPipe> BodyPipePointer;
17
18 namespace Adaptation
19 {
20
21 // Manages the header and the body of an HTTP message being worked on.
22 // Adaptation transactions use this class for virgin and adapted HTTP messages.
23 // TODO: remove this class after adding refcounted message pointers and
24 // after making sure nobody abruptly clears the Http::Message::body_pipe pointer.
25 class Message
26 {
27
28 public:
29 typedef Http::Message Header;
30
31 Message();
32 Message(Header *aHeader);
33 ~Message();
34
35 void clear();
36 void set(Header *aHeader);
37
38 static void ShortCircuit(Message &src, Message &dest);
39
40 public:
41 // virgin or adapted message being worked on
42 Header *header; // parsed HTTP status/request line and headers
43
44 /// Copy of header->body_pipe, in case somebody moves the original.
45 /// \todo Find and fix the code that moves (if any) and remove this.
46 BodyPipePointer body_pipe;
47
48 private:
49 Message(const Message &); // not implemented
50 Message &operator =(const Message &); // not implemented
51 };
52
53 } // namespace Adaptation;
54
55 // TODO: replace ICAPInOut with Adaptation::Message (adding one for "cause")
56
57 #endif /* SQUID__ADAPTATION__MESSAGE_H */
58