]> git.stg.codes - stg.git/blobdiff - projects/stargazer/plugins/configuration/sgconfig/configproto.cpp
Use `time` for message creation time.
[stg.git] / projects / stargazer / plugins / configuration / sgconfig / configproto.cpp
index d54c68f998d38e443dea95d7a5d885da550ebb81..011979046169a6f51592694d8edee410abd83a65 100644 (file)
@@ -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"
 
 namespace SP = STG::PARSER;
 
-CONFIGPROTO::CONFIGPROTO(PLUGIN_LOGGER & l)
+CONFIGPROTO::CONFIGPROTO(STG::PluginLogger & l)
     : m_settings(NULL),
       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"),
       m_running(false),
@@ -65,9 +69,16 @@ CONFIGPROTO::CONFIGPROTO(PLUGIN_LOGGER & l)
 
 CONFIGPROTO::~CONFIGPROTO()
 {
+    {
     std::deque<STG::Conn *>::iterator it;
     for (it = m_conns.begin(); it != m_conns.end(); ++it)
         delete *it;
+    }
+    {
+    BASE_PARSER::REGISTRY::iterator it;
+    for (it = m_registry.begin(); it != m_registry.end(); ++it)
+        delete it->second;
+    }
 }
 
 int CONFIGPROTO::Prepare()
@@ -79,7 +90,6 @@ int CONFIGPROTO::Prepare()
     sigaddset(&sigmask, SIGUSR1);
     sigaddset(&sigmask, SIGHUP);
     pthread_sigmask(SIG_BLOCK, &sigmask, &oldmask);
-
     m_listenSocket = socket(PF_INET, SOCK_STREAM, 0);
 
     if (m_listenSocket < 0)
@@ -207,6 +217,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);
 
@@ -227,6 +239,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);