X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/65a51d11c64daa4df3d4388df60bb4efc3e67e14..114e097d3658e41e7946b5d5ba1ad2ffdc7fe2d9:/projects/rlm_stg/stg_client.h diff --git a/projects/rlm_stg/stg_client.h b/projects/rlm_stg/stg_client.h index 6315a0a5..b90b0e60 100644 --- a/projects/rlm_stg/stg_client.h +++ b/projects/rlm_stg/stg_client.h @@ -21,13 +21,13 @@ #ifndef STG_CLIENT_H #define STG_CLIENT_H -#include "stg/sgcp_proto.h" // Proto -#include "stg/sgcp_types.h" // TransportType #include "stg/os_int.h" +#include + #include #include -#include +#include typedef std::vector > PAIRS; @@ -44,9 +44,10 @@ struct ChannelConfig { ChannelConfig(std::string address); - STG::SGCP::TransportType transport; + std::string transport; std::string key; std::string address; + std::string portStr; uint16_t port; }; @@ -64,21 +65,24 @@ public: Error(const std::string& message) : runtime_error(message) {} }; - STG_CLIENT(const std::string& address); + typedef bool (*Callback)(void* /*data*/, const RESULT& /*result*/, bool /*status*/); + + STG_CLIENT(const std::string& address, Callback callback, void* data); + STG_CLIENT(const STG_CLIENT& rhs); ~STG_CLIENT(); + bool stop(); + bool connected() const; + static STG_CLIENT* get(); - static bool configure(const std::string& address); + static bool configure(const std::string& address, Callback callback, void* data); + static bool reconnect(); - RESULT request(TYPE type, const std::string& userName, const std::string& password, const PAIRS& pairs); + bool request(TYPE type, const std::string& userName, const std::string& password, const PAIRS& pairs); private: - ChannelConfig m_config; - STG::SGCP::Proto m_proto; - - void m_writeHeader(TYPE type, const std::string& userName, const std::string& password); - void m_writePairBlock(const PAIRS& source); - PAIRS m_readPairBlock(); + class Impl; + boost::scoped_ptr m_impl; }; #endif