]> git.ipfire.org Git - thirdparty/squid.git/blob - src/snmp/Inquirer.h
SourceFormat Enforcement
[thirdparty/squid.git] / src / snmp / Inquirer.h
1 /*
2 * Copyright (C) 1996-2017 The Squid Software Foundation and contributors
3 *
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.
7 */
8
9 /* DEBUG: section 49 SNMP Interface */
10
11 #ifndef SQUID_SNMPX_INQUIRER_H
12 #define SQUID_SNMPX_INQUIRER_H
13
14 #include "comm/forward.h"
15 #include "ipc/Inquirer.h"
16 #include "snmp/forward.h"
17 #include "snmp/Pdu.h"
18
19 class CommCloseCbParams;
20
21 namespace Snmp
22 {
23
24 /// Coordinator's job that sends a PDU request to each strand,
25 /// aggregates strand responses and send back the result to client
26 class Inquirer: public Ipc::Inquirer
27 {
28 CBDATA_CLASS(Inquirer);
29
30 public:
31 Inquirer(const Request& aRequest, const Ipc::StrandCoords& coords);
32
33 protected:
34 /* AsyncJob API */
35 virtual void start();
36 virtual bool doneAll() const;
37
38 /* Ipc::Inquirer API */
39 virtual void cleanup();
40 virtual void handleException(const std::exception& e);
41 virtual void sendResponse();
42 virtual bool aggregate(Ipc::Response::Pointer aResponse);
43
44 private:
45 void noteCommClosed(const CommCloseCbParams& params);
46
47 private:
48 Pdu aggrPdu; ///< aggregated pdu
49 Comm::ConnectionPointer conn; ///< client connection descriptor
50
51 AsyncCall::Pointer writer; ///< comm_write callback
52 AsyncCall::Pointer closer; ///< comm_close handler
53 };
54
55 } // namespace Snmp
56
57 #endif /* SQUID_SNMPX_INQUIRER_H */
58