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 //-----------------------------------------------------------------------------
130 DIR_TRAFF sessionDown;
136 time_t lastCashAddTime;
138 time_t lastActivityTime;
140 //-----------------------------------------------------------------------------
141 typedef std::map<IP_DIR_PAIR, STAT_NODE> TRAFF_STAT;
142 //-----------------------------------------------------------------------------
158 USER_STAT_RES & operator= (const USER_STAT & us)
162 lastCashAdd = us.lastCashAdd;
163 lastCashAddTime = us.lastCashAddTime;
164 passiveTime = us.passiveTime;
165 lastActivityTime = us.lastActivityTime;
166 sessionUp = us.sessionUp;
167 sessionDown = us.sessionDown;
168 monthUp = us.monthUp;
169 monthDown = us.monthDown;
172 USER_STAT GetData() const
175 us.cash = cash.data();
176 us.freeMb = freeMb.data();
177 us.lastCashAdd = lastCashAdd.data();
178 us.lastCashAddTime = lastCashAddTime.data();
179 us.passiveTime = passiveTime.data();
180 us.lastActivityTime = lastActivityTime.data();
181 us.sessionUp = sessionUp.GetData();
182 us.sessionDown = sessionDown.GetData();
183 us.monthUp = monthUp.GetData();
184 us.monthDown = monthDown.GetData();
188 RESETABLE<double> cash;
189 RESETABLE<double> freeMb;
190 RESETABLE<double> lastCashAdd;
191 RESETABLE<time_t> lastCashAddTime;
192 RESETABLE<time_t> passiveTime;
193 RESETABLE<time_t> lastActivityTime;
194 DIR_TRAFF_RES sessionUp;
195 DIR_TRAFF_RES sessionDown;
196 DIR_TRAFF_RES monthUp;
197 DIR_TRAFF_RES monthDown;
199 //-----------------------------------------------------------------------------