]> git.ipfire.org Git - thirdparty/squid.git/blame - src/snmp/Forwarder.h
Source Format Enforcement (#763)
[thirdparty/squid.git] / src / snmp / Forwarder.h
CommitLineData
51ea0904 1/*
f70aedc4 2 * Copyright (C) 1996-2021 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
18class CommCloseCbParams;
19
20namespace 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 */
27class Forwarder: public Ipc::Forwarder
28{
5c2f68b7
AJ
29 CBDATA_CLASS(Forwarder);
30
51ea0904
CT
31public:
32 Forwarder(const Pdu& aPdu, const Session& aSession, int aFd,
33 const Ip::Address& anAddress);
34
35protected:
36 /* Ipc::Forwarder API */
ebaabe74 37 virtual void swanSong();
51ea0904
CT
38 virtual void handleTimeout();
39 virtual void handleException(const std::exception& e);
40
41private:
42 void noteCommClosed(const CommCloseCbParams& params);
43 void sendError(int error);
44
45private:
46 int fd; ///< client connection descriptor
47 AsyncCall::Pointer closer; ///< comm_close handler for the connection
51ea0904
CT
48};
49
4c218615 50void SendResponse(Ipc::RequestId, const Pdu &);
51ea0904
CT
51
52} // namespace Snmp
53
54#endif /* SQUID_SNMPX_FORWARDER_H */
f53969cc 55