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 : Maxim Mamontov <faust@stargazer.dp.ua>
27 #ifndef __USERSTAT_H__
28 #define __USERSTAT_H__
35 #include <netinet/in.h>
37 #include "base_plugin.h"
39 #define USTAT_VERSION "UserStats 1.0_alt"
41 extern "C" BASE_PLUGIN * GetPlugin();
43 class USERSTAT : public BASE_PLUGIN
49 virtual void SetUsers(USERS * u) { users = u; };
50 virtual void SetTariffs(TARIFFS * t) {};
51 virtual void SetAdmins(ADMINS * a) {};
52 virtual void SetTraffcounter(TRAFFCOUNTER * tc) {};
53 virtual void SetStore(BASE_STORE * st) { store = st; };
54 virtual void SetStgSettings(const SETTINGS * s) {};
55 virtual void SetSettings(const MODULE_SETTINGS & s) { settings = s; };
56 virtual int ParseSettings();
60 virtual bool IsRunning() { return isRunning; };
61 virtual const string & GetStrError() const { return errorStr; };
62 virtual const string GetVersion() const { return version; };
63 virtual uint16_t GetStartPosition() const { return 0; };
64 virtual uint16_t GetStopPosition() const { return 0; };
67 struct IsDone : public unary_function<DataThread, bool>
69 bool operator()(const DataThread & info) { return info.IsDone(); };
71 struct ToLower : public unary_function<char, char>
73 char operator() (char c) const { return std::tolower(c); }
79 std::vector<DataThread> pool;
84 struct sockaddr_in listenAddr;
86 pthread_mutex_t mutex;
90 MODULE_SETTINGS settings;
94 static void * Run(void *);
95 static void * Operate(void *);