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 $
36 #include "resetable.h"
37 #include "user_traff.h"
38 //-----------------------------------------------------------------------------
41 #ifdef TRAFF_STAT_WITH_PORTS
42 IP_DIR_PAIR(uint32_t _ip,
50 IP_DIR_PAIR(uint32_t _ip,
56 //------------------------
57 bool operator<(const IP_DIR_PAIR & idp) const
65 #ifdef TRAFF_STAT_WITH_PORTS
78 //------------------------
79 bool operator!=(const IP_DIR_PAIR & rvalue) const
84 #ifdef TRAFF_STAT_WITH_PORTS
85 if (port != rvalue.port)
89 if (dir != rvalue.dir)
94 //------------------------
97 #ifdef TRAFF_STAT_WITH_PORTS
101 //-----------------------------------------------------------------------------
104 STAT_NODE(uint64_t _up,
115 //-----------------------------------------------------------------------------
132 DIR_TRAFF sessionDown;
138 time_t lastCashAddTime;
140 time_t lastActivityTime;
142 //-----------------------------------------------------------------------------
143 typedef std::map<IP_DIR_PAIR, STAT_NODE> TRAFF_STAT;
144 //-----------------------------------------------------------------------------
145 typedef std::pair<double, std::string> CASH_INFO;
146 //-----------------------------------------------------------------------------
162 USER_STAT_RES & operator= (const USER_STAT & us)
166 lastCashAdd = us.lastCashAdd;
167 lastCashAddTime = us.lastCashAddTime;
168 passiveTime = us.passiveTime;
169 lastActivityTime = us.lastActivityTime;
170 sessionUp = us.sessionUp;
171 sessionDown = us.sessionDown;
172 monthUp = us.monthUp;
173 monthDown = us.monthDown;
176 USER_STAT GetData() const
179 us.cash = cash.data();
180 us.freeMb = freeMb.data();
181 us.lastCashAdd = lastCashAdd.data();
182 us.lastCashAddTime = lastCashAddTime.data();
183 us.passiveTime = passiveTime.data();
184 us.lastActivityTime = lastActivityTime.data();
185 us.sessionUp = sessionUp.GetData();
186 us.sessionDown = sessionDown.GetData();
187 us.monthUp = monthUp.GetData();
188 us.monthDown = monthDown.GetData();
192 RESETABLE<double> cash;
193 RESETABLE<CASH_INFO> cashAdd;
194 RESETABLE<CASH_INFO> cashSet;
195 RESETABLE<double> freeMb;
196 RESETABLE<double> lastCashAdd;
197 RESETABLE<time_t> lastCashAddTime;
198 RESETABLE<time_t> passiveTime;
199 RESETABLE<time_t> lastActivityTime;
200 DIR_TRAFF_RES sessionUp;
201 DIR_TRAFF_RES sessionDown;
202 DIR_TRAFF_RES monthUp;
203 DIR_TRAFF_RES monthDown;
205 //-----------------------------------------------------------------------------