3 $Date: 2009/06/23 11:32:28 $
17 #include "module_settings.h"
23 extern "C" PLUGIN * GetPlugin();
28 //-----------------------------------------------------------------------------*/
29 class CHG_CURRIP_NOTIFIER_PING: public PROPERTY_NOTIFIER_BASE<uint32_t> {
31 CHG_CURRIP_NOTIFIER_PING(const PING & p, USER_PTR u) : user(u), ping(p) {}
32 void Notify(const uint32_t & oldIP, const uint32_t & newIP);
33 USER_PTR GetUser() const { return user; }
39 //-----------------------------------------------------------------------------
40 class CHG_IPS_NOTIFIER_PING: public PROPERTY_NOTIFIER_BASE<USER_IPS> {
42 CHG_IPS_NOTIFIER_PING(const PING & p, USER_PTR u) : user(u), ping(p) {}
43 void Notify(const USER_IPS & oldIPS, const USER_IPS & newIPS);
44 USER_PTR GetUser() const { return user; }
50 //-----------------------------------------------------------------------------
51 class ADD_USER_NONIFIER_PING: public NOTIFIER_BASE<USER_PTR> {
53 ADD_USER_NONIFIER_PING(PING & p) : ping(p) {}
54 virtual ~ADD_USER_NONIFIER_PING() {}
55 void Notify(const USER_PTR & user);
60 //-----------------------------------------------------------------------------
61 class DEL_USER_NONIFIER_PING: public NOTIFIER_BASE<USER_PTR> {
63 DEL_USER_NONIFIER_PING(PING & p) : ping(p) {}
64 virtual ~DEL_USER_NONIFIER_PING() {}
65 void Notify(const USER_PTR & user);
70 //-----------------------------------------------------------------------------
74 virtual ~PING_SETTINGS() {}
75 const std::string & GetStrError() const { return errorStr; }
76 int ParseSettings(const MODULE_SETTINGS & s);
77 int GetPingDelay() const { return pingDelay; }
79 int ParseIntInRange(const std::string & str, int min, int max, int * val);
82 mutable std::string errorStr;
84 //-----------------------------------------------------------------------------
85 class PING : public PLUGIN {
86 friend class CHG_CURRIP_NOTIFIER_PING;
87 friend class CHG_IPS_NOTIFIER_PING;
92 void SetUsers(USERS * u);
93 void SetTariffs(TARIFFS *) {}
94 void SetAdmins(ADMINS *) {}
95 void SetTraffcounter(TRAFFCOUNTER *) {}
96 void SetStore(STORE *) {}
97 void SetStgSettings(const SETTINGS *) {}
98 void SetSettings(const MODULE_SETTINGS & s);
103 int Reload() { return 0; }
106 const std::string & GetStrError() const;
107 const std::string GetVersion() const;
108 uint16_t GetStartPosition() const;
109 uint16_t GetStopPosition() const;
111 void AddUser(USER_PTR u);
112 void DelUser(USER_PTR u);
116 void SetUserNotifiers(USER_PTR u);
117 void UnSetUserNotifiers(USER_PTR u);
118 static void * Run(void * d);
120 mutable std::string errorStr;
121 PING_SETTINGS pingSettings;
122 MODULE_SETTINGS settings;
124 std::list<USER_PTR> usersList;
127 ÍÙ ÄÏÌÖÎÙ ÐÅÒÅÐÒÏ×ÅÒÉÔØ ×ÏÚÍÏÖÎÏÓÔØ ÐÉÎÇÏ×ÁÎÉÑ ÀÚÅÒÁ ÐÒÉ ÉÚÍÅÎÅÎÉÉ
128 ÓÌÅÄÕÀÝÉÈ ÅÇÏ ÐÁÒÁÍÅÔÒÏ×:
133 pthread_mutex_t mutex;
136 mutable STG_PINGER pinger;
138 std::list<CHG_CURRIP_NOTIFIER_PING> ChgCurrIPNotifierList;
139 std::list<CHG_IPS_NOTIFIER_PING> ChgIPNotifierList;
141 ADD_USER_NONIFIER_PING onAddUserNotifier;
142 DEL_USER_NONIFIER_PING onDelUserNotifier;
144 //-----------------------------------------------------------------------------