1/*****************************************************************************\
2 *  $Id: ipmi_monitoring.h,v 1.69 2010-07-22 21:49:00 chu11 Exp $
3 *****************************************************************************
4 *  Copyright (C) 2007-2015 Lawrence Livermore National Security, LLC.
5 *  Copyright (C) 2006-2007 The Regents of the University of California.
6 *  Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
7 *  Written by Albert Chu <chu11@llnl.gov>
8 *  UCRL-CODE-222073
9 *
10 *  This file is part of Ipmimonitoring, an IPMI sensor monitoring
11 *  library.  For details, see http://www.llnl.gov/linux/.
12 *
13 *  Ipmimonitoring is free software; you can redistribute it and/or modify
14 *  it under the terms of the GNU General Public License as published by the
15 *  Free Software Foundation; either version 3 of the License, or (at your
16 *  option) any later version.
17 *
18 *  Ipmimonitoring is distributed in the hope that it will be useful, but
19 *  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
20 *  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
21 *  for more details.
22 *
23 *  You should have received a copy of the GNU General Public License along
24 *  with Ipmimonitoring.  If not, see <http://www.gnu.org/licenses/>.
25\*****************************************************************************/
26
27#ifndef IPMI_MONITORING_H
28#define IPMI_MONITORING_H
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34/*
35 * Libipmimonitoring version
36 *
37 * MAJOR - Incremented when interfaces are changed or removed.
38 *         Interfaces may be binary incompatible.  When incremented, MINOR
39 *         and PATCH are zeroed.
40 *
41 * MINOR - Incremented when interfaces are added.  Interfaces are
42 *         binary compatible with older minor versions.  When incremented,
43 *         PATCH is zeroed.
44 *
45 * PATCH - Incremented when interfaces are not changed.  Typically
46 *         incremented due to bug fixes or minor features.  Interfaces are
47 *         forward and backward compatible to other PATCH versions.
48 */
49
50#define LIBIPMIMONITORING_VERSION_MAJOR @LIBIPMIMONITORING_VERSION_MAJOR@
51#define LIBIPMIMONITORING_VERSION_MINOR @LIBIPMIMONITORING_VERSION_MINOR@
52#define LIBIPMIMONITORING_VERSION_PATCH @LIBIPMIMONITORING_VERSION_PATCH@
53
54enum ipmi_monitoring_error_codes
55  {
56    IPMI_MONITORING_ERR_SUCCESS                             = 0,
57    IPMI_MONITORING_ERR_CTX_NULL                            = 1,
58    IPMI_MONITORING_ERR_CTX_INVALID                         = 2,
59    IPMI_MONITORING_ERR_PARAMETERS                          = 3,
60    IPMI_MONITORING_ERR_PERMISSION                          = 4,
61    IPMI_MONITORING_ERR_LIBRARY_UNINITIALIZED               = 5,
62    IPMI_MONITORING_ERR_SEL_CONFIG_FILE_DOES_NOT_EXIST      = 6,
63    IPMI_MONITORING_ERR_SEL_CONFIG_FILE_PARSE               = 7,
64    IPMI_MONITORING_ERR_SENSOR_CONFIG_FILE_DOES_NOT_EXIST   = 8,
65    IPMI_MONITORING_ERR_SENSOR_CONFIG_FILE_PARSE            = 9,
66    IPMI_MONITORING_ERR_SDR_CACHE_PERMISSION                = 10,
67    IPMI_MONITORING_ERR_SDR_CACHE_FILESYSTEM                = 11,
68    IPMI_MONITORING_ERR_HOSTNAME_INVALID                    = 12,
69    IPMI_MONITORING_ERR_SENSOR_NOT_FOUND                    = 13,
70    IPMI_MONITORING_ERR_NO_SEL_RECORDS                      = 14,
71    IPMI_MONITORING_ERR_SEL_RECORDS_LIST_END                = 15,
72    IPMI_MONITORING_ERR_SEL_RECORD_DATA_NOT_AVAILABLE       = 16,
73    IPMI_MONITORING_ERR_NO_SENSOR_READINGS                  = 17,
74    IPMI_MONITORING_ERR_SENSOR_READINGS_LIST_END            = 18,
75    IPMI_MONITORING_ERR_CONNECTION_TIMEOUT                  = 19,
76    IPMI_MONITORING_ERR_SESSION_TIMEOUT                     = 20,
77    IPMI_MONITORING_ERR_USERNAME_INVALID                    = 21,
78    IPMI_MONITORING_ERR_PASSWORD_INVALID                    = 22,
79    IPMI_MONITORING_ERR_PASSWORD_VERIFICATION_TIMEOUT       = 23,
80    IPMI_MONITORING_ERR_K_G_INVALID                         = 24,
81    IPMI_MONITORING_ERR_PRIVILEGE_LEVEL_INSUFFICIENT        = 25,
82    IPMI_MONITORING_ERR_PRIVILEGEL_LEVEL_CANNOT_BE_OBTAINED = 26,
83    IPMI_MONITORING_ERR_AUTHENTICATION_TYPE_UNAVAILABLE     = 27,
84    IPMI_MONITORING_ERR_IPMI_2_0_UNAVAILABLE                = 28,
85    IPMI_MONITORING_ERR_CIPHER_SUITE_ID_UNAVAILABLE         = 29,
86    IPMI_MONITORING_ERR_CALLBACK_ERROR                      = 30,
87    IPMI_MONITORING_ERR_BMC_BUSY                            = 31,
88    IPMI_MONITORING_ERR_OUT_OF_MEMORY                       = 32,
89    IPMI_MONITORING_ERR_IPMI_ERROR                          = 33,
90    IPMI_MONITORING_ERR_SYSTEM_ERROR                        = 34,
91    IPMI_MONITORING_ERR_INTERNAL_ERROR                      = 35,
92    IPMI_MONITORING_ERR_ERRNUMRANGE                         = 36,
93  };
94
95enum ipmi_monitoring_state
96  {
97    IPMI_MONITORING_STATE_NOMINAL  = 0x00,
98    IPMI_MONITORING_STATE_WARNING  = 0x01,
99    IPMI_MONITORING_STATE_CRITICAL = 0x02,
100    IPMI_MONITORING_STATE_UNKNOWN  = 0x03,
101  };
102
103enum ipmi_monitoring_sel_record_type_class
104  {
105    IPMI_MONITORING_SEL_RECORD_TYPE_CLASS_SYSTEM_EVENT_RECORD        = 0x00,
106    IPMI_MONITORING_SEL_RECORD_TYPE_CLASS_TIMESTAMPED_OEM_RECORD     = 0x01,
107    IPMI_MONITORING_SEL_RECORD_TYPE_CLASS_NON_TIMESTAMPED_OEM_RECORD = 0x02,
108    IPMI_MONITORING_SEL_RECORD_TYPE_CLASS_UNKNOWN                    = 0x03,
109  };
110
111enum ipmi_monitoring_sensor_type
112  {
113    IPMI_MONITORING_SENSOR_TYPE_RESERVED                            = 0x00,
114    IPMI_MONITORING_SENSOR_TYPE_TEMPERATURE                         = 0x01,
115    IPMI_MONITORING_SENSOR_TYPE_VOLTAGE                             = 0x02,
116    IPMI_MONITORING_SENSOR_TYPE_CURRENT                             = 0x03,
117    IPMI_MONITORING_SENSOR_TYPE_FAN                                 = 0x04,
118    IPMI_MONITORING_SENSOR_TYPE_PHYSICAL_SECURITY                   = 0x05,
119    IPMI_MONITORING_SENSOR_TYPE_PLATFORM_SECURITY_VIOLATION_ATTEMPT = 0x06,
120    IPMI_MONITORING_SENSOR_TYPE_PROCESSOR                           = 0x07,
121    IPMI_MONITORING_SENSOR_TYPE_POWER_SUPPLY                        = 0x08,
122    IPMI_MONITORING_SENSOR_TYPE_POWER_UNIT                          = 0x09,
123    IPMI_MONITORING_SENSOR_TYPE_COOLING_DEVICE                      = 0x0A,
124    IPMI_MONITORING_SENSOR_TYPE_OTHER_UNITS_BASED_SENSOR            = 0x0B,
125    IPMI_MONITORING_SENSOR_TYPE_MEMORY                              = 0x0C,
126    IPMI_MONITORING_SENSOR_TYPE_DRIVE_SLOT                          = 0x0D,
127    IPMI_MONITORING_SENSOR_TYPE_POST_MEMORY_RESIZE                  = 0x0E,
128    IPMI_MONITORING_SENSOR_TYPE_SYSTEM_FIRMWARE_PROGRESS            = 0x0F,
129    IPMI_MONITORING_SENSOR_TYPE_EVENT_LOGGING_DISABLED              = 0x10,
130    IPMI_MONITORING_SENSOR_TYPE_WATCHDOG1                           = 0x11,
131    IPMI_MONITORING_SENSOR_TYPE_SYSTEM_EVENT                        = 0x12,
132    IPMI_MONITORING_SENSOR_TYPE_CRITICAL_INTERRUPT                  = 0x13,
133    IPMI_MONITORING_SENSOR_TYPE_BUTTON_SWITCH                       = 0x14,
134    IPMI_MONITORING_SENSOR_TYPE_MODULE_BOARD                        = 0x15,
135    IPMI_MONITORING_SENSOR_TYPE_MICROCONTROLLER_COPROCESSOR         = 0x16,
136    IPMI_MONITORING_SENSOR_TYPE_ADD_IN_CARD                         = 0x17,
137    IPMI_MONITORING_SENSOR_TYPE_CHASSIS                             = 0x18,
138    IPMI_MONITORING_SENSOR_TYPE_CHIP_SET                            = 0x19,
139    IPMI_MONITORING_SENSOR_TYPE_OTHER_FRU                           = 0x1A,
140    IPMI_MONITORING_SENSOR_TYPE_CABLE_INTERCONNECT                  = 0x1B,
141    IPMI_MONITORING_SENSOR_TYPE_TERMINATOR                          = 0x1C,
142    IPMI_MONITORING_SENSOR_TYPE_SYSTEM_BOOT_INITIATED               = 0x1D,
143    IPMI_MONITORING_SENSOR_TYPE_BOOT_ERROR                          = 0x1E,
144    IPMI_MONITORING_SENSOR_TYPE_OS_BOOT                             = 0x1F,
145    IPMI_MONITORING_SENSOR_TYPE_OS_CRITICAL_STOP                    = 0x20,
146    IPMI_MONITORING_SENSOR_TYPE_SLOT_CONNECTOR                      = 0x21,
147    IPMI_MONITORING_SENSOR_TYPE_SYSTEM_ACPI_POWER_STATE             = 0x22,
148    IPMI_MONITORING_SENSOR_TYPE_WATCHDOG2                           = 0x23,
149    IPMI_MONITORING_SENSOR_TYPE_PLATFORM_ALERT                      = 0x24,
150    IPMI_MONITORING_SENSOR_TYPE_ENTITY_PRESENCE                     = 0x25,
151    IPMI_MONITORING_SENSOR_TYPE_MONITOR_ASIC_IC                     = 0x26,
152    IPMI_MONITORING_SENSOR_TYPE_LAN                                 = 0x27,
153    IPMI_MONITORING_SENSOR_TYPE_MANAGEMENT_SUBSYSTEM_HEALTH         = 0x28,
154    IPMI_MONITORING_SENSOR_TYPE_BATTERY                             = 0x29,
155    IPMI_MONITORING_SENSOR_TYPE_SESSION_AUDIT                       = 0x2A,
156    IPMI_MONITORING_SENSOR_TYPE_VERSION_CHANGE                      = 0x2B,
157    IPMI_MONITORING_SENSOR_TYPE_FRU_STATE                           = 0x2C,
158    /* 0x2D - 0xBF - RESERVED */
159    /* 0xC0 - 0xFF - OEM sensor types */
160    IPMI_MONITORING_SENSOR_TYPE_OEM_MIN                             = 0xC0,
161    IPMI_MONITORING_SENSOR_TYPE_OEM_MAX                             = 0xFF,
162    IPMI_MONITORING_SENSOR_TYPE_UNKNOWN                             = 0xFFFF,
163  };
164
165enum ipmi_monitoring_sel_event_direction
166  {
167    IPMI_MONITORING_SEL_EVENT_DIRECTION_ASSERTION   = 0x00,
168    IPMI_MONITORING_SEL_EVENT_DIRECTION_DEASSERTION = 0x01,
169  };
170
171enum ipmi_monitoring_sensor_units
172  {
173    IPMI_MONITORING_SENSOR_UNITS_NONE       = 0x00,
174    IPMI_MONITORING_SENSOR_UNITS_CELSIUS    = 0x01,
175    IPMI_MONITORING_SENSOR_UNITS_FAHRENHEIT = 0x02,
176    IPMI_MONITORING_SENSOR_UNITS_VOLTS      = 0x03,
177    IPMI_MONITORING_SENSOR_UNITS_AMPS       = 0x04,
178    IPMI_MONITORING_SENSOR_UNITS_RPM        = 0x05,
179    IPMI_MONITORING_SENSOR_UNITS_WATTS      = 0x06,
180    IPMI_MONITORING_SENSOR_UNITS_PERCENT    = 0x07,
181    /* 0x08 - 0xFE - reserved for ipmimonitoring */
182    IPMI_MONITORING_SENSOR_UNITS_UNKNOWN    = 0xFF,
183  };
184
185enum ipmi_monitoring_sensor_reading_type
186  {
187    IPMI_MONITORING_SENSOR_READING_TYPE_UNSIGNED_INTEGER8_BOOL     = 0x00,
188    IPMI_MONITORING_SENSOR_READING_TYPE_UNSIGNED_INTEGER32         = 0x01,
189    IPMI_MONITORING_SENSOR_READING_TYPE_DOUBLE                     = 0x02,
190    /* 0x03 - 0xFE - reserved for ipmimonitoring */
191    IPMI_MONITORING_SENSOR_READING_TYPE_UNKNOWN                    = 0xFF,
192  };
193
194enum ipmi_monitoring_driver_type
195  {
196    IPMI_MONITORING_DRIVER_TYPE_KCS      = 0x00,
197    IPMI_MONITORING_DRIVER_TYPE_SSIF     = 0x01,
198    IPMI_MONITORING_DRIVER_TYPE_OPENIPMI = 0x02,
199    IPMI_MONITORING_DRIVER_TYPE_SUNBMC   = 0x03,
200  };
201
202enum ipmi_monitoring_protocol_version
203  {
204    IPMI_MONITORING_PROTOCOL_VERSION_1_5 = 0x00,
205    IPMI_MONITORING_PROTOCOL_VERSION_2_0 = 0x01,
206  };
207
208enum ipmi_monitoring_privilege
209  {
210    IPMI_MONITORING_PRIVILEGE_LEVEL_USER     = 0x00,
211    IPMI_MONITORING_PRIVILEGE_LEVEL_OPERATOR = 0x01,
212    IPMI_MONITORING_PRIVILEGE_LEVEL_ADMIN    = 0x02,
213  };
214
215enum ipmi_monitoring_authentication_type
216  {
217    IPMI_MONITORING_AUTHENTICATION_TYPE_NONE                  = 0x00,
218    IPMI_MONITORING_AUTHENTICATION_TYPE_STRAIGHT_PASSWORD_KEY = 0x01,
219    IPMI_MONITORING_AUTHENTICATION_TYPE_MD2                   = 0x02,
220    IPMI_MONITORING_AUTHENTICATION_TYPE_MD5                   = 0x03,
221  };
222
223enum ipmi_monitoring_flags
224  {
225    IPMI_MONITORING_FLAGS_NONE               = 0x00,
226    IPMI_MONITORING_FLAGS_DEBUG              = 0x01,
227    IPMI_MONITORING_FLAGS_DEBUG_IPMI_PACKETS = 0x02,
228    IPMI_MONITORING_FLAGS_LOCK_MEMORY        = 0x04,
229  };
230
231enum ipmi_monitoring_workaround_flags
232  {
233    /* For use w/ IPMI_MONITORING_PROTOCOL_VERSION_1_5 */
234    IPMI_MONITORING_WORKAROUND_FLAGS_PROTOCOL_VERSION_1_5_AUTHENTICATION_CAPABILITIES     = 0x00000001,
235    IPMI_MONITORING_WORKAROUND_FLAGS_PROTOCOL_VERSION_1_5_ACCEPT_SESSION_ID_ZERO          = 0x00000002,
236    IPMI_MONITORING_WORKAROUND_FLAGS_PROTOCOL_VERSION_1_5_FORCE_PERMSG_AUTHENTICATION     = 0x00000004,
237    IPMI_MONITORING_WORKAROUND_FLAGS_PROTOCOL_VERSION_1_5_CHECK_UNEXPECTED_AUTHCODE       = 0x00000008,
238    IPMI_MONITORING_WORKAROUND_FLAGS_PROTOCOL_VERSION_1_5_BIG_ENDIAN_SEQUENCE_NUMBER      = 0x00000010,
239    IPMI_MONITORING_WORKAROUND_FLAGS_PROTOCOL_VERSION_1_5_NO_AUTH_CODE_CHECK              = 0x00000020,
240    IPMI_MONITORING_WORKAROUND_FLAGS_PROTOCOL_VERSION_1_5_NO_CHECKSUM_CHECK               = 0x00000040,
241
242    /* For use w/ IPMI_MONITORING_PROTOCOL_VERSION_2_0 */
243    IPMI_MONITORING_WORKAROUND_FLAGS_PROTOCOL_VERSION_2_0_AUTHENTICATION_CAPABILITIES     = 0x00000001,
244    IPMI_MONITORING_WORKAROUND_FLAGS_PROTOCOL_VERSION_2_0_INTEL_2_0_SESSION               = 0x00000002,
245    IPMI_MONITORING_WORKAROUND_FLAGS_PROTOCOL_VERSION_2_0_SUPERMICRO_2_0_SESSION          = 0x00000004,
246    IPMI_MONITORING_WORKAROUND_FLAGS_PROTOCOL_VERSION_2_0_SUN_2_0_SESSION                 = 0x00000008,
247    IPMI_MONITORING_WORKAROUND_FLAGS_PROTOCOL_VERSION_2_0_OPEN_SESSION_PRIVILEGE          = 0x00000010,
248    IPMI_MONITORING_WORKAROUND_FLAGS_PROTOCOL_VERSION_2_0_NON_EMPTY_INTEGRITY_CHECK_VALUE = 0x00000020,
249    IPMI_MONITORING_WORKAROUND_FLAGS_PROTOCOL_VERSION_2_0_NO_CHECKSUM_CHECK               = 0x00000040,
250
251    /* For use w/ an In-band driver */
252    IPMI_MONITORING_WORKAROUND_FLAGS_INBAND_ASSUME_IO_BASE_ADDRESS                        = 0x00000001,
253    IPMI_MONITORING_WORKAROUND_FLAGS_INBAND_SPIN_POLL                                     = 0x00000002,
254  };
255
256/* REREAD_SDR_CACHE - Re-read the SDR cache
257 *
258 * INTERPRET_OEM_DATA - Attempt to interpret OEM data if read.
259 *
260 * ASSUME_SYSTEM_EVENT_RECORD - If an event record is illegal, assume
261 * it is a bug in the system and actually a system event record.
262 *
263 * ENTITY_SENSOR_NAMES - Return sensor names with appropriate entity
264 * id and instance prefixed when appropriate.
265 *
266 * ASSUME_MAX_SDR_RECORD_COUNT - If motherboard does not implement SDR
267 * record reading properly, do not fail out.  Assume a max count.
268 */
269enum ipmi_monitoring_sel_flags
270  {
271    IPMI_MONITORING_SEL_FLAGS_REREAD_SDR_CACHE            = 0x00000001,
272    IPMI_MONITORING_SEL_FLAGS_INTERPRET_OEM_DATA          = 0x00000002,
273    IPMI_MONITORING_SEL_FLAGS_ASSUME_SYSTEM_EVENT_RECORD  = 0x00000004,
274    IPMI_MONITORING_SEL_FLAGS_ENTITY_SENSOR_NAMES         = 0x00000008,
275    IPMI_MONITORING_SEL_FLAGS_ASSUME_MAX_SDR_RECORD_COUNT = 0x00000010,
276  };
277
278/* REREAD_SDR_CACHE - Re-read the SDR cache
279 *
280 * IGNORE_NON_INTERPRETABLE_SENSORS - Do not read sensors that cannot be interpreted.
281 *
282 * BRIDGE_SENSORS - Attempt to bridge sensors not owned by the BMC
283 *
284 * INTERPRET_OEM_DATA - Attempt to interpret OEM data if read.
285 *
286 * SHARED_SENSORS - Iterate through shared sensors if found
287 *
288 * DISCRETE_READING - Allow sensor readings to be read even if the event/reading type
289 *                    code for the sensor is not valid.  This option works around
290 *                    poorly defined (and arguably illegal) SDR records that list
291 *                    non-discrete sensor expectations along with discrete state
292 *                    conditions.
293 *
294 * IGNORE_SCANNING_DISABLED - Ignore the scanning bit and read sensors no matter
295 *                            what.  This option works around motherboards
296 *                            that incorrectly indicate sensors as disabled.
297 *
298 * ASSUME_BMC_OWNER - Assume the BMC is the sensor owner no matter what.  This option
299 *                    works around motherboards that incorrectly indicate a non-BMC
300 *                    sensor owner (e.g. usually bridging is required).
301 *
302 * ENTITY_SENSOR_NAMES - Return sensor names with appropriate entity
303 *                       id and instance prefixed when appropriate.
304 *
305 * ASSUME_MAX_SDR_RECORD_COUNT - If motherboard does not implement SDR
306 *                               record reading properly, do not fail
307 *                               out.  Assume a max count.
308 */
309enum ipmi_monitoring_sensor_reading_flags
310  {
311    IPMI_MONITORING_SENSOR_READING_FLAGS_REREAD_SDR_CACHE                 = 0x00000001,
312    IPMI_MONITORING_SENSOR_READING_FLAGS_IGNORE_NON_INTERPRETABLE_SENSORS = 0x00000002,
313    IPMI_MONITORING_SENSOR_READING_FLAGS_BRIDGE_SENSORS                   = 0x00000004,
314    IPMI_MONITORING_SENSOR_READING_FLAGS_INTERPRET_OEM_DATA               = 0x00000008,
315    IPMI_MONITORING_SENSOR_READING_FLAGS_SHARED_SENSORS                   = 0x00000010,
316    IPMI_MONITORING_SENSOR_READING_FLAGS_DISCRETE_READING                 = 0x00000020,
317    IPMI_MONITORING_SENSOR_READING_FLAGS_IGNORE_SCANNING_DISABLED         = 0x00000040,
318    IPMI_MONITORING_SENSOR_READING_FLAGS_ASSUME_BMC_OWNER                 = 0x00000080,
319    IPMI_MONITORING_SENSOR_READING_FLAGS_ENTITY_SENSOR_NAMES              = 0x00000100,
320    IPMI_MONITORING_SENSOR_READING_FLAGS_ASSUME_MAX_SDR_RECORD_COUNT      = 0x00000200,
321    IPMI_MONITORING_SENSOR_READING_FLAGS_IGNORE_UNREADABLE_SENSORS        = 0x00000002, /* legacy macro */
322  };
323
324/*
325 * ipmi_monitoring_ipmi_config
326 *
327 * Configuration information for IPMI Inband monitoring
328 *
329 * driver_type
330 *
331 *   Use a specific in-band driver.
332 *
333 *   IPMI_MONITORING_DRIVER_TYPE_KCS
334 *   IPMI_MONITORING_DRIVER_TYPE_SSIF
335 *   IPMI_MONITORING_DRIVER_TYPE_OPENIPMI
336 *   IPMI_MONITORING_DRIVER_TYPE_SUNBMC
337 *
338 *    Pass < 0 for default of IPMI_MONITORING_DRIVER_TYPE_KCS.
339 *
340 * disable_auto_probe
341 *
342 *   Flag informs the library if in-band driver information should be
343 *   probed or not.
344 *
345 * driver_address
346 *
347 *   Use this specified driver address instead of a probed one.
348 *
349 * register_spacing
350 *
351 *   Use this register space instead of the probed one.
352 *
353 * driver_device
354 *
355 *   Use this driver device for the IPMI driver.
356 *
357 * Configuration information for IPMI Out-of-Band monitoring
358 *
359 * protocol_version
360 *
361 *   Indicate the IPMI protocol version to use
362 *
363 *   IPMI_MONITORING_PROTOCOL_VERSION_1_5
364 *   IPMI_MONITORING_PROTOCOL_VERSION_2_0
365 *
366 *   Pass < 0 for default of IPMI_MONITORING_VERSION_1_5.
367 *
368 * username
369 *
370 *   BMC username. Pass NULL ptr for NULL username.  Maximum length of
371 *   16 bytes.
372 *
373 * password
374 *
375 *   BMC password. Pass NULL ptr for NULL password.  Maximum length of
376 *   16 bytes for IPMI 1.5, 20 bytes for IPMI 2.0
377 *
378 * k_g
379 *
380 *   BMC Key for 2-key authentication.  Pass NULL ptr to use password
381 *   as BMC key.  The k_g key need not be an ascii string.
382 *
383 * k_g_len
384 *
385 *   Length of k_g.  Necessary b/c k_g may contain null values or in its
386 *   hex key.  Maximum length of 20 bytes.
387 *
388 * privilege_level
389 *
390 *   privilege level to authenticate with.
391 *
392 *   Supported privilege levels:
393 *
394 *   IPMI_MONITORING_PRIVILEGE_LEVEL_USER
395 *   IPMI_MONITORING_PRIVILEGE_LEVEL_OPERATOR
396 *   IPMI_MONITORING_PRIVILEGE_LEVEL_ADMIN
397 *
398 *   Pass < 0 for default of IPMI_MONITORING_PRIVILEGE_LEVEL_USER.
399 *
400 * authentication_type
401 *
402 *   authentication type to use
403 *
404 *   IPMI_MONITORING_AUTHENTICATION_TYPE_NONE
405 *   IPMI_MONITORING_AUTHENTICATION_TYPE_STRAIGHT_PASSWORD_KEY
406 *   IPMI_MONITORING_AUTHENTICATION_TYPE_MD2
407 *   IPMI_MONITORING_AUTHENTICATION_TYPE_MD5
408 *
409 *   Pass < 0 for default of IPMI_MONITORING_AUTHENTICATION_TYPE_MD5.
410 *
411 * cipher_suite_id
412 *
413 *   Cipher suite identifier to determine authentication, integrity,
414 *   and confidentiality algorithms to use.
415 *
416 *   Supported Cipher Suite IDs
417 *   (Key: A - Authentication Algorithm
418 *         I - Integrity Algorithm
419 *         C - Confidentiality Algorithm)
420 *
421 *   0 - A = None; I = None; C = None
422 *   1 - A = HMAC-SHA1; I = None; C = None
423 *   2 - A = HMAC-SHA1; I = HMAC-SHA1-96; C = None
424 *   3 - A = HMAC-SHA1; I = HMAC-SHA1-96; C = AES-CBC-128
425 *   6 - A = HMAC-MD5; I = None; C = None
426 *   7 - A = HMAC-MD5; I = HMAC-MD5-128; C = None
427 *   8 - A = HMAC-MD5; I = HMAC-MD5-128; C = AES-CBC-128
428 *   11 - A = HMAC-MD5; I = MD5-128; C = None
429 *   12 - A = HMAC-MD5; I = MD5-128; C = AES-CBC-128
430 *   15 - A = HMAC-SHA256; I = None; C = None
431 *   16 - A = HMAC-SHA256; I = HMAC-SHA256-128; C = None
432 *   17 - A = HMAC-SHA256; I = HMAC-SHA256-128; C = AES-CBC-128
433 *
434 *   Pass < 0 for default of 3.
435 *
436 * session_timeout_len
437 *
438 *   Specifies the session timeout length in milliseconds.  Pass <= 0
439 *   to default to 60000 (60 seconds).
440 *
441 * retransmission_timeout_len
442 *
443 *   Specifies the packet retransmission timeout length in
444 *   milliseconds.  Pass <= 0 to default to 500 (0.5 seconds).
445 *
446 * Configuration information for both Inband and Outofband
447 *
448 * workaround_flags
449 *
450 *   Bitwise OR of flags indicating any behavior which should be
451 *   changed from the default to handle IPMI non-compliance problems.
452 *   Some BMCs which are non-compliant may require a workaround flag
453 *   for correct operation. Pass 0 for default of no modifications to
454 *   behavior.
455 */
456struct ipmi_monitoring_ipmi_config
457{
458  int driver_type;
459  int disable_auto_probe;
460  unsigned int driver_address;
461  unsigned int register_spacing;
462  char *driver_device;
463
464  int protocol_version;
465  char *username;
466  char *password;
467  unsigned char *k_g;
468  unsigned int k_g_len;
469  int privilege_level;
470  int authentication_type;
471  int cipher_suite_id;
472  int session_timeout_len;
473  int retransmission_timeout_len;
474
475  unsigned int workaround_flags;
476};
477
478typedef struct ipmi_monitoring_ctx *ipmi_monitoring_ctx_t;
479
480/*
481 * Ipmi_Monitoring_Callback
482 *
483 * If callback returns < 0, libipmimonitoring will stop reading
484 * remaining information.
485 */
486typedef int (*Ipmi_Monitoring_Callback)(ipmi_monitoring_ctx_t c, void *callback_data);
487
488/*
489 * ipmi_monitoring_init
490 *
491 * Initialize the ipmi monitoring library.  Needs to be called only
492 * once before any ipmi monitoring functions are called.  Threaded
493 * applications are responsible for calling this function before any
494 * thread may call another function in the library.
495 *
496 * Returns 0 on success, -1 on error
497 */
498int ipmi_monitoring_init (unsigned int flags, int *errnum);
499
500/*
501 * ipmi_monitoring_ctx_create
502 *
503 * Create an ipmi monitoring context
504 *
505 * Returns context on success, NULL on error
506 */
507ipmi_monitoring_ctx_t ipmi_monitoring_ctx_create (void);
508
509/*
510 * ipmi_monitoring_ctx_destroy
511 *
512 * Destroy an ipmi monitoring context
513 */
514void ipmi_monitoring_ctx_destroy (ipmi_monitoring_ctx_t c);
515
516/*
517 * ipmi_monitoring_ctx_errnum
518 *
519 * Returns the error code of the most recently caused error
520 */
521int ipmi_monitoring_ctx_errnum (ipmi_monitoring_ctx_t c);
522
523/*
524 * ipmi_monitoring_ctx_strerror
525 *
526 * Returns a pointer to statically allocated string describing the
527 * error code in errnum.
528 */
529char *ipmi_monitoring_ctx_strerror (int errnum);
530
531/*
532 * ipmi_monitoring_ctx_errormsg
533 *
534 * Returns a pointer to statically allocated string describing the
535 * most recently caused error.
536 */
537char *ipmi_monitoring_ctx_errormsg (ipmi_monitoring_ctx_t c);
538
539/*
540 * ipmi_monitoring_ctx_sel_config_file
541 *
542 * Initialize the ipmi monitoring context with the interpretation
543 * rules stored in a specific sel configuration file.  If NULL
544 * sel_config_file is specified, the default sel configuration
545 * file will be read and parsed.
546 *
547 * If this function is never called, only the default
548 * libipmimonitoring interpretations will be used.
549 *
550 * Returns 0 on success, -1 on error
551 */
552int ipmi_monitoring_ctx_sel_config_file (ipmi_monitoring_ctx_t c,
553                                         const char *sel_config_file);
554
555/*
556 * ipmi_monitoring_ctx_sensor_config_file
557 *
558 * Initialize the ipmi monitoring context with the interpretation
559 * rules stored in a specific sensor configuration file.  If NULL
560 * sensor_config_file is specified, the default sensor configuration
561 * file will be read and parsed.
562 *
563 * If this function is never called, only the default
564 * libipmimonitoring interpretations will be used.
565 *
566 * Returns 0 on success, -1 on error
567 */
568int ipmi_monitoring_ctx_sensor_config_file (ipmi_monitoring_ctx_t c,
569                                            const char *sensor_config_file);
570
571/*
572 * ipmi_monitoring_ctx_sdr_cache_directory
573 *
574 * Initialize the ipmi monitoring context with a different SDR cache
575 * directory.
576 *
577 * Returns 0 on success, -1 on error
578 */
579int ipmi_monitoring_ctx_sdr_cache_directory (ipmi_monitoring_ctx_t c,
580                                             const char *dir);
581
582/*
583 * ipmi_monitoring_ctx_sdr_cache_filenames
584 *
585 * Initialize how sdr cache filenames will be formatted when
586 * written/read.
587 *
588 * The following may be included in the format.
589 *
590 * %L - the hostname of the local machine
591 * %H - the remote host being monitored
592 *
593 * Atleast %H must be specified.
594 *
595 * Returns 0 on success, -1 on error
596 */
597int ipmi_monitoring_ctx_sdr_cache_filenames (ipmi_monitoring_ctx_t c,
598                                             const char *format);
599
600/*
601 * ipmi_monitoring_sel_by_record_id
602 *
603 * Retrieve SEL records by record ID and store them in the monitoring context.
604 *
605 * If 'hostname' is NULL, SEL records for the current node will be retrieved in-band.
606 * If 'record_ids' is NULL, all records will be retrieved
607 * If specified, callback function will be called after each record is read and parsed.
608 *
609 * Returns number of records retrieved on success, -1 on error.
610 * SEL iterators below may be used after calling this function to
611 * iterate through records.
612 */
613int ipmi_monitoring_sel_by_record_id (ipmi_monitoring_ctx_t c,
614                                      const char *hostname,
615                                      struct ipmi_monitoring_ipmi_config *config,
616                                      unsigned int sel_flags,
617                                      unsigned int *record_ids,
618                                      unsigned int record_ids_len,
619                                      Ipmi_Monitoring_Callback callback,
620                                      void *callback_data);
621
622/*
623 * ipmi_monitoring_sel_by_sensor_type
624 *
625 * Retrieve SEL records by sensor type and store them in the
626 * monitoring context.  See 'ipmi_monitoring_sensor_type' for possible
627 * sensor type values.
628 *
629 * If 'hostname' is NULL, SEL records for the current node will be retrieved in-band.
630 * If 'sensor_types' is NULL, all records will be retrieved.
631 * If specified, callback function will be called after each record is read and parsed.
632 *
633 * Returns number of records retrieved on success, -1 on error
634 * SEL iterators below may be used after calling this function to
635 * iterate through records.
636 */
637int ipmi_monitoring_sel_by_sensor_type (ipmi_monitoring_ctx_t c,
638                                        const char *hostname,
639                                        struct ipmi_monitoring_ipmi_config *config,
640                                        unsigned int sel_flags,
641                                        unsigned int *sensor_types,
642                                        unsigned int sensor_types_len,
643                                        Ipmi_Monitoring_Callback callback,
644                                        void *callback_data);
645
646/*
647 * ipmi_monitoring_sel_by_date_range
648 *
649 * Retrieve SEL records by date range and store them in the monitoring
650 * context.  Dates may be specified in a format of MM/DD/YYYY or
651 * MM-DD-YYYY.  The month may be specified as a numeral or its
652 * abbreviated string name.
653 *
654 * If 'hostname' is NULL, SEL records for the current node will be retrieved in-band.
655 * If 'date_begin' is NULL, all records before the 'date_end' will be retrieved.
656 * If 'date_end' is NULL, the current time is assumed.
657 * If specified, callback function will be called after each record is read and parsed.
658 *
659 * Note that non-timestamped SEL records will not be retrieved at all
660 * b/c they lack a timestamp.
661 *
662 * Returns number of records retrieved on success, -1 on error
663 * SEL iterators below may be used after calling this function to
664 * iterate through records.
665 */
666int ipmi_monitoring_sel_by_date_range (ipmi_monitoring_ctx_t c,
667                                       const char *hostname,
668                                       struct ipmi_monitoring_ipmi_config *config,
669                                       unsigned int sel_flags,
670                                       const char *date_begin,
671                                       const char *date_end,
672                                       Ipmi_Monitoring_Callback callback,
673                                       void *callback_data);
674
675/*
676 * ipmi_monitoring_sel_iterator_first
677 *
678 * Reset iterator to the first sel record
679 *
680 * Returns 0 on success, -1 on error
681 */
682int ipmi_monitoring_sel_iterator_first (ipmi_monitoring_ctx_t c);
683
684/*
685 * ipmi_monitoring_sel_iterator_next
686 *
687 * Advance iterator to the next sel record information
688 *
689 * Returns 1 on iterator advancing, 0 on end, -1 on error
690 */
691int ipmi_monitoring_sel_iterator_next (ipmi_monitoring_ctx_t c);
692
693/*
694 * ipmi_monitoring_sel_iterator_destroy
695 *
696 * Destroy all internally stored sel records.
697 */
698void ipmi_monitoring_sel_iterator_destroy (ipmi_monitoring_ctx_t c);
699
700/*
701 * ipmi_monitoring_sel_read_record_id
702 *
703 * Returns the record id of the current sel record in a callback
704 * or the iterator, -1 on error.
705 */
706int ipmi_monitoring_sel_read_record_id (ipmi_monitoring_ctx_t c);
707
708/*
709 * ipmi_monitoring_sel_read_record_type
710 *
711 * Returns the sel record type of the current sel record in a
712 * callback or the iterator, -1 on error.
713 */
714int ipmi_monitoring_sel_read_record_type (ipmi_monitoring_ctx_t c);
715
716/*
717 * ipmi_monitoring_sel_read_record_type_class
718 *
719 * Returns the sel record type class of the current sel record in a
720 * callback or the iterator, -1 on error.  See
721 * 'ipmi_monitoring_sel_record_type_class' for possible return values.
722 */
723int ipmi_monitoring_sel_read_record_type_class (ipmi_monitoring_ctx_t c);
724
725/*
726 * ipmi_monitoring_sel_read_sel_state
727 *
728 * Returns the sel state of the current sel record in a callback or
729 * the iterator, -1 on error.  See 'ipmi_monitoring_state' for
730 * possible return values.
731 */
732int ipmi_monitoring_sel_read_sel_state (ipmi_monitoring_ctx_t c);
733
734/*
735 * ipmi_monitoring_sel_read_timestamp
736 *
737 * Returns 0 on success, -1 on error.  Returns the sel record
738 * timestamp of the current sel record in 'timestamp'.  Valid for
739 * IPMI_MONITORING_SEL_RECORD_TYPE_CLASS_SYSTEM_EVENT_RECORD or
740 * IPMI_MONITORING_SEL_RECORD_TYPE_CLASS_TIMESTAMPED_OEM_RECORD class
741 * records.
742 */
743int ipmi_monitoring_sel_read_timestamp (ipmi_monitoring_ctx_t c, unsigned int *timestamp);
744
745/*
746 * ipmi_monitoring_sel_read_sensor_type
747 *
748 * Returns the sel record sensor type of the current sel record in a
749 * callback or the iterator, -1 on error.  Valid for
750 * IPMI_MONITORING_SEL_RECORD_TYPE_CLASS_SYSTEM_EVENT_RECORD class
751 * records.  See 'ipmi_monitoring_sensor_type' for possible return
752 * values.
753 */
754int ipmi_monitoring_sel_read_sensor_type (ipmi_monitoring_ctx_t c);
755
756/*
757 * ipmi_monitoring_sel_read_sensor_number
758 *
759 * Returns the sel record sensor number of the current sel record in a
760 * callback or the iterator, -1 on error.  Valid for
761 * IPMI_MONITORING_SEL_RECORD_TYPE_CLASS_SYSTEM_EVENT_RECORD class
762 * records.
763 */
764int ipmi_monitoring_sel_read_sensor_number (ipmi_monitoring_ctx_t c);
765
766/*
767 * ipmi_monitoring_sel_read_sensor_name
768 *
769 * Returns the sel record sensor name of the current sel record in a
770 * callback or the iterator, NULL on error.  Valid for
771 * IPMI_MONITORING_SEL_RECORD_TYPE_CLASS_SYSTEM_EVENT_RECORD class
772 * records.
773 */
774char *ipmi_monitoring_sel_read_sensor_name (ipmi_monitoring_ctx_t c);
775
776/*
777 * ipmi_monitoring_sel_read_event_direction
778 *
779 * Returns the sel record event direction of the current sel record in
780 * a callback or the iterator, -1 on error.  Valid for
781 * IPMI_MONITORING_SEL_RECORD_TYPE_CLASS_SYSTEM_EVENT_RECORD class
782 * records.  See 'ipmi_monitoring_sel_event_direction' for possible
783 * return values.
784 */
785int ipmi_monitoring_sel_read_event_direction (ipmi_monitoring_ctx_t c);
786
787/*
788 * ipmi_monitoring_sel_read_event_offset_type
789 *
790 * Returns the offset type of the current sel record in a
791 * callback or the iterator, -1 on error.  See
792 * 'ipmi_monitoring_event_offset_type' and offsets in
793 * ipmi_monitoring_offsets.h to determine offset conditions for a
794 * given offset type.
795 */
796int ipmi_monitoring_sel_read_event_offset_type (ipmi_monitoring_ctx_t c);
797
798/*
799 * ipmi_monitoring_sel_read_event_offset
800 *
801 * Returns the offset of the current sel record in a callback or
802 * the iterator, -1 on error.  See offsets in ipmi_monitoring_offsets.h to
803 * determine offset conditions for a given offset type.
804 */
805int ipmi_monitoring_sel_read_event_offset (ipmi_monitoring_ctx_t c);
806
807/*
808 * ipmi_monitoring_sel_read_event_offset_string
809 *
810 * Returns a string representing the event in the event offset, NULL
811 * on error.  An empty string may be returned if no event offset
812 * string is available.
813 */
814char *ipmi_monitoring_sel_read_event_offset_string (ipmi_monitoring_ctx_t c);
815
816/*
817 * ipmi_monitoring_sel_read_event_type_code
818 *
819 * Returns the event type code of the current sel record in a callback
820 * or the iterator, -1 on error.  The event type code is is piece of
821 * information is internal to the IPMI protocol.  This may be useful
822 * for advanced users wanting to handle OEM sel records or sensors not
823 * covered by this library.  Valid for
824 * IPMI_MONITORING_SEL_RECORD_TYPE_CLASS_SYSTEM_EVENT_RECORD class
825 * records.
826 */
827int ipmi_monitoring_sel_read_event_type_code (ipmi_monitoring_ctx_t c);
828
829/*
830 * ipmi_monitoring_sel_read_event_data
831 *
832 * Returns 0 on success, -1 on error.  Returns event data of the
833 * current sel record in a callback or the iterator in 'event_data1',
834 * 'event_data2', and 'event_data3' respectively.  The event data is
835 * is piece of information is internal to the IPMI protocol.  This may
836 * be useful for advanced users wanting to handle OEM sel records not
837 * covered by this library.  Valid for
838 * IPMI_MONITORING_SEL_RECORD_TYPE_CLASS_SYSTEM_EVENT_RECORD class
839 * records.
840 */
841int ipmi_monitoring_sel_read_event_data (ipmi_monitoring_ctx_t c,
842                                         unsigned int *event_data1,
843                                         unsigned int *event_data2,
844                                         unsigned int *event_data3);
845
846/*
847 * ipmi_monitoring_sel_read_manufacturer_id
848 *
849 * Returns the manufacturer ID of the current sel record in a callback
850 * or the iterator, -1 on error.  Valid for
851 * IPMI_MONITORING_SEL_RECORD_TYPE_CLASS_TIMESTAMPED_OEM_RECORD class
852 * records.
853 */
854int ipmi_monitoring_sel_read_manufacturer_id (ipmi_monitoring_ctx_t c);
855
856/*
857 * ipmi_monitoring_sel_read_oem_data
858 *
859 * Returns the OEM record data length of the current sel record in a
860 * callback or the iterator, -1 on error.  Returns OEM record data in
861 * 'oem_data'.  Valid for
862 * IPMI_MONITORING_SEL_RECORD_TYPE_CLASS_TIMESTAMPED_OEM_RECORD or
863 * IPMI_MONITORING_SEL_RECORD_TYPE_CLASS_NON_TIMESTAMPED_OEM_RECORD
864 * class records.
865 */
866int ipmi_monitoring_sel_read_oem_data (ipmi_monitoring_ctx_t c,
867                                       void *oem_data,
868                                       unsigned int oem_data_len);
869
870/*
871 * ipmi_monitoring_sensor_readings_by_record_id
872 *
873 * Retrieve sensor readings by sensor numbers and store them in the monitoring context.
874 *
875 * If 'hostname' is NULL, sensors for the current node will be retrieved in-band.
876 * If 'record_ids' is NULL, all sensors will be retrieved
877 * If specified, callback function will be called after each sensor is read and parsed.
878 *
879 * Returns number of sensors values retrieved on success, -1 on error.
880 * Sensor iterators below may be used after calling this function to
881 * iterate through sensors.
882 */
883int ipmi_monitoring_sensor_readings_by_record_id (ipmi_monitoring_ctx_t c,
884                                                  const char *hostname,
885                                                  struct ipmi_monitoring_ipmi_config *config,
886                                                  unsigned int sensor_reading_flags,
887                                                  unsigned int *record_ids,
888                                                  unsigned int record_ids_len,
889                                                  Ipmi_Monitoring_Callback callback,
890                                                  void *callback_data);
891
892/*
893 * ipmi_monitoring_sensor_readings_by_sensor_type
894 *
895 * Retrieve sensor readings by sensor type and store them in the
896 * monitoring context.  See 'ipmi_monitoring_sensor_type' for possible
897 * sensor type values.
898 *
899 * If 'hostname' is NULL, sensors for the current node will be retrieved in-band.
900 * If 'sensor_types' is NULL, all sensors will be retrieved.
901 * If specified, callback function will be called after each sensor is read and parsed.
902 *
903 * Returns number of sensors values retrieved on success, -1 on error
904 * Sensor iterators below may be used after calling this function to
905 * iterate through sensors.
906 */
907int ipmi_monitoring_sensor_readings_by_sensor_type (ipmi_monitoring_ctx_t c,
908                                                    const char *hostname,
909                                                    struct ipmi_monitoring_ipmi_config *config,
910                                                    unsigned int sensor_reading_flags,
911                                                    unsigned int *sensor_types,
912                                                    unsigned int sensor_types_len,
913                                                    Ipmi_Monitoring_Callback callback,
914                                                    void *callback_data);
915
916/*
917 * ipmi_monitoring_sensor_iterator_first
918 *
919 * Reset iterator to the first sensor reading
920 *
921 * Returns 0 on success, -1 on error
922 */
923int ipmi_monitoring_sensor_iterator_first (ipmi_monitoring_ctx_t c);
924
925/*
926 * ipmi_monitoring_sensor_iterator_next
927 *
928 * Advance iterator to the next set of sensors information
929 *
930 * Returns 0 on success, -1 on error
931 */
932int ipmi_monitoring_sensor_iterator_next (ipmi_monitoring_ctx_t c);
933
934/*
935 * ipmi_monitoring_sensor_iterator_destroy
936 *
937 * Destroy all internally stored sensors readings.
938 */
939void ipmi_monitoring_sensor_iterator_destroy (ipmi_monitoring_ctx_t c);
940
941/*
942 * ipmi_monitoring_sensor_read_record_id
943 *
944 * Returns the record id of the current sensor reading in a callback
945 * or the iterator, -1 on error.
946 */
947int ipmi_monitoring_sensor_read_record_id (ipmi_monitoring_ctx_t c);
948
949/*
950 * ipmi_monitoring_sensor_read_sensor_number
951 *
952 * Returns the sensor number of the current sensor reading in a
953 * callback or the iterator, -1 on error.  May be useful if
954 * IPMI_MONITORING_SENSOR_READING_FLAGS_SHARED_SENSORS has been set.
955 */
956int ipmi_monitoring_sensor_read_sensor_number (ipmi_monitoring_ctx_t c);
957
958/*
959 * ipmi_monitoring_sensor_read_sensor_type
960 *
961 * Returns the sensor type of the current sensor reading in a callback
962 * or the iterator, -1 on error.  See 'ipmi_monitoring_sensor_type' for possible
963 * return values.
964 */
965int ipmi_monitoring_sensor_read_sensor_type (ipmi_monitoring_ctx_t c);
966
967/*
968 * ipmi_monitoring_sensor_read_sensor_name
969 *
970 * Returns a pointer to the sensor name of the current sensor reading
971 * in a callback or the iterator, NULL on error.
972 */
973char *ipmi_monitoring_sensor_read_sensor_name (ipmi_monitoring_ctx_t c);
974
975/*
976 * ipmi_monitoring_sensor_read_sensor_state
977 *
978 * Returns the current sensor state of the current sensor reading in a
979 * callback or the iterator, -1 on error.  See 'ipmi_monitoring_state'
980 * for possible return values.
981 */
982int ipmi_monitoring_sensor_read_sensor_state (ipmi_monitoring_ctx_t c);
983
984/*
985 * ipmi_monitoring_sensor_read_sensor_units
986 *
987 * Returns the sensor units type of the current sensor reading in a
988 * callback or the iterator, -1 on error.  See
989 * 'ipmi_monitoring_sensor_units' for possible return values.
990 */
991int ipmi_monitoring_sensor_read_sensor_units (ipmi_monitoring_ctx_t c);
992
993/*
994 * ipmi_monitoring_sensor_read_sensor_reading_type
995 *
996 * Returns the sensor reading type of the current sensor reading in a
997 * callback or the iterator, -1 on error.  See
998 * 'ipmi_monitoring_sensor_reading_type' for possible return values.
999 */
1000int ipmi_monitoring_sensor_read_sensor_reading_type (ipmi_monitoring_ctx_t c);
1001
1002/*
1003 * ipmi_monitoring_sensor_read_sensor_reading
1004 *
1005 * Returns a pointer to the sensor reading of the current sensor
1006 * reading in a callback or the iterator, NULL on error.  It is the responsibility of
1007 * the user to cast it to the correct type based on the reading type.
1008 * Returns NULL if no reading available.
1009 */
1010void *ipmi_monitoring_sensor_read_sensor_reading (ipmi_monitoring_ctx_t c);
1011
1012/*
1013 * ipmi_monitoring_sensor_read_sensor_bitmask_type
1014 *
1015 * Returns the bitmask type of the current sensor reading in a
1016 * callback or the iterator, -1 on error.  See
1017 * 'ipmi_monitoring_sensor_bitmask_type' and bitmasks in
1018 * ipmi_monitoring_bitmasks.h to determine bitmask conditions for a
1019 * given bitmask type.
1020 */
1021int ipmi_monitoring_sensor_read_sensor_bitmask_type (ipmi_monitoring_ctx_t c);
1022
1023/*
1024 * ipmi_monitoring_sensor_read_sensor_bitmask
1025 *
1026 * Returns the bitmask of the current sensor reading in a callback or
1027 * the iterator, -1 on error.  See bitmasks in ipmi_monitoring_bitmasks.h to
1028 * determine bitmask conditions for a given bitmask type.
1029 */
1030int ipmi_monitoring_sensor_read_sensor_bitmask (ipmi_monitoring_ctx_t c);
1031
1032/*
1033 * ipmi_monitoring_sensor_read_sensor_bitmask_strings
1034 *
1035 * Returns an array of strings representing the events in the bitmask,
1036 * NULL on error.  Array is NUL terminated.
1037 */
1038char **ipmi_monitoring_sensor_read_sensor_bitmask_strings (ipmi_monitoring_ctx_t c);
1039
1040/*
1041 * ipmi_monitoring_sensor_read_event_reading_type_code
1042 *
1043 * Returns the event/reading type code of the current sensor reading
1044 * in a callback or the iterator, -1 on error.  The event/reading type
1045 * code is is piece of information is internal to the IPMI protocol.
1046 * This may be useful for advanced users wanting to handle OEM sensors
1047 * not covered by this library.
1048 */
1049int ipmi_monitoring_sensor_read_event_reading_type_code (ipmi_monitoring_ctx_t c);
1050
1051#ifdef __cplusplus
1052}
1053#endif
1054
1055#endif /* IPMI_MONITORING_H */
1056