X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/96895bd4b4f6dfe95babece955434d5392866562..0f4172ffbddd7b51c80f388adc69c4601d230bf6:/projects/stargazer/plugins/configuration/sgconfig/conn.h?ds=inline diff --git a/projects/stargazer/plugins/configuration/sgconfig/conn.h b/projects/stargazer/plugins/configuration/sgconfig/conn.h index fae0c4b2..4bf94a5f 100644 --- a/projects/stargazer/plugins/configuration/sgconfig/conn.h +++ b/projects/stargazer/plugins/configuration/sgconfig/conn.h @@ -15,7 +15,7 @@ */ /* - * Author : Maxim Mamontov + * Author : Maksym Mamontov */ #ifndef __STG_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);