]> git.ipfire.org Git - thirdparty/squid.git/blame - src/mgr/Request.cc
Source Format Enforcement (#763)
[thirdparty/squid.git] / src / mgr / Request.cc
CommitLineData
8822ebee 1/*
f70aedc4 2 * Copyright (C) 1996-2021 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
4c218615
EB
19Mgr::Request::Request(const int aRequestorId,
20 const Ipc::RequestId aRequestId,
21 const Comm::ConnectionPointer &aConn,
d9fc6862 22 const ActionParams &aParams):
f53969cc
SM
23 Ipc::Request(aRequestorId, aRequestId),
24 conn(aConn),
25 params(aParams)
8822ebee
AR
26{
27 Must(requestorId > 0);
8822ebee
AR
28}
29
4c218615 30Mgr::Request::Request(const Ipc::TypedMsgHdr &msg)
8822ebee
AR
31{
32 msg.checkType(Ipc::mtCacheMgrRequest);
33 msg.getPod(requestorId);
34 msg.getPod(requestId);
35 params = ActionParams(msg);
36
1b76e6c1
AJ
37 conn = new Comm::Connection;
38 conn->fd = msg.getFd();
39 // For now we just have the FD.
40 // Address and connectio details wil be pulled/imported by the component later
8822ebee
AR
41}
42
43void
44Mgr::Request::pack(Ipc::TypedMsgHdr& msg) const
45{
46 msg.setType(Ipc::mtCacheMgrRequest);
47 msg.putPod(requestorId);
48 msg.putPod(requestId);
49 params.pack(msg);
50
1b76e6c1 51 msg.putFd(conn->fd);
8822ebee 52}
51ea0904
CT
53
54Ipc::Request::Pointer
55Mgr::Request::clone() const
56{
57 return new Request(*this);
8822ebee 58}
f53969cc 59