1 /*
2  * Copyright (C) 2007-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_CHASSIS_H
20 #define IPMI_CHASSIS_H
21 
22 #include <freeipmi/freeipmi.h>
23 
24 #include "tool-cmdline-common.h"
25 #include "pstdout.h"
26 
27 enum ipmi_chassis_argp_option_keys
28   {
29     GET_CHASSIS_CAPABILITIES_KEY = 160,
30     GET_CHASSIS_STATUS_KEY = 161,
31     CHASSIS_CONTROL_KEY = 162,
32     CHASSIS_IDENTIFY_KEY = 163,
33     GET_SYSTEM_RESTART_CAUSE_KEY = 164,
34     GET_POWER_ON_HOURS_COUNTER_KEY = 165,
35     SET_POWER_CYCLE_INTERVAL_KEY = 166,
36     GET_BOOT_FLAGS_KEY = 167,
37     SET_BOOT_FLAGS_KEY = 168,
38     SET_BOOT_FLAGS_BOOT_TYPE_KEY = 169,
39     SET_BOOT_FLAGS_LOCK_OUT_RESET_BUTTON_KEY = 170,
40     SET_BOOT_FLAGS_SCREEN_BLANK_KEY = 171,
41     SET_BOOT_FLAGS_BOOT_DEVICE_KEY = 172,
42     SET_BOOT_FLAGS_LOCK_KEYBOARD_KEY = 173,
43     SET_BOOT_FLAGS_CMOS_CLEAR_KEY = 174,
44     SET_BOOT_FLAGS_CONSOLE_REDIRECTION_KEY = 175,
45     SET_BOOT_FLAGS_USER_PASSWORD_BYPASS_KEY = 176,
46     SET_BOOT_FLAGS_FORCE_PROGRESS_EVENT_TRAPS_KEY = 177,
47     SET_BOOT_FLAGS_FIRMWARE_BIOS_VERBOSITY_KEY = 178,
48     SET_POWER_RESTORE_POLICY_KEY = 179,
49   };
50 
51 struct cmd_set_system_boot_options
52 {
53   int bios_boot_type;
54   uint8_t bios_boot_type_arg;
55   int lock_out_reset_button;
56   uint8_t lock_out_reset_button_arg;
57   int screen_blank;
58   uint8_t screen_blank_arg;
59   int boot_device;
60   uint8_t boot_device_arg;
61   int lock_keyboard;
62   uint8_t lock_keyboard_arg;
63   int cmos_clear;
64   uint8_t cmos_clear_arg;
65   int console_redirection;
66   uint8_t console_redirection_arg;
67   int user_password_bypass;
68   uint8_t user_password_bypass_arg;
69   int force_progress_event_traps;
70   uint8_t force_progress_event_traps_arg;
71   int firmware_bios_verbosity;
72   uint8_t firmware_bios_verbosity_arg;
73 };
74 
75 struct cmd_chassis_identify
76 {
77   int identify_interval;
78   uint8_t identify_interval_arg;
79   int force_identify;
80   uint8_t force_identify_arg;
81 };
82 
83 struct ipmi_chassis_arguments
84 {
85   struct common_cmd_args common_args;
86   int get_chassis_capabilities;
87   int get_chassis_status;
88   int chassis_control;
89   uint8_t chassis_control_arg;
90   int chassis_identify;
91   struct cmd_chassis_identify chassis_identify_args;
92   int set_power_restore_policy;
93   uint8_t set_power_restore_policy_arg;
94   int set_power_cycle_interval;
95   uint8_t set_power_cycle_interval_arg;
96   int get_system_restart_cause;
97   int set_system_boot_options;
98   struct cmd_set_system_boot_options set_system_boot_options_args;
99   int get_system_boot_options;
100   int get_power_on_hours_counter;
101 };
102 
103 typedef struct ipmi_chassis_prog_data
104 {
105   char *progname;
106   struct ipmi_chassis_arguments *args;
107 } ipmi_chassis_prog_data_t;
108 
109 typedef struct ipmi_chassis_state_data
110 {
111   ipmi_chassis_prog_data_t *prog_data;
112   ipmi_ctx_t ipmi_ctx;
113   pstdout_state_t pstate;
114 } ipmi_chassis_state_data_t;
115 
116 #endif /* IPMI_CHASSIS_H */
117