if (nfq_get_payload(nfqData, &payload) < 0 || payload == NULL)
return id;
-RAW_PACKET packet;
+STG::RawPacket packet;
memcpy(&packet.rawPacket, payload, sizeof(packet.rawPacket));
}
-extern "C" Plugin* GetPlugin()
+extern "C" STG::Plugin* GetPlugin()
{
static NFQ_CAP plugin;
return &plugin;
nfqHandle(NULL),
queueHandle(NULL),
traffCnt(NULL),
- logger(PluginLogger::get("cap_nfqueue"))
+ logger(STG::PluginLogger::get("cap_nfqueue"))
{
}
//-----------------------------------------------------------------------------
return NULL;
}
//-----------------------------------------------------------------------------
-void NFQ_CAP::Process(const RAW_PACKET & packet)
+void NFQ_CAP::Process(const STG::RawPacket & packet)
{
-traffCnt->Process(packet);
+traffCnt->process(packet);
}
* Author : Maxim Mamontov <faust@stargazer.dp.ua>
*/
-#ifndef NFQ_CAP_H
-#define NFQ_CAP_H
+#pragma once
#include "stg/plugin.h"
#include "stg/module_settings.h"
#include <pthread.h>
-class USERS;
-class TARIFFS;
-class ADMINS;
-class TRAFFCOUNTER;
-class SETTINGS;
-struct RAW_PACKET;
+namespace STG
+{
-class TRAFFCOUNTER;
+struct Users;
+struct Tariffs;
+struct Admins;
+struct TraffCounter;
+struct Settings;
+struct RawPacket;
+
+}
struct nfq_handle;
struct nfq_q_handle;
-class NFQ_CAP : public PLUGIN {
+class NFQ_CAP : public STG::Plugin {
public:
NFQ_CAP();
- virtual ~NFQ_CAP() {}
- void SetTraffcounter(TRAFFCOUNTER * tc) { traffCnt = tc; }
+ void SetTraffcounter(STG::TraffCounter * tc) override { traffCnt = tc; }
- int Start();
- int Stop();
- int Reload(const MODULE_SETTINGS & /*ms*/) { return 0; }
- bool IsRunning() { return isRunning; }
+ int Start() override;
+ int Stop() override;
+ int Reload(const STG::ModuleSettings & /*ms*/) override { return 0; }
+ bool IsRunning() override { return isRunning; }
- void SetSettings(const MODULE_SETTINGS & s) { settings = s; }
- int ParseSettings();
+ void SetSettings(const STG::ModuleSettings & s) override { settings = s; }
+ int ParseSettings() override;
- const std::string & GetStrError() const { return errorStr; }
- std::string GetVersion() const;
- uint16_t GetStartPosition() const { return 40; }
- uint16_t GetStopPosition() const { return 40; }
+ const std::string & GetStrError() const override { return errorStr; }
+ std::string GetVersion() const override;
+ uint16_t GetStartPosition() const override { return 40; }
+ uint16_t GetStopPosition() const override { return 40; }
- void Process(const RAW_PACKET & packet);
+ void Process(const STG::RawPacket & packet);
private:
NFQ_CAP(const NFQ_CAP & rvalue);
pthread_t thread;
bool nonstop;
bool isRunning;
- MODULE_SETTINGS settings;
+ STG::ModuleSettings settings;
size_t queueNumber;
struct nfq_handle * nfqHandle;
struct nfq_q_handle * queueHandle;
- TRAFFCOUNTER * traffCnt;
+ STG::TraffCounter * traffCnt;
- PLUGIN_LOGGER logger;
+ STG::PluginLogger logger;
};
-//-----------------------------------------------------------------------------
-
-#endif
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-extern "C" Plugin* GetPlugin()
+extern "C" STG::Plugin* GetPlugin()
{
-static PCAP_CAP plugin;
-return &plugin;
+ static PCAP_CAP plugin;
+ return &plugin;
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
: nonstop(false),
isRunning(false),
traffCnt(NULL),
- logger(PluginLogger::get("pcap_cap"))
+ logger(STG::PluginLogger::get("pcap_cap"))
{
}
//-----------------------------------------------------------------------------
if (eth->ether_type != 0x8)
return;
-RAW_PACKET ip;
+STG::RawPacket ip;
memcpy(&ip.rawPacket, packet + 14, sizeof(ip.rawPacket));
-traffCnt->Process(ip);
+traffCnt->process(ip);
}
* Author : Maxim Mamontov <faust@stargazer.dp.ua>
*/
-#ifndef PCAP_CAP_H
-#define PCAP_CAP_H
+#pragma once
#include "stg/plugin.h"
#include "stg/module_settings.h"
#include <pthread.h>
#include <sys/select.h>
-class USERS;
-class TARIFFS;
-class ADMINS;
-class TRAFFCOUNTER;
-class SETTINGS;
+namespace STG
+{
+
+struct Users;
+struct Tariffs;
+struct Admins;
+struct TraffCounter;
+struct Settings;
-class TRAFFCOUNTER;
+}
struct DEV
{
typedef std::vector<DEV> DEV_MAP;
-class PCAP_CAP : public PLUGIN {
+class PCAP_CAP : public STG::Plugin {
public:
PCAP_CAP();
- virtual ~PCAP_CAP() {}
- void SetTraffcounter(TRAFFCOUNTER * tc) { traffCnt = tc; }
+ void SetTraffcounter(STG::TraffCounter * tc) override { traffCnt = tc; }
- int Start();
- int Stop();
- int Reload(const MODULE_SETTINGS & /*ms*/) { return 0; }
- bool IsRunning() { return isRunning; }
+ int Start() override;
+ int Stop() override;
+ int Reload(const STG::ModuleSettings & /*ms*/) override { return 0; }
+ bool IsRunning() override { return isRunning; }
- void SetSettings(const MODULE_SETTINGS & s) { settings = s; }
- int ParseSettings();
+ void SetSettings(const STG::ModuleSettings & s) override { settings = s; }
+ int ParseSettings() override;
- const std::string & GetStrError() const { return errorStr; }
- std::string GetVersion() const;
- uint16_t GetStartPosition() const { return 40; }
- uint16_t GetStopPosition() const { return 40; }
+ const std::string & GetStrError() const override { return errorStr; }
+ std::string GetVersion() const override;
+ uint16_t GetStartPosition() const override { return 40; }
+ uint16_t GetStopPosition() const override { return 40; }
private:
PCAP_CAP(const PCAP_CAP & rvalue);
pthread_t thread;
bool nonstop;
bool isRunning;
- MODULE_SETTINGS settings;
+ STG::ModuleSettings settings;
DEV_MAP devices;
- TRAFFCOUNTER * traffCnt;
+ STG::TraffCounter * traffCnt;
- PLUGIN_LOGGER logger;
+ STG::PluginLogger logger;
};
-//-----------------------------------------------------------------------------
-
-#endif
#include "stg/users.h"
#include "stg/user.h"
+#include <cstring>
+
using STG::PARSER::AUTH_BY;
const char * AUTH_BY::tag = "GetUserAuthBy";
#include "stg/users.h"
#include "stg/user.h"
+#include <cstring>
+
extern volatile time_t stgTime; // So sad...
using STG::PARSER::SEND_MESSAGE;
#include "firebird_store.h"
-#include "stg/ibpp.h"
-#include "stg/plugin_creator.h"
+#include "stg/common.h"
#include <string>
#include <vector>
-namespace
+extern "C" STG::Store* GetStore()
{
-PLUGIN_CREATOR<FIREBIRD_STORE> frsc;
-}
-
-extern "C" STORE * GetStore();
-//-----------------------------------------------------------------------------
-STORE * GetStore()
-{
-return frsc.GetPlugin();
+ static FIREBIRD_STORE plugin;
+ return &plugin;
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
til(IBPP::ilConcurrency),
tlr(IBPP::lrWait),
schemaVersion(0),
- logger(PluginLogger::get("store_firebird"))
+ logger(STG::PluginLogger::get("store_firebird"))
{
pthread_mutex_init(&mutex, NULL);
}
//-----------------------------------------------------------------------------
int FIREBIRD_STORE::ParseSettings()
{
-std::vector<PARAM_VALUE>::iterator i;
+std::vector<STG::ParamValue>::iterator i;
std::string s;
for(i = settings.moduleParams.begin(); i != settings.moduleParams.end(); ++i)
* Author : Maxim Mamontov <faust@stargazer.dp.ua>
*/
-/*
- * Firebird storage class definition
- *
- * $Revision: 1.13 $
- * $Date: 2010/01/19 11:07:25 $
- *
- */
-
-#ifndef FIREBIRD_STORE_H
-#define FIREBIRD_STORE_H
-
-#include <ctime>
-#include <string>
-#include <vector>
+#pragma once
#include "stg/store.h"
#include "stg/locker.h"
#include "stg/ibpp.h"
#include "stg/logger.h"
+#include "stg/module_settings.h"
+
+#include <ctime>
+#include <string>
+#include <vector>
struct ToLower {
char operator() (char c) const { return static_cast<char>(std::tolower(c)); }
};
-class FIREBIRD_STORE : public STORE {
+class FIREBIRD_STORE : public STG::Store {
public:
FIREBIRD_STORE();
- virtual ~FIREBIRD_STORE();
-
- int GetUsersList(std::vector<std::string> * usersList) const;
- int AddUser(const std::string & login) const;
- int DelUser(const std::string & login) const;
- int SaveUserStat(const USER_STAT & stat, const std::string & login) const;
- int SaveUserConf(const USER_CONF & conf, const std::string & login) const;
- int RestoreUserStat(USER_STAT * stat, const std::string & login) const;
- int RestoreUserConf(USER_CONF * conf, const std::string & login) const;
+ ~FIREBIRD_STORE() override;
+
+ int GetUsersList(std::vector<std::string> * usersList) const override;
+ int AddUser(const std::string & login) const override;
+ int DelUser(const std::string & login) const override;
+ int SaveUserStat(const STG::UserStat & stat, const std::string & login) const override;
+ int SaveUserConf(const STG::UserConf & conf, const std::string & login) const override;
+ int RestoreUserStat(STG::UserStat * stat, const std::string & login) const override;
+ int RestoreUserConf(STG::UserConf * conf, const std::string & login) const override;
int WriteUserChgLog(const std::string & login,
const std::string & admLogin,
uint32_t admIP,
const std::string & paramName,
const std::string & oldValue,
const std::string & newValue,
- const std::string & message) const;
- int WriteUserConnect(const std::string & login, uint32_t ip) const;
+ const std::string & message) const override;
+ int WriteUserConnect(const std::string & login, uint32_t ip) const override;
int WriteUserDisconnect(const std::string & login,
- const DIR_TRAFF & up,
- const DIR_TRAFF & down,
- const DIR_TRAFF & sessionUp,
- const DIR_TRAFF & sessionDown,
+ const STG::DirTraff & up,
+ const STG::DirTraff & down,
+ const STG::DirTraff & sessionUp,
+ const STG::DirTraff & sessionDown,
double cash,
double freeMb,
- const std::string & reason) const;
- int WriteDetailedStat(const TRAFF_STAT & statTree,
+ const std::string & reason) const override;
+ int WriteDetailedStat(const STG::TraffStat & statTree,
time_t lastStat,
- const std::string & login) const;
+ const std::string & login) const override;
- int AddMessage(STG_MSG * msg, const std::string & login) const;
- int EditMessage(const STG_MSG & msg, const std::string & login) const;
- int GetMessage(uint64_t id, STG_MSG * msg, const std::string & login) const;
- int DelMessage(uint64_t id, const std::string & login) const;
- int GetMessageHdrs(std::vector<STG_MSG_HDR> * hdrsList, const std::string & login) const;
+ int AddMessage(STG::Message * msg, const std::string & login) const override;
+ int EditMessage(const STG::Message & msg, const std::string & login) const override;
+ int GetMessage(uint64_t id, STG::Message * msg, const std::string & login) const override;
+ int DelMessage(uint64_t id, const std::string & login) const override;
+ int GetMessageHdrs(std::vector<STG::Message::Header> * hdrsList, const std::string & login) const override;
- int SaveMonthStat(const USER_STAT & stat, int month, int year, const std::string & login) const;
+ int SaveMonthStat(const STG::UserStat & stat, int month, int year, const std::string & login) const override;
- int GetAdminsList(std::vector<std::string> * adminsList) const;
- int SaveAdmin(const ADMIN_CONF & ac) const;
- int RestoreAdmin(ADMIN_CONF * ac, const std::string & login) const;
- int AddAdmin(const std::string & login) const;
- int DelAdmin(const std::string & login) const;
+ int GetAdminsList(std::vector<std::string> * adminsList) const override;
+ int SaveAdmin(const STG::AdminConf & ac) const override;
+ int RestoreAdmin(STG::AdminConf * ac, const std::string & login) const override;
+ int AddAdmin(const std::string & login) const override;
+ int DelAdmin(const std::string & login) const override;
- int GetTariffsList(std::vector<std::string> * tariffsList) const;
- int AddTariff(const std::string & name) const;
- int DelTariff(const std::string & name) const;
- int SaveTariff(const TARIFF_DATA & td, const std::string & tariffName) const;
- int RestoreTariff(TARIFF_DATA * td, const std::string & tariffName) const;
+ int GetTariffsList(std::vector<std::string> * tariffsList) const override;
+ int AddTariff(const std::string & name) const override;
+ int DelTariff(const std::string & name) const override;
+ int SaveTariff(const STG::TariffData & td, const std::string & tariffName) const override;
+ int RestoreTariff(STG::TariffData * td, const std::string & tariffName) const override;
- int GetCorpsList(std::vector<std::string> * corpsList) const;
- int SaveCorp(const CORP_CONF & cc) const;
- int RestoreCorp(CORP_CONF * cc, const std::string & name) const;
- int AddCorp(const std::string & name) const;
- int DelCorp(const std::string & name) const;
+ int GetCorpsList(std::vector<std::string> * corpsList) const override;
+ int SaveCorp(const STG::CorpConf & cc) const override;
+ int RestoreCorp(STG::CorpConf * cc, const std::string & name) const override;
+ int AddCorp(const std::string & name) const override;
+ int DelCorp(const std::string & name) const override;
- inline void SetSettings(const MODULE_SETTINGS & s) { settings = s; }
- int ParseSettings();
+ inline void SetSettings(const STG::ModuleSettings & s) override { settings = s; }
+ int ParseSettings() override;
- inline const std::string & GetStrError() const { return strError; }
+ inline const std::string & GetStrError() const override { return strError; }
- inline const std::string & GetVersion() const { return version; }
+ inline const std::string & GetVersion() const override { return version; }
- int GetServicesList(std::vector<std::string> * servicesList) const;
- int SaveService(const SERVICE_CONF & sc) const;
- int RestoreService(SERVICE_CONF * sc, const std::string & name) const;
- int AddService(const std::string & name) const;
- int DelService(const std::string & name) const;
+ int GetServicesList(std::vector<std::string> * servicesList) const override;
+ int SaveService(const STG::ServiceConf & sc) const override;
+ int RestoreService(STG::ServiceConf * sc, const std::string & name) const override;
+ int AddService(const std::string & name) const override;
+ int DelService(const std::string & name) const override;
private:
FIREBIRD_STORE(const FIREBIRD_STORE & rvalue);
std::string version;
mutable std::string strError;
std::string db_server, db_database, db_user, db_password;
- MODULE_SETTINGS settings;
+ STG::ModuleSettings settings;
mutable IBPP::Database db;
mutable pthread_mutex_t mutex;
IBPP::TIL til;
IBPP::TLR tlr;
int schemaVersion;
- PLUGIN_LOGGER logger;
+ STG::PluginLogger logger;
- int SaveStat(const USER_STAT & stat, const std::string & login, int year = 0, int month = 0) const;
+ int SaveStat(const STG::UserStat & stat, const std::string & login, int year = 0, int month = 0) const;
int CheckVersion();
};
st->Get(pos, value);
return value;
}
-
-#endif //FIREBIRD_STORE_H
*
*/
-#include <string>
-#include <vector>
-
#include "firebird_store.h"
+
#include "stg/ibpp.h"
+#include "stg/admin_conf.h"
#include "stg/blowfish.h"
+#include "stg/common.h"
+
+#include <string>
+#include <vector>
#define adm_enc_passwd "cjeifY8m3"
return 0;
}
//-----------------------------------------------------------------------------
-int FIREBIRD_STORE::SaveAdmin(const ADMIN_CONF & ac) const
+int FIREBIRD_STORE::SaveAdmin(const STG::AdminConf & ac) const
{
STG_LOCKER lock(&mutex);
return 0;
}
//-----------------------------------------------------------------------------
-int FIREBIRD_STORE::RestoreAdmin(ADMIN_CONF * ac, const std::string & login) const
+int FIREBIRD_STORE::RestoreAdmin(STG::AdminConf * ac, const std::string & login) const
{
STG_LOCKER lock(&mutex);
*/
#include "firebird_store.h"
+
#include "stg/ibpp.h"
+#include "stg/corp_conf.h"
+#include "stg/common.h"
//-----------------------------------------------------------------------------
int FIREBIRD_STORE::GetCorpsList(std::vector<std::string> * corpsList) const
return 0;
}
//-----------------------------------------------------------------------------
-int FIREBIRD_STORE::SaveCorp(const CORP_CONF & cc) const
+int FIREBIRD_STORE::SaveCorp(const STG::CorpConf & cc) const
{
STG_LOCKER lock(&mutex);
return 0;
}
//-----------------------------------------------------------------------------
-int FIREBIRD_STORE::RestoreCorp(CORP_CONF * cc, const std::string & name) const
+int FIREBIRD_STORE::RestoreCorp(STG::CorpConf * cc, const std::string & name) const
{
STG_LOCKER lock(&mutex);
*/
#include "firebird_store.h"
+
#include "stg/ibpp.h"
+#include "stg/message.h"
+#include "stg/common.h"
//-----------------------------------------------------------------------------
-int FIREBIRD_STORE::AddMessage(STG_MSG * msg, const std::string & login) const
+int FIREBIRD_STORE::AddMessage(STG::Message * msg, const std::string & login) const
{
STG_LOCKER lock(&mutex);
return 0;
}
//-----------------------------------------------------------------------------
-int FIREBIRD_STORE::EditMessage(const STG_MSG & msg,
+int FIREBIRD_STORE::EditMessage(const STG::Message & msg,
const std::string & login) const
{
STG_LOCKER lock(&mutex);
}
//-----------------------------------------------------------------------------
int FIREBIRD_STORE::GetMessage(uint64_t id,
- STG_MSG * msg,
+ STG::Message * msg,
const std::string &) const
{
STG_LOCKER lock(&mutex);
return 0;
}
//-----------------------------------------------------------------------------
-int FIREBIRD_STORE::GetMessageHdrs(std::vector<STG_MSG_HDR> * hdrsList,
+int FIREBIRD_STORE::GetMessageHdrs(std::vector<STG::Message::Header> * hdrsList,
const std::string & login) const
{
STG_LOCKER lock(&mutex);
IBPP::Transaction tr = IBPP::TransactionFactory(db, IBPP::amRead, til, tlr);
IBPP::Statement st = IBPP::StatementFactory(db, tr);
-STG_MSG_HDR header;
+STG::Message::Header header;
try
{
*/
#include "firebird_store.h"
+
#include "stg/ibpp.h"
+#include "stg/service_conf.h"
+#include "stg/common.h"
//-----------------------------------------------------------------------------
int FIREBIRD_STORE::GetServicesList(std::vector<std::string> * servicesList) const
return 0;
}
//-----------------------------------------------------------------------------
-int FIREBIRD_STORE::SaveService(const SERVICE_CONF & sc) const
+int FIREBIRD_STORE::SaveService(const STG::ServiceConf & sc) const
{
STG_LOCKER lock(&mutex);
return 0;
}
//-----------------------------------------------------------------------------
-int FIREBIRD_STORE::RestoreService(SERVICE_CONF * sc,
+int FIREBIRD_STORE::RestoreService(STG::ServiceConf * sc,
const std::string & name) const
{
STG_LOCKER lock(&mutex);
*
*/
-#include <cmath>
-
#include "firebird_store.h"
+
#include "stg/ibpp.h"
+#include "stg/tariff.h"
+#include "stg/tariff_conf.h"
+#include "stg/common.h"
+
+#include <cmath>
namespace
{
return 0;
}
//-----------------------------------------------------------------------------
-int FIREBIRD_STORE::SaveTariff(const TARIFF_DATA & td,
+int FIREBIRD_STORE::SaveTariff(const STG::TariffData & td,
const std::string & tariffName) const
{
STG_LOCKER lock(&mutex);
if (schemaVersion > 0)
{
- st->Set(5, TARIFF::PeriodToString(td.tariffConf.period));
+ st->Set(5, STG::Tariff::toString(td.tariffConf.period));
++num;
}
if (schemaVersion > 1)
{
- st->Set(6, TARIFF::ChangePolicyToString(td.tariffConf.changePolicy));
+ st->Set(6, STG::Tariff::toString(td.tariffConf.changePolicy));
IBPP::Timestamp policyTimeout;
time_t2ts(td.tariffConf.changePolicyTimeout, &policyTimeout);
st->Set(7, policyTimeout);
return 0;
}
//-----------------------------------------------------------------------------
-int FIREBIRD_STORE::RestoreTariff(TARIFF_DATA * td,
+int FIREBIRD_STORE::RestoreTariff(STG::TariffData * td,
const std::string & tariffName) const
{
STG_LOCKER lock(&mutex);
st->Get(3, td->tariffConf.fee);
st->Get(4, td->tariffConf.free);
st->Get(5, td->tariffConf.passiveCost);
- td->tariffConf.traffType = TARIFF::IntToTraffType(Get<int>(st, 6));
+ td->tariffConf.traffType = STG::Tariff::fromInt(Get<int>(st, 6));
if (schemaVersion > 0)
- td->tariffConf.period = TARIFF::StringToPeriod(Get<std::string>(st, 7));
+ td->tariffConf.period = STG::Tariff::parsePeriod(Get<std::string>(st, 7));
if (schemaVersion > 1)
{
- td->tariffConf.changePolicy = TARIFF::StringToChangePolicy(Get<std::string>(st, 8));
+ td->tariffConf.changePolicy = STG::Tariff::parseChangePolicy(Get<std::string>(st, 8));
td->tariffConf.changePolicyTimeout = ts2time_t(Get<IBPP::Timestamp>(st, 9));
}
st->Close();
*
*/
-#include "stg/const.h"
#include "firebird_store.h"
+
#include "stg/ibpp.h"
+#include "stg/user_conf.h"
+#include "stg/user_stat.h"
+#include "stg/user_traff.h"
+#include "stg/user_ips.h"
+#include "stg/const.h"
+#include "stg/common.h"
//-----------------------------------------------------------------------------
int FIREBIRD_STORE::GetUsersList(std::vector<std::string> * usersList) const
return 0;
}
//-----------------------------------------------------------------------------
-int FIREBIRD_STORE::SaveUserStat(const USER_STAT & stat,
+int FIREBIRD_STORE::SaveUserStat(const STG::UserStat & stat,
const std::string & login) const
{
STG_LOCKER lock(&mutex);
return SaveStat(stat, login);
}
//-----------------------------------------------------------------------------
-int FIREBIRD_STORE::SaveStat(const USER_STAT & stat,
+int FIREBIRD_STORE::SaveStat(const STG::UserStat & stat,
const std::string & login,
int year,
int month) const
return 0;
}
//-----------------------------------------------------------------------------
-int FIREBIRD_STORE::SaveUserConf(const USER_CONF & conf,
+int FIREBIRD_STORE::SaveUserConf(const STG::UserConf & conf,
const std::string & login) const
{
STG_LOCKER lock(&mutex);
st->Execute();
st->Prepare("insert into tb_allowed_ip (fk_user, ip, mask) values (?, ?, ?)");
- for(size_t i = 0; i < conf.ips.Count(); i++)
+ for(size_t i = 0; i < conf.ips.count(); i++)
{
st->Set(1, uid);
st->Set(2, (int32_t)conf.ips[i].ip);
return 0;
}
//-----------------------------------------------------------------------------
-int FIREBIRD_STORE::RestoreUserStat(USER_STAT * stat,
+int FIREBIRD_STORE::RestoreUserStat(STG::UserStat * stat,
const std::string & login) const
{
STG_LOCKER lock(&mutex);
return 0;
}
//-----------------------------------------------------------------------------
-int FIREBIRD_STORE::RestoreUserConf(USER_CONF * conf,
+int FIREBIRD_STORE::RestoreUserConf(STG::UserConf * conf,
const std::string & login) const
{
STG_LOCKER lock(&mutex);
where fk_user = ?");
st->Set(1, uid);
st->Execute();
- USER_IPS ips;
+ STG::UserIPs ips;
while (st->Fetch())
{
- IP_MASK im;
+ STG::IPMask im;
st->Get(1, (int32_t &)im.ip);
st->Get(2, (int32_t &)im.mask);
- ips.Add(im);
+ ips.add(im);
}
conf->ips = ips;
}
//-----------------------------------------------------------------------------
int FIREBIRD_STORE::WriteUserDisconnect(const std::string & login,
- const DIR_TRAFF & up,
- const DIR_TRAFF & down,
- const DIR_TRAFF & sessionUp,
- const DIR_TRAFF & sessionDown,
+ const STG::DirTraff & up,
+ const STG::DirTraff & down,
+ const STG::DirTraff & sessionUp,
+ const STG::DirTraff & sessionDown,
double /*cash*/,
double /*freeMb*/,
const std::string & /*reason*/) const
return 0;
}
//-----------------------------------------------------------------------------
-int FIREBIRD_STORE::WriteDetailedStat(const std::map<IP_DIR_PAIR, STAT_NODE> & statTree,
+int FIREBIRD_STORE::WriteDetailedStat(const STG::TraffStat & statTree,
time_t lastStat,
const std::string & login) const
{
try
{
tr->Start();
- std::map<IP_DIR_PAIR, STAT_NODE>::const_iterator it;
+ STG::TraffStat::const_iterator it;
it = statTree.begin();
st->Prepare("insert into tb_detail_stats \
(till_time, from_time, fk_user, dir_num, \
return 0;
}
//-----------------------------------------------------------------------------
-int FIREBIRD_STORE::SaveMonthStat(const USER_STAT & stat, int month, int year, const std::string & login) const
+int FIREBIRD_STORE::SaveMonthStat(const STG::UserStat & stat, int month, int year, const std::string & login) const
{
STG_LOCKER lock(&mutex);
*
*/
-#include <cstdio>
-
#include "firebird_store.h"
+
#include "stg/ibpp.h"
+#include "stg/common.h"
+
+#include <cstdio>
//-----------------------------------------------------------------------------
time_t ts2time_t(const IBPP::Timestamp & ts)