]> git.ipfire.org Git - thirdparty/squid.git/blob - src/mgr/Request.cc
Roll Comm::Connection into new mgr/ code
[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 "comm/Connection.h"
11 #include "ipc/Messages.h"
12 #include "mgr/ActionParams.h"
13 #include "mgr/Request.h"
14
15
16 Mgr::Request::Request(int aRequestorId, unsigned int aRequestId, const Comm::ConnectionPointer &conn,
17 const ActionParams &aParams):
18 requestorId(aRequestorId), requestId(aRequestId),
19 fd(conn->fd),
20 params(aParams)
21 {
22 Must(requestorId > 0);
23 Must(requestId != 0);
24 }
25
26 Mgr::Request::Request(const Ipc::TypedMsgHdr& msg)
27 {
28 msg.checkType(Ipc::mtCacheMgrRequest);
29 msg.getPod(requestorId);
30 msg.getPod(requestId);
31 params = ActionParams(msg);
32
33 fd = msg.getFd();
34 }
35
36 void
37 Mgr::Request::pack(Ipc::TypedMsgHdr& msg) const
38 {
39 msg.setType(Ipc::mtCacheMgrRequest);
40 msg.putPod(requestorId);
41 msg.putPod(requestId);
42 params.pack(msg);
43
44 msg.putFd(fd);
45 }