]> git.ipfire.org Git - thirdparty/squid.git/blame - src/mgr/Request.cc
Source Format Enforcement (#532)
[thirdparty/squid.git] / src / mgr / Request.cc
CommitLineData
8822ebee 1/*
77b1029d 2 * Copyright (C) 1996-2020 The Squid Software Foundation and contributors
8822ebee 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.
8822ebee
AR
7 */
8
bbc27441
AJ
9/* DEBUG: section 16 Cache Manager API */
10
f7f3304a 11#include "squid.h"
8822ebee 12#include "base/TextException.h"
c3e8e4e9 13#include "comm/Connection.h"
8822ebee 14#include "ipc/Messages.h"
51ea0904 15#include "ipc/TypedMsgHdr.h"
8822ebee
AR
16#include "mgr/ActionParams.h"
17#include "mgr/Request.h"
18
1b76e6c1 19Mgr::Request::Request(int aRequestorId, unsigned int aRequestId, const Comm::ConnectionPointer &aConn,
d9fc6862 20 const ActionParams &aParams):
f53969cc
SM
21 Ipc::Request(aRequestorId, aRequestId),
22 conn(aConn),
23 params(aParams)
8822ebee
AR
24{
25 Must(requestorId > 0);
8822ebee
AR
26}
27
51ea0904 28Mgr::Request::Request(const Request& request):
f53969cc
SM
29 Ipc::Request(request.requestorId, request.requestId),
30 conn(request.conn), params(request.params)
51ea0904
CT
31{
32}
33
34Mgr::Request::Request(const Ipc::TypedMsgHdr& msg):
f53969cc 35 Ipc::Request(0, 0)
8822ebee
AR
36{
37 msg.checkType(Ipc::mtCacheMgrRequest);
38 msg.getPod(requestorId);
39 msg.getPod(requestId);
40 params = ActionParams(msg);
41
1b76e6c1
AJ
42 conn = new Comm::Connection;
43 conn->fd = msg.getFd();
44 // For now we just have the FD.
45 // Address and connectio details wil be pulled/imported by the component later
8822ebee
AR
46}
47
48void
49Mgr::Request::pack(Ipc::TypedMsgHdr& msg) const
50{
51 msg.setType(Ipc::mtCacheMgrRequest);
52 msg.putPod(requestorId);
53 msg.putPod(requestId);
54 params.pack(msg);
55
1b76e6c1 56 msg.putFd(conn->fd);
8822ebee 57}
51ea0904
CT
58
59Ipc::Request::Pointer
60Mgr::Request::clone() const
61{
62 return new Request(*this);
8822ebee 63}
f53969cc 64