//-----------------------------------------------------------------------------
TRAFFCOUNTER_IMPL::TRAFFCOUNTER_IMPL(USERS_IMPL * u, const std::string & fn)
//-----------------------------------------------------------------------------
TRAFFCOUNTER_IMPL::TRAFFCOUNTER_IMPL(USERS_IMPL * u, const std::string & fn)
//-----------------------------------------------------------------------------
int TRAFFCOUNTER_IMPL::Start()
{
//-----------------------------------------------------------------------------
int TRAFFCOUNTER_IMPL::Start()
{
std::string monFile(tc->monitorDir + "/traffcounter_r");
printfd(__FILE__, "Monitor=%d file TRAFFCOUNTER %s\n", tc->monitoring, monFile.c_str());
touchTime = stgTime;
std::string monFile(tc->monitorDir + "/traffcounter_r");
printfd(__FILE__, "Monitor=%d file TRAFFCOUNTER %s\n", tc->monitoring, monFile.c_str());
touchTime = stgTime;
std::string monFile = monitorDir + "/traffcounter_p";
printfd(__FILE__, "Monitor=%d file TRAFFCOUNTER %s\n", monitoring, monFile.c_str());
touchTimeP = stgTime;
std::string monFile = monitorDir + "/traffcounter_p";
printfd(__FILE__, "Monitor=%d file TRAFFCOUNTER %s\n", monitoring, monFile.c_str());
touchTimeP = stgTime;
//printfd(__FILE__, "TRAFFCOUNTER::Process()\n");
//TODO replace find with lower_bound.
//printfd(__FILE__, "TRAFFCOUNTER::Process()\n");
//TODO replace find with lower_bound.
//-----------------------------------------------------------------------------
void TRAFFCOUNTER_IMPL::FlushAndRemove()
{
//-----------------------------------------------------------------------------
void TRAFFCOUNTER_IMPL::FlushAndRemove()
{
Packets::size_type oldPacketsSize = packets.size();
Index::size_type oldIp2packetsSize = ip2packets.size();
Packets::size_type oldPacketsSize = packets.size();
Index::size_type oldIp2packetsSize = ip2packets.size();
uint32_t uip = user->GetCurrIP();
std::pair<ip2p_iter, ip2p_iter> pi;
uint32_t uip = user->GetCurrIP();
std::pair<ip2p_iter, ip2p_iter> pi;
printfd(__FILE__, "DelUser: %s \n", inet_ntostring(uip).c_str());
std::pair<ip2p_iter, ip2p_iter> pi;
printfd(__FILE__, "DelUser: %s \n", inet_ntostring(uip).c_str());
std::pair<ip2p_iter, ip2p_iter> pi;
int * dirU, // Direction for incoming packet
int * dirD) const // Direction for outgoing packet
{
int * dirU, // Direction for incoming packet
int * dirD) const // Direction for outgoing packet
{
bool foundU = false; // Was rule for U found ?
bool foundD = false; // Was rule for D found ?
//printfd(__FILE__, "foundU=%d, foundD=%d\n", foundU, foundD);
bool foundU = false; // Was rule for U found ?
bool foundD = false; // Was rule for D found ?
//printfd(__FILE__, "foundU=%d, foundD=%d\n", foundU, foundD);
- r = sscanf(str,"%100s %100s %100s", tp, ta, td);
+ r = sscanf(str,"%99s %99s %99s", tp, ta, td);
if (r != 3)
{
printfd(__FILE__, "TRAFFCOUNTER_IMPL::ReadRules() - Error in file '%s' at line %d. There must be 3 parameters.\n", rulesFileName.c_str(), lineNumber);
if (r != 3)
{
printfd(__FILE__, "TRAFFCOUNTER_IMPL::ReadRules() - Error in file '%s' at line %d. There must be 3 parameters.\n", rulesFileName.c_str(), lineNumber);
//-----------------------------------------------------------------------------
int TRAFFCOUNTER_IMPL::Reload()
{
//-----------------------------------------------------------------------------
int TRAFFCOUNTER_IMPL::Reload()
{