X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/fd41f8dfd1133e89f6b5ac675fe2b5068b6bb652..02efb4e1196ca467e796f65ef1d49db27a5254f8:/projects/rlm_stg/stg_client.h diff --git a/projects/rlm_stg/stg_client.h b/projects/rlm_stg/stg_client.h index ee15774f..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*/, bool /*status*/); - - 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