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 SetStore(BASE_STORE * st) { store = st; }
51 virtual void SetSettings(const MODULE_SETTINGS & s) { settings = s; }
52 virtual int ParseSettings();
56 virtual bool IsRunning() { return isRunning; }
57 virtual const string & GetStrError() const { return errorStr; }
58 virtual const string GetVersion() const { return version; }
59 virtual uint16_t GetStartPosition() const { return 10; }
60 virtual uint16_t GetStopPosition() const { return 10; }
63 struct IsDone : public unary_function<DataThread, bool>
65 bool operator()(const DataThread & info) { return info.IsDone(); }
67 struct ToLower : public unary_function<char, char>
69 char operator() (char c) const { return std::tolower(c); }
75 std::vector<DataThread> pool;
80 struct sockaddr_in listenAddr;
82 pthread_mutex_t mutex;
86 MODULE_SETTINGS settings;
90 static void * Run(void *);
91 static void * Operate(void *);