#ifndef TRAFFCOUNTER_IMPL_H
#define TRAFFCOUNTER_IMPL_H
-#include <pthread.h>
-
-#include <ctime>
-#include <list>
-#include <map>
-#include <string>
-
#include "stg/traffcounter.h"
#include "stg/os_int.h"
#include "stg/logger.h"
#include "eventloop.h"
#include "user_impl.h"
+#include <ctime>
+#include <list>
+#include <map>
+#include <string>
+
+#include <pthread.h>
+
#define PROTOMAX (5)
class USERS_IMPL;
lenD(0)
{}
-PACKET_EXTRA_DATA(const PACKET_EXTRA_DATA & pp)
- : flushTime(pp.flushTime),
- updateTime(pp.updateTime),
- userU(pp.userU),
- userUPresent(pp.userUPresent),
- userD(pp.userD),
- userDPresent(pp.userDPresent),
- dirU(pp.dirU),
- dirD(pp.dirD),
- lenU(pp.lenU),
- lenD(pp.lenD)
-{}
-
time_t flushTime; // Last flush time
time_t updateTime; // Last update time
USER_IMPL * userU; // Uploader
//-----------------------------------------------------------------------------
class ADD_USER_NONIFIER: public NOTIFIER_BASE<USER_IMPL_PTR> {
public:
- ADD_USER_NONIFIER(TRAFFCOUNTER_IMPL & t) :
+ explicit ADD_USER_NONIFIER(TRAFFCOUNTER_IMPL & t) :
NOTIFIER_BASE<USER_IMPL_PTR>(),
traffCnt(t)
{}
//-----------------------------------------------------------------------------
class DEL_USER_NONIFIER: public NOTIFIER_BASE<USER_IMPL_PTR> {
public:
- DEL_USER_NONIFIER(TRAFFCOUNTER_IMPL & t) :
+ explicit DEL_USER_NONIFIER(TRAFFCOUNTER_IMPL & t) :
NOTIFIER_BASE<USER_IMPL_PTR>(),
traffCnt(t)
{}
TRAFFCOUNTER_IMPL(USERS_IMPL * users, const std::string & rulesFileName);
~TRAFFCOUNTER_IMPL();
- void SetRulesFile(const std::string & rulesFileName);
-
int Reload();
int Start();
int Stop();
size_t RulesCount() const { return rules.size(); }
private:
- TRAFFCOUNTER_IMPL(const TRAFFCOUNTER_IMPL & rvalue);
- TRAFFCOUNTER_IMPL & operator=(const TRAFFCOUNTER_IMPL & rvalue);
+ TRAFFCOUNTER_IMPL(const TRAFFCOUNTER_IMPL &);
+ TRAFFCOUNTER_IMPL & operator=(const TRAFFCOUNTER_IMPL &);
bool ParseAddress(const char * ta, RULE * rule) const;
uint32_t CalcMask(uint32_t msk) const;
void FreeRules();
- void PrintRule(RULE rule) const;
bool ReadRules(bool test = false);
static void * Run(void * data);
std::string monitorDir;
bool monitoring;
+ time_t touchTimeP;
USERS_IMPL * users;