X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/3a9bc658f505e423b3be181948f1870a09915ea9..8c6fa3fbaccc22127280bf77a48fab5a3ee0716e:/projects/rlm_stg/stg_client.h diff --git a/projects/rlm_stg/stg_client.h b/projects/rlm_stg/stg_client.h index 82d2287b..917d0e51 100644 --- a/projects/rlm_stg/stg_client.h +++ b/projects/rlm_stg/stg_client.h @@ -18,68 +18,41 @@ * Author : Maxim Mamontov */ -#ifndef STG_CLIENT_H -#define STG_CLIENT_H +#ifndef __STG_RLM_CLIENT_H__ +#define __STG_RLM_CLIENT_H__ + +#include "types.h" #include "stg/os_int.h" #include #include -#include -#include - -typedef std::vector > PAIRS; -struct RESULT +namespace STG +{ +namespace RLM { - PAIRS modify; - PAIRS reply; -}; - -struct ChannelConfig { - struct Error : std::runtime_error { - Error(const std::string& message) : runtime_error(message) {} - }; - - ChannelConfig(std::string address); - - std::string transport; - std::string key; - std::string address; - std::string portStr; - uint16_t port; -}; -class STG_CLIENT +class Client { public: - enum TYPE { - AUTHORIZE, - AUTHENTICATE, - POST_AUTH, - PRE_ACCT, - ACCOUNT - }; - struct Error : std::runtime_error { - Error(const std::string& message) : runtime_error(message) {} - }; - - typedef bool (*Callback)(void* data, const RESULT& result); - - STG_CLIENT(const std::string& address, Callback callback, void* data); - ~STG_CLIENT(); + explicit Client(const std::string& address); + ~Client(); bool stop(); - static STG_CLIENT* get(); - static bool configure(const std::string& address, Callback callback, void* data); + static Client* get(); + static bool configure(const std::string& address); - bool request(TYPE type, const std::string& userName, const std::string& password, const PAIRS& pairs); + RESULT request(REQUEST_TYPE type, const std::string& userName, const std::string& password, const PAIRS& pairs); private: class Impl; boost::scoped_ptr m_impl; }; +} // namespace RLM +} // namespace STG + #endif