]>
Commit | Line | Data |
---|---|---|
8822ebee | 1 | /* |
bbc27441 | 2 | * Copyright (C) 1996-2014 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 | 19 | Mgr::Request::Request(int aRequestorId, unsigned int aRequestId, const Comm::ConnectionPointer &aConn, |
d9fc6862 | 20 | const ActionParams &aParams): |
51ea0904 | 21 | Ipc::Request(aRequestorId, aRequestId), |
1b76e6c1 | 22 | conn(aConn), |
c3e8e4e9 | 23 | params(aParams) |
8822ebee AR |
24 | { |
25 | Must(requestorId > 0); | |
8822ebee AR |
26 | } |
27 | ||
51ea0904 | 28 | Mgr::Request::Request(const Request& request): |
8fb5a96c | 29 | Ipc::Request(request.requestorId, request.requestId), |
1b76e6c1 | 30 | conn(request.conn), params(request.params) |
51ea0904 CT |
31 | { |
32 | } | |
33 | ||
34 | Mgr::Request::Request(const Ipc::TypedMsgHdr& msg): | |
8fb5a96c | 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 | ||
48 | void | |
49 | Mgr::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 | |
59 | Ipc::Request::Pointer | |
60 | Mgr::Request::clone() const | |
61 | { | |
62 | return new Request(*this); | |
8822ebee | 63 | } |