2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 * Author : Boris Mikhailenko <stg34@stargazer.dp.ua>
19 * Author : Maxim Mamontov <faust@stargazer.dp.ua>
26 #include "stg/module_settings.h"
32 #include <sys/select.h>
33 #include <sys/types.h>
54 explicit CONFIGPROTO(STG::PluginLogger & l);
57 void SetPort(uint16_t port) { m_port = port; }
58 void SetBindAddress(const std::string & address) { m_bindAddress = address; }
59 void SetSettings(const STG::Settings * settings) { m_settings = settings; }
60 void SetAdmins(STG::Admins * admins) { m_admins = admins; }
61 void SetTariffs(STG::Tariffs * tariffs) { m_tariffs = tariffs; }
62 void SetUsers(STG::Users * users) { m_users = users; }
63 void SetStore(STG::Store * store) { m_store = store; }
64 void SetServices(STG::Services * services) { m_services = services; }
65 void SetCorporations(STG::Corporations * corporations) { m_corporations = corporations; }
69 const std::string & GetStrError() const { return m_errorStr; }
73 CONFIGPROTO(const CONFIGPROTO & rvalue);
74 CONFIGPROTO & operator=(const CONFIGPROTO & rvalue);
76 const STG::Settings * m_settings;
77 STG::Admins * m_admins;
78 STG::Tariffs * m_tariffs;
80 STG::Services * m_services;
81 STG::Corporations * m_corporations;
85 std::string m_bindAddress;
88 STG::PluginLogger & m_logger;
91 std::string m_errorStr;
93 BASE_PARSER::REGISTRY m_registry;
94 std::deque<STG::Conn *> m_conns;
98 void RegisterParsers();
101 void BuildFDSet(fd_set & fds) const;
103 void HandleEvents(const fd_set & fds);
104 void AcceptConnection();