]> git.ipfire.org Git - thirdparty/squid.git/blob - src/mgr/Request.cc
Applying sourceformating
[thirdparty/squid.git] / src / mgr / Request.cc
1 /*
2 * $Id$
3 *
4 * DEBUG: section 16 Cache Manager API
5 *
6 */
7
8 #include "config.h"
9 #include "base/TextException.h"
10 #include "ipc/Messages.h"
11 #include "ipc/TypedMsgHdr.h"
12 #include "mgr/ActionParams.h"
13 #include "mgr/Request.h"
14
15
16 Mgr::Request::Request(int aRequestorId, unsigned int aRequestId, int aFd,
17 const ActionParams &aParams):
18 Ipc::Request(aRequestorId, aRequestId),
19 fd(aFd), params(aParams)
20 {
21 Must(requestorId > 0);
22 }
23
24 Mgr::Request::Request(const Request& request):
25 Ipc::Request(request.requestorId, request.requestId),
26 fd(request.fd), params(request.params)
27 {
28 }
29
30 Mgr::Request::Request(const Ipc::TypedMsgHdr& msg):
31 Ipc::Request(0, 0)
32 {
33 msg.checkType(Ipc::mtCacheMgrRequest);
34 msg.getPod(requestorId);
35 msg.getPod(requestId);
36 params = ActionParams(msg);
37
38 fd = msg.getFd();
39 }
40
41 void
42 Mgr::Request::pack(Ipc::TypedMsgHdr& msg) const
43 {
44 msg.setType(Ipc::mtCacheMgrRequest);
45 msg.putPod(requestorId);
46 msg.putPod(requestId);
47 params.pack(msg);
48
49 msg.putFd(fd);
50 }
51
52 Ipc::Request::Pointer
53 Mgr::Request::clone() const
54 {
55 return new Request(*this);
56 }