source: nscp/modules/NRPEServer/handler_impl.hpp @ 497b779

0.4.00.4.10.4.2
Last change on this file since 497b779 was 497b779, checked in by Michael Medin <michael@…>, 3 years ago

New settings client (c++ instead of c) which looks pretty sweet :P
Only NRPEServer and CHeckExternalScripts implements it as of yet...

  • Property mode set to 100644
File size: 1.2 KB
Line 
1#pragma once
2
3#include <nrpe/packet.hpp>
4#include <nrpe/server/handler.hpp>
5#include <boost/tuple/tuple.hpp>
6
7class handler_impl : public nrpe::server::handler, private boost::noncopyable {
8        unsigned int payload_length_;
9        bool allowArgs_;
10        bool allowNasty_;
11        bool noPerfData_;
12public:
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};
Note: See TracBrowser for help on using the repository browser.