X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/641204dfbdb9fc870cdd2e7f9e3169a44693e7bf..2e6fab3ee7df25d343fb30b006126e7817dfeb12:/projects/stargazer/plugins/other/userstat/userstat.h?ds=inline diff --git a/projects/stargazer/plugins/other/userstat/userstat.h b/projects/stargazer/plugins/other/userstat/userstat.h index 83f66202..1c5776f8 100644 --- a/projects/stargazer/plugins/other/userstat/userstat.h +++ b/projects/stargazer/plugins/other/userstat/userstat.h @@ -19,47 +19,26 @@ */ /* - $Revision: 1.1 $ - $Date: 2008/07/05 12:35:53 $ - $Author: faust $ + $Revision: $ + $Date: $ + $Author: $ */ #ifndef __USERSTAT_H__ #define __USERSTAT_H__ -#include +#include +#include +#include + #include #include #include "base_plugin.h" -extern "C" BASE_PLUGIN * GetPlugin(); - -struct THREAD_INFO -{ - pthread_t thread; - USERS * users; - BASE_STORE * store; - int outerSocket; - bool done; -}; - -uint32_t n2l(unsigned char * c) -{ - uint32_t t = *c++ << 24; - t += *c++ << 16; - t += *c++ << 8; - t += *c; - return t; -} +#define USTAT_VERSION "UserStats 1.0_alt" -void l2n(uint32_t t, unsigned char * c) -{ - *c++ = t >> 24 & 0x000000FF; - *c++ = t >> 16 & 0x000000FF; - *c++ = t >> 8 & 0x000000FF; - *c++ = t & 0x000000FF; -} +extern "C" BASE_PLUGIN * GetPlugin(); class USERSTAT : public BASE_PLUGIN { @@ -67,27 +46,23 @@ public: USERSTAT(); ~USERSTAT(); - virtual void SetUsers(USERS * u) { users = u; }; - virtual void SetTariffs(TARIFFS * t) {}; - virtual void SetAdmins(ADMINS * a) {}; - virtual void SetTraffcounter(TRAFFCOUNTER * tc) {}; - virtual void SetStore(BASE_STORE * st) { store = st; }; - virtual void SetStgSettings(const SETTINGS * s) {}; - virtual void SetSettings(const MODULE_SETTINGS & s) { settings = s; }; + virtual void SetUsers(USERS * u) { users = u; } + virtual void SetStore(BASE_STORE * st) { store = st; } + virtual void SetSettings(const MODULE_SETTINGS & s) { settings = s; } virtual int ParseSettings(); virtual int Start(); virtual int Stop(); - virtual bool IsRunning() { return isRunning; }; - virtual const string & GetStrError() const { return errorStr; }; - virtual const string GetVersion() const { return version; }; - virtual uint16_t GetStartPosition() const { return 0; }; - virtual uint16_t GetStopPosition() const { return 0; }; + virtual bool IsRunning() { return isRunning; } + virtual const string & GetStrError() const { return errorStr; } + virtual const string GetVersion() const { return version; } + virtual uint16_t GetStartPosition() const { return 0; } + virtual uint16_t GetStopPosition() const { return 0; } private: - struct IsDone : public unary_function + struct IsDone : public unary_function { - bool operator()(const THREAD_INFO & info) { return info.done; }; + bool operator()(const DataThread & info) { return info.IsDone(); } }; struct ToLower : public unary_function { @@ -97,7 +72,7 @@ private: bool nonstop; std::string errorStr; std::string version; - std::vector pool; + std::vector pool; int listenSocket; int threads; unsigned maxThreads; @@ -110,15 +85,10 @@ private: MODULE_SETTINGS settings; - XML_Parser xmlParser; - int Prepare(); int Finalize(); static void * Run(void *); static void * Operate(void *); - - friend void ParseXMLStart(void * data, char * name, char ** attr); - friend void ParseXMLEnd(void * data, char * name); }; #endif