| 1 | #pragma once
|
|---|
| 2 |
|
|---|
| 3 | #include <nrpe/packet.hpp>
|
|---|
| 4 | #include <nrpe/server/handler.hpp>
|
|---|
| 5 | #include <boost/tuple/tuple.hpp>
|
|---|
| 6 |
|
|---|
| 7 | class handler_impl : public nrpe::server::handler, private boost::noncopyable {
|
|---|
| 8 | unsigned int payload_length_;
|
|---|
| 9 | bool allowArgs_;
|
|---|
| 10 | bool allowNasty_;
|
|---|
| 11 | bool noPerfData_;
|
|---|
| 12 | public:
|
|---|
| 13 | handler_impl(unsigned int payload_length) : payload_length_(payload_length), noPerfData_(false), allowNasty_(false), allowArgs_(false) {}
|
|---|
| 14 |
|
|---|
| 15 | unsigned int get_payload_length() {
|
|---|
| 16 | return payload_length_;
|
|---|
| 17 | }
|
|---|
| 18 | void set_payload_length(unsigned int payload) {
|
|---|
| 19 | payload_length_ = payload;
|
|---|
| 20 | }
|
|---|
| 21 |
|
|---|
| 22 | nrpe::packet handle(nrpe::packet packet);
|
|---|
| 23 |
|
|---|
| 24 | nrpe::packet create_error(std::wstring msg) {
|
|---|
| 25 | return nrpe::packet::create_response(4, msg, payload_length_);
|
|---|
| 26 | }
|
|---|
| 27 |
|
|---|
| 28 | virtual void set_allow_arguments(bool v) {
|
|---|
| 29 | allowArgs_ = v;
|
|---|
| 30 | }
|
|---|
| 31 | virtual void set_allow_nasty_arguments(bool v) {
|
|---|
| 32 | allowNasty_ = v;
|
|---|
| 33 | }
|
|---|
| 34 | virtual void set_perf_data(bool v) {
|
|---|
| 35 | noPerfData_ = !v;
|
|---|
| 36 | }
|
|---|
| 37 |
|
|---|
| 38 | void log_debug(std::wstring file, int line, std::wstring msg) {
|
|---|
| 39 | GET_CORE()->Message(NSCAPI::debug, file, line, msg);
|
|---|
| 40 | }
|
|---|
| 41 | void log_error(std::wstring file, int line, std::wstring msg) {
|
|---|
| 42 | GET_CORE()->Message(NSCAPI::error, file, line, msg);
|
|---|
| 43 | }
|
|---|
| 44 | };
|
|---|