]> git.ipfire.org Git - thirdparty/squid.git/blob - src/snmp/Request.cc
Merged from trunk
[thirdparty/squid.git] / src / snmp / Request.cc
1 /*
2 * $Id$
3 *
4 * DEBUG: section 49 SNMP Interface
5 *
6 */
7
8 #include "squid.h"
9 #include "ipc/Messages.h"
10 #include "ipc/TypedMsgHdr.h"
11 #include "snmp/Request.h"
12
13 Snmp::Request::Request(int aRequestorId, unsigned int aRequestId,
14 const Pdu& aPdu, const Session& aSession,
15 int aFd, const Ip::Address& anAddress):
16 Ipc::Request(aRequestorId, aRequestId),
17 pdu(aPdu), session(aSession), fd(aFd), address(anAddress)
18 {
19 }
20
21 Snmp::Request::Request(const Request& request):
22 Ipc::Request(request.requestorId, request.requestId),
23 pdu(request.pdu), session(request.session),
24 fd(request.fd), address(request.address)
25 {
26 }
27
28 Snmp::Request::Request(const Ipc::TypedMsgHdr& msg):
29 Ipc::Request(0, 0)
30 {
31 msg.checkType(Ipc::mtSnmpRequest);
32 msg.getPod(requestorId);
33 msg.getPod(requestId);
34 pdu.unpack(msg);
35 session.unpack(msg);
36 msg.getPod(address);
37
38 fd = msg.getFd();
39 }
40
41 void
42 Snmp::Request::pack(Ipc::TypedMsgHdr& msg) const
43 {
44 msg.setType(Ipc::mtSnmpRequest);
45 msg.putPod(requestorId);
46 msg.putPod(requestId);
47 pdu.pack(msg);
48 session.pack(msg);
49 msg.putPod(address);
50
51 msg.putFd(fd);
52 }
53
54 Ipc::Request::Pointer
55 Snmp::Request::clone() const
56 {
57 return new Request(*this);
58 }