]> git.ipfire.org Git - thirdparty/squid.git/blob - src/snmp/Request.cc
Renamed squid.h to squid-old.h and config.h to squid.h
[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
14 Snmp::Request::Request(int aRequestorId, unsigned int aRequestId,
15 const Pdu& aPdu, const Session& aSession,
16 int aFd, const Ip::Address& anAddress):
17 Ipc::Request(aRequestorId, aRequestId),
18 pdu(aPdu), session(aSession), fd(aFd), address(anAddress)
19 {
20 }
21
22 Snmp::Request::Request(const Request& request):
23 Ipc::Request(request.requestorId, request.requestId),
24 pdu(request.pdu), session(request.session),
25 fd(request.fd), address(request.address)
26 {
27 }
28
29 Snmp::Request::Request(const Ipc::TypedMsgHdr& msg):
30 Ipc::Request(0, 0)
31 {
32 msg.checkType(Ipc::mtSnmpRequest);
33 msg.getPod(requestorId);
34 msg.getPod(requestId);
35 pdu.unpack(msg);
36 session.unpack(msg);
37 msg.getPod(address);
38
39 fd = msg.getFd();
40 }
41
42 void
43 Snmp::Request::pack(Ipc::TypedMsgHdr& msg) const
44 {
45 msg.setType(Ipc::mtSnmpRequest);
46 msg.putPod(requestorId);
47 msg.putPod(requestId);
48 pdu.pack(msg);
49 session.pack(msg);
50 msg.putPod(address);
51
52 msg.putFd(fd);
53 }
54
55 Ipc::Request::Pointer
56 Snmp::Request::clone() const
57 {
58 return new Request(*this);
59 }