1 #ifndef __SNMP_AGENT_H__
 
   2 #define __SNMP_AGENT_H__
 
   8 #include "stg/os_int.h"
 
   9 #include "stg/plugin.h"
 
  10 #include "stg/module_settings.h"
 
  11 #include "stg/users.h"
 
  13 extern "C" PLUGIN * GetPlugin();
 
  17 //-----------------------------------------------------------------------------
 
  18 class SNMP_AGENT_SETTINGS {
 
  20     SNMP_AGENT_SETTINGS();
 
  21     virtual ~SNMP_AGENT_SETTINGS() {}
 
  22     const std::string & GetStrError() const { return errorStr; }
 
  23     int ParseSettings(const MODULE_SETTINGS & s);
 
  25     uint32_t GetIP() const { return ip; }
 
  26     uint16_t GetPort() const { return port; }
 
  27     const std::string GetPassword() const { return password; }
 
  30     mutable std::string errorStr;
 
  36 //-----------------------------------------------------------------------------
 
  37 class SNMP_AGENT : public PLUGIN {
 
  40     virtual ~SNMP_AGENT();
 
  42     void SetUsers(USERS *) {}
 
  43     void SetTariffs(TARIFFS *) {}
 
  44     void SetAdmins(ADMINS *) {}
 
  45     void SetTraffcounter(TRAFFCOUNTER *) {}
 
  46     void SetStore(STORE *) {}
 
  47     void SetStgSettings(const SETTINGS *) {}
 
  48     void SetSettings(const MODULE_SETTINGS & s) { settings = s; }
 
  53     int Reload() { return 0; }
 
  54     bool IsRunning() { return running && !stopped; }
 
  56     const std::string & GetStrError() const { return errorStr; }
 
  57     const std::string GetVersion() const { return "Stg SNMP Agent 1.0"; }
 
  58     uint16_t GetStartPosition() const { return 100; }
 
  59     uint16_t GetStopPosition() const { return 100; }
 
  62     static void * Runner(void * d);
 
  66     mutable std::string errorStr;
 
  67     SNMP_AGENT_SETTINGS snmpAgentSettings;
 
  68     MODULE_SETTINGS settings;
 
  71     pthread_mutex_t mutex;
 
  77 //-----------------------------------------------------------------------------
 
  79 extern "C" PLUGIN * GetPlugin();