]>
Commit | Line | Data |
---|---|---|
51ea0904 | 1 | /* |
bbc27441 | 2 | * Copyright (C) 1996-2014 The Squid Software Foundation and contributors |
51ea0904 | 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. | |
51ea0904 CT |
7 | */ |
8 | ||
bbc27441 AJ |
9 | /* DEBUG: section 49 SNMP Interface */ |
10 | ||
51ea0904 CT |
11 | #ifndef SQUID_SNMPX_FORWARDER_H |
12 | #define SQUID_SNMPX_FORWARDER_H | |
13 | ||
14 | #include "ipc/Forwarder.h" | |
d6e3ad20 CT |
15 | #include "snmp/Pdu.h" |
16 | #include "snmp/Session.h" | |
51ea0904 | 17 | |
51ea0904 CT |
18 | class CommCloseCbParams; |
19 | ||
20 | namespace Snmp | |
21 | { | |
22 | ||
23 | /** Forwards a single client SNMP request to Coordinator. | |
24 | * Waits for an ACK from Coordinator | |
25 | * Send the data unit with an error response if forwarding fails. | |
26 | */ | |
27 | class Forwarder: public Ipc::Forwarder | |
28 | { | |
5c2f68b7 AJ |
29 | CBDATA_CLASS(Forwarder); |
30 | ||
51ea0904 CT |
31 | public: |
32 | Forwarder(const Pdu& aPdu, const Session& aSession, int aFd, | |
33 | const Ip::Address& anAddress); | |
34 | ||
35 | protected: | |
36 | /* Ipc::Forwarder API */ | |
37 | virtual void cleanup(); ///< perform cleanup actions | |
38 | virtual void handleTimeout(); | |
39 | virtual void handleException(const std::exception& e); | |
40 | ||
41 | private: | |
42 | void noteCommClosed(const CommCloseCbParams& params); | |
43 | void sendError(int error); | |
44 | ||
45 | private: | |
46 | int fd; ///< client connection descriptor | |
47 | AsyncCall::Pointer closer; ///< comm_close handler for the connection | |
51ea0904 CT |
48 | }; |
49 | ||
82afb125 | 50 | void SendResponse(unsigned int requestId, const Pdu& pdu); |
51ea0904 CT |
51 | |
52 | } // namespace Snmp | |
53 | ||
54 | #endif /* SQUID_SNMPX_FORWARDER_H */ |