Subversion Repositories f9daq

Rev

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