| 1 | #pragma once
|
|---|
| 2 |
|
|---|
| 3 | #include <nscp/packet.hpp>
|
|---|
| 4 | #include <nscp/handler.hpp>
|
|---|
| 5 |
|
|---|
| 6 | class handler_impl : public nscp::handler, private boost::noncopyable {
|
|---|
| 7 | bool allowArgs_;
|
|---|
| 8 | bool allowNasty_;
|
|---|
| 9 | bool noPerfData_;
|
|---|
| 10 | public:
|
|---|
| 11 | handler_impl() : noPerfData_(false), allowNasty_(false), allowArgs_(false) {}
|
|---|
| 12 |
|
|---|
| 13 | NSCAPI::nagiosReturn handle_query_request(const std::string &request, Plugin::QueryRequestMessage &msg, std::string &reply);
|
|---|
| 14 | NSCAPI::nagiosReturn handle_submission_request(const std::string &request, Plugin::SubmitRequestMessage &msg, std::string &reply);
|
|---|
| 15 | NSCAPI::nagiosReturn handle_exec_request(const std::string &request, Plugin::ExecuteRequestMessage &msg, std::string &reply);
|
|---|
| 16 |
|
|---|
| 17 | NSCAPI::nagiosReturn process_single_query_request_payload(std::wstring &command, const Plugin::Common::Header &hdr, const Plugin::QueryRequestMessage_Request &payload, Plugin::QueryResponseMessage &response);
|
|---|
| 18 | NSCAPI::nagiosReturn process_single_submit_request_payload(std::wstring &channel, const Plugin::Common::Header &hdr, const Plugin::QueryResponseMessage_Response &payload, Plugin::SubmitResponseMessage &response);
|
|---|
| 19 | NSCAPI::nagiosReturn process_single_exec_request_payload(std::wstring &command, const Plugin::Common::Header &hdr, const Plugin::ExecuteRequestMessage_Request &payload, Plugin::ExecuteResponseMessage &response);
|
|---|
| 20 |
|
|---|
| 21 | nscp::packet create_error(std::wstring msg) {
|
|---|
| 22 | return nscp::factory::create_error(msg);
|
|---|
| 23 | }
|
|---|
| 24 |
|
|---|
| 25 | virtual void set_allow_arguments(bool v) {
|
|---|
| 26 | allowArgs_ = v;
|
|---|
| 27 | }
|
|---|
| 28 | virtual void set_allow_nasty_arguments(bool v) {
|
|---|
| 29 | allowNasty_ = v;
|
|---|
| 30 | }
|
|---|
| 31 | virtual void set_perf_data(bool v) {
|
|---|
| 32 | noPerfData_ = !v;
|
|---|
| 33 | if (noPerfData_)
|
|---|
| 34 | log_debug(__FILE__, __LINE__, _T("Performance data disabled!"));
|
|---|
| 35 | }
|
|---|
| 36 |
|
|---|
| 37 | void log_debug(std::string file, int line, std::wstring msg) {
|
|---|
| 38 | GET_CORE()->Message(NSCAPI::debug, file, line, msg);
|
|---|
| 39 | }
|
|---|
| 40 | void log_error(std::string file, int line, std::wstring msg) {
|
|---|
| 41 | GET_CORE()->Message(NSCAPI::error, file, line, msg);
|
|---|
| 42 | }
|
|---|
| 43 | };
|
|---|