Subversion Repositories f9daq

Rev

Rev 154 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

  1. /** @file */
  2.  
  3. #ifndef WIENER_SNMP_H
  4. #define WIENER_SNMP_H
  5.  
  6. //#include "netsnmplib.h"
  7. /*
  8. #ifdef _MSC_VER
  9. #define EXPORT extern "C" _declspec(dllexport)
  10. #else
  11. #define EXPORT extern "C"
  12. #endif
  13. */
  14. #define EXPORT
  15.  
  16. #define WIN32_LEAN_AND_MEAN
  17.  
  18. //#include <net-snmp/net-snmp-config.h>
  19. #include "net-snmp-config.h"
  20. //#define NET_SNMP_SNMPV3_H                   // we don't need SNMPV3 (one include file is missing)
  21. #include <net-snmp/net-snmp-includes.h>
  22.  
  23. typedef void *HSNMP;   // SNMP handle (like FILE)
  24.  
  25. // DLL functions
  26. EXPORT void   snmpSetStdErrLog(void);
  27. EXPORT void   snmpSetFileLog(const char * const fileName);
  28. EXPORT unsigned int snmpGetVersion(void);
  29. EXPORT char  *snmpGetVersionString(void);
  30.  
  31. EXPORT int    snmpInit(void);
  32. EXPORT void   snmpCleanup(void);
  33. EXPORT void   snmpSetReadCommunityName(const char * const readCommunityName);
  34. EXPORT void   snmpSetWriteCommunityName(const char * const writeCommunityName);
  35.  
  36. EXPORT HSNMP  snmpOpen(const char * const ipAddress);
  37. EXPORT void   snmpClose(HSNMP session);
  38. EXPORT char  *snmpGetLastError(void);
  39.  
  40. // System Functions
  41. EXPORT char *getSysDescr(HSNMP session);
  42. EXPORT int  getMainSwitch(HSNMP session);
  43. EXPORT int  setMainSwitch(HSNMP session, int value);
  44. EXPORT int  getMainStatus(HSNMP session);
  45. EXPORT int  getVmeReset(HSNMP session);
  46. EXPORT int  setVmeReset(HSNMP session);
  47. EXPORT int  getIpStaticAddress(HSNMP session);
  48. EXPORT int  setIpStaticAddress(HSNMP session, int value);
  49. EXPORT char *getPsSerialNumber(HSNMP session);
  50.  
  51. // Output Counts
  52. EXPORT int  getOutputNumber(HSNMP session);
  53. EXPORT int  getOutputGroups(HSNMP session);
  54.  
  55. //Output Channel Information
  56. //std::string  getOutputName(HSNMP session, int channel);
  57. EXPORT int     getOutputGroup(HSNMP session, int channel);
  58. EXPORT int     getOutputStatus(HSNMP session, int channel);
  59. EXPORT int     getChannelStatus(HSNMP m_sessmp, int channel);
  60. EXPORT double  getOutputSenseMeasurement(HSNMP session, int channel);
  61. EXPORT double  getOutputTerminalMeasurement(HSNMP session, int channel);
  62. EXPORT double  getCurrentMeasurement(HSNMP session, int channel);
  63. EXPORT int     getTemperatureMeasurement(HSNMP session, int channel);
  64. EXPORT int     setChannelSwitch(HSNMP session, int channel, int value);
  65. EXPORT int     setOutputSwitch(HSNMP session, int channel, int value);
  66. EXPORT int     getChannelSwitch(HSNMP session, int channel);
  67. EXPORT int     getOutputSwitch(HSNMP session, int channel);
  68. EXPORT int     setHighVoltageGroupsSwitch(HSNMP session, int value);
  69. EXPORT int     getHighVoltageGroupsSwitch(HSNMP session);
  70. EXPORT int     setLowVoltageGroupsSwitch(HSNMP session, int value);
  71. EXPORT int     getLowVoltageGroupsSwitch(HSNMP session);
  72. EXPORT double  getOutputVoltage(HSNMP session, int channel);
  73. EXPORT double  setOutputVoltage(HSNMP session, int channel, double value);
  74. EXPORT double  getOutputCurrent(HSNMP session, int channel);
  75. EXPORT double  setOutputCurrent(HSNMP session, int channel, double value);
  76. EXPORT double  getOutputRiseRate(HSNMP session, int channel);
  77. EXPORT double  setOutputRiseRate(HSNMP session, int channel, double value);
  78. EXPORT double  getOutputFallRate(HSNMP session, int channel);
  79. EXPORT double  setOutputFallRate(HSNMP session, int channel, double value);
  80. EXPORT double  getOutputCurrentRiseRate(HSNMP session, int channel);
  81. EXPORT double  setOutputCurrentRiseRate(HSNMP session, int channel, double value);
  82. EXPORT double  getOutputCurrentFallRate(HSNMP session, int channel);
  83. EXPORT double  setOutputCurrentFallRate(HSNMP session, int channel, double value);
  84. EXPORT int     getOutputSupervisionBehavior(HSNMP session, int channel);
  85. EXPORT int     setOutputSupervisionBehavior(HSNMP session, int channel, int value);
  86. EXPORT double  getOutputSupervisionMinSenseVoltage(HSNMP session, int channel);
  87. EXPORT double  setOutputSupervisionMinSenseVoltage(HSNMP session, int channel, double value);
  88. EXPORT double  getOutputSupervisionMaxSenseVoltage(HSNMP session, int channel);
  89. EXPORT double  setOutputSupervisionMaxSenseVoltage(HSNMP session, int channel, double value);
  90. EXPORT double  getOutputSupervisionMaxTerminalVoltage(HSNMP session, int channel);
  91. EXPORT double  setOutputSupervisionMaxTerminalVoltage(HSNMP session, int channel, double value);
  92. EXPORT double  getOutputSupervisionMaxCurrent(HSNMP session, int channel);
  93. EXPORT double  setOutputSupervisionMaxCurrent(HSNMP session, int channel, double value);
  94. EXPORT int     setOutputSupervisionMaxTemperature(HSNMP session, int channel, int value);
  95. EXPORT double  getOutputConfigMaxSenseVoltage(HSNMP session, int channel);
  96. EXPORT double  getOutputConfigMaxTerminalVoltage(HSNMP session, int channel);
  97. EXPORT double  getOutputConfigMaxCurrent(HSNMP session, int channel);
  98. EXPORT double  getOutputSupervisionMaxPower(HSNMP session, int channel);
  99. EXPORT int     getOutputTripTimeMaxCurrent(HSNMP session, int channel);
  100. EXPORT int     setOutputTripTimeMaxCurrent(HSNMP session, int channel, int delay);
  101.  
  102. //Sensor Information functions
  103. EXPORT int  getSensorNumber(HSNMP session);
  104. EXPORT int  getSensorTemp(HSNMP session, int sensor);
  105. EXPORT int  getSensorWarningTemperature(HSNMP session, int sensor);
  106. EXPORT int  setSensorWarningTemperature(HSNMP session, int sensor, int value);
  107. EXPORT int  getSensorFailureTemperature(HSNMP session, int sensor);
  108. EXPORT int  setSensorFailureTemperature(HSNMP session, int sensor, int value);
  109.  
  110. //SNMP Community Name Functions
  111. //std::string  getSnmpCommunityName(HSNMP session, int index);
  112. //std::string  setSnmpCommunityName(HSNMP session, int index , int value);
  113.  
  114. //Power Supply Detail Functions
  115. //std::string  getPsFirmwareVersion(HSNMP session);
  116. //std::string  getPsSerialNumber(HSNMP session);
  117. EXPORT int    getPsOperatingTime(HSNMP session);
  118. EXPORT double getPsAuxVoltage(HSNMP session, int auxIndex);
  119. EXPORT double getPsAuxCurrent(HSNMP session, int auxIndex);
  120. //std::string  getPsDirectAccess(HSNMP session);
  121. //std::string  setPsDirectAccess(HSNMP session);
  122.  
  123. //Fan Tray Functions
  124. //std::string  getFanFirmwareVersion(HSNMP session);
  125. //std::string  getFanSerialNumber(HSNMP session);
  126. EXPORT int  getFanOperatingTime(HSNMP session);
  127. EXPORT int  getFanAirTemperature(HSNMP session);
  128. EXPORT int  getFanSwitchOffDelay(HSNMP session);
  129. EXPORT int  setFanSwitchOffDelay(HSNMP session, int value);
  130. EXPORT int  getFanNominalSpeed(HSNMP session);
  131. EXPORT int  setFanNominalSpeed(HSNMP session, int value);
  132. EXPORT int  getFanNumberOfFans(HSNMP session);
  133. EXPORT int  getFanSpeed(HSNMP session, int fan);
  134.  
  135. // Module functions
  136. EXPORT char  *getModuleDescription(HSNMP session, int slot);
  137. EXPORT double getModuleSupply24(HSNMP session, int slot);
  138. EXPORT double getModuleSupply5(HSNMP session, int slot);
  139. EXPORT double getModuleAuxTemperature(HSNMP session, int slot, int index);
  140. EXPORT double getModuleHardwareLimitVoltage(HSNMP session, int slot);
  141. EXPORT double getModuleHardwareLimitCurrent(HSNMP session, int slot);
  142. EXPORT double getModuleRampSpeedVoltage(HSNMP session, int slot);
  143. EXPORT double setModuleRampSpeedVoltage(HSNMP session, int slot, double value);
  144. EXPORT double getModuleRampSpeedCurrent(HSNMP session, int slot);
  145. EXPORT double setModuleRampSpeedCurrent(HSNMP session, int slot, double value);
  146. EXPORT int    getModuleStatus(HSNMP session, int slot);
  147. EXPORT int    getModuleEventStatus(HSNMP session, int slot);
  148. EXPORT int    setModuleDoClear(HSNMP session, int slot);
  149.  
  150. /**
  151.  * @enum MaximumCrateValues
  152.  */
  153. typedef enum MaximumCrateValues {
  154.         MaxModuleAuxSupplies = 2,     ///< The maximum number of module auxiliary supply measurements
  155.         MaxModuleAuxTemperatures = 4, ///< The maximum number of module temperature sensors (iseg HV only)
  156.         MaxCommunities = 4,           ///< The maximum number of SNMP community names
  157.         MaxFans = 6,
  158.         MaxPsAuxSupplies = 8,
  159.         MaxSlotsPerCrate = 10,        ///< The number of slots per crate
  160.         MaxSensors = 12,              ///< The maximum
  161.         MaxChannelsPerSlot = 100,     ///< The maximum number of channels per slot
  162.         MaxChannelsPerCrate = 1000    ///< The maximum number of channels per crate
  163. } MaximumCrateValues;
  164.  
  165. /**
  166.  * @struct SnmpDoubleBuffer
  167.  * This struct is used to pass double parameters to setMultiple... functions
  168.  * and for the result value of getMultiple.../setMultiple... functions.
  169.  */
  170. typedef struct SnmpDoubleBuffer {
  171.         int size;                         ///< The number of values used in value[]
  172.         double value[MaxChannelsPerSlot]; ///< An array of max. 100 double values
  173. } SnmpDoubleBuffer;
  174.  
  175. /**
  176.  * @struct SnmpIntegerBuffer
  177.  * This struct is used to pass integer parameters to setMultiple... functions
  178.  * and for the result value of getMultiple.../setMultiple... functions.
  179. */
  180. typedef struct SnmpIntegerBuffer {
  181.         int size;                      ///< The number of values used in value[]
  182.         int value[MaxChannelsPerSlot]; ///< An array of max. 100 int values
  183. } SnmpIntegerBuffer;
  184.  
  185. // Functions for multiple data transfer in one SNMP packet
  186. EXPORT SnmpIntegerBuffer *getMultipleChannelStatuses(HSNMP session, int start, int size);
  187. EXPORT SnmpIntegerBuffer *getMultipleOutputStatuses(HSNMP session, int start, int size);
  188. EXPORT SnmpIntegerBuffer *getMultipleOutputSwitches(HSNMP session, int start, int size);
  189. EXPORT SnmpIntegerBuffer *setMultipleOutputSwitches(HSNMP session, int start, SnmpIntegerBuffer *values);
  190. EXPORT SnmpDoubleBuffer *getMultipleOutputVoltages(HSNMP session, int start, int size);
  191. EXPORT SnmpDoubleBuffer *setMultipleOutputVoltages(HSNMP session, int start, SnmpDoubleBuffer *values);
  192. EXPORT SnmpDoubleBuffer *getMultipleMeasurementTerminalVoltages(HSNMP session, int start, int size);
  193. EXPORT SnmpDoubleBuffer *getMultipleOutputMeasurementTerminalVoltages(HSNMP session, int start, int size);
  194. EXPORT SnmpDoubleBuffer *getMultipleOutputConfigMaxTerminalVoltages(HSNMP session, int start, int size);
  195. EXPORT SnmpDoubleBuffer *getMultipleOutputCurrents(HSNMP session, int start, int size);
  196. EXPORT SnmpDoubleBuffer *setMultipleOutputCurrents(HSNMP session, int start, SnmpDoubleBuffer *values);
  197. EXPORT SnmpDoubleBuffer *getMultipleMeasurementCurrents(HSNMP session, int start, int size);
  198. EXPORT SnmpDoubleBuffer *getMultipleOutputMeasurementCurrents(HSNMP session, int start, int size);
  199. EXPORT SnmpDoubleBuffer *getMultipleOutputConfigMaxCurrents(HSNMP session, int start, int size);
  200. EXPORT SnmpIntegerBuffer *getMultipleOutputTripTimeMaxCurrents(HSNMP session, int start, int size);
  201. EXPORT SnmpIntegerBuffer *setMultipleOutputTripTimeMaxCurrents(HSNMP session, int start, SnmpIntegerBuffer *values);
  202. EXPORT SnmpIntegerBuffer *getMultipleOutputSupervisionBehaviors(HSNMP session, int start, int size);
  203. EXPORT SnmpIntegerBuffer *setMultipleOutputSupervisionBehaviors(HSNMP session, int start, SnmpIntegerBuffer *values);
  204.  
  205. #endif
  206.