1 /* 2 * Copyright (C) 2003-2015 FreeIPMI Core Team 3 * 4 * This program is free software: you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation, either version 3 of the License, or 7 * (at your option) any later version. 8 * 9 * This program is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with this program. If not, see <http://www.gnu.org/licenses/>. 16 * 17 */ 18 19 #ifndef IPMI_INTERPRET_H 20 #define IPMI_INTERPRET_H 21 22 #ifdef __cplusplus 23 extern "C" { 24 #endif 25 26 #include <stdint.h> 27 28 #define IPMI_INTERPRET_ERR_SUCCESS 0 29 #define IPMI_INTERPRET_ERR_CONTEXT_NULL 1 30 #define IPMI_INTERPRET_ERR_CONTEXT_INVALID 2 31 #define IPMI_INTERPRET_ERR_PARAMETERS 3 32 #define IPMI_INTERPRET_ERR_OUT_OF_MEMORY 4 33 #define IPMI_INTERPRET_ERR_PERMISSION 5 34 #define IPMI_INTERPRET_ERR_SEL_CONFIG_FILE_DOES_NOT_EXIST 6 35 #define IPMI_INTERPRET_ERR_SEL_CONFIG_FILE_PARSE 7 36 #define IPMI_INTERPRET_ERR_SENSOR_CONFIG_FILE_DOES_NOT_EXIST 8 37 #define IPMI_INTERPRET_ERR_SENSOR_CONFIG_FILE_PARSE 9 38 #define IPMI_INTERPRET_ERR_INVALID_SEL_RECORD 10 39 #define IPMI_INTERPRET_ERR_SYSTEM_ERROR 11 40 #define IPMI_INTERPRET_ERR_OVERFLOW 12 41 #define IPMI_INTERPRET_ERR_INTERNAL_ERROR 13 42 #define IPMI_INTERPRET_ERR_ERRNUMRANGE 14 43 44 #define IPMI_INTERPRET_FLAGS_DEFAULT 0x0000 45 #define IPMI_INTERPRET_FLAGS_INTERPRET_OEM_DATA 0x0001 46 #define IPMI_INTERPRET_FLAGS_SEL_ASSUME_SYSTEM_EVENT_RECORDS 0x0002 47 #define IPMI_INTERPRET_FLAGS_IGNORE_UNRECOGNIZED_EVENTS 0x0004 48 49 #define IPMI_INTERPRET_STATE_NOMINAL 0x00 50 #define IPMI_INTERPRET_STATE_WARNING 0x01 51 #define IPMI_INTERPRET_STATE_CRITICAL 0x02 52 #define IPMI_INTERPRET_STATE_UNKNOWN 0x03 53 54 typedef struct ipmi_interpret_ctx *ipmi_interpret_ctx_t; 55 56 /* Interpret Context Functions */ 57 ipmi_interpret_ctx_t ipmi_interpret_ctx_create (void); 58 void ipmi_interpret_ctx_destroy (ipmi_interpret_ctx_t ctx); 59 int ipmi_interpret_ctx_errnum (ipmi_interpret_ctx_t ctx); 60 char * ipmi_interpret_ctx_strerror (int errnum); 61 char * ipmi_interpret_ctx_errormsg (ipmi_interpret_ctx_t ctx); 62 63 /* interpret flag functions */ 64 int ipmi_interpret_ctx_get_flags (ipmi_interpret_ctx_t ctx, unsigned int *flags); 65 int ipmi_interpret_ctx_set_flags (ipmi_interpret_ctx_t ctx, unsigned int flags); 66 /* for use w/ IPMI_INTERPRET_FLAGS_INTERPRET_OEM_DATA */ 67 int ipmi_interpret_ctx_get_manufacturer_id (ipmi_interpret_ctx_t ctx, uint32_t *manufacturer_id); 68 int ipmi_interpret_ctx_set_manufacturer_id (ipmi_interpret_ctx_t ctx, uint32_t manufacturer_id); 69 /* for use w/ IPMI_INTERPRET_FLAGS_INTERPRET_OEM_DATA */ 70 int ipmi_interpret_ctx_get_product_id (ipmi_interpret_ctx_t ctx, uint16_t *product_id); 71 int ipmi_interpret_ctx_set_product_id (ipmi_interpret_ctx_t ctx, uint16_t product_id); 72 73 /* interpret file config loading */ 74 75 /* specify NULL for default config file */ 76 /* if not called, library default will always be used */ 77 int ipmi_interpret_load_sel_config (ipmi_interpret_ctx_t ctx, 78 const char *sel_config_file); 79 80 /* specify NULL for default config file */ 81 /* if not called, library default will always be used */ 82 int ipmi_interpret_load_sensor_config (ipmi_interpret_ctx_t ctx, 83 const char *sensor_config_file); 84 85 /* interpret core functions */ 86 87 int ipmi_interpret_sel (ipmi_interpret_ctx_t ctx, 88 const void *sel_record, 89 unsigned int sel_record_len, 90 unsigned int *sel_state); 91 92 int ipmi_interpret_sensor (ipmi_interpret_ctx_t ctx, 93 uint8_t event_reading_type_code, 94 uint8_t sensor_type, 95 uint16_t sensor_event_bitmask, 96 unsigned int *sensor_state); 97 98 #ifdef __cplusplus 99 } 100 #endif 101 102 #endif /* IPMI_INTERPRET_H */ 103