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
18 * Author : Boris Mikhailenko <stg34@stargazer.dp.ua>
23 $Date: 2010/03/11 14:42:05 $
34 #include "resetable.h"
35 #include "user_traff.h"
36 //-----------------------------------------------------------------------------
39 #ifdef TRAFF_STAT_WITH_PORTS
40 IP_DIR_PAIR(uint32_t _ip,
48 IP_DIR_PAIR(uint32_t _ip,
54 //------------------------
55 bool operator<(const IP_DIR_PAIR & idp) const
63 #ifdef TRAFF_STAT_WITH_PORTS
76 //------------------------
77 bool operator!=(const IP_DIR_PAIR & rvalue) const
82 #ifdef TRAFF_STAT_WITH_PORTS
83 if (port != rvalue.port)
87 if (dir != rvalue.dir)
92 //------------------------
95 #ifdef TRAFF_STAT_WITH_PORTS
99 //-----------------------------------------------------------------------------
102 STAT_NODE(uint64_t _up,
113 //-----------------------------------------------------------------------------
132 time_t lastCashAddTime;
134 time_t lastActivityTime;
136 //-----------------------------------------------------------------------------
137 typedef std::map<IP_DIR_PAIR, STAT_NODE> TRAFF_STAT;
138 //-----------------------------------------------------------------------------
152 USER_STAT_RES & operator= (const USER_STAT & us)
156 lastCashAdd = us.lastCashAdd;
157 lastCashAddTime = us.lastCashAddTime;
158 passiveTime = us.passiveTime;
159 lastActivityTime = us.lastActivityTime;
164 USER_STAT GetData() const
167 us.cash = cash.data();
168 us.freeMb = freeMb.data();
169 us.lastCashAdd = lastCashAdd.data();
170 us.lastCashAddTime = lastCashAddTime.data();
171 us.passiveTime = passiveTime.data();
172 us.lastActivityTime = lastActivityTime.data();
174 us.down = down.data();
178 RESETABLE<double> cash;
179 RESETABLE<double> freeMb;
180 RESETABLE<double> lastCashAdd;
181 RESETABLE<time_t> lastCashAddTime;
182 RESETABLE<time_t> passiveTime;
183 RESETABLE<time_t> lastActivityTime;
184 RESETABLE<DIR_TRAFF> up;
185 RESETABLE<DIR_TRAFF> down;
187 //-----------------------------------------------------------------------------