From: Maxim Mamontov Date: Sun, 28 Sep 2014 16:08:03 +0000 (+0300) Subject: Register services and corporations within sgconfig plugin. X-Git-Url: https://git.stg.codes/stg.git/commitdiff_plain/0347d1faca21404b65dd648033e066029abdebb6?hp=fa37e48043079fdf1a33c695c75f83706d59e46b Register services and corporations within sgconfig plugin. --- diff --git a/projects/stargazer/plugins/configuration/sgconfig/configproto.cpp b/projects/stargazer/plugins/configuration/sgconfig/configproto.cpp index 9f67f181..f012fa1a 100644 --- a/projects/stargazer/plugins/configuration/sgconfig/configproto.cpp +++ b/projects/stargazer/plugins/configuration/sgconfig/configproto.cpp @@ -27,6 +27,7 @@ #include "parser_admins.h" #include "parser_tariffs.h" #include "parser_users.h" +#include "parser_services.h" #include "parser_message.h" #include "parser_user_info.h" #include "parser_auth_by.h" @@ -54,6 +55,8 @@ CONFIGPROTO::CONFIGPROTO(PLUGIN_LOGGER & l) m_admins(NULL), m_tariffs(NULL), m_users(NULL), + m_services(NULL), + m_corporations(NULL), m_store(NULL), m_port(0), m_bindAddress("0.0.0.0"), @@ -208,6 +211,8 @@ void CONFIGPROTO::RegisterParsers() assert(m_admins != NULL); assert(m_users != NULL); assert(m_tariffs != NULL); + assert(m_services != NULL); + assert(m_corporations != NULL); SP::GET_SERVER_INFO::FACTORY::Register(m_registry, *m_settings, *m_users, *m_tariffs); @@ -228,6 +233,12 @@ void CONFIGPROTO::RegisterParsers() SP::CHG_USER::FACTORY::Register(m_registry, *m_users, *m_store, *m_tariffs); SP::CHECK_USER::FACTORY::Register(m_registry, *m_users); + SP::GET_SERVICES::FACTORY::Register(m_registry, *m_services); + SP::GET_SERVICE::FACTORY::Register(m_registry, *m_services); + SP::ADD_SERVICE::FACTORY::Register(m_registry, *m_services); + SP::DEL_SERVICE::FACTORY::Register(m_registry, *m_services); + SP::CHG_SERVICE::FACTORY::Register(m_registry, *m_services); + SP::SEND_MESSAGE::FACTORY::Register(m_registry, *m_users); SP::AUTH_BY::FACTORY::Register(m_registry, *m_users); diff --git a/projects/stargazer/plugins/configuration/sgconfig/configproto.h b/projects/stargazer/plugins/configuration/sgconfig/configproto.h index 2119bc67..e18ae82e 100644 --- a/projects/stargazer/plugins/configuration/sgconfig/configproto.h +++ b/projects/stargazer/plugins/configuration/sgconfig/configproto.h @@ -38,6 +38,8 @@ class SETTINGS; class ADMINS; class TARIFFS; class USERS; +class SERVICES; +class CORPORATIONS; class STORE; class PLUGIN_LOGGER; @@ -53,18 +55,20 @@ public: CONFIGPROTO(PLUGIN_LOGGER & l); ~CONFIGPROTO(); - void SetPort(uint16_t port) { m_port = port; } - void SetBindAddress(const std::string & address) { m_bindAddress = address; } - void SetSettings(const SETTINGS * settings) { m_settings = settings; } - void SetAdmins(ADMINS * admins) { m_admins = admins; } - void SetTariffs(TARIFFS * tariffs) { m_tariffs = tariffs; } - void SetUsers(USERS * users) { m_users = users; } - void SetStore(STORE * store) { m_store = store; } - - int Prepare(); - int Stop(); + void SetPort(uint16_t port) { m_port = port; } + void SetBindAddress(const std::string & address) { m_bindAddress = address; } + void SetSettings(const SETTINGS * settings) { m_settings = settings; } + void SetAdmins(ADMINS * admins) { m_admins = admins; } + void SetTariffs(TARIFFS * tariffs) { m_tariffs = tariffs; } + void SetUsers(USERS * users) { m_users = users; } + void SetServices(SERVICES * services) { m_services = services; } + void SetCorporations(CORPORATIONS * corporations) { m_corporations = corporations; } + void SetStore(STORE * store) { m_store = store; } + + int Prepare(); + int Stop(); const std::string & GetStrError() const { return m_errorStr; } - void Run(); + void Run(); private: CONFIGPROTO(const CONFIGPROTO & rvalue); @@ -74,6 +78,8 @@ private: ADMINS * m_admins; TARIFFS * m_tariffs; USERS * m_users; + SERVICES * m_services; + CORPORATIONS * m_corporations; STORE * m_store; uint16_t m_port; @@ -97,8 +103,6 @@ private: void CleanupConns(); void HandleEvents(const fd_set & fds); void AcceptConnection(); - - //void WriteLogAccessFailed(uint32_t ip); }; #endif //CONFIGPROTO_H diff --git a/projects/stargazer/plugins/configuration/sgconfig/stgconfig.h b/projects/stargazer/plugins/configuration/sgconfig/stgconfig.h index 287c3813..8902766a 100644 --- a/projects/stargazer/plugins/configuration/sgconfig/stgconfig.h +++ b/projects/stargazer/plugins/configuration/sgconfig/stgconfig.h @@ -53,6 +53,8 @@ class STG_CONFIG : public PLUGIN void SetUsers(USERS * users) { config.SetUsers(users); } void SetTariffs(TARIFFS * tariffs) { config.SetTariffs(tariffs); } void SetAdmins(ADMINS * admins) { config.SetAdmins(admins); } + void SetServices(SERVICES * services) { config.SetServices(services); } + void SetCorporations(CORPORATIONS * corporations) { config.SetCorporations( corporations); } void SetStore(STORE * store) { config.SetStore(store); } void SetStgSettings(const SETTINGS * s) { config.SetSettings(s); } void SetSettings(const MODULE_SETTINGS & s) { settings = s; }