34 #include <boost/algorithm/string.hpp>
54 boost::trim_if(str, boost::is_any_of(
"'\""));
57 else if (str ==
"WARNING")
59 else if (str ==
"CRITICAL")
60 return Code::CRITICAL;
61 else if (str ==
"UNKNOWN")
87 lock_guard<mutex> lock(m_mutex);
93 lock_guard<mutex> lock(m_mutex);
94 if (m_code ==
Code::OK && m_text.empty())
95 return format(
"%s OK", service.c_str());
char * decode_vstr(const uint8_t **bufp, size_t *remainp)
Decode a vstr (vint64, data, null).
String format(const char *fmt,...)
Returns a String using printf like format facilities Vanilla snprintf is about 1.5x faster than this...
Po::typed_value< String > * str(String *v=0)
size_t encoded_length_vstr(size_t len)
Computes the encoded length of vstr (vint64, data, null)
Code
Enumeration for status codes.
uint32_t decode_i32(const uint8_t **bufp, size_t *remainp)
Decode a 32-bit integer in little-endian order.
static const char * code_to_string(Code code)
void encode_internal(uint8_t **bufp) const override
Writes serialized representation of object to a buffer.
void encode_i32(uint8_t **bufp, uint32_t val)
Encode a 32-bit integer in little-endian order.
Compatibility Macros for C/C++.
uint8_t encoding_version() const override
Returns encoding version.
Functions to serialize/deserialize primitives to/from a memory buffer.
void encode_vstr(uint8_t **bufp, const void *buf, size_t len)
Encode a buffer as variable length string (vint64, data, null)
size_t encoded_length_internal() const override
Returns internal serialized length.
#define HT_THROWF(_code_, _fmt_,...)
static Code string_to_code(std::string str)
void decode_internal(uint8_t version, const uint8_t **bufp, size_t *remainp) override
Reads serialized representation of object from a buffer.
A String class based on std::string.
std::string format_output_line(const std::string &service)
Formats a Nagios-style output line.
const char * code_to_string(int var_code)
Converts variable code to variable string.