X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/5acc5a82caf7402cfa71c6ead1c95adc9a2d026b..8c6fa3fbaccc22127280bf77a48fab5a3ee0716e:/projects/stargazer/plugins/configuration/sgconfig/conn.h?ds=sidebyside diff --git a/projects/stargazer/plugins/configuration/sgconfig/conn.h b/projects/stargazer/plugins/configuration/sgconfig/conn.h index fae0c4b2..ed2e64d1 100644 --- a/projects/stargazer/plugins/configuration/sgconfig/conn.h +++ b/projects/stargazer/plugins/configuration/sgconfig/conn.h @@ -23,6 +23,8 @@ #include "parser.h" +#include "dumphelpers.h" + #include "stg/os_int.h" #include "stg/const.h" @@ -51,7 +53,7 @@ class Conn public: struct Error : public std::runtime_error { - Error(const std::string& message) : runtime_error(message.c_str()) {} + explicit Error(const std::string& message) : runtime_error(message.c_str()) {} }; Conn(const BASE_PARSER::REGISTRY & registry, @@ -63,6 +65,8 @@ class Conn uint32_t IP() const { return *(uint32_t *)(&m_addr.sin_addr); } uint16_t Port() const { return ntohs(m_addr.sin_port); } + std::string endpoint() const { return inet_ntostring(IP()) + ":" + x2str(Port()); } + bool Read(); bool IsOk() const { return m_state != ERROR; } @@ -127,6 +131,10 @@ class Conn Conn & conn; } m_dataState; +#ifdef DUMPCRYPTO + Dumper m_dumper; +#endif + static bool DataCallback(const void * block, size_t size, void * data); static void ParseXMLStart(void * data, const char * el, const char ** attr); static void ParseXMLEnd(void * data, const char * el);