From: Maxim Mamontov Date: Sat, 13 Aug 2011 16:06:02 +0000 (+0300) Subject: More clear plugin API X-Git-Tag: 2.408-alpha~34 X-Git-Url: https://git.stg.codes/stg.git/commitdiff_plain/13121b693bd98a04532195b9631b862b6136b3c7?ds=sidebyside More clear plugin API --- diff --git a/include/stg/plugin.h b/include/stg/plugin.h index 35a5a4c9..845a3d15 100644 --- a/include/stg/plugin.h +++ b/include/stg/plugin.h @@ -35,6 +35,8 @@ #include "admins.h" #include "users.h" #include "tariffs.h" +#include "services.h" +#include "corporations.h" class TRAFFCOUNTER; class SETTINGS; @@ -43,13 +45,15 @@ struct MODULE_SETTINGS; class PLUGIN : private NONCOPYABLE { public: - virtual void SetUsers(USERS * u) = 0; - virtual void SetTariffs(TARIFFS * t) = 0; - virtual void SetAdmins(ADMINS * a) = 0; - virtual void SetTraffcounter(TRAFFCOUNTER * tc) = 0; - virtual void SetStore(STORE * st) = 0; - virtual void SetStgSettings(const SETTINGS * s) = 0; - virtual void SetSettings(const MODULE_SETTINGS & s) = 0; + virtual void SetUsers(USERS *) {} + virtual void SetTariffs(TARIFFS *) {} + virtual void SetAdmins(ADMINS *) {} + virtual void SetServices(SERVICES *) {} + virtual void SetCorporations(CORPORATIONS *) {} + virtual void SetTraffcounter(TRAFFCOUNTER *) {} + virtual void SetStore(STORE *) {} + virtual void SetStgSettings(const SETTINGS *) {} + virtual void SetSettings(const MODULE_SETTINGS &) {} virtual int ParseSettings() = 0; virtual int Start() = 0; diff --git a/projects/stargazer/plugins/authorization/ao/ao.h b/projects/stargazer/plugins/authorization/ao/ao.h index a0c0953d..cac18dfd 100644 --- a/projects/stargazer/plugins/authorization/ao/ao.h +++ b/projects/stargazer/plugins/authorization/ao/ao.h @@ -73,11 +73,6 @@ public: virtual ~AUTH_AO(){}; void SetUsers(USERS * u) { users = u; } - void SetTariffs(TARIFFS *) {} - void SetAdmins(ADMINS *) {} - void SetTraffcounter(TRAFFCOUNTER *) {} - void SetStore(STORE *) {} - void SetStgSettings(const SETTINGS *) {} int Start(); int Stop(); diff --git a/projects/stargazer/plugins/authorization/inetaccess/inetaccess.h b/projects/stargazer/plugins/authorization/inetaccess/inetaccess.h index fe556495..a648ec04 100644 --- a/projects/stargazer/plugins/authorization/inetaccess/inetaccess.h +++ b/projects/stargazer/plugins/authorization/inetaccess/inetaccess.h @@ -204,10 +204,6 @@ public: virtual ~AUTH_IA(); void SetUsers(USERS * u) { users = u; } - void SetTariffs(TARIFFS *) {} - void SetAdmins(ADMINS *) {} - void SetTraffcounter(TRAFFCOUNTER *) {} - void SetStore(STORE *) {} void SetStgSettings(const SETTINGS * s) { stgSettings = s; } void SetSettings(const MODULE_SETTINGS & s) { settings = s; } int ParseSettings(); diff --git a/projects/stargazer/plugins/authorization/stress/stress.h b/projects/stargazer/plugins/authorization/stress/stress.h index bfcf56d0..fe9ccd9d 100644 --- a/projects/stargazer/plugins/authorization/stress/stress.h +++ b/projects/stargazer/plugins/authorization/stress/stress.h @@ -88,11 +88,6 @@ public: virtual ~AUTH_STRESS() {} void SetUsers(USERS * u); - void SetTariffs(TARIFFS *) {} - void SetAdmins(ADMINS *) {} - void SetTraffcounter(TRAFFCOUNTER *) {} - void SetStore(STORE *) {} - void SetStgSettings(const SETTINGS *) {} int Start(); int Stop(); diff --git a/projects/stargazer/plugins/capture/cap_debug/debug_cap.h b/projects/stargazer/plugins/capture/cap_debug/debug_cap.h index 207aa40e..5e5e2cf6 100644 --- a/projects/stargazer/plugins/capture/cap_debug/debug_cap.h +++ b/projects/stargazer/plugins/capture/cap_debug/debug_cap.h @@ -68,18 +68,12 @@ public: DEBUG_CAP(); virtual ~DEBUG_CAP() {} - void SetUsers(USERS * u) {} - void SetTariffs(TARIFFS * t) {} - void SetAdmins(ADMINS * a) {} void SetTraffcounter(TRAFFCOUNTER * tc); - void SetStore(STORE *) {} - void SetStgSettings(const SETTINGS *) {} int Start(); int Stop(); int Reload() { return 0; } int ParseSettings() { return 0; } - void SetSettings(const MODULE_SETTINGS & s) {} bool IsRunning(); const string & GetStrError() const; const string GetVersion() const; diff --git a/projects/stargazer/plugins/capture/cap_nf/cap_nf.h b/projects/stargazer/plugins/capture/cap_nf/cap_nf.h index 80373433..ccdd6708 100644 --- a/projects/stargazer/plugins/capture/cap_nf/cap_nf.h +++ b/projects/stargazer/plugins/capture/cap_nf/cap_nf.h @@ -92,12 +92,7 @@ public: NF_CAP(); ~NF_CAP(); - void SetUsers(USERS *) {} - void SetTariffs(TARIFFS *) {} - void SetAdmins(ADMINS *) {} void SetTraffcounter(TRAFFCOUNTER * tc) { traffCnt = tc; } - void SetStore(STORE *) {} - void SetStgSettings(const SETTINGS *) {} void SetSettings(const MODULE_SETTINGS & s) { settings = s; } int ParseSettings(); diff --git a/projects/stargazer/plugins/capture/divert_freebsd/divert_cap.h b/projects/stargazer/plugins/capture/divert_freebsd/divert_cap.h index f5bb432b..432ee4b1 100644 --- a/projects/stargazer/plugins/capture/divert_freebsd/divert_cap.h +++ b/projects/stargazer/plugins/capture/divert_freebsd/divert_cap.h @@ -48,12 +48,7 @@ public: DIVERT_CAP(); virtual ~DIVERT_CAP() {} - void SetUsers(USERS *) {} - void SetTariffs(TARIFFS *) {} - void SetAdmins(ADMINS *) {} void SetTraffcounter(TRAFFCOUNTER * tc) { traffCnt = tc; } - void SetStore(STORE *) {} - void SetStgSettings(const SETTINGS *) {} int Start(); int Stop(); diff --git a/projects/stargazer/plugins/capture/ether_freebsd/ether_cap.h b/projects/stargazer/plugins/capture/ether_freebsd/ether_cap.h index 05357212..b51cc56d 100644 --- a/projects/stargazer/plugins/capture/ether_freebsd/ether_cap.h +++ b/projects/stargazer/plugins/capture/ether_freebsd/ether_cap.h @@ -95,12 +95,7 @@ public: BPF_CAP(); virtual ~BPF_CAP() {} - void SetUsers(USERS *) {} - void SetTariffs(TARIFFS *) {} - void SetAdmins(ADMINS *) {} void SetTraffcounter(TRAFFCOUNTER * tc) { traffCnt = tc; } - void SetStore(STORE *) {} - void SetStgSettings(const SETTINGS *) {} int Start(); int Stop(); diff --git a/projects/stargazer/plugins/capture/ether_linux/ether_cap.h b/projects/stargazer/plugins/capture/ether_linux/ether_cap.h index ed7ba299..c03a6066 100644 --- a/projects/stargazer/plugins/capture/ether_linux/ether_cap.h +++ b/projects/stargazer/plugins/capture/ether_linux/ether_cap.h @@ -49,19 +49,13 @@ public: ETHER_CAP(); virtual ~ETHER_CAP() {} - void SetUsers(USERS *) {} - void SetTariffs(TARIFFS *) {} - void SetAdmins(ADMINS *) {} void SetTraffcounter(TRAFFCOUNTER * tc) { traffCnt = tc; } - void SetStore(STORE *) {} - void SetStgSettings(const SETTINGS *) {} int Start(); int Stop(); int Reload() { return 0; } bool IsRunning() { return isRunning; } - void SetSettings(const MODULE_SETTINGS &) {} int ParseSettings() { return 0; } const std::string & GetStrError() const { return errorStr; } const std::string GetVersion() const; diff --git a/projects/stargazer/plugins/capture/ipq_linux/ipq_cap.h b/projects/stargazer/plugins/capture/ipq_linux/ipq_cap.h index 6253fe3a..990aae3b 100644 --- a/projects/stargazer/plugins/capture/ipq_linux/ipq_cap.h +++ b/projects/stargazer/plugins/capture/ipq_linux/ipq_cap.h @@ -44,19 +44,13 @@ public: IPQ_CAP(); virtual ~IPQ_CAP() {} - void SetUsers(USERS *) {} - void SetTariffs(TARIFFS *) {} - void SetAdmins(ADMINS *) {} void SetTraffcounter(TRAFFCOUNTER * tc) { traffCnt = tc; } - void SetStore(STORE *) {} - void SetStgSettings(const SETTINGS *) {} int Start(); int Stop(); int Reload() { return 0; } bool IsRunning() { return isRunning; } - void SetSettings(const MODULE_SETTINGS &) {} int ParseSettings() { return 0; } const std::string & GetStrError() const { return errorStr; } const std::string GetVersion() const; diff --git a/projects/stargazer/plugins/configuration/rpcconfig/rpcconfig.h b/projects/stargazer/plugins/configuration/rpcconfig/rpcconfig.h index 1213f7d3..1095dd73 100644 --- a/projects/stargazer/plugins/configuration/rpcconfig/rpcconfig.h +++ b/projects/stargazer/plugins/configuration/rpcconfig/rpcconfig.h @@ -58,7 +58,6 @@ public: void SetTariffs(TARIFFS * t) { tariffs = t; } void SetAdmins(ADMINS * a) { admins = a; } void SetStore(STORE * s) { store = s; } - void SetTraffcounter(TRAFFCOUNTER *) {} void SetStgSettings(const SETTINGS * s); void SetSettings(const MODULE_SETTINGS & s) { settings = s; } int ParseSettings(); diff --git a/projects/stargazer/plugins/configuration/sgconfig-ng/stgconfig.h b/projects/stargazer/plugins/configuration/sgconfig-ng/stgconfig.h index 329a114c..fd3a9e62 100644 --- a/projects/stargazer/plugins/configuration/sgconfig-ng/stgconfig.h +++ b/projects/stargazer/plugins/configuration/sgconfig-ng/stgconfig.h @@ -29,7 +29,6 @@ public: void SetTariffs(TARIFFS * t) { tariffs = t; } void SetAdmins(ADMINS * a) { admins = a; } void SetStore(STORE * s) { store = s; } - void SetTraffcounter(TRAFFCOUNTER *) {} void SetStgSettings(const SETTINGS * s) { stgSettings = s; } void SetSettings(const MODULE_SETTINGS & s) { modSettings = s; } int ParseSettings(); diff --git a/projects/stargazer/plugins/configuration/sgconfig/stgconfig.h b/projects/stargazer/plugins/configuration/sgconfig/stgconfig.h index ce1c3af8..d1506ea8 100644 --- a/projects/stargazer/plugins/configuration/sgconfig/stgconfig.h +++ b/projects/stargazer/plugins/configuration/sgconfig/stgconfig.h @@ -34,7 +34,6 @@ public: void SetTariffs(TARIFFS * t) { tariffs = t; } void SetAdmins(ADMINS * a) { admins = a; } void SetStore(STORE * s) { store = s; } - void SetTraffcounter(TRAFFCOUNTER *) {} void SetStgSettings(const SETTINGS * s) { stgSettings = s; } void SetSettings(const MODULE_SETTINGS & s) { settings = s; } int ParseSettings(); diff --git a/projects/stargazer/plugins/configuration/sgconfig2/stgconfig.h b/projects/stargazer/plugins/configuration/sgconfig2/stgconfig.h index 1c8743d1..52d78018 100644 --- a/projects/stargazer/plugins/configuration/sgconfig2/stgconfig.h +++ b/projects/stargazer/plugins/configuration/sgconfig2/stgconfig.h @@ -35,7 +35,6 @@ public: void SetTariffs(TARIFFS * t) { tariffs = t; } void SetAdmins(ADMINS * a) { admins = a; } void SetStore(STORE * s) { store = s; } - void SetTraffcounter(TRAFFCOUNTER *) {} void SetStgSettings(const SETTINGS * s) { stgConfigSettings = s; } void SetSettings(const MODULE_SETTINGS & s) { settings = s; } int ParseSettings(); diff --git a/projects/stargazer/plugins/configuration/xrconfig/xrconfig.h b/projects/stargazer/plugins/configuration/xrconfig/xrconfig.h index 4630edb4..219f8d22 100644 --- a/projects/stargazer/plugins/configuration/xrconfig/xrconfig.h +++ b/projects/stargazer/plugins/configuration/xrconfig/xrconfig.h @@ -34,7 +34,6 @@ public: void SetTariffs(TARIFFS * t); void SetAdmins(ADMINS * a); void SetStore(BASE_STORE * s); - void SetTraffcounter(TRAFFCOUNTER * tc){}; void SetStgSettings(const SETTINGS * s); void SetSettings(const MODULE_SETTINGS & s); int ParseSettings(); diff --git a/projects/stargazer/plugins/other/ping/ping.h b/projects/stargazer/plugins/other/ping/ping.h index aecbfb15..618ecc73 100644 --- a/projects/stargazer/plugins/other/ping/ping.h +++ b/projects/stargazer/plugins/other/ping/ping.h @@ -88,11 +88,6 @@ public: virtual ~PING(); void SetUsers(USERS * u); - void SetTariffs(TARIFFS *) {} - void SetAdmins(ADMINS *) {} - void SetTraffcounter(TRAFFCOUNTER *) {} - void SetStore(STORE *) {} - void SetStgSettings(const SETTINGS *) {} void SetSettings(const MODULE_SETTINGS & s); int ParseSettings(); diff --git a/projects/stargazer/plugins/other/radius/radius.h b/projects/stargazer/plugins/other/radius/radius.h index 70c904ae..2a60f117 100644 --- a/projects/stargazer/plugins/other/radius/radius.h +++ b/projects/stargazer/plugins/other/radius/radius.h @@ -86,9 +86,6 @@ public: virtual ~RADIUS() {}; void SetUsers(USERS * u); - void SetTariffs(TARIFFS *) {} - void SetAdmins(ADMINS *) {} - void SetTraffcounter(TRAFFCOUNTER *) {} void SetStore(STORE * ); void SetStgSettings(const SETTINGS * s); void SetSettings(const MODULE_SETTINGS & s); diff --git a/projects/stargazer/plugins/other/rscript/rscript.h b/projects/stargazer/plugins/other/rscript/rscript.h index 24d44763..649970e9 100644 --- a/projects/stargazer/plugins/other/rscript/rscript.h +++ b/projects/stargazer/plugins/other/rscript/rscript.h @@ -129,11 +129,6 @@ public: virtual ~REMOTE_SCRIPT(); void SetUsers(USERS * u) { users = u; } - void SetTariffs(TARIFFS *) {} - void SetAdmins(ADMINS *) {} - void SetTraffcounter(TRAFFCOUNTER *) {} - void SetStore(STORE *) {} - void SetStgSettings(const SETTINGS *) {} void SetSettings(const MODULE_SETTINGS & s) { settings = s; } int ParseSettings(); diff --git a/projects/stargazer/plugins/other/smux/smux.h b/projects/stargazer/plugins/other/smux/smux.h index 7ab603df..5230a85c 100644 --- a/projects/stargazer/plugins/other/smux/smux.h +++ b/projects/stargazer/plugins/other/smux/smux.h @@ -61,9 +61,6 @@ public: void SetAdmins(ADMINS * a) { admins = a; } void SetServices(SERVICES * s) { services = s; } void SetCorporations(CORPORATIONS * c) { corporations = c; } - void SetTraffcounter(TRAFFCOUNTER *) {} - void SetStore(STORE *) {} - void SetStgSettings(const SETTINGS *) {} void SetSettings(const MODULE_SETTINGS & s) { settings = s; } int ParseSettings(); diff --git a/projects/stargazer/plugins/other/userstat/userstat.h b/projects/stargazer/plugins/other/userstat/userstat.h index 9dd01f25..1c5776f8 100644 --- a/projects/stargazer/plugins/other/userstat/userstat.h +++ b/projects/stargazer/plugins/other/userstat/userstat.h @@ -46,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 { - bool operator()(const DataThread & info) { return info.IsDone(); }; + bool operator()(const DataThread & info) { return info.IsDone(); } }; struct ToLower : public unary_function {