#include "stg_client.h"
-typedef std::vector<std::pair<std::string, std::string> > PAIRS;
+namespace {
+
+STG_CLIENT* stgClient = NULL;
+
+}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-const STG_PAIRS * STG_CLIENT::Authorize(const std::string & login, const std::string & svc)
+const STG_PAIRS * STG_CLIENT::Authorize(const PAIRS& pairs)
{
/*RAD_PACKET packet;
return ToSTGPairs(pairs);
}
-const STG_PAIRS * STG_CLIENT::Authenticate(const std::string & login, const std::string & svc)
+const STG_PAIRS * STG_CLIENT::Authenticate(const PAIRS& pairs)
{
/*RAD_PACKET packet;
return ToSTGPairs(pairs);
}
-const STG_PAIRS * STG_CLIENT::PostAuth(const std::string & login, const std::string & svc)
+const STG_PAIRS * STG_CLIENT::PostAuth(const PAIRS& pairs)
{
/*RAD_PACKET packet;
return ToSTGPairs(pairs);
}
-const STG_PAIRS * STG_CLIENT::PreAcct(const std::string & login, const std::String & service)
+const STG_PAIRS * STG_CLIENT::PreAcct(const PAIRS& pairs)
{
PAIRS pairs;
return ToSTGPairs(pairs);
}
-const STG_PAIRS * STG_CLIENT::Account(const std::string & type, const std::string & login, const std::string & svc, const std::string & sessid)
+const STG_PAIRS * STG_CLIENT::Account(const PAIRS& pairs)
{
/*RAD_PACKET packet;
//-----------------------------------------------------------------------------
-STG_CLIENT * STG_CLIENT_ST::Get()
+STG_CLIENT* STG_CLIENT::get()
{
- static STG_CLIENT * stgClient = NULL;
- if ( stgClient == NULL )
- stgClient = new STG_CLIENT(m_host, m_port, m_password);
return stgClient;
}
-void STG_CLIENT_ST::Configure(const std::string & host, uint16_t port, const std::string & password)
+void STG_CLIENT::configure(const std::string& server, uint16_t port, const std::string& password)
{
- m_host = host;
- m_port = port;
- m_password = password;
+ if ( stgClient != NULL )
+ delete stgClient;
+ stgClient = new STG_CLIENT(server, port, password);
}
//-----------------------------------------------------------------------------