3 $Date: 2009/06/23 11:32:28 $
14 #include "base_plugin.h"
18 #include "../../../users.h"
22 extern "C" BASE_PLUGIN * GetPlugin();
25 //-----------------------------------------------------------------------------*/
26 class CHG_CURRIP_NOTIFIER_PING: public PROPERTY_NOTIFIER_BASE<uint32_t>
29 void Notify(const uint32_t & oldIP, const uint32_t & newIP);
30 void SetUser(user_iter u) { user = u; }
31 user_iter GetUser() {return user; }
32 void SetPinger(const PING * p) { ping = p; }
38 //-----------------------------------------------------------------------------
39 class CHG_IPS_NOTIFIER_PING: public PROPERTY_NOTIFIER_BASE<USER_IPS>
42 void Notify(const USER_IPS & oldIPS, const USER_IPS & newIPS);
43 void SetUser(user_iter u) { user = u; }
44 user_iter GetUser() {return user; }
45 void SetPinger(const PING * p) { ping = p; }
51 //-----------------------------------------------------------------------------
52 class ADD_USER_NONIFIER_PING: public NOTIFIER_BASE<user_iter>
55 ADD_USER_NONIFIER_PING(){};
56 virtual ~ADD_USER_NONIFIER_PING(){};
58 void SetPinger(PING * p) { ping = p; }
59 void Notify(const user_iter & user);
64 //-----------------------------------------------------------------------------
65 class DEL_USER_NONIFIER_PING: public NOTIFIER_BASE<user_iter>
68 DEL_USER_NONIFIER_PING(){};
69 virtual ~DEL_USER_NONIFIER_PING(){};
71 void SetPinger(PING * p) { ping = p; }
72 void Notify(const user_iter & user);
77 //-----------------------------------------------------------------------------
82 virtual ~PING_SETTINGS(){};
83 const string& GetStrError() const { return errorStr; }
84 int ParseSettings(const MODULE_SETTINGS & s);
85 int GetPingDelay(){ return pingDelay; };
87 int ParseIntInRange(const string & str, int min, int max, int * val);
89 mutable string errorStr;
91 //-----------------------------------------------------------------------------
92 class PING: public BASE_PLUGIN
94 friend class CHG_CURRIP_NOTIFIER_PING;
95 friend class CHG_IPS_NOTIFIER_PING;
100 void SetUsers(USERS * u);
101 void SetTariffs(TARIFFS *){};
102 void SetAdmins(ADMINS *){};
103 void SetTraffcounter(TRAFFCOUNTER *){};
104 void SetStore(BASE_STORE *){};
105 void SetStgSettings(const SETTINGS *){};
106 void SetSettings(const MODULE_SETTINGS & s);
111 int Reload() { return 0; };
114 const string & GetStrError() const;
115 const string GetVersion() const;
116 uint16_t GetStartPosition() const;
117 uint16_t GetStopPosition() const;
119 void AddUser(user_iter u);
120 void DelUser(user_iter u);
124 void SetUserNotifiers(user_iter u);
125 void UnSetUserNotifiers(user_iter u);
126 static void * Run(void * d);
127 mutable string errorStr;
128 PING_SETTINGS pingSettings;
129 MODULE_SETTINGS settings;
131 list<user_iter> usersList;
134 ÍÙ ÄÏÌÖÎÙ ÐÅÒÅÐÒÏ×ÅÒÉÔØ ×ÏÚÍÏÖÎÏÓÔØ ÐÉÎÇÏ×ÁÎÉÑ ÀÚÅÒÁ ÐÒÉ ÉÚÍÅÎÅÎÉÉ
135 ÓÌÅÄÕÀÝÉÈ ÅÇÏ ÐÁÒÁÍÅÔÒÏ×:
140 pthread_mutex_t mutex;
143 mutable STG_PINGER pinger;
145 list<CHG_CURRIP_NOTIFIER_PING> ChgCurrIPNotifierList;
146 list<CHG_IPS_NOTIFIER_PING> ChgIPNotifierList;
148 ADD_USER_NONIFIER_PING onAddUserNotifier;
149 DEL_USER_NONIFIER_PING onDelUserNotifier;
151 //-----------------------------------------------------------------------------