]> git.ipfire.org Git - thirdparty/squid.git/blame - src/ipc/Response.h
SourceFormat Enforcement
[thirdparty/squid.git] / src / ipc / Response.h
CommitLineData
51ea0904 1/*
4ac4a490 2 * Copyright (C) 1996-2017 The Squid Software Foundation and contributors
51ea0904 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.
51ea0904
CT
7 */
8
bbc27441
AJ
9/* DEBUG: section 54 Interprocess Communication */
10
51ea0904
CT
11#ifndef SQUID_IPC_RESPONSE_H
12#define SQUID_IPC_RESPONSE_H
13
8bf217bd 14#include "base/RefCount.h"
51ea0904 15#include "ipc/forward.h"
51ea0904 16
51ea0904
CT
17namespace Ipc
18{
19
20/// A response to Ipc::Request.
21class Response: public RefCountable
22{
23public:
24 typedef RefCount<Response> Pointer;
25
26public:
27 explicit Response(unsigned int aRequestId):
f53969cc 28 requestId(aRequestId) {}
51ea0904
CT
29
30 virtual void pack(TypedMsgHdr& msg) const = 0; ///< prepare for sendmsg()
31 virtual Pointer clone() const = 0; ///< returns a copy of this
32
33private:
34 Response(const Response&); // not implemented
35 Response& operator= (const Response&); // not implemented
36
37public:
38 unsigned int requestId; ///< ID of request we are responding to
39};
40
f738d783
CT
41inline
42std::ostream& operator << (std::ostream &os, const Response& response)
43{
44 os << "[response.requestId %u]" << response.requestId << '}';
45 return os;
46}
47
51ea0904
CT
48} // namespace Ipc
49
50#endif /* SQUID_IPC_RESPONSE_H */
f53969cc 51