X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/6207d1bdab32119da7d30a3d38d3dcf6a5f09671..52b4afb2c72468a55fb49aeed3f7dda1277319df:/projects/stargazer/plugins/other/snmp/snmp.h diff --git a/projects/stargazer/plugins/other/snmp/snmp.h b/projects/stargazer/plugins/other/snmp/snmp.h deleted file mode 100644 index fe5fa05e..00000000 --- a/projects/stargazer/plugins/other/snmp/snmp.h +++ /dev/null @@ -1,81 +0,0 @@ -#ifndef __SNMP_AGENT_H__ -#define __SNMP_AGENT_H__ - -#include - -#include - -#include "stg/os_int.h" -#include "stg/plugin.h" -#include "stg/module_settings.h" -#include "stg/users.h" - -extern "C" PLUGIN * GetPlugin(); - -class USER; -class SETTINGS; -//----------------------------------------------------------------------------- -class SNMP_AGENT_SETTINGS { -public: - SNMP_AGENT_SETTINGS(); - virtual ~SNMP_AGENT_SETTINGS() {} - const std::string & GetStrError() const { return errorStr; } - int ParseSettings(const MODULE_SETTINGS & s); - - uint32_t GetIP() const { return ip; } - uint16_t GetPort() const { return port; } - const std::string GetPassword() const { return password; } - -private: - mutable std::string errorStr; - - uint32_t ip; - uint16_t port; - std::string password; -}; -//----------------------------------------------------------------------------- -class SNMP_AGENT : public PLUGIN { -public: - SNMP_AGENT(); - virtual ~SNMP_AGENT(); - - void SetUsers(USERS *) {} - 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(); - - int Start(); - int Stop(); - int Reload() { return 0; } - bool IsRunning() { return running && !stopped; } - - const std::string & GetStrError() const { return errorStr; } - const std::string GetVersion() const { return "Stg SNMP Agent 1.0"; } - uint16_t GetStartPosition() const { return 100; } - uint16_t GetStopPosition() const { return 100; } - -private: - static void * Runner(void * d); - void Run(); - bool PrepareNet(); - - mutable std::string errorStr; - SNMP_AGENT_SETTINGS snmpAgentSettings; - MODULE_SETTINGS settings; - - pthread_t thread; - pthread_mutex_t mutex; - bool running; - bool stopped; - - int sock; -}; -//----------------------------------------------------------------------------- - -extern "C" PLUGIN * GetPlugin(); - -#endif