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 TOOL_EVENT_COMMON_H
20 #define TOOL_EVENT_COMMON_H
21 
22 #include <stdio.h>
23 #include <stdint.h>
24 
25 #include <freeipmi/freeipmi.h>
26 
27 #include "tool-cmdline-common.h"
28 #include "tool-oem-common.h"
29 #include "tool-sensor-common.h"
30 #include "pstdout.h"
31 
32 #define EVENT_FMT_BUFLEN       4096
33 #define EVENT_OUTPUT_BUFLEN    4096
34 #define EVENT_NA_STRING        "N/A"
35 #define EVENT_OUTPUT_SEPARATOR " ; "
36 
37 int event_load_event_state_config_file (pstdout_state_t pstate,
38                                         ipmi_interpret_ctx_t interpret_ctx,
39                                         const char *event_state_config_file);
40 
41 /* All functions below
42  * return 1 on success
43  * return (0) on non-success, data ill-formed/invalid
44  * return (-1) on error
45  */
46 
47 int event_output_time (pstdout_state_t pstate,
48                        ipmi_sel_ctx_t sel_ctx,
49                        uint8_t *sel_record,
50                        unsigned int sel_record_len,
51                        int comma_separated_output,
52                        int debug,
53                        unsigned int flags);
54 
55 int event_output_not_available_time (pstdout_state_t pstate,
56                                      int comma_separated_output);
57 
58 int event_output_sensor_name (pstdout_state_t pstate,
59                               ipmi_sel_ctx_t sel_ctx,
60                               uint8_t *sel_record,
61                               unsigned int sel_record_len,
62                               struct sensor_column_width *column_width,
63                               struct common_cmd_args *common_args,
64                               int comma_separated_output,
65                               unsigned int flags);
66 
67 int event_output_not_available_sensor_name (pstdout_state_t pstate,
68                                             struct sensor_column_width *column_width,
69                                             int comma_separated_output);
70 
71 int event_output_sensor_type (pstdout_state_t pstate,
72                               ipmi_sel_ctx_t sel_ctx,
73                               uint8_t *sel_record,
74                               unsigned int sel_record_len,
75                               struct sensor_column_width *column_width,
76                               int comma_separated_output,
77                               int debug,
78                               unsigned int flags);
79 
80 int event_output_not_available_sensor_type (pstdout_state_t pstate,
81                                             struct sensor_column_width *column_width,
82                                             int comma_separated_output);
83 
84 int event_output_event_state (pstdout_state_t pstate,
85                               ipmi_sel_ctx_t sel_ctx,
86                               uint8_t *sel_record,
87                               unsigned int sel_record_len,
88                               int comma_separated_output,
89                               int debug,
90                               unsigned int flags);
91 
92 int event_output_event_direction (pstdout_state_t pstate,
93                                   ipmi_sel_ctx_t sel_ctx,
94                                   uint8_t *sel_record,
95                                   unsigned int sel_record_len,
96                                   int comma_separated_output,
97                                   int debug,
98                                   unsigned int flags);
99 
100 int event_output_not_available_event_direction (pstdout_state_t pstate,
101                                                 int comma_separated_output);
102 
103 int event_output_event (pstdout_state_t pstate,
104                         ipmi_sel_ctx_t sel_ctx,
105                         uint8_t *sel_record,
106                         unsigned int sel_record_len,
107                         int comma_separated_output,
108                         int debug,
109                         unsigned int flags);
110 
111 int event_output_not_available_event (pstdout_state_t pstate,
112                                       int comma_separated_output);
113 
114 #endif /* TOOL_EVENT_COMMON_H */
115