2 #include "net_configurator.h"
3 #include "../../internal_configurator.h"
5 //-----------------------------------------------------------------------------
6 const string & NET_CONFIGURATOR_SETTINGS::GetStrError()
10 //-----------------------------------------------------------------------------
11 int NET_CONFIGURATOR_SETTINGS::ReadSettings(const CONFIGFILE &cf)
13 if (cf.ReadUShortInt("AdminPort", &port, 5555) != 0)
15 strError = "Cannot read parameter AdminPort.";
18 if (port < 1 || port > 65535)
20 strError = "Incorrect value AdminPort.";
25 cf.ReadString("AdminOrder", &strOrder, "allow,deny");
26 if (hostAllow.ParseOrder(strOrder.c_str()) < 0)
28 strError = string("Error in parameter AdminOrder. ") + hostAllow.GetStrError();
33 cf.ReadString("AdminAllowFrom", &strAllow, "all");
34 if (hostAllow.ParseHosts(strAllow.c_str(), hostsAllow) != 0)
36 strError = string("Error in parameter AdminAllowFrom. ") + hostAllow.GetStrError();
41 cf.ReadString("AdminDenyFrom", &strDeny, "");
42 if (hostAllow.ParseHosts(strDeny.c_str(), hostsDeny) != 0)
44 strError = string("Error in parameter AdminDenyFrom. ") + hostAllow.GetStrError();
49 //-----------------------------------------------------------------------------
50 uint16_t NET_CONFIGURATOR_SETTINGS::GetPort()
54 //-----------------------------------------------------------------------------
55 HOSTALLOW * NET_CONFIGURATOR_SETTINGS::GetHostAllow()
59 //-----------------------------------------------------------------------------
60 //-----------------------------------------------------------------------------
61 //-----------------------------------------------------------------------------
62 NET_CONFIGURATOR::NET_CONFIGURATOR()
64 hostAllow = settings.GetHostAllow();
66 //-----------------------------------------------------------------------------
67 NET_CONFIGURATOR::~NET_CONFIGURATOR()
71 //-----------------------------------------------------------------------------
72 void NET_CONFIGURATOR::SetStgConfigurator(BASE_INT_CONFIGURATOR * bsc)
74 stgConfigurator = bsc;
75 cp.SetStgConfigurator(stgConfigurator);
77 //-----------------------------------------------------------------------------
78 int NET_CONFIGURATOR::UserGetAll(string * login,
85 //-----------------------------------------------------------------------------
86 int NET_CONFIGURATOR::TatiffGetAll(TARIFF_CONF * conf)
90 //-----------------------------------------------------------------------------
91 int NET_CONFIGURATOR::AdminGetAll(ADMIN_CONF * conf)
95 //-----------------------------------------------------------------------------
96 const string & NET_CONFIGURATOR::GetStrError()
100 //-----------------------------------------------------------------------------
101 void NET_CONFIGURATOR::Start()
103 cp.SetPort(settings.GetPort());
104 cp.SetHostAllow(settings.GetHostAllow());
107 //-----------------------------------------------------------------------------
108 void NET_CONFIGURATOR::Stop()
112 //-----------------------------------------------------------------------------
113 void NET_CONFIGURATOR::Restart()
117 //-----------------------------------------------------------------------------
118 CONF_STATUS NET_CONFIGURATOR::Status()
122 //-----------------------------------------------------------------------------
123 BASE_SETTINGS * NET_CONFIGURATOR::GetConfiguratorSettings()
127 //-----------------------------------------------------------------------------
128 void NET_CONFIGURATOR::SetAdmins(const ADMINS * a)
132 //-----------------------------------------------------------------------------