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
22 * Author : Boris Mikhailenko <stg34@stargazer.dp.ua>
27 $Date: 2010/11/03 11:28:07 $
32 #include <sys/types.h>
33 #include <sys/socket.h>
34 #include <netinet/in.h>
35 #include <arpa/inet.h>
39 #include <cstdio> // fopen and similar
41 #include "stg/common.h"
42 #include "stg/locker.h"
43 #include "traffcounter_impl.h"
44 #include "stg_timer.h"
46 #define FLUSH_TIME (10)
47 #define REMOVE_TIME (31)
49 const char protoName[PROTOMAX][8] =
50 {"TCP", "UDP", "ICMP", "TCP_UDP", "ALL"};
54 tcp = 0, udp, icmp, tcp_udp, all
57 //-----------------------------------------------------------------------------
58 TRAFFCOUNTER_IMPL::TRAFFCOUNTER_IMPL(USERS * u, const TARIFFS *, const std::string & fn)
59 : WriteServLog(GetStgLogger()),
65 addUserNotifier(*this),
66 delUserNotifier(*this)
68 for (int i = 0; i < DIR_NUM; i++)
69 strprintf(&dirName[i], "DIR%d", i);
71 dirName[DIR_NUM] = "NULL";
73 users->AddNotifierUserAdd(&addUserNotifier);
74 users->AddNotifierUserDel(&delUserNotifier);
76 pthread_mutex_init(&mutex, NULL);
78 //-----------------------------------------------------------------------------
79 TRAFFCOUNTER_IMPL::~TRAFFCOUNTER_IMPL()
81 pthread_mutex_destroy(&mutex);
83 //-----------------------------------------------------------------------------
84 int TRAFFCOUNTER_IMPL::Start()
86 STG_LOCKER lock(&mutex, __FILE__, __LINE__);
93 printfd(__FILE__, "TRAFFCOUNTER_IMPL::Start() - Cannot read rules\n");
94 WriteServLog("TRAFFCOUNTER: Cannot read rules.");
98 printfd(__FILE__, "TRAFFCOUNTER::Start()\n");
99 int h = users->OpenSearch();
103 printfd(__FILE__, "TRAFFCOUNTER_IMPL::Start() - Cannot get users\n");
104 WriteServLog("TRAFFCOUNTER: Cannot get users.");
108 while (users->SearchNext(h, &u) == 0)
112 users->CloseSearch(h);
115 if (pthread_create(&thread, NULL, Run, this))
117 printfd(__FILE__, "TRAFFCOUNTER_IMPL::Start() - Cannot start thread\n");
118 WriteServLog("TRAFFCOUNTER: Error: Cannot start thread.");
123 //-----------------------------------------------------------------------------
124 int TRAFFCOUNTER_IMPL::Stop()
131 int h = users->OpenSearch();
134 WriteServLog("TRAFFCOUNTER: Fatal error: Cannot get users.");
139 while (users->SearchNext(h, &u) == 0)
141 UnSetUserNotifiers(u);
143 users->CloseSearch(h);
145 //5 seconds to thread stops itself
146 struct timespec ts = {0, 200000000};
147 for (int i = 0; i < 25 && !stopped; i++)
149 nanosleep(&ts, NULL);
152 //after 5 seconds waiting thread still running. now kill it
155 printfd(__FILE__, "kill TRAFFCOUNTER thread.\n");
156 if (pthread_kill(thread, SIGINT))
160 printfd(__FILE__, "TRAFFCOUNTER killed\n");
162 printfd(__FILE__, "TRAFFCOUNTER::Stop()\n");
166 //-----------------------------------------------------------------------------
167 void * TRAFFCOUNTER_IMPL::Run(void * data)
169 TRAFFCOUNTER_IMPL * tc = static_cast<TRAFFCOUNTER_IMPL *>(data);
173 time_t touchTime = stgTime - MONITOR_TIME_DELAY_SEC;
174 struct timespec ts = {0, 500000000};
180 tc->FlushAndRemove();
184 if (tc->monitoring && (touchTime + MONITOR_TIME_DELAY_SEC <= stgTime))
186 std::string monFile(tc->monitorDir + "/traffcounter_r");
187 printfd(__FILE__, "Monitor=%d file TRAFFCOUNTER %s\n", tc->monitoring, monFile.c_str());
189 TouchFile(monFile.c_str());
192 if (++c % FLUSH_TIME == 0)
193 tc->FlushAndRemove();
199 //-----------------------------------------------------------------------------
200 void TRAFFCOUNTER_IMPL::Process(const RAW_PACKET & rawPacket)
205 static time_t touchTime = stgTime - MONITOR_TIME_DELAY_SEC;
207 if (monitoring && (touchTime + MONITOR_TIME_DELAY_SEC <= stgTime))
209 static std::string monFile = monitorDir + "/traffcounter_p";
210 printfd(__FILE__, "Monitor=%d file TRAFFCOUNTER %s\n", monitoring, monFile.c_str());
212 TouchFile(monFile.c_str());
215 STG_LOCKER lock(&mutex, __FILE__, __LINE__);
217 //printfd(__FILE__, "TRAFFCOUNTER::Process()\n");
218 //TODO replace find with lower_bound.
220 // Searching a new packet in a tree.
221 pp_iter pi = packets.find(rawPacket);
223 // Packet found - update length and time
224 if (pi != packets.end())
226 pi->second.lenU += rawPacket.GetLen();
227 pi->second.lenD += rawPacket.GetLen();
228 pi->second.updateTime = stgTime;
229 /*printfd(__FILE__, "=============================\n");
230 printfd(__FILE__, "Packet found!\n");
231 printfd(__FILE__, "Version=%d\n", rawPacket.GetIPVersion());
232 printfd(__FILE__, "HeaderLen=%d\n", rawPacket.GetHeaderLen());
233 printfd(__FILE__, "PacketLen=%d\n", rawPacket.GetLen());
234 printfd(__FILE__, "SIP=%s\n", inet_ntostring(rawPacket.GetSrcIP()).c_str());
235 printfd(__FILE__, "DIP=%s\n", inet_ntostring(rawPacket.GetDstIP()).c_str());
236 printfd(__FILE__, "src port=%d\n", rawPacket.GetSrcPort());
237 printfd(__FILE__, "pst port=%d\n", rawPacket.GetDstPort());
238 printfd(__FILE__, "len=%d\n", rawPacket.GetLen());
239 printfd(__FILE__, "proto=%d\n", rawPacket.GetProto());
240 printfd(__FILE__, "PacketDirU=%d\n", pi->second.dirU);
241 printfd(__FILE__, "PacketDirD=%d\n", pi->second.dirD);
242 printfd(__FILE__, "=============================\n");*/
246 PACKET_EXTRA_DATA ed;
248 // Packet not found - add new packet
250 ed.updateTime = stgTime;
251 ed.flushTime = stgTime;
254 userU is that whose user_ip == packet_ip_src
255 userD is that whose user_ip == packet_ip_dst
258 uint32_t ipU = rawPacket.GetSrcIP();
259 uint32_t ipD = rawPacket.GetDstIP();
261 // Searching users with such IP
262 if (users->FindByIPIdx(ipU, &ed.userU) == 0)
264 ed.userUPresent = true;
267 if (users->FindByIPIdx(ipD, &ed.userD) == 0)
269 ed.userDPresent = true;
272 if (ed.userUPresent ||
275 DeterminateDir(rawPacket, &ed.dirU, &ed.dirD);
277 ed.lenD = ed.lenU = rawPacket.GetLen();
279 //TODO use result of lower_bound to inserting new record
281 // Adding packet to a tree.
282 std::pair<pp_iter, bool> insertResult = packets.insert(std::make_pair(rawPacket, ed));
283 pp_iter newPacket = insertResult.first;
285 // Adding packet reference to an IP index.
286 ip2packets.insert(std::make_pair(ipU, newPacket));
287 ip2packets.insert(std::make_pair(ipD, newPacket));
290 //-----------------------------------------------------------------------------
291 void TRAFFCOUNTER_IMPL::FlushAndRemove()
293 STG_LOCKER lock(&mutex, __FILE__, __LINE__);
295 int oldPacketsSize = packets.size();
296 int oldIp2packetsSize = ip2packets.size();
299 pi = packets.begin();
300 std::map<RAW_PACKET, PACKET_EXTRA_DATA> newPackets;
301 ip2packets.erase(ip2packets.begin(), ip2packets.end());
302 while (pi != packets.end())
305 if (stgTime - pi->second.flushTime > FLUSH_TIME)
307 if (pi->second.userUPresent)
309 //printfd(__FILE__, "+++ Flushing U user %s (%s:%d) of length %d\n", pi->second.userU->GetLogin().c_str(), inet_ntostring(pi->first.GetSrcIP()).c_str(), pi->first.GetSrcPort(), pi->second.lenU);
312 if (pi->second.dirU < DIR_NUM)
314 #ifdef TRAFF_STAT_WITH_PORTS
315 pi->second.userU->AddTraffStatU(pi->second.dirU,
316 pi->first.GetDstIP(),
317 pi->first.GetDstPort(),
320 pi->second.userU->AddTraffStatU(pi->second.dirU,
321 pi->first.GetDstIP(),
327 pi->second.flushTime = stgTime;
330 if (pi->second.userDPresent)
332 //printfd(__FILE__, "+++ Flushing D user %s (%s:%d) of length %d\n", pi->second.userD->GetLogin().c_str(), inet_ntostring(pi->first.GetDstIP()).c_str(), pi->first.GetDstPort(), pi->second.lenD);
335 if (pi->second.dirD < DIR_NUM)
337 #ifdef TRAFF_STAT_WITH_PORTS
338 pi->second.userD->AddTraffStatD(pi->second.dirD,
339 pi->first.GetSrcIP(),
340 pi->first.GetSrcPort(),
343 pi->second.userD->AddTraffStatD(pi->second.dirD,
344 pi->first.GetSrcIP(),
350 pi->second.flushTime = stgTime;
355 if (stgTime - pi->second.updateTime > REMOVE_TIME)
357 // Remove packet and references from ip2packets index
358 //printfd(__FILE__, "+++ Removing +++\n");
359 pair<ip2p_iter, ip2p_iter> be(
360 ip2packets.equal_range(pi->first.GetSrcIP()));
361 while (be.first != be.second)
363 // Have a reference to a packet?
364 if (be.first->second == pi)
366 ip2packets.erase(be.first++);
367 //printfd(__FILE__, "Remove U from ip2packets %s\n", inet_ntostring(pi->first.GetSrcIP()).c_str());
375 //printfd(__FILE__, "-------------------\n");
376 be = ip2packets.equal_range(pi->first.GetDstIP());
377 while (be.first != be.second)
379 // Have a reference to a packet?
380 if (be.first->second == pi)
382 ip2packets.erase(be.first++);
383 //printfd(__FILE__, "Remove D from ip2packets %s\n", inet_ntostring(pi->first.GetDstIP()).c_str());
390 //printfd(__FILE__, "Remove packet\n");
397 if (stgTime - pi->second.updateTime < REMOVE_TIME)
399 std::pair<pp_iter, bool> res = newPackets.insert(*pi);
402 ip2packets.insert(std::make_pair(pi->first.GetSrcIP(), res.first));
403 ip2packets.insert(std::make_pair(pi->first.GetDstIP(), res.first));
408 swap(packets, newPackets);
409 printfd(__FILE__, "FlushAndRemove() packets: %d(rem %d) ip2packets: %d(rem %d)\n",
411 oldPacketsSize - packets.size(),
413 oldIp2packetsSize - ip2packets.size());
416 //-----------------------------------------------------------------------------
417 void TRAFFCOUNTER_IMPL::AddUser(USER_PTR user)
419 printfd(__FILE__, "AddUser: %s\n", user->GetLogin().c_str());
420 uint32_t uip = user->GetCurrIP();
421 std::pair<ip2p_iter, ip2p_iter> pi;
423 STG_LOCKER lock(&mutex, __FILE__, __LINE__);
424 // Find all packets with IP belongs to this user
425 pi = ip2packets.equal_range(uip);
427 while (pi.first != pi.second)
429 if (pi.first->second->first.GetSrcIP() == uip)
431 assert((!pi.first->second->second.userUPresent ||
432 pi.first->second->second.userU == user) &&
433 "U user present but it's not current user");
435 pi.first->second->second.lenU = 0;
436 pi.first->second->second.userU = user;
437 pi.first->second->second.userUPresent = true;
440 if (pi.first->second->first.GetDstIP() == uip)
442 assert((!pi.first->second->second.userDPresent ||
443 pi.first->second->second.userD == user) &&
444 "D user present but it's not current user");
446 pi.first->second->second.lenD = 0;
447 pi.first->second->second.userD = user;
448 pi.first->second->second.userDPresent = true;
454 //-----------------------------------------------------------------------------
455 void TRAFFCOUNTER_IMPL::DelUser(uint32_t uip)
457 printfd(__FILE__, "DelUser: %s \n", inet_ntostring(uip).c_str());
458 std::pair<ip2p_iter, ip2p_iter> pi;
460 STG_LOCKER lock(&mutex, __FILE__, __LINE__);
461 pi = ip2packets.equal_range(uip);
463 while (pi.first != pi.second)
465 if (pi.first->second->first.GetSrcIP() == uip)
467 if (pi.first->second->second.dirU < DIR_NUM && pi.first->second->second.userUPresent)
469 #ifdef TRAFF_STAT_WITH_PORTS
470 pi.first->second->second.userU->AddTraffStatU(pi.first->second->second.dirU,
471 pi.first->second->first.GetDstIP(),
472 pi.first->second->first.GetDstPort(),
473 pi.first->second->second.lenU);
475 pi.first->second->second.userU->AddTraffStatU(pi.first->second->second.dirU,
476 pi.first->second->first.GetDstIP(),
477 pi.first->second->second.lenU);
480 pi.first->second->second.userUPresent = false;
483 if (pi.first->second->first.GetDstIP() == uip)
485 if (pi.first->second->second.dirD < DIR_NUM && pi.first->second->second.userDPresent)
487 #ifdef TRAFF_STAT_WITH_PORTS
488 pi.first->second->second.userD->AddTraffStatD(pi.first->second->second.dirD,
489 pi.first->second->first.GetSrcIP(),
490 pi.first->second->first.GetSrcPort(),
491 pi.first->second->second.lenD);
493 pi.first->second->second.userD->AddTraffStatD(pi.first->second->second.dirD,
494 pi.first->second->first.GetSrcIP(),
495 pi.first->second->second.lenD);
499 pi.first->second->second.userDPresent = false;
505 ip2packets.erase(pi.first, pi.second);
507 //-----------------------------------------------------------------------------
508 void TRAFFCOUNTER_IMPL::SetUserNotifiers(USER_PTR user)
510 // Adding user. Adding notifiers to user.
511 TRF_IP_BEFORE ipBNotifier(*this, user);
512 ipBeforeNotifiers.push_front(ipBNotifier);
513 user->AddCurrIPBeforeNotifier(&(*ipBeforeNotifiers.begin()));
515 TRF_IP_AFTER ipANotifier(*this, user);
516 ipAfterNotifiers.push_front(ipANotifier);
517 user->AddCurrIPAfterNotifier(&(*ipAfterNotifiers.begin()));
519 //-----------------------------------------------------------------------------
520 void TRAFFCOUNTER_IMPL::UnSetUserNotifiers(USER_PTR user)
522 // Removing user. Removing notifiers from user.
523 std::list<TRF_IP_BEFORE>::iterator bi;
524 std::list<TRF_IP_AFTER>::iterator ai;
526 bi = ipBeforeNotifiers.begin();
527 while (bi != ipBeforeNotifiers.end())
529 if (user->GetLogin() == bi->GetUser()->GetLogin())
531 user->DelCurrIPBeforeNotifier(&(*bi));
532 ipBeforeNotifiers.erase(bi);
538 ai = ipAfterNotifiers.begin();
539 while (ai != ipAfterNotifiers.end())
541 if (user->GetLogin() == ai->GetUser()->GetLogin())
543 user->DelCurrIPAfterNotifier(&(*ai));
544 ipAfterNotifiers.erase(ai);
550 //-----------------------------------------------------------------------------
551 void TRAFFCOUNTER_IMPL::DeterminateDir(const RAW_PACKET & packet,
552 int * dirU, // Direction for incoming packet
553 int * dirD) const // Direction for outgoing packet
559 bool foundU = false; // Was rule for U found ?
560 bool foundD = false; // Was rule for D found ?
561 //printfd(__FILE__, "foundU=%d, foundD=%d\n", foundU, foundD);
563 enum { ICMP_RPOTO = 1, TCP_PROTO = 6, UDP_PROTO = 17 };
565 std::list<RULE>::const_iterator ln;
568 while (ln != rules.end())
582 portMatchU = (packet.GetProto() == ICMP_RPOTO);
586 if (packet.GetProto() == TCP_PROTO || packet.GetProto() == UDP_PROTO)
587 portMatchU = (packet.GetDstPort() >= ln->port1) && (packet.GetDstPort() <= ln->port2);
591 if (packet.GetProto() == TCP_PROTO)
592 portMatchU = (packet.GetDstPort() >= ln->port1) && (packet.GetDstPort() <= ln->port2);
596 if (packet.GetProto() == UDP_PROTO)
597 portMatchU = (packet.GetDstPort() >= ln->port1) && (packet.GetDstPort() <= ln->port2);
601 printfd(__FILE__, "Error! Incorrect rule!\n");
605 addrMatchU = (packet.GetDstIP() & ln->mask) == ln->ip;
607 if (!foundU && addrMatchU && portMatchU)
611 //printfd(__FILE__, "Up rule ok! %d\n", ln->dir);
612 //PrintRule(ln->rule);
629 portMatchD = (packet.GetProto() == ICMP_RPOTO);
633 if (packet.GetProto() == TCP_PROTO || packet.GetProto() == UDP_PROTO)
634 portMatchD = (packet.GetSrcPort() >= ln->port1) && (packet.GetSrcPort() <= ln->port2);
638 if (packet.GetProto() == TCP_PROTO)
639 portMatchD = (packet.GetSrcPort() >= ln->port1) && (packet.GetSrcPort() <= ln->port2);
643 if (packet.GetProto() == UDP_PROTO)
644 portMatchD = (packet.GetSrcPort() >= ln->port1) && (packet.GetSrcPort() <= ln->port2);
648 printfd(__FILE__, "Error! Incorrect rule!\n");
652 addrMatchD = (packet.GetSrcIP() & ln->mask) == ln->ip;
654 if (!foundD && addrMatchD && portMatchD)
658 //printfd(__FILE__, "Down rule ok! %d\n", ln->dir);
659 //PrintRule(ln->rule);
664 } //while (ln != rules.end())
674 //-----------------------------------------------------------------------------
675 void TRAFFCOUNTER_IMPL::SetRulesFile(const std::string & fn)
679 //-----------------------------------------------------------------------------
680 bool TRAFFCOUNTER_IMPL::ReadRules(bool test)
682 //printfd(__FILE__, "TRAFFCOUNTER::ReadRules()\n");
687 char tp[100]; // protocol
688 char ta[100]; // address
689 char td[100]; // target direction
692 f = fopen(rulesFileName.c_str(), "rt");
696 printfd(__FILE__, "TRAFFCOUNTER_IMPL::ReadRules() - File '%s' cannot be opened.\n", rulesFileName.c_str());
697 WriteServLog("File '%s' cannot be oppened.", rulesFileName.c_str());
701 while (fgets(str, 1023, f))
704 if (str[strspn(str," \t")] == '#' || str[strspn(str," \t")] == '\n')
709 r = sscanf(str,"%s %s %s", tp, ta, td);
712 printfd(__FILE__, "TRAFFCOUNTER_IMPL::ReadRules() - Error in file '%s' at line %d. There must be 3 parameters.\n", rulesFileName.c_str(), lineNumber);
713 WriteServLog("Error in file '%s' at line %d. There must be 3 parameters.", rulesFileName.c_str(), lineNumber);
721 for (int i = 0; i < PROTOMAX; i++)
723 if (strcasecmp(tp, protoName[i]) == 0)
727 for (int i = 0; i < DIR_NUM + 1; i++)
729 if (td == dirName[i])
733 if (rul.dir == 0xff || rul.proto == 0xff)
735 printfd(__FILE__, "TRAFFCOUNTER_IMPL::ReadRules() - Error in file '%s' at line %d.\n", rulesFileName.c_str(), lineNumber);
736 WriteServLog("Error in file %s. Line %d.",
737 rulesFileName.c_str(), lineNumber);
742 if (ParseAddress(ta, &rul) != 0)
744 printfd(__FILE__, "TRAFFCOUNTER_IMPL::ReadRules() - Error in file '%s' at line %d. Error in adress.\n", rulesFileName.c_str(), lineNumber);
745 WriteServLog("Error in file %s. Error in adress. Line %d.",
746 rulesFileName.c_str(), lineNumber);
751 rules.push_back(rul);
757 // Adding lastest rule: ALL 0.0.0.0/0 NULL
758 rul.dir = DIR_NUM; //NULL
759 rul.ip = 0; //0.0.0.0
766 rules.push_back(rul);
772 //-----------------------------------------------------------------------------
773 int TRAFFCOUNTER_IMPL::Reload()
775 STG_LOCKER lock(&mutex, __FILE__, __LINE__);
779 printfd(__FILE__, "TRAFFCOUNTER_IMPL::Reload() - Failed to reload rules.\n");
780 WriteServLog("TRAFFCOUNTER: Cannot reload rules. Errors found.");
786 printfd(__FILE__, "TRAFFCOUNTER_IMPL::Reload() - Reload rules successfull.\n");
787 WriteServLog("TRAFFCOUNTER: Reload rules successfull.");
790 //-----------------------------------------------------------------------------
791 bool TRAFFCOUNTER_IMPL::ParseAddress(const char * ta, RULE * rule) const
793 char addr[50], mask[20], port1[20], port2[20], ports[40];
795 int len = strlen(ta);
798 memset(addr, 0, sizeof(addr));
799 for (i = 0; i < len; i++)
801 if (ta[i] == '/' || ta[i] == ':')
839 if (!(rule->proto == tcp || rule->proto == udp || rule->proto == tcp_udp))
841 printfd(__FILE__, "TRAFFCOUNTER_IMPL::ParseAddress() - No ports specified for this protocol.\n");
842 WriteServLog("No ports specified for this protocol.");
847 ports[i - p] = ta[i];
853 strcpy(ports, "0-65535");
860 if ((sss = strchr(ports, '-')) != NULL)
862 strncpy(port1, ports, int(sss-ports));
863 port1[int(sss - ports)] = 0;
864 strcpy(port2, sss + 1);
868 strcpy(port1, ports);
869 strcpy(port2, ports);
872 // Convert strings to mask, ports and IP
877 msk = strtol(mask, &res, 10);
881 prt1 = strtol(port1, &res, 10);
885 prt2 = strtol(port2, &res, 10);
889 int r = inet_aton(addr, (struct in_addr*)&ip);
894 rule->mask = CalcMask(msk);
896 //printfd(__FILE__, "msk=%d mask=%08X mask=%08X\n", msk, rule->mask, (0xFFffFFff << (32 - msk)));
898 if ((ip & rule->mask) != ip)
900 printfd(__FILE__, "TRAFFCOUNTER_IMPL::ParseAddress() - Address does'n match mask.\n");
901 WriteServLog("Address does'n match mask.");
910 //-----------------------------------------------------------------------------
911 uint32_t TRAFFCOUNTER_IMPL::CalcMask(uint32_t msk) const
913 if (msk >= 32) return 0xFFffFFff;
914 if (msk == 0) return 0;
915 return htonl(0xFFffFFff << (32 - msk));
917 //---------------------------------------------------------------------------
918 void TRAFFCOUNTER_IMPL::FreeRules()
922 //-----------------------------------------------------------------------------
923 void TRAFFCOUNTER_IMPL::PrintRule(RULE rule) const
925 printf("%15s ", inet_ntostring(rule.ip).c_str());
926 printf("mask=%08X ", rule.mask);
927 printf("port1=%5d ", rule.port1);
928 printf("port2=%5d ", rule.port2);
947 printf("dir=%d \n", rule.dir);
950 //-----------------------------------------------------------------------------
951 void TRAFFCOUNTER_IMPL::SetMonitorDir(const std::string & monitorDir)
953 TRAFFCOUNTER_IMPL::monitorDir = monitorDir;
954 monitoring = (monitorDir != "");
956 //-----------------------------------------------------------------------------