]> git.ipfire.org Git - thirdparty/squid.git/blob - src/ipc/Response.h
Source Format Enforcement (#1234)
[thirdparty/squid.git] / src / ipc / Response.h
1 /*
2 * Copyright (C) 1996-2023 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 /* DEBUG: section 54 Interprocess Communication */
10
11 #ifndef SQUID_IPC_RESPONSE_H
12 #define SQUID_IPC_RESPONSE_H
13
14 #include "base/RefCount.h"
15 #include "base/TypeTraits.h"
16 #include "ipc/forward.h"
17 #include "ipc/QuestionerId.h"
18
19 namespace Ipc
20 {
21
22 /// A response to Ipc::Request.
23 class Response: public RefCountable, public Interface
24 {
25 public:
26 typedef RefCount<Response> Pointer;
27
28 public:
29 virtual void pack(TypedMsgHdr& msg) const = 0; ///< prepare for sendmsg()
30 virtual Pointer clone() const = 0; ///< returns a copy of this
31
32 /// for Mine() tests
33 QuestionerId intendedRecepient() const { return requestId.questioner(); }
34
35 public:
36 RequestId requestId; ///< the ID of the request we are responding to
37
38 protected:
39 /// sender's constructor
40 explicit Response(const RequestId aRequestId): requestId(aRequestId) {}
41
42 /// recipient's constructor
43 Response() = default;
44 };
45
46 } // namespace Ipc
47
48 #endif /* SQUID_IPC_RESPONSE_H */
49