3 $Date: 2009/06/23 11:32:28 $
15 #include "base_plugin.h"
19 #include "../../../users.h"
23 extern "C" BASE_PLUGIN * GetPlugin();
26 //-----------------------------------------------------------------------------*/
27 class CHG_CURRIP_NOTIFIER_PING: public PROPERTY_NOTIFIER_BASE<uint32_t>
30 CHG_CURRIP_NOTIFIER_PING(const PING & p, user_iter u) : user(u), ping(p) {}
31 void Notify(const uint32_t & oldIP, const uint32_t & newIP);
32 user_iter GetUser() { return user; }
38 //-----------------------------------------------------------------------------
39 class CHG_IPS_NOTIFIER_PING: public PROPERTY_NOTIFIER_BASE<USER_IPS>
42 CHG_IPS_NOTIFIER_PING(const PING & p, user_iter u) : user(u), ping(p) {}
43 void Notify(const USER_IPS & oldIPS, const USER_IPS & newIPS);
44 user_iter GetUser() { return user; }
50 //-----------------------------------------------------------------------------
51 class ADD_USER_NONIFIER_PING: public NOTIFIER_BASE<user_iter>
54 ADD_USER_NONIFIER_PING(PING & p) : ping(p) {}
55 virtual ~ADD_USER_NONIFIER_PING() {}
56 void Notify(const user_iter & user);
61 //-----------------------------------------------------------------------------
62 class DEL_USER_NONIFIER_PING: public NOTIFIER_BASE<user_iter>
65 DEL_USER_NONIFIER_PING(PING & p) : ping(p) {}
66 virtual ~DEL_USER_NONIFIER_PING() {}
67 void Notify(const user_iter & user);
72 //-----------------------------------------------------------------------------
77 virtual ~PING_SETTINGS() {}
78 const string& GetStrError() const { return errorStr; }
79 int ParseSettings(const MODULE_SETTINGS & s);
80 int GetPingDelay() const { return pingDelay; }
82 int ParseIntInRange(const string & str, int min, int max, int * val);
85 mutable string errorStr;
87 //-----------------------------------------------------------------------------
88 class PING: public BASE_PLUGIN
90 friend class CHG_CURRIP_NOTIFIER_PING;
91 friend class CHG_IPS_NOTIFIER_PING;
96 void SetUsers(USERS * u);
97 void SetTariffs(TARIFFS *) {}
98 void SetAdmins(ADMINS *) {}
99 void SetTraffcounter(TRAFFCOUNTER *) {}
100 void SetStore(BASE_STORE *) {}
101 void SetStgSettings(const SETTINGS *) {}
102 void SetSettings(const MODULE_SETTINGS & s);
107 int Reload() { return 0; }
110 const string & GetStrError() const;
111 const string GetVersion() const;
112 uint16_t GetStartPosition() const;
113 uint16_t GetStopPosition() const;
115 void AddUser(user_iter u);
116 void DelUser(user_iter u);
120 void SetUserNotifiers(user_iter u);
121 void UnSetUserNotifiers(user_iter u);
122 static void * Run(void * d);
124 mutable string errorStr;
125 PING_SETTINGS pingSettings;
126 MODULE_SETTINGS settings;
128 list<user_iter> usersList;
131 ÍÙ ÄÏÌÖÎÙ ÐÅÒÅÐÒÏ×ÅÒÉÔØ ×ÏÚÍÏÖÎÏÓÔØ ÐÉÎÇÏ×ÁÎÉÑ ÀÚÅÒÁ ÐÒÉ ÉÚÍÅÎÅÎÉÉ
132 ÓÌÅÄÕÀÝÉÈ ÅÇÏ ÐÁÒÁÍÅÔÒÏ×:
137 pthread_mutex_t mutex;
140 mutable STG_PINGER pinger;
142 list<CHG_CURRIP_NOTIFIER_PING> ChgCurrIPNotifierList;
143 list<CHG_IPS_NOTIFIER_PING> ChgIPNotifierList;
145 ADD_USER_NONIFIER_PING onAddUserNotifier;
146 DEL_USER_NONIFIER_PING onDelUserNotifier;
148 //-----------------------------------------------------------------------------