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_SENSORS_H 20 #define IPMI_SENSORS_H 21 22 #include <freeipmi/freeipmi.h> 23 24 #include "tool-cmdline-common.h" 25 #include "tool-oem-common.h" 26 #include "tool-sensor-common.h" 27 #include "pstdout.h" 28 29 enum ipmi_sensors_argp_option_keys 30 { 31 VERBOSE_KEY = 'v', 32 SDR_INFO_KEY = 'i', 33 QUIET_READINGS_KEY = 'q', 34 SENSORS_KEY = 's', /* legacy */ 35 RECORD_IDS_KEY = 'r', 36 EXCLUDE_RECORD_IDS_KEY = 'R', 37 GROUP_KEY = 160, /* legacy */ 38 GROUPS_KEY = 'g', /* legacy */ 39 EXCLUDE_GROUPS_KEY = 161, /* legacy */ 40 LIST_GROUPS_KEY = 162, /* legacy */ 41 SENSOR_TYPE_KEY = 163, 42 SENSOR_TYPES_KEY = 't', 43 EXCLUDE_SENSOR_TYPES_KEY = 'T', 44 LIST_SENSOR_TYPES_KEY = 'L', 45 BRIDGE_SENSORS_KEY = 'b', 46 SHARED_SENSORS_KEY = 164, 47 INTERPRET_OEM_DATA_KEY = 165, 48 IGNORE_NOT_AVAILABLE_SENSORS_KEY = 166, 49 IGNORE_UNRECOGNIZED_EVENTS_KEY = 167, 50 OUTPUT_EVENT_BITMASK_KEY = 168, 51 OUTPUT_SENSOR_STATE_KEY = 169, 52 SENSOR_STATE_CONFIG_FILE_KEY = 170, 53 ENTITY_SENSOR_NAMES_KEY = 171, 54 OUTPUT_SENSOR_THRESHOLDS_KEY = 172, 55 NO_SENSOR_TYPE_OUTPUT_KEY = 173, 56 COMMA_SEPARATED_OUTPUT_KEY = 174, 57 NO_HEADER_OUTPUT_KEY = 175, 58 NON_ABBREVIATED_UNITS_KEY = 176, 59 LEGACY_OUTPUT_KEY = 177, 60 IPMIMONITORING_LEGACY_OUTPUT_KEY = 178, 61 }; 62 63 struct ipmi_sensors_arguments 64 { 65 struct common_cmd_args common_args; 66 unsigned int verbose_count; 67 int sdr_info; 68 int quiet_readings; 69 unsigned int record_ids[MAX_SENSOR_RECORD_IDS]; 70 unsigned int record_ids_length; 71 unsigned int exclude_record_ids[MAX_SENSOR_RECORD_IDS]; 72 unsigned int exclude_record_ids_length; 73 char sensor_types[MAX_SENSOR_TYPES][MAX_SENSOR_TYPES_STRING_LENGTH+1]; 74 unsigned int sensor_types_length; 75 char exclude_sensor_types[MAX_SENSOR_TYPES][MAX_SENSOR_TYPES_STRING_LENGTH+1]; 76 unsigned int exclude_sensor_types_length; 77 int list_sensor_types; 78 int bridge_sensors; 79 int shared_sensors; 80 int interpret_oem_data; 81 int ignore_not_available_sensors; 82 int ignore_unrecognized_events; 83 int output_event_bitmask; 84 int output_sensor_state; 85 char *sensor_state_config_file; 86 int entity_sensor_names; 87 int output_sensor_thresholds; 88 int no_sensor_type_output; 89 int comma_separated_output; 90 int no_header_output; 91 int non_abbreviated_units; 92 int legacy_output; 93 int ipmimonitoring_legacy_output; 94 }; 95 96 typedef struct ipmi_sensors_prog_data 97 { 98 char *progname; 99 struct ipmi_sensors_arguments *args; 100 } ipmi_sensors_prog_data_t; 101 102 struct ipmi_sensors_interpret_oem_data_intel_node_manager { 103 int node_manager_data_found; 104 uint8_t nm_health_event_sensor_number; 105 uint8_t nm_exception_event_sensor_number; 106 uint8_t nm_operational_capabilities_sensor_number; 107 uint8_t nm_alert_threshold_exceeded_sensor_number; 108 }; 109 110 typedef struct ipmi_sensors_state_data 111 { 112 ipmi_sensors_prog_data_t *prog_data; 113 ipmi_ctx_t ipmi_ctx; 114 pstdout_state_t pstate; 115 char *hostname; 116 ipmi_sdr_ctx_t sdr_ctx; 117 ipmi_sensor_read_ctx_t sensor_read_ctx; 118 ipmi_interpret_ctx_t interpret_ctx; 119 int output_headers; 120 struct sensor_column_width column_width; 121 struct ipmi_oem_data oem_data; 122 struct ipmi_sensors_interpret_oem_data_intel_node_manager intel_node_manager; 123 } ipmi_sensors_state_data_t; 124 125 #endif /* IPMI_SENSORS_H */ 126