]> git.ipfire.org Git - thirdparty/squid.git/blob - src/snmp/Forwarder.h
SourceFormat Enforcement
[thirdparty/squid.git] / src / snmp / Forwarder.h
1 /*
2 * $Id$
3 *
4 * DEBUG: section 49 SNMP Interface
5 *
6 */
7
8 #ifndef SQUID_SNMPX_FORWARDER_H
9 #define SQUID_SNMPX_FORWARDER_H
10
11 #include "ipc/Forwarder.h"
12 #include "snmp/Pdu.h"
13 #include "snmp/Session.h"
14
15 class CommCloseCbParams;
16
17 namespace Snmp
18 {
19
20 /** Forwards a single client SNMP request to Coordinator.
21 * Waits for an ACK from Coordinator
22 * Send the data unit with an error response if forwarding fails.
23 */
24 class Forwarder: public Ipc::Forwarder
25 {
26 public:
27 Forwarder(const Pdu& aPdu, const Session& aSession, int aFd,
28 const Ip::Address& anAddress);
29
30 protected:
31 /* Ipc::Forwarder API */
32 virtual void cleanup(); ///< perform cleanup actions
33 virtual void handleTimeout();
34 virtual void handleException(const std::exception& e);
35
36 private:
37 void noteCommClosed(const CommCloseCbParams& params);
38 void sendError(int error);
39
40 private:
41 int fd; ///< client connection descriptor
42 AsyncCall::Pointer closer; ///< comm_close handler for the connection
43
44 CBDATA_CLASS2(Forwarder);
45 };
46
47 extern void SendResponse(unsigned int requestId, const Pdu& pdu);
48
49 } // namespace Snmp
50
51 #endif /* SQUID_SNMPX_FORWARDER_H */