*/
/*
- * Author : Maxim Mamontov <faust@stargazer.dp.ua>
+ * Author : Maksym Mamontov <stg@madf.info>
*/
#ifndef __STG_SGCONFIG_CONN_H__
#include "parser.h"
+#include "dumphelpers.h"
+
#include "stg/os_int.h"
#include "stg/const.h"
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,
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; }
bool IsDone() const { return m_state == DONE; }
bool IsKeepAlive() const { return m_keepAlive; }
+ void SetKeepAlive() { m_keepAlive = true; }
+
private:
static const char STG_HEADER[5];
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);