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 #ifdef HAVE_CONFIG_H
20 #include <config.h>
21 #endif /* HAVE_CONFIG_H */
22
23 #include <stdio.h>
24 #include <stdlib.h>
25 #ifdef STDC_HEADERS
26 #include <string.h>
27 #endif /* STDC_HEADERS */
28 #include <errno.h>
29 #include <assert.h>
30
31 #include "freeipmi/cmds/ipmi-messaging-support-cmds.h"
32 #include "freeipmi/fiid/fiid.h"
33 #include "freeipmi/interface/ipmi-rmcpplus-interface.h"
34 #include "freeipmi/spec/ipmi-authentication-type-spec.h"
35 #include "freeipmi/spec/ipmi-channel-spec.h"
36 #include "freeipmi/spec/ipmi-cmd-spec.h"
37 #include "freeipmi/spec/ipmi-privilege-level-spec.h"
38 #include "freeipmi/spec/ipmi-system-info-parameters-spec.h"
39
40 #include "libcommon/ipmi-fiid-util.h"
41 #include "libcommon/ipmi-fill-util.h"
42 #include "libcommon/ipmi-trace.h"
43
44 #include "freeipmi-portability.h"
45
46 #define IPMI_MAX_K_LENGTH 64
47
48 fiid_template_t tmpl_cmd_set_bmc_global_enables_rq =
49 {
50 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
51 { 1, "receive_message_queue_interrupt", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
52 { 1, "event_message_buffer_full_interrupt", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
53 { 1, "event_message_buffer", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
54 { 1, "system_event_logging", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
55 { 1, "reserved", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
56 { 1, "oem_0", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
57 { 1, "oem_1", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
58 { 1, "oem_2", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
59 { 0, "", 0}
60 };
61
62 fiid_template_t tmpl_cmd_set_bmc_global_enables_rs =
63 {
64 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
65 { 8, "comp_code", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
66 { 0, "", 0}
67 };
68
69 fiid_template_t tmpl_cmd_get_bmc_global_enables_rq =
70 {
71 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
72 { 0, "", 0}
73 };
74
75 fiid_template_t tmpl_cmd_get_bmc_global_enables_rs =
76 {
77 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
78 { 8, "comp_code", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
79 { 1, "receive_message_queue_interrupt", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
80 { 1, "event_message_buffer_full_interrupt", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
81 { 1, "event_message_buffer", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
82 { 1, "system_event_logging", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
83 { 1, "reserved", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
84 { 1, "oem_0", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
85 { 1, "oem_1", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
86 { 1, "oem_2", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
87 { 0, "", 0}
88 };
89
90 fiid_template_t tmpl_cmd_clear_message_flags_rq =
91 {
92 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
93 { 1, "clear_receive_message_queue", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
94 { 1, "clear_event_message_buffer", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
95 { 1, "reserved1", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
96 { 1, "clear_watchdog_pre_timeout_interrupt_flag", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
97 { 1, "reserved2", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
98 { 1, "clear_oem_0", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
99 { 1, "clear_oem_1", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
100 { 1, "clear_oem_2", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
101 { 0, "", 0}
102 };
103
104 fiid_template_t tmpl_cmd_clear_message_flags_rs =
105 {
106 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
107 { 8, "comp_code", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
108 { 0, "", 0}
109 };
110
111 fiid_template_t tmpl_cmd_get_message_flags_rq =
112 {
113 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
114 { 0, "", 0}
115 };
116
117 fiid_template_t tmpl_cmd_get_message_flags_rs =
118 {
119 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
120 { 8, "comp_code", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
121 { 1, "receive_message_available", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
122 { 1, "event_message_buffer_full", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
123 { 1, "reserved1", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
124 { 1, "watchdog_pre_timeout_interrupt_occurred", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
125 { 1, "reserved2", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
126 { 1, "oem_0_data_available", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
127 { 1, "oem_1_data_available", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
128 { 1, "oem_2_data_available", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
129 { 0, "", 0}
130 };
131
132 fiid_template_t tmpl_cmd_enable_message_channel_receive_rq =
133 {
134 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
135 { 4, "channel_number", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
136 { 4, "reserved1", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
137 { 2, "channel_operation", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
138 { 6, "reserved2", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
139 { 0, "", 0}
140 };
141
142 fiid_template_t tmpl_cmd_enable_message_channel_receive_rs =
143 {
144 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
145 { 8, "comp_code", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
146 { 4, "channel_number", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
147 { 4, "reserved1", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
148 { 1, "channel_state", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
149 { 7, "reserved2", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
150 { 0, "", 0}
151 };
152
153 fiid_template_t tmpl_cmd_get_message_rq =
154 {
155 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
156 { 0, "", 0}
157 };
158
159 fiid_template_t tmpl_cmd_get_message_rs =
160 {
161 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
162 { 8, "comp_code", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
163 { 4, "channel_number", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
164 { 4, "inferred_privilege_level", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
165 { 1024, "message_data", FIID_FIELD_OPTIONAL | FIID_FIELD_LENGTH_VARIABLE},
166 { 0, "", 0}
167 };
168
169 fiid_template_t tmpl_cmd_send_message_rq =
170 {
171 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
172 { 4, "channel_number", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
173 { 1, "send_message_with_authentication", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
174 { 1, "send_message_with_encryption", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
175 { 2, "tracking_operation", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
176 { 1024, "message_data", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_VARIABLE},
177 { 0, "", 0}
178 };
179
180 fiid_template_t tmpl_cmd_send_message_rs =
181 {
182 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
183 { 8, "comp_code", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
184 { 1024, "response_data", FIID_FIELD_OPTIONAL | FIID_FIELD_LENGTH_VARIABLE},
185 { 0, "", 0}
186 };
187
188 fiid_template_t tmpl_cmd_read_event_message_buffer_rq =
189 {
190 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
191 { 0, "", 0}
192 };
193
194 fiid_template_t tmpl_cmd_read_event_message_buffer_rs =
195 {
196 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
197 { 8, "comp_code", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
198 { 128, "message_data", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
199 { 0, "", 0}
200 };
201
202 fiid_template_t tmpl_cmd_get_system_interface_capabilities_rq =
203 {
204 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
205 { 4, "system_interface", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
206 { 4, "reserved", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
207 { 0, "", 0}
208 };
209
210 fiid_template_t tmpl_cmd_get_system_interface_capabilities_rs =
211 {
212 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
213 { 8, "comp_code", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
214 { 8, "reserved1", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
215 { 32, "data", FIID_FIELD_OPTIONAL | FIID_FIELD_LENGTH_VARIABLE},
216 { 0, "", 0}
217 };
218
219 fiid_template_t tmpl_cmd_get_system_interface_capabilities_ssif_rs =
220 {
221 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
222 { 8, "comp_code", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
223 { 8, "reserved1", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
224 { 3, "ssif_version", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
225 { 1, "pec_support", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
226 { 2, "reserved2", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
227 { 2, "transaction_support", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
228 { 8, "input_message_size", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
229 { 8, "output_message_size", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
230 { 0, "", 0}
231 };
232
233 fiid_template_t tmpl_cmd_get_system_interface_capabilities_kcs_rs =
234 {
235 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
236 { 8, "comp_code", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
237 { 8, "reserved1", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
238 { 3, "system_interface_version", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
239 { 5, "reserved", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
240 { 8, "input_maximum_message_size", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
241 { 0, "", 0}
242 };
243
244 fiid_template_t tmpl_cmd_get_bt_interface_capabilities_rq =
245 {
246 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
247 { 0, "", 0}
248 };
249
250 fiid_template_t tmpl_cmd_get_bt_interface_capabilities_rs =
251 {
252 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
253 { 8, "comp_code", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
254 { 8, "number_of_outstanding_requests_supported", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
255 { 8, "input_buffer_size", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED}, /* in bytes */
256 { 8, "output_buffer_size", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED}, /* in bytes */
257 { 8, "bmc_request_to_response_time", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED}, /* in seconds */
258 { 8, "recommended_retries", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
259 { 0, "", 0}
260 };
261
262 fiid_template_t tmpl_cmd_master_write_read_rq =
263 {
264 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
265 { 1, "bus_type", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
266 { 3, "bus_id", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
267 { 4, "channel_number", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
268 { 1, "reserved", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
269 { 7, "slave_address", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
270 { 8, "read_count", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
271 { 2040, "data", FIID_FIELD_OPTIONAL | FIID_FIELD_LENGTH_VARIABLE},
272 { 0, "", 0}
273 };
274
275 fiid_template_t tmpl_cmd_master_write_read_rs =
276 {
277 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
278 { 8, "comp_code", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
279 { 2040, "data", FIID_FIELD_OPTIONAL | FIID_FIELD_LENGTH_VARIABLE},
280 { 0, "", 0}
281 };
282
283 fiid_template_t tmpl_cmd_get_channel_authentication_capabilities_rq =
284 {
285 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
286 { 4, "channel_number", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
287 { 3, "reserved1", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
288 { 1, "get_ipmi_v2.0_extended_data", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
289 { 4, "maximum_privilege_level", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
290 { 4, "reserved2", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
291 { 0, "", 0}
292 };
293
294 fiid_template_t tmpl_cmd_get_channel_authentication_capabilities_rs =
295 {
296 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
297 { 8, "comp_code", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
298 { 8, "channel_number", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
299 { 1, "authentication_type.none", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
300 { 1, "authentication_type.md2", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
301 { 1, "authentication_type.md5", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
302 { 1, "authentication_type.reserved1", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
303 { 1, "authentication_type.straight_password_key", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
304 { 1, "authentication_type.oem_prop", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
305 { 1, "authentication_type.reserved2", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
306 { 1, "authentication_type.ipmi_v2.0_extended_capabilities_available", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
307 { 1, "authentication_status.anonymous_login", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
308 { 1, "authentication_status.null_username", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
309 { 1, "authentication_status.non_null_username", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
310 { 1, "authentication_status.user_level_authentication", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
311 { 1, "authentication_status.per_message_authentication", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
312 { 1, "authentication_status.k_g", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
313 { 2, "authentication_status.reserved", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
314 { 1, "channel_supports_ipmi_v1.5_connections", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
315 { 1, "channel_supports_ipmi_v2.0_connections", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
316 { 6, "reserved", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
317 { 24, "oem_id", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
318 { 8, "oem_auxiliary_data", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
319 { 0, "", 0}
320 };
321
322 fiid_template_t tmpl_cmd_get_system_guid_rq =
323 {
324 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
325 { 0, "", 0}
326 };
327
328 fiid_template_t tmpl_cmd_get_system_guid_rs =
329 {
330 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
331 { 8, "comp_code", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
332 { 128, "guid", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
333 { 0, "", 0}
334 };
335
336 /* achu: format in IPMI spec differs from the format in the "Wired for
337 Management Baseline" 2.0 document. In the IPMI spec there is a 2 byte
338 field called "clock_seq_and_reserved", and in "Wired for Management
339 Baseline" there is a 1 byte field called
340 "clock_seq_hi_and_reserved" and a 1 byte field called
341 "clock_seq_low". I am going with the "Wired for Management
342 Baseline" format under the assumption the IPMI spec has a typo.
343 */
344 fiid_template_t tmpl_cmd_get_system_guid_format_rs =
345 {
346 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
347 { 8, "comp_code", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
348 { 48, "node", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED}, /* LS byte first */
349 { 8, "clock_seq_low", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
350 { 8, "clock_seq_hi_and_reserved", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
351 { 16, "time_high_and_version", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED}, /* LS byte first */
352 { 16, "time_mid", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED}, /* LS byte first */
353 { 32, "time_low", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED}, /* LS byte first */
354 { 0, "", 0}
355 };
356
357 fiid_template_t tmpl_cmd_set_system_info_parameters_rq =
358 {
359 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
360 { 8, "parameter_selector", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
361 { 1024, "configuration_parameter_data", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_VARIABLE},
362 { 0, "", 0}
363 };
364
365 fiid_template_t tmpl_cmd_set_system_info_parameters_rs =
366 {
367 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
368 { 8, "comp_code", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
369 { 0, "", 0}
370 };
371
372 fiid_template_t tmpl_cmd_set_system_info_parameters_set_in_progress_rq =
373 {
374 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
375 { 8, "parameter_selector", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
376 { 2, "state", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
377 { 6, "reserved", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
378 { 0, "", 0}
379 };
380
381 fiid_template_t tmpl_cmd_set_system_info_parameters_system_firmware_version_first_set_rq =
382 {
383 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
384 { 8, "parameter_selector", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
385 { 8, "set_selector", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
386 { 4, "encoding", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
387 { 4, "reserved", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
388 { 8, "string_length", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
389 { 112, "string", FIID_FIELD_OPTIONAL | FIID_FIELD_LENGTH_VARIABLE},
390 { 0, "", 0}
391 };
392
393 fiid_template_t tmpl_cmd_set_system_info_parameters_system_firmware_version_rq =
394 {
395 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
396 { 8, "parameter_selector", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
397 { 8, "set_selector", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
398 { 128, "string", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_VARIABLE},
399 { 0, "", 0}
400 };
401
402 fiid_template_t tmpl_cmd_set_system_info_parameters_system_name_first_set_rq =
403 {
404 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
405 { 8, "parameter_selector", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
406 { 8, "set_selector", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
407 { 4, "encoding", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
408 { 4, "reserved", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
409 { 8, "string_length", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
410 { 112, "string", FIID_FIELD_OPTIONAL | FIID_FIELD_LENGTH_VARIABLE},
411 { 0, "", 0}
412 };
413
414 fiid_template_t tmpl_cmd_set_system_info_parameters_system_name_rq =
415 {
416 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
417 { 8, "parameter_selector", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
418 { 8, "set_selector", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
419 { 128, "string", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_VARIABLE},
420 { 0, "", 0}
421 };
422
423 fiid_template_t tmpl_cmd_set_system_info_parameters_primary_operating_system_name_first_set_rq =
424 {
425 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
426 { 8, "parameter_selector", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
427 { 8, "set_selector", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
428 { 4, "encoding", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
429 { 4, "reserved", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
430 { 8, "string_length", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
431 { 112, "string", FIID_FIELD_OPTIONAL | FIID_FIELD_LENGTH_VARIABLE},
432 { 0, "", 0}
433 };
434
435 fiid_template_t tmpl_cmd_set_system_info_parameters_primary_operating_system_name_rq =
436 {
437 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
438 { 8, "parameter_selector", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
439 { 8, "set_selector", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
440 { 128, "string", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_VARIABLE},
441 { 0, "", 0}
442 };
443
444 fiid_template_t tmpl_cmd_set_system_info_parameters_operating_system_name_first_set_rq =
445 {
446 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
447 { 8, "parameter_selector", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
448 { 8, "set_selector", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
449 { 4, "encoding", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
450 { 4, "reserved", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
451 { 8, "string_length", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
452 { 112, "string", FIID_FIELD_OPTIONAL | FIID_FIELD_LENGTH_VARIABLE},
453 { 0, "", 0}
454 };
455
456 fiid_template_t tmpl_cmd_set_system_info_parameters_operating_system_name_rq =
457 {
458 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
459 { 8, "parameter_selector", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
460 { 8, "set_selector", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
461 { 128, "string", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_VARIABLE},
462 { 0, "", 0}
463 };
464
465 fiid_template_t tmpl_cmd_set_system_info_parameters_present_os_version_number_first_set_rq =
466 {
467 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
468 { 8, "parameter_selector", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
469 { 8, "set_selector", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
470 { 4, "encoding", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
471 { 4, "reserved", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
472 { 8, "string_length", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
473 { 112, "string", FIID_FIELD_OPTIONAL | FIID_FIELD_LENGTH_VARIABLE},
474 { 0, "", 0}
475 };
476
477 fiid_template_t tmpl_cmd_set_system_info_parameters_present_os_version_number_rq =
478 {
479 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
480 { 8, "parameter_selector", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
481 { 8, "set_selector", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
482 { 128, "string", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_VARIABLE},
483 { 0, "", 0}
484 };
485
486 fiid_template_t tmpl_cmd_set_system_info_parameters_bmc_url_first_set_rq =
487 {
488 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
489 { 8, "parameter_selector", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
490 { 8, "set_selector", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
491 { 4, "encoding", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
492 { 4, "reserved", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
493 { 8, "string_length", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
494 { 112, "string", FIID_FIELD_OPTIONAL | FIID_FIELD_LENGTH_VARIABLE},
495 { 0, "", 0}
496 };
497
498 fiid_template_t tmpl_cmd_set_system_info_parameters_bmc_url_rq =
499 {
500 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
501 { 8, "parameter_selector", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
502 { 8, "set_selector", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
503 { 128, "string", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_VARIABLE},
504 { 0, "", 0}
505 };
506
507 fiid_template_t tmpl_cmd_set_system_info_parameters_base_os_hypervisor_url_first_set_rq =
508 {
509 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
510 { 8, "parameter_selector", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
511 { 8, "set_selector", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
512 { 4, "encoding", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
513 { 4, "reserved", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
514 { 8, "string_length", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
515 { 112, "string", FIID_FIELD_OPTIONAL | FIID_FIELD_LENGTH_VARIABLE},
516 { 0, "", 0}
517 };
518
519 fiid_template_t tmpl_cmd_set_system_info_parameters_base_os_hypervisor_url_rq =
520 {
521 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
522 { 8, "parameter_selector", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
523 { 8, "set_selector", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
524 { 128, "string", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_VARIABLE},
525 { 0, "", 0}
526 };
527
528 fiid_template_t tmpl_cmd_get_system_info_parameters_rq =
529 {
530 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
531 { 7, "reserved", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
532 { 1, "get_parameter", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
533 { 8, "parameter_selector", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
534 { 8, "set_selector", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
535 { 8, "block_selector", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
536 { 0, "", 0}
537 };
538
539 fiid_template_t tmpl_cmd_get_system_info_parameters_rs =
540 {
541 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
542 { 8, "comp_code", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
543 { 8, "parameter_revision", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
544 { 1024, "configuration_parameter_data", FIID_FIELD_OPTIONAL | FIID_FIELD_LENGTH_VARIABLE},
545 { 0, "", 0}
546 };
547
548 fiid_template_t tmpl_cmd_get_system_info_parameters_set_in_progress_rs =
549 {
550 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
551 { 8, "comp_code", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
552 { 8, "parameter_revision", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
553 { 2, "state", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
554 { 6, "reserved", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
555 { 0, "", 0}
556 };
557
558 fiid_template_t tmpl_cmd_get_system_info_parameters_system_firmware_version_first_set_rs =
559 {
560 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
561 { 8, "comp_code", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
562 { 8, "parameter_revision", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
563 { 8, "set_selector", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
564 { 4, "encoding", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
565 { 4, "reserved", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
566 { 8, "string_length", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
567 { 112, "string", FIID_FIELD_OPTIONAL | FIID_FIELD_LENGTH_VARIABLE},
568 { 0, "", 0}
569 };
570
571 fiid_template_t tmpl_cmd_get_system_info_parameters_system_firmware_version_rs =
572 {
573 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
574 { 8, "comp_code", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
575 { 8, "parameter_revision", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
576 { 8, "set_selector", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
577 { 128, "string", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_VARIABLE},
578 { 0, "", 0}
579 };
580
581 fiid_template_t tmpl_cmd_get_system_info_parameters_system_name_first_set_rs =
582 {
583 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
584 { 8, "comp_code", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
585 { 8, "parameter_revision", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
586 { 8, "set_selector", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
587 { 4, "encoding", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
588 { 4, "reserved", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
589 { 8, "string_length", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
590 { 112, "string", FIID_FIELD_OPTIONAL | FIID_FIELD_LENGTH_VARIABLE},
591 { 0, "", 0}
592 };
593
594 fiid_template_t tmpl_cmd_get_system_info_parameters_system_name_rs =
595 {
596 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
597 { 8, "comp_code", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
598 { 8, "parameter_revision", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
599 { 8, "set_selector", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
600 { 128, "string", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_VARIABLE},
601 { 0, "", 0}
602 };
603
604 fiid_template_t tmpl_cmd_get_system_info_parameters_primary_operating_system_name_first_set_rs =
605 {
606 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
607 { 8, "comp_code", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
608 { 8, "parameter_revision", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
609 { 8, "set_selector", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
610 { 4, "encoding", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
611 { 4, "reserved", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
612 { 8, "string_length", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
613 { 112, "string", FIID_FIELD_OPTIONAL | FIID_FIELD_LENGTH_VARIABLE},
614 { 0, "", 0}
615 };
616
617 fiid_template_t tmpl_cmd_get_system_info_parameters_primary_operating_system_name_rs =
618 {
619 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
620 { 8, "comp_code", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
621 { 8, "parameter_revision", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
622 { 8, "set_selector", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
623 { 128, "string", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_VARIABLE},
624 { 0, "", 0}
625 };
626
627 fiid_template_t tmpl_cmd_get_system_info_parameters_operating_system_name_first_set_rs =
628 {
629 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
630 { 8, "comp_code", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
631 { 8, "parameter_revision", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
632 { 8, "set_selector", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
633 { 4, "encoding", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
634 { 4, "reserved", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
635 { 8, "string_length", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
636 { 112, "string", FIID_FIELD_OPTIONAL | FIID_FIELD_LENGTH_VARIABLE},
637 { 0, "", 0}
638 };
639
640 fiid_template_t tmpl_cmd_get_system_info_parameters_operating_system_name_rs =
641 {
642 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
643 { 8, "comp_code", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
644 { 8, "parameter_revision", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
645 { 8, "set_selector", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
646 { 128, "string", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_VARIABLE},
647 { 0, "", 0}
648 };
649
650 fiid_template_t tmpl_cmd_get_system_info_parameters_present_os_version_number_first_set_rs =
651 {
652 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
653 { 8, "comp_code", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
654 { 8, "parameter_revision", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
655 { 8, "set_selector", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
656 { 4, "encoding", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
657 { 4, "reserved", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
658 { 8, "string_length", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
659 { 112, "string", FIID_FIELD_OPTIONAL | FIID_FIELD_LENGTH_VARIABLE},
660 { 0, "", 0}
661 };
662
663 fiid_template_t tmpl_cmd_get_system_info_parameters_present_os_version_number_rs =
664 {
665 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
666 { 8, "comp_code", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
667 { 8, "parameter_revision", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
668 { 8, "set_selector", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
669 { 128, "string", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_VARIABLE},
670 { 0, "", 0}
671 };
672
673 fiid_template_t tmpl_cmd_get_system_info_parameters_bmc_url_first_set_rs =
674 {
675 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
676 { 8, "comp_code", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
677 { 8, "parameter_revision", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
678 { 8, "set_selector", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
679 { 4, "encoding", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
680 { 4, "reserved", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
681 { 8, "string_length", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
682 { 112, "string", FIID_FIELD_OPTIONAL | FIID_FIELD_LENGTH_VARIABLE},
683 { 0, "", 0}
684 };
685
686 fiid_template_t tmpl_cmd_get_system_info_parameters_bmc_url_rs =
687 {
688 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
689 { 8, "comp_code", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
690 { 8, "parameter_revision", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
691 { 8, "set_selector", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
692 { 128, "string", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_VARIABLE},
693 { 0, "", 0}
694 };
695
696 fiid_template_t tmpl_cmd_get_system_info_parameters_base_os_hypervisor_url_first_set_rs =
697 {
698 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
699 { 8, "comp_code", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
700 { 8, "parameter_revision", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
701 { 8, "set_selector", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
702 { 4, "encoding", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
703 { 4, "reserved", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
704 { 8, "string_length", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
705 { 112, "string", FIID_FIELD_OPTIONAL | FIID_FIELD_LENGTH_VARIABLE},
706 { 0, "", 0}
707 };
708
709 fiid_template_t tmpl_cmd_get_system_info_parameters_base_os_hypervisor_url_rs =
710 {
711 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
712 { 8, "comp_code", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
713 { 8, "parameter_revision", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
714 { 8, "set_selector", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
715 { 128, "string", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_VARIABLE},
716 { 0, "", 0}
717 };
718
719 fiid_template_t tmpl_cmd_get_channel_cipher_suites_rq =
720 {
721 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
722 { 4, "channel_number", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
723 { 4, "reserved1", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
724 { 6, "payload_type", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
725 { 2, "reserved2", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
726 { 6, "list_index", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
727 { 1, "reserved3", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
728 { 1, "list_algorithm_type", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
729 { 0, "", 0}
730 };
731
732 fiid_template_t tmpl_cmd_get_channel_cipher_suites_rs =
733 {
734 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
735 { 8, "comp_code", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
736 { 8, "channel_number", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
737 { 128, "cipher_suite_record_data", FIID_FIELD_OPTIONAL | FIID_FIELD_LENGTH_VARIABLE},
738 { 0, "", 0}
739 };
740
741 fiid_template_t tmpl_cmd_get_session_challenge_rq =
742 {
743 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
744 { 4, "authentication_type", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
745 { 4, "reserved", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
746 { 128, "user_name", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
747 { 0, "", 0}
748 };
749
750 fiid_template_t tmpl_cmd_get_session_challenge_rs =
751 {
752 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
753 { 8, "comp_code", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
754 { 32, "temp_session_id", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED}, /* LS byte first */
755 { 128, "challenge_string", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
756 { 0, "", 0}
757 };
758
759 fiid_template_t tmpl_cmd_activate_session_rq =
760 {
761 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
762 { 4, "authentication_type", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
763 { 4, "reserved1", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
764 { 4, "maximum_privilege_level", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
765 { 4, "reserved2", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
766 { 128, "challenge_string", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
767 { 32, "initial_outbound_sequence_number", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
768 { 0, "", 0}
769 };
770
771 fiid_template_t tmpl_cmd_activate_session_rs =
772 {
773 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
774 { 8, "comp_code", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
775 { 4, "authentication_type", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
776 { 4, "reserved1", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
777 { 32, "session_id", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
778 { 32, "initial_inbound_sequence_number", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
779 { 4, "maximum_privilege_level", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
780 { 4, "reserved2", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
781 { 0, "", 0}
782 };
783
784 fiid_template_t tmpl_cmd_set_session_privilege_level_rq =
785 {
786 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
787 { 4, "privilege_level", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
788 { 4, "reserved1", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
789 { 0, "", 0}
790 };
791
792 fiid_template_t tmpl_cmd_set_session_privilege_level_rs =
793 {
794 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
795 { 8, "comp_code", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
796 { 4, "privilege_level", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
797 { 4, "reserved1", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
798 { 0, "", 0}
799 };
800
801 fiid_template_t tmpl_cmd_close_session_rq =
802 {
803 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
804 { 32, "session_id", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
805 { 8, "session_handle", FIID_FIELD_OPTIONAL | FIID_FIELD_LENGTH_FIXED},
806 { 0, "", 0}
807 };
808
809 fiid_template_t tmpl_cmd_close_session_rs =
810 {
811 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
812 { 8, "comp_code", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
813 { 0, "", 0}
814 };
815
816
817 fiid_template_t tmpl_cmd_set_channel_access_rq =
818 {
819 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
820 { 4, "channel_number", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
821 { 4, "reserved1", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
822 { 3, "ipmi_messaging_access_mode", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
823 { 1, "user_level_authentication", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
824 { 1, "per_message_authentication", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
825 { 1, "pef_alerting", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
826 { 2, "channel_access_set", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
827 { 4, "channel_privilege_level_limit", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
828 { 2, "reserved2", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
829 { 2, "channel_privilege_level_limit_set", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
830 { 0, "", 0}
831 };
832
833 fiid_template_t tmpl_cmd_set_channel_access_rs =
834 {
835 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
836 { 8, "comp_code", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
837 { 0, "", 0}
838 };
839
840 fiid_template_t tmpl_cmd_get_channel_access_rq =
841 {
842 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
843 { 4, "channel_number", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
844 { 4, "reserved1", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
845 { 6, "reserved2", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
846 { 2, "channel_access_get", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
847 { 0, "", 0}
848 };
849
850 fiid_template_t tmpl_cmd_get_channel_access_rs =
851 {
852 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
853 { 8, "comp_code", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
854 { 3, "ipmi_messaging_access_mode", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
855 { 1, "user_level_authentication", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
856 { 1, "per_message_authentication", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
857 { 1, "pef_alerting", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
858 { 2, "reserved1", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
859 { 4, "channel_privilege_level_limit", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
860 { 4, "reserved2", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
861 { 0, "", 0}
862 };
863
864 fiid_template_t tmpl_cmd_get_channel_info_rq =
865 {
866 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
867 { 4, "channel_number", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
868 { 4, "reserved", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
869 { 0, "", 0}
870 };
871
872 fiid_template_t tmpl_cmd_get_channel_info_rs =
873 {
874 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
875 { 8, "comp_code", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
876 { 4, "actual_channel_number", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
877 { 4, "actual_channel_number.reserved", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
878 { 7, "channel_medium_type", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
879 { 1, "channel_medium_type.reserved", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
880 { 5, "channel_protocol_type", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
881 { 3, "channel_protocol_type.reserved", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
882 { 6, "active_session_count", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
883 { 2, "session_support", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
884 { 24, "vendor_id", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
885 { 16, "auxiliary_channel_info", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
886 { 0, "", 0}
887 };
888
889 fiid_template_t tmpl_cmd_set_channel_security_keys_rq =
890 {
891 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
892 { 4, "channel_number", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
893 { 4, "reserved1", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
894 { 2, "operation", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
895 { 6, "reserved2", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
896 { 8, "key_id", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
897 { 160, "key_value", FIID_FIELD_OPTIONAL | FIID_FIELD_LENGTH_VARIABLE},
898 { 0, "", 0}
899 };
900
901 fiid_template_t tmpl_cmd_set_channel_security_keys_rs =
902 {
903 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
904 { 8, "comp_code", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
905 { 2, "lock_status", FIID_FIELD_OPTIONAL | FIID_FIELD_LENGTH_FIXED},
906 { 6, "reserved", FIID_FIELD_OPTIONAL | FIID_FIELD_LENGTH_FIXED},
907 { 160, "key_value", FIID_FIELD_OPTIONAL | FIID_FIELD_LENGTH_VARIABLE},
908 { 0, "", 0}
909 };
910
911 fiid_template_t tmpl_cmd_set_user_access_rq =
912 {
913 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
914 { 4, "channel_number", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
915 { 1, "user_ipmi_messaging", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
916 { 1, "user_link_authentication", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
917 { 1, "user_restricted_to_callback", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
918 { 1, "change_bits_in_byte", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
919 { 6, "user_id", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
920 { 2, "reserved1", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
921 { 4, "user_privilege_level_limit", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
922 { 4, "reserved2", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
923 { 4, "user_session_limit", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
924 { 4, "reserved3", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
925 { 0, "", 0}
926 };
927
928 fiid_template_t tmpl_cmd_set_user_access_rs =
929 {
930 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
931 { 8, "comp_code", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
932 { 0, "", 0}
933 };
934
935 fiid_template_t tmpl_cmd_get_user_access_rq =
936 {
937 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
938 { 4, "channel_number", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
939 { 4, "reserved1", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
940 { 6, "user_id", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
941 { 2, "reserved2", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
942 { 0, "", 0}
943 };
944
945 fiid_template_t tmpl_cmd_get_user_access_rs =
946 {
947 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
948 { 8, "comp_code", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
949 { 6, "max_channel_user_ids", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
950 { 2, "reserved1", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
951 { 6, "current_channel_user_ids", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
952 { 2, "user_id_enable_status", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
953 { 6, "current_channel_fixed_names", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
954 { 2, "reserved2", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
955 { 4, "user_privilege_level_limit", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
956 { 1, "user_ipmi_messaging", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
957 { 1, "user_link_authentication", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
958 { 1, "user_restricted_to_callback", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
959 { 1, "reserved3", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
960 { 0, "", 0}
961 };
962
963 fiid_template_t tmpl_cmd_set_user_name_rq =
964 {
965 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
966 { 6, "user_id", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
967 { 2, "user_id.reserved", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
968 { 128, "user_name", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
969 { 0, "", 0}
970 };
971
972 fiid_template_t tmpl_cmd_set_user_name_rs =
973 {
974 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
975 { 8, "comp_code", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
976 { 0, "", 0}
977 };
978
979 fiid_template_t tmpl_cmd_get_user_name_rq =
980 {
981 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
982 { 6, "user_id", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
983 { 2, "user_id.reserved", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
984 { 0, "", 0}
985 };
986
987 fiid_template_t tmpl_cmd_get_user_name_rs =
988 {
989 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
990 { 8, "comp_code", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
991 { 128, "user_name", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
992 { 0, "", 0}
993 };
994
995 /* achu: Note that the password is variable length, but it must be
996 * fixed to 0, 16, or 20 bytes. We may try and amend this situation
997 * in fiid at a later time.
998 */
999 fiid_template_t tmpl_cmd_set_user_password_rq =
1000 {
1001 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
1002 { 6, "user_id", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
1003 { 1, "user_id.reserved", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
1004 { 1, "password_size", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
1005 { 2, "operation", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
1006 { 6, "operation.reserved", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED},
1007 { 160, "password", FIID_FIELD_OPTIONAL | FIID_FIELD_LENGTH_VARIABLE},
1008 { 0, "", 0}
1009 };
1010
1011 fiid_template_t tmpl_cmd_set_user_password_rs =
1012 {
1013 { 8, "cmd", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
1014 { 8, "comp_code", FIID_FIELD_REQUIRED | FIID_FIELD_LENGTH_FIXED | FIID_FIELD_MAKES_PACKET_SUFFICIENT},
1015 { 0, "", 0}
1016 };
1017
1018 int
fill_cmd_set_bmc_global_enables(uint8_t receive_message_queue_interrupt,uint8_t event_message_buffer_full_interrupt,uint8_t event_message_buffer,uint8_t system_event_logging,uint8_t oem_0,uint8_t oem_1,uint8_t oem_2,fiid_obj_t obj_cmd_rq)1019 fill_cmd_set_bmc_global_enables (uint8_t receive_message_queue_interrupt,
1020 uint8_t event_message_buffer_full_interrupt,
1021 uint8_t event_message_buffer,
1022 uint8_t system_event_logging,
1023 uint8_t oem_0,
1024 uint8_t oem_1,
1025 uint8_t oem_2,
1026 fiid_obj_t obj_cmd_rq)
1027 {
1028 if (!IPMI_BMC_GLOBAL_ENABLES_VALID (receive_message_queue_interrupt)
1029 || !IPMI_BMC_GLOBAL_ENABLES_VALID (event_message_buffer_full_interrupt)
1030 || !IPMI_BMC_GLOBAL_ENABLES_VALID (event_message_buffer)
1031 || !IPMI_BMC_GLOBAL_ENABLES_VALID (system_event_logging)
1032 || !IPMI_BMC_GLOBAL_ENABLES_VALID (oem_0)
1033 || !IPMI_BMC_GLOBAL_ENABLES_VALID (oem_1)
1034 || !IPMI_BMC_GLOBAL_ENABLES_VALID (oem_2)
1035 || !fiid_obj_valid (obj_cmd_rq))
1036 {
1037 SET_ERRNO (EINVAL);
1038 return (-1);
1039 }
1040
1041 if (FIID_OBJ_TEMPLATE_COMPARE (obj_cmd_rq, tmpl_cmd_set_bmc_global_enables_rq) < 0)
1042 {
1043 ERRNO_TRACE (errno);
1044 return (-1);
1045 }
1046
1047 FILL_FIID_OBJ_CLEAR (obj_cmd_rq);
1048 FILL_FIID_OBJ_SET (obj_cmd_rq, "cmd", IPMI_CMD_SET_BMC_GLOBAL_ENABLES);
1049 FILL_FIID_OBJ_SET (obj_cmd_rq, "receive_message_queue_interrupt", receive_message_queue_interrupt);
1050 FILL_FIID_OBJ_SET (obj_cmd_rq, "event_message_buffer_full_interrupt", event_message_buffer_full_interrupt);
1051 FILL_FIID_OBJ_SET (obj_cmd_rq, "event_message_buffer", event_message_buffer);
1052 FILL_FIID_OBJ_SET (obj_cmd_rq, "system_event_logging", system_event_logging);
1053 FILL_FIID_OBJ_SET (obj_cmd_rq, "reserved", 0);
1054 FILL_FIID_OBJ_SET (obj_cmd_rq, "oem_0", oem_0);
1055 FILL_FIID_OBJ_SET (obj_cmd_rq, "oem_1", oem_1);
1056 FILL_FIID_OBJ_SET (obj_cmd_rq, "oem_2", oem_2);
1057
1058 return (0);
1059 }
1060
1061 int
fill_cmd_get_bmc_global_enables(fiid_obj_t obj_cmd_rq)1062 fill_cmd_get_bmc_global_enables (fiid_obj_t obj_cmd_rq)
1063 {
1064 if (!fiid_obj_valid (obj_cmd_rq))
1065 {
1066 SET_ERRNO (EINVAL);
1067 return (-1);
1068 }
1069
1070 if (FIID_OBJ_TEMPLATE_COMPARE (obj_cmd_rq, tmpl_cmd_get_bmc_global_enables_rq) < 0)
1071 {
1072 ERRNO_TRACE (errno);
1073 return (-1);
1074 }
1075
1076 FILL_FIID_OBJ_CLEAR (obj_cmd_rq);
1077 FILL_FIID_OBJ_SET (obj_cmd_rq, "cmd", IPMI_CMD_GET_BMC_GLOBAL_ENABLES);
1078
1079 return (0);
1080 }
1081
1082 int
fill_cmd_clear_message_flags(uint8_t receive_message_queue,uint8_t event_message_buffer,uint8_t watchdog_pre_timeout_interrupt_flag,uint8_t oem_0,uint8_t oem_1,uint8_t oem_2,fiid_obj_t obj_cmd_rq)1083 fill_cmd_clear_message_flags (uint8_t receive_message_queue,
1084 uint8_t event_message_buffer,
1085 uint8_t watchdog_pre_timeout_interrupt_flag,
1086 uint8_t oem_0,
1087 uint8_t oem_1,
1088 uint8_t oem_2,
1089 fiid_obj_t obj_cmd_rq)
1090 {
1091 if (!IPMI_MESSAGE_FLAGS_VALID (receive_message_queue)
1092 || !IPMI_MESSAGE_FLAGS_VALID (event_message_buffer)
1093 || !IPMI_MESSAGE_FLAGS_VALID (watchdog_pre_timeout_interrupt_flag)
1094 || !IPMI_MESSAGE_FLAGS_VALID (oem_0)
1095 || !IPMI_MESSAGE_FLAGS_VALID (oem_1)
1096 || !IPMI_MESSAGE_FLAGS_VALID (oem_2)
1097 || !fiid_obj_valid (obj_cmd_rq))
1098 {
1099 SET_ERRNO (EINVAL);
1100 return (-1);
1101 }
1102
1103 if (FIID_OBJ_TEMPLATE_COMPARE (obj_cmd_rq, tmpl_cmd_clear_message_flags_rq) < 0)
1104 {
1105 ERRNO_TRACE (errno);
1106 return (-1);
1107 }
1108
1109 FILL_FIID_OBJ_CLEAR (obj_cmd_rq);
1110 FILL_FIID_OBJ_SET (obj_cmd_rq, "cmd", IPMI_CMD_CLEAR_MESSAGE_FLAGS);
1111 FILL_FIID_OBJ_SET (obj_cmd_rq, "clear_receive_message_queue", receive_message_queue);
1112 FILL_FIID_OBJ_SET (obj_cmd_rq, "clear_event_message_buffer", event_message_buffer);
1113 FILL_FIID_OBJ_SET (obj_cmd_rq, "reserved1", 0);
1114 FILL_FIID_OBJ_SET (obj_cmd_rq, "clear_watchdog_pre_timeout_interrupt_flag", watchdog_pre_timeout_interrupt_flag);
1115 FILL_FIID_OBJ_SET (obj_cmd_rq, "reserved2", 0);
1116 FILL_FIID_OBJ_SET (obj_cmd_rq, "clear_oem_0", oem_0);
1117 FILL_FIID_OBJ_SET (obj_cmd_rq, "clear_oem_1", oem_1);
1118 FILL_FIID_OBJ_SET (obj_cmd_rq, "clear_oem_2", oem_2);
1119 return (0);
1120 }
1121
1122 int
fill_cmd_get_message_flags(fiid_obj_t obj_cmd_rq)1123 fill_cmd_get_message_flags (fiid_obj_t obj_cmd_rq)
1124 {
1125 if (!fiid_obj_valid (obj_cmd_rq))
1126 {
1127 SET_ERRNO (EINVAL);
1128 return (-1);
1129 }
1130
1131 if (FIID_OBJ_TEMPLATE_COMPARE (obj_cmd_rq, tmpl_cmd_get_message_flags_rq) < 0)
1132 {
1133 ERRNO_TRACE (errno);
1134 return (-1);
1135 }
1136
1137 FILL_FIID_OBJ_CLEAR (obj_cmd_rq);
1138 FILL_FIID_OBJ_SET (obj_cmd_rq, "cmd", IPMI_CMD_GET_MESSAGE_FLAGS);
1139 return (0);
1140 }
1141
1142 int
fill_cmd_enable_message_channel_receive(uint8_t channel_number,uint8_t channel_operation,fiid_obj_t obj_cmd_rq)1143 fill_cmd_enable_message_channel_receive (uint8_t channel_number,
1144 uint8_t channel_operation,
1145 fiid_obj_t obj_cmd_rq)
1146 {
1147 if (!IPMI_CHANNEL_NUMBER_VALID (channel_number)
1148 || !IPMI_CHANNEL_OPERATION_VALID (channel_operation)
1149 || !fiid_obj_valid (obj_cmd_rq))
1150 {
1151 SET_ERRNO (EINVAL);
1152 return (-1);
1153 }
1154
1155 if (FIID_OBJ_TEMPLATE_COMPARE (obj_cmd_rq, tmpl_cmd_enable_message_channel_receive_rq) < 0)
1156 {
1157 ERRNO_TRACE (errno);
1158 return (-1);
1159 }
1160
1161 FILL_FIID_OBJ_CLEAR (obj_cmd_rq);
1162 FILL_FIID_OBJ_SET (obj_cmd_rq, "cmd", IPMI_CMD_ENABLE_MESSAGE_CHANNEL_RECEIVE);
1163 FILL_FIID_OBJ_SET (obj_cmd_rq, "channel_number", channel_number);
1164 FILL_FIID_OBJ_SET (obj_cmd_rq, "reserved1", 0);
1165 FILL_FIID_OBJ_SET (obj_cmd_rq, "channel_operation", channel_operation);
1166 FILL_FIID_OBJ_SET (obj_cmd_rq, "reserved2", 0);
1167 return (0);
1168 }
1169
1170 int
fill_cmd_get_message(fiid_obj_t obj_cmd_rq)1171 fill_cmd_get_message (fiid_obj_t obj_cmd_rq)
1172 {
1173 if (!fiid_obj_valid (obj_cmd_rq))
1174 {
1175 SET_ERRNO (EINVAL);
1176 return (-1);
1177 }
1178
1179 if (FIID_OBJ_TEMPLATE_COMPARE (obj_cmd_rq, tmpl_cmd_get_message_rq) < 0)
1180 {
1181 ERRNO_TRACE (errno);
1182 return (-1);
1183 }
1184
1185 FILL_FIID_OBJ_CLEAR (obj_cmd_rq);
1186 FILL_FIID_OBJ_SET (obj_cmd_rq, "cmd", IPMI_CMD_GET_MESSAGE);
1187 return (0);
1188 }
1189
1190 int
fill_cmd_send_message(uint8_t channel_number,uint8_t message_authentication,uint8_t message_encryption,uint8_t tracking_operation,const void * message_data,unsigned int message_data_len,fiid_obj_t obj_cmd_rq)1191 fill_cmd_send_message (uint8_t channel_number,
1192 uint8_t message_authentication,
1193 uint8_t message_encryption,
1194 uint8_t tracking_operation,
1195 const void *message_data,
1196 unsigned int message_data_len,
1197 fiid_obj_t obj_cmd_rq)
1198 {
1199 if (!IPMI_CHANNEL_NUMBER_VALID (channel_number)
1200 || !IPMI_SEND_MESSAGE_AUTHENTICATION_VALID (message_authentication)
1201 || !IPMI_SEND_MESSAGE_ENCRYPTION_VALID (message_encryption)
1202 || !IPMI_SEND_MESSAGE_TRACKING_VALID (tracking_operation)
1203 || !message_data
1204 || !message_data_len
1205 || !fiid_obj_valid (obj_cmd_rq))
1206 {
1207 SET_ERRNO (EINVAL);
1208 return (-1);
1209 }
1210
1211 if (FIID_OBJ_TEMPLATE_COMPARE (obj_cmd_rq, tmpl_cmd_send_message_rq) < 0)
1212 {
1213 ERRNO_TRACE (errno);
1214 return (-1);
1215 }
1216
1217 FILL_FIID_OBJ_CLEAR (obj_cmd_rq);
1218 FILL_FIID_OBJ_SET (obj_cmd_rq, "cmd", IPMI_CMD_SEND_MESSAGE);
1219 FILL_FIID_OBJ_SET (obj_cmd_rq, "channel_number", channel_number);
1220 FILL_FIID_OBJ_SET (obj_cmd_rq, "send_message_with_authentication", message_authentication);
1221 FILL_FIID_OBJ_SET (obj_cmd_rq, "send_message_with_encryption", message_encryption);
1222 FILL_FIID_OBJ_SET (obj_cmd_rq, "tracking_operation", tracking_operation);
1223 FILL_FIID_OBJ_SET_DATA (obj_cmd_rq,
1224 "message_data",
1225 message_data,
1226 message_data_len);
1227 return (0);
1228 }
1229
1230 int
fill_cmd_read_event_message_buffer(fiid_obj_t obj_cmd_rq)1231 fill_cmd_read_event_message_buffer (fiid_obj_t obj_cmd_rq)
1232 {
1233 if (!fiid_obj_valid (obj_cmd_rq))
1234 {
1235 SET_ERRNO (EINVAL);
1236 return (-1);
1237 }
1238
1239 if (FIID_OBJ_TEMPLATE_COMPARE (obj_cmd_rq, tmpl_cmd_read_event_message_buffer_rq) < 0)
1240 {
1241 ERRNO_TRACE (errno);
1242 return (-1);
1243 }
1244
1245 FILL_FIID_OBJ_CLEAR (obj_cmd_rq);
1246 FILL_FIID_OBJ_SET (obj_cmd_rq, "cmd", IPMI_CMD_READ_EVENT_MESSAGE_BUFFER);
1247 return (0);
1248 }
1249
1250 int
fill_cmd_get_system_interface_capabilities(uint8_t system_interface,fiid_obj_t obj_cmd_rq)1251 fill_cmd_get_system_interface_capabilities (uint8_t system_interface,
1252 fiid_obj_t obj_cmd_rq)
1253 {
1254 if (!IPMI_SYSTEM_INTERFACE_VALID (system_interface)
1255 || !fiid_obj_valid (obj_cmd_rq))
1256 {
1257 SET_ERRNO (EINVAL);
1258 return (-1);
1259 }
1260
1261 if (FIID_OBJ_TEMPLATE_COMPARE (obj_cmd_rq, tmpl_cmd_get_system_interface_capabilities_rq) < 0)
1262 {
1263 ERRNO_TRACE (errno);
1264 return (-1);
1265 }
1266
1267 FILL_FIID_OBJ_CLEAR (obj_cmd_rq);
1268 FILL_FIID_OBJ_SET (obj_cmd_rq, "cmd", IPMI_CMD_GET_SYSTEM_INTERFACE_CAPABILITIES);
1269 FILL_FIID_OBJ_SET (obj_cmd_rq, "system_interface", system_interface);
1270 FILL_FIID_OBJ_SET (obj_cmd_rq, "reserved", 0);
1271 return (0);
1272 }
1273
1274 int
fill_cmd_get_bt_interface_capabilities(fiid_obj_t obj_cmd_rq)1275 fill_cmd_get_bt_interface_capabilities (fiid_obj_t obj_cmd_rq)
1276 {
1277 if (!fiid_obj_valid (obj_cmd_rq))
1278 {
1279 SET_ERRNO (EINVAL);
1280 return (-1);
1281 }
1282
1283 if (FIID_OBJ_TEMPLATE_COMPARE (obj_cmd_rq, tmpl_cmd_get_bt_interface_capabilities_rq) < 0)
1284 {
1285 ERRNO_TRACE (errno);
1286 return (-1);
1287 }
1288
1289 FILL_FIID_OBJ_CLEAR (obj_cmd_rq);
1290 FILL_FIID_OBJ_SET (obj_cmd_rq, "cmd", IPMI_CMD_GET_BT_INTERFACE_CAPABILITIES);
1291 return (0);
1292 }
1293
1294 int
fill_cmd_master_write_read(uint8_t bus_type,uint8_t bus_id,uint8_t channel_number,uint8_t slave_address,uint8_t read_count,const void * data,unsigned int data_len,fiid_obj_t obj_cmd_rq)1295 fill_cmd_master_write_read (uint8_t bus_type,
1296 uint8_t bus_id,
1297 uint8_t channel_number,
1298 uint8_t slave_address,
1299 uint8_t read_count,
1300 const void *data,
1301 unsigned int data_len,
1302 fiid_obj_t obj_cmd_rq)
1303 {
1304 /* note, don't check channel number, since this is a master write-read command */
1305 if (!IPMI_BUS_TYPE_VALID (bus_type)
1306 || !fiid_obj_valid (obj_cmd_rq))
1307 {
1308 SET_ERRNO (EINVAL);
1309 return (-1);
1310 }
1311
1312 if (FIID_OBJ_TEMPLATE_COMPARE (obj_cmd_rq, tmpl_cmd_master_write_read_rq) < 0)
1313 {
1314 ERRNO_TRACE (errno);
1315 return (-1);
1316 }
1317
1318 FILL_FIID_OBJ_CLEAR (obj_cmd_rq);
1319 FILL_FIID_OBJ_SET (obj_cmd_rq, "cmd", IPMI_CMD_MASTER_WRITE_READ);
1320 FILL_FIID_OBJ_SET (obj_cmd_rq, "bus_type", bus_type);
1321 FILL_FIID_OBJ_SET (obj_cmd_rq, "bus_id", bus_id);
1322 FILL_FIID_OBJ_SET (obj_cmd_rq, "channel_number", channel_number);
1323 FILL_FIID_OBJ_SET (obj_cmd_rq, "reserved", 0);
1324 FILL_FIID_OBJ_SET (obj_cmd_rq, "slave_address", slave_address);
1325 FILL_FIID_OBJ_SET (obj_cmd_rq, "read_count", read_count);
1326 if (data && data_len)
1327 FILL_FIID_OBJ_SET_DATA (obj_cmd_rq, "data", data, data_len);
1328
1329 return (0);
1330 }
1331
1332
1333 int
fill_cmd_get_channel_authentication_capabilities(uint8_t channel_number,uint8_t maximum_privilege_level,uint8_t get_ipmi_v20_extended_data,fiid_obj_t obj_cmd_rq)1334 fill_cmd_get_channel_authentication_capabilities (uint8_t channel_number,
1335 uint8_t maximum_privilege_level,
1336 uint8_t get_ipmi_v20_extended_data,
1337 fiid_obj_t obj_cmd_rq)
1338 {
1339 if (!IPMI_CHANNEL_NUMBER_VALID (channel_number)
1340 || !IPMI_PRIVILEGE_LEVEL_VALID (maximum_privilege_level)
1341 || !IPMI_GET_IPMI_DATA_VALID (get_ipmi_v20_extended_data)
1342 || !fiid_obj_valid (obj_cmd_rq))
1343 {
1344 SET_ERRNO (EINVAL);
1345 return (-1);
1346 }
1347
1348 if (FIID_OBJ_TEMPLATE_COMPARE (obj_cmd_rq, tmpl_cmd_get_channel_authentication_capabilities_rq) < 0)
1349 {
1350 ERRNO_TRACE (errno);
1351 return (-1);
1352 }
1353
1354 FILL_FIID_OBJ_SET (obj_cmd_rq, "cmd", IPMI_CMD_GET_CHANNEL_AUTHENTICATION_CAPABILITIES);
1355 FILL_FIID_OBJ_SET (obj_cmd_rq, "channel_number", channel_number);
1356 FILL_FIID_OBJ_SET (obj_cmd_rq, "reserved1", 0);
1357 FILL_FIID_OBJ_SET (obj_cmd_rq, "get_ipmi_v2.0_extended_data", get_ipmi_v20_extended_data);
1358 FILL_FIID_OBJ_SET (obj_cmd_rq, "maximum_privilege_level", maximum_privilege_level);
1359 FILL_FIID_OBJ_SET (obj_cmd_rq, "reserved2", 0);
1360
1361 return (0);
1362 }
1363
1364 int
fill_cmd_get_system_guid(fiid_obj_t obj_cmd_rq)1365 fill_cmd_get_system_guid (fiid_obj_t obj_cmd_rq)
1366 {
1367 if (!fiid_obj_valid (obj_cmd_rq))
1368 {
1369 SET_ERRNO (EINVAL);
1370 return (-1);
1371 }
1372
1373 if (FIID_OBJ_TEMPLATE_COMPARE (obj_cmd_rq, tmpl_cmd_get_system_guid_rq) < 0)
1374 {
1375 ERRNO_TRACE (errno);
1376 return (-1);
1377 }
1378
1379 FILL_FIID_OBJ_SET (obj_cmd_rq, "cmd", IPMI_CMD_GET_SYSTEM_GUID);
1380
1381 return (0);
1382 }
1383
1384 int
fill_cmd_set_system_info_parameters(uint8_t parameter_selector,const void * configuration_parameter_data,unsigned int configuration_parameter_data_len,fiid_obj_t obj_cmd_rq)1385 fill_cmd_set_system_info_parameters (uint8_t parameter_selector,
1386 const void *configuration_parameter_data,
1387 unsigned int configuration_parameter_data_len,
1388 fiid_obj_t obj_cmd_rq)
1389 {
1390 if ((!IPMI_SYSTEM_INFO_PARAMETER_SELECTOR_VALID (parameter_selector)
1391 && !IPMI_SYSTEM_INFO_PARAMETER_SELECTOR_IS_OEM (parameter_selector))
1392 || !configuration_parameter_data
1393 || !configuration_parameter_data_len
1394 || !fiid_obj_valid (obj_cmd_rq))
1395 {
1396 SET_ERRNO (EINVAL);
1397 return (-1);
1398 }
1399
1400 if (FIID_OBJ_TEMPLATE_COMPARE (obj_cmd_rq, tmpl_cmd_set_system_info_parameters_rq) < 0)
1401 {
1402 ERRNO_TRACE (errno);
1403 return (-1);
1404 }
1405
1406 FILL_FIID_OBJ_CLEAR (obj_cmd_rq);
1407 FILL_FIID_OBJ_SET (obj_cmd_rq, "cmd", IPMI_CMD_SET_SYSTEM_INFO_PARAMETERS);
1408 FILL_FIID_OBJ_SET (obj_cmd_rq, "parameter_selector", parameter_selector);
1409 FILL_FIID_OBJ_SET_DATA (obj_cmd_rq,
1410 "configuration_parameter_data",
1411 configuration_parameter_data,
1412 configuration_parameter_data_len);
1413
1414 return (0);
1415 }
1416
1417 int
fill_cmd_set_system_info_parameters_set_in_progress(uint8_t state,fiid_obj_t obj_cmd_rq)1418 fill_cmd_set_system_info_parameters_set_in_progress (uint8_t state,
1419 fiid_obj_t obj_cmd_rq)
1420 {
1421 if (!IPMI_SYSTEM_INFO_PARAMETERS_SET_IN_PROGRESS_VALID (state)
1422 || !fiid_obj_valid (obj_cmd_rq))
1423 {
1424 SET_ERRNO (EINVAL);
1425 return (-1);
1426 }
1427
1428 if (FIID_OBJ_TEMPLATE_COMPARE (obj_cmd_rq, tmpl_cmd_set_system_info_parameters_set_in_progress_rq) < 0)
1429 {
1430 ERRNO_TRACE (errno);
1431 return (-1);
1432 }
1433
1434 FILL_FIID_OBJ_CLEAR (obj_cmd_rq);
1435 FILL_FIID_OBJ_CLEAR (obj_cmd_rq);
1436 FILL_FIID_OBJ_SET (obj_cmd_rq, "cmd", IPMI_CMD_SET_SYSTEM_INFO_PARAMETERS);
1437 FILL_FIID_OBJ_SET (obj_cmd_rq, "parameter_selector", IPMI_SYSTEM_INFO_PARAMETER_SYSTEM_FIRMWARE_VERSION);
1438 FILL_FIID_OBJ_SET (obj_cmd_rq, "state", state);
1439 FILL_FIID_OBJ_SET (obj_cmd_rq, "reserved", 0);
1440
1441 return (0);
1442 }
1443
1444 static int
_fill_cmd_set_system_info_parameters_string_first_set_common(uint8_t set_selector,uint8_t encoding,uint8_t string_length,const void * string_block,unsigned int string_block_length,fiid_obj_t obj_cmd_rq,fiid_field_t * tmpl_cmd_rq_expected,uint8_t parameter_selector)1445 _fill_cmd_set_system_info_parameters_string_first_set_common (uint8_t set_selector,
1446 uint8_t encoding,
1447 uint8_t string_length,
1448 const void *string_block,
1449 unsigned int string_block_length,
1450 fiid_obj_t obj_cmd_rq,
1451 fiid_field_t *tmpl_cmd_rq_expected,
1452 uint8_t parameter_selector)
1453 {
1454 uint8_t stringbuf[IPMI_SYSTEM_INFO_FIRST_SET_STRING_LEN_MAX];
1455
1456 assert (tmpl_cmd_rq_expected);
1457
1458 if (!IPMI_SYSTEM_INFO_ENCODING_VALID (encoding)
1459 || string_block_length > IPMI_SYSTEM_INFO_FIRST_SET_STRING_LEN_MAX
1460 || !fiid_obj_valid (obj_cmd_rq))
1461 {
1462 SET_ERRNO (EINVAL);
1463 return (-1);
1464 }
1465
1466 if (FIID_OBJ_TEMPLATE_COMPARE (obj_cmd_rq, tmpl_cmd_rq_expected) < 0)
1467 {
1468 ERRNO_TRACE (errno);
1469 return (-1);
1470 }
1471
1472 FILL_FIID_OBJ_CLEAR (obj_cmd_rq);
1473 FILL_FIID_OBJ_SET (obj_cmd_rq, "cmd", IPMI_CMD_SET_SYSTEM_INFO_PARAMETERS);
1474 FILL_FIID_OBJ_SET (obj_cmd_rq, "parameter_selector", parameter_selector);
1475 FILL_FIID_OBJ_SET (obj_cmd_rq, "set_selector", set_selector);
1476 FILL_FIID_OBJ_SET (obj_cmd_rq, "encoding", encoding);
1477 FILL_FIID_OBJ_SET (obj_cmd_rq, "reserved", 0);
1478 FILL_FIID_OBJ_SET (obj_cmd_rq, "string_length", string_length);
1479
1480 /* achu: spec is not clear if this data should be 0 extended, we
1481 * will do it to be on the safe side
1482 */
1483 memset (stringbuf, '\0', IPMI_SYSTEM_INFO_FIRST_SET_STRING_LEN_MAX);
1484 if (string_block && string_block_length)
1485 memcpy (stringbuf, string_block, string_block_length);
1486 FILL_FIID_OBJ_SET_DATA (obj_cmd_rq, "string", stringbuf, IPMI_SYSTEM_INFO_FIRST_SET_STRING_LEN_MAX);
1487
1488 return (0);
1489 }
1490
1491 static int
_fill_cmd_set_system_info_parameters_string_set_common(uint8_t set_selector,const void * string_block,unsigned int string_block_length,fiid_obj_t obj_cmd_rq,fiid_field_t * tmpl_cmd_rq_expected,uint8_t parameter_selector)1492 _fill_cmd_set_system_info_parameters_string_set_common (uint8_t set_selector,
1493 const void *string_block,
1494 unsigned int string_block_length,
1495 fiid_obj_t obj_cmd_rq,
1496 fiid_field_t *tmpl_cmd_rq_expected,
1497 uint8_t parameter_selector)
1498 {
1499 uint8_t stringbuf[IPMI_SYSTEM_INFO_SET_STRING_LEN_MAX];
1500
1501 assert (tmpl_cmd_rq_expected);
1502
1503 if (string_block_length > IPMI_SYSTEM_INFO_SET_STRING_LEN_MAX
1504 || !fiid_obj_valid (obj_cmd_rq))
1505 {
1506 SET_ERRNO (EINVAL);
1507 return (-1);
1508 }
1509
1510 if (FIID_OBJ_TEMPLATE_COMPARE (obj_cmd_rq, tmpl_cmd_rq_expected) < 0)
1511 {
1512 ERRNO_TRACE (errno);
1513 return (-1);
1514 }
1515
1516 FILL_FIID_OBJ_CLEAR (obj_cmd_rq);
1517 FILL_FIID_OBJ_SET (obj_cmd_rq, "cmd", IPMI_CMD_SET_SYSTEM_INFO_PARAMETERS);
1518 FILL_FIID_OBJ_SET (obj_cmd_rq, "parameter_selector", parameter_selector);
1519 FILL_FIID_OBJ_SET (obj_cmd_rq, "set_selector", set_selector);
1520
1521 /* achu: spec is not clear if this data should be 0 extended, we
1522 * will do it to be on the safe side
1523 */
1524 memset (stringbuf, '\0', IPMI_SYSTEM_INFO_SET_STRING_LEN_MAX);
1525 if (string_block && string_block_length)
1526 memcpy (stringbuf, string_block, string_block_length);
1527 FILL_FIID_OBJ_SET_DATA (obj_cmd_rq, "string", stringbuf, IPMI_SYSTEM_INFO_SET_STRING_LEN_MAX);
1528
1529 return (0);
1530 }
1531
1532 int
fill_cmd_set_system_info_parameters_system_firmware_version_first_set(uint8_t set_selector,uint8_t encoding,uint8_t string_length,const void * string_block,unsigned int string_block_length,fiid_obj_t obj_cmd_rq)1533 fill_cmd_set_system_info_parameters_system_firmware_version_first_set (uint8_t set_selector,
1534 uint8_t encoding,
1535 uint8_t string_length,
1536 const void *string_block,
1537 unsigned int string_block_length,
1538 fiid_obj_t obj_cmd_rq)
1539 {
1540 if (_fill_cmd_set_system_info_parameters_string_first_set_common (set_selector,
1541 encoding,
1542 string_length,
1543 string_block,
1544 string_block_length,
1545 obj_cmd_rq,
1546 tmpl_cmd_set_system_info_parameters_system_firmware_version_first_set_rq,
1547 IPMI_SYSTEM_INFO_PARAMETER_SYSTEM_FIRMWARE_VERSION) < 0)
1548 {
1549 ERRNO_TRACE (errno);
1550 return (-1);
1551 }
1552
1553 return (0);
1554 }
1555
1556 int
fill_cmd_set_system_info_parameters_system_firmware_version(uint8_t set_selector,const void * string_block,unsigned int string_block_length,fiid_obj_t obj_cmd_rq)1557 fill_cmd_set_system_info_parameters_system_firmware_version (uint8_t set_selector,
1558 const void *string_block,
1559 unsigned int string_block_length,
1560 fiid_obj_t obj_cmd_rq)
1561 {
1562 if (_fill_cmd_set_system_info_parameters_string_set_common (set_selector,
1563 string_block,
1564 string_block_length,
1565 obj_cmd_rq,
1566 tmpl_cmd_set_system_info_parameters_system_firmware_version_rq,
1567 IPMI_SYSTEM_INFO_PARAMETER_SYSTEM_FIRMWARE_VERSION) < 0)
1568 {
1569 ERRNO_TRACE (errno);
1570 return (-1);
1571 }
1572
1573 return (0);
1574 }
1575
1576 int
fill_cmd_set_system_info_parameters_system_name_first_set(uint8_t set_selector,uint8_t encoding,uint8_t string_length,const void * string_block,unsigned int string_block_length,fiid_obj_t obj_cmd_rq)1577 fill_cmd_set_system_info_parameters_system_name_first_set (uint8_t set_selector,
1578 uint8_t encoding,
1579 uint8_t string_length,
1580 const void *string_block,
1581 unsigned int string_block_length,
1582 fiid_obj_t obj_cmd_rq)
1583 {
1584 if (_fill_cmd_set_system_info_parameters_string_first_set_common (set_selector,
1585 encoding,
1586 string_length,
1587 string_block,
1588 string_block_length,
1589 obj_cmd_rq,
1590 tmpl_cmd_set_system_info_parameters_system_name_first_set_rq,
1591 IPMI_SYSTEM_INFO_PARAMETER_SYSTEM_NAME) < 0)
1592 {
1593 ERRNO_TRACE (errno);
1594 return (-1);
1595 }
1596
1597 return (0);
1598 }
1599
1600 int
fill_cmd_set_system_info_parameters_system_name(uint8_t set_selector,const void * string_block,unsigned int string_block_length,fiid_obj_t obj_cmd_rq)1601 fill_cmd_set_system_info_parameters_system_name (uint8_t set_selector,
1602 const void *string_block,
1603 unsigned int string_block_length,
1604 fiid_obj_t obj_cmd_rq)
1605 {
1606 if (_fill_cmd_set_system_info_parameters_string_set_common (set_selector,
1607 string_block,
1608 string_block_length,
1609 obj_cmd_rq,
1610 tmpl_cmd_set_system_info_parameters_system_name_rq,
1611 IPMI_SYSTEM_INFO_PARAMETER_SYSTEM_NAME) < 0)
1612 {
1613 ERRNO_TRACE (errno);
1614 return (-1);
1615 }
1616
1617 return (0);
1618 }
1619
1620 int
fill_cmd_set_system_info_parameters_primary_operating_system_name_first_set(uint8_t set_selector,uint8_t encoding,uint8_t string_length,const void * string_block,unsigned int string_block_length,fiid_obj_t obj_cmd_rq)1621 fill_cmd_set_system_info_parameters_primary_operating_system_name_first_set (uint8_t set_selector,
1622 uint8_t encoding,
1623 uint8_t string_length,
1624 const void *string_block,
1625 unsigned int string_block_length,
1626 fiid_obj_t obj_cmd_rq)
1627 {
1628 if (_fill_cmd_set_system_info_parameters_string_first_set_common (set_selector,
1629 encoding,
1630 string_length,
1631 string_block,
1632 string_block_length,
1633 obj_cmd_rq,
1634 tmpl_cmd_set_system_info_parameters_primary_operating_system_name_first_set_rq,
1635 IPMI_SYSTEM_INFO_PARAMETER_PRIMARY_OPERATING_SYSTEM_NAME) < 0)
1636 {
1637 ERRNO_TRACE (errno);
1638 return (-1);
1639 }
1640
1641 return (0);
1642 }
1643
1644 int
fill_cmd_set_system_info_parameters_primary_operating_system_name(uint8_t set_selector,const void * string_block,unsigned int string_block_length,fiid_obj_t obj_cmd_rq)1645 fill_cmd_set_system_info_parameters_primary_operating_system_name (uint8_t set_selector,
1646 const void *string_block,
1647 unsigned int string_block_length,
1648 fiid_obj_t obj_cmd_rq)
1649 {
1650 if (_fill_cmd_set_system_info_parameters_string_set_common (set_selector,
1651 string_block,
1652 string_block_length,
1653 obj_cmd_rq,
1654 tmpl_cmd_set_system_info_parameters_primary_operating_system_name_rq,
1655 IPMI_SYSTEM_INFO_PARAMETER_PRIMARY_OPERATING_SYSTEM_NAME) < 0)
1656 {
1657 ERRNO_TRACE (errno);
1658 return (-1);
1659 }
1660
1661 return (0);
1662 }
1663
1664 int
fill_cmd_set_system_info_parameters_operating_system_name_first_set(uint8_t set_selector,uint8_t encoding,uint8_t string_length,const void * string_block,unsigned int string_block_length,fiid_obj_t obj_cmd_rq)1665 fill_cmd_set_system_info_parameters_operating_system_name_first_set (uint8_t set_selector,
1666 uint8_t encoding,
1667 uint8_t string_length,
1668 const void *string_block,
1669 unsigned int string_block_length,
1670 fiid_obj_t obj_cmd_rq)
1671 {
1672 if (_fill_cmd_set_system_info_parameters_string_first_set_common (set_selector,
1673 encoding,
1674 string_length,
1675 string_block,
1676 string_block_length,
1677 obj_cmd_rq,
1678 tmpl_cmd_set_system_info_parameters_operating_system_name_first_set_rq,
1679 IPMI_SYSTEM_INFO_PARAMETER_OPERATING_SYSTEM_NAME) < 0)
1680 {
1681 ERRNO_TRACE (errno);
1682 return (-1);
1683 }
1684
1685 return (0);
1686 }
1687
1688 int
fill_cmd_set_system_info_parameters_operating_system_name(uint8_t set_selector,const void * string_block,unsigned int string_block_length,fiid_obj_t obj_cmd_rq)1689 fill_cmd_set_system_info_parameters_operating_system_name (uint8_t set_selector,
1690 const void *string_block,
1691 unsigned int string_block_length,
1692 fiid_obj_t obj_cmd_rq)
1693 {
1694 if (_fill_cmd_set_system_info_parameters_string_set_common (set_selector,
1695 string_block,
1696 string_block_length,
1697 obj_cmd_rq,
1698 tmpl_cmd_set_system_info_parameters_operating_system_name_rq,
1699 IPMI_SYSTEM_INFO_PARAMETER_OPERATING_SYSTEM_NAME) < 0)
1700 {
1701 ERRNO_TRACE (errno);
1702 return (-1);
1703 }
1704
1705 return (0);
1706 }
1707
1708 int
fill_cmd_set_system_info_parameters_present_os_version_number_first_set(uint8_t set_selector,uint8_t encoding,uint8_t string_length,const void * string_block,unsigned int string_block_length,fiid_obj_t obj_cmd_rq)1709 fill_cmd_set_system_info_parameters_present_os_version_number_first_set (uint8_t set_selector,
1710 uint8_t encoding,
1711 uint8_t string_length,
1712 const void *string_block,
1713 unsigned int string_block_length,
1714 fiid_obj_t obj_cmd_rq)
1715 {
1716 if (_fill_cmd_set_system_info_parameters_string_first_set_common (set_selector,
1717 encoding,
1718 string_length,
1719 string_block,
1720 string_block_length,
1721 obj_cmd_rq,
1722 tmpl_cmd_set_system_info_parameters_present_os_version_number_first_set_rq,
1723 IPMI_SYSTEM_INFO_PARAMETER_PRESENT_OS_VERSION_NUMBER) < 0)
1724 {
1725 ERRNO_TRACE (errno);
1726 return (-1);
1727 }
1728
1729 return (0);
1730 }
1731
1732 int
fill_cmd_set_system_info_parameters_present_os_version_number(uint8_t set_selector,const void * string_block,unsigned int string_block_length,fiid_obj_t obj_cmd_rq)1733 fill_cmd_set_system_info_parameters_present_os_version_number (uint8_t set_selector,
1734 const void *string_block,
1735 unsigned int string_block_length,
1736 fiid_obj_t obj_cmd_rq)
1737 {
1738 if (_fill_cmd_set_system_info_parameters_string_set_common (set_selector,
1739 string_block,
1740 string_block_length,
1741 obj_cmd_rq,
1742 tmpl_cmd_set_system_info_parameters_present_os_version_number_rq,
1743 IPMI_SYSTEM_INFO_PARAMETER_PRESENT_OS_VERSION_NUMBER) < 0)
1744 {
1745 ERRNO_TRACE (errno);
1746 return (-1);
1747 }
1748
1749 return (0);
1750 }
1751
1752 int
fill_cmd_set_system_info_parameters_bmc_url_first_set(uint8_t set_selector,uint8_t encoding,uint8_t string_length,const void * string_block,unsigned int string_block_length,fiid_obj_t obj_cmd_rq)1753 fill_cmd_set_system_info_parameters_bmc_url_first_set (uint8_t set_selector,
1754 uint8_t encoding,
1755 uint8_t string_length,
1756 const void *string_block,
1757 unsigned int string_block_length,
1758 fiid_obj_t obj_cmd_rq)
1759 {
1760 if (_fill_cmd_set_system_info_parameters_string_first_set_common (set_selector,
1761 encoding,
1762 string_length,
1763 string_block,
1764 string_block_length,
1765 obj_cmd_rq,
1766 tmpl_cmd_set_system_info_parameters_bmc_url_first_set_rq,
1767 IPMI_SYSTEM_INFO_PARAMETER_BMC_URL) < 0)
1768 {
1769 ERRNO_TRACE (errno);
1770 return (-1);
1771 }
1772
1773 return (0);
1774 }
1775
1776 int
fill_cmd_set_system_info_parameters_bmc_url(uint8_t set_selector,const void * string_block,unsigned int string_block_length,fiid_obj_t obj_cmd_rq)1777 fill_cmd_set_system_info_parameters_bmc_url (uint8_t set_selector,
1778 const void *string_block,
1779 unsigned int string_block_length,
1780 fiid_obj_t obj_cmd_rq)
1781 {
1782 if (_fill_cmd_set_system_info_parameters_string_set_common (set_selector,
1783 string_block,
1784 string_block_length,
1785 obj_cmd_rq,
1786 tmpl_cmd_set_system_info_parameters_bmc_url_rq,
1787 IPMI_SYSTEM_INFO_PARAMETER_BMC_URL) < 0)
1788 {
1789 ERRNO_TRACE (errno);
1790 return (-1);
1791 }
1792
1793 return (0);
1794 }
1795
1796 int
fill_cmd_set_system_info_parameters_base_os_hypervisor_url_first_set(uint8_t set_selector,uint8_t encoding,uint8_t string_length,const void * string_block,unsigned int string_block_length,fiid_obj_t obj_cmd_rq)1797 fill_cmd_set_system_info_parameters_base_os_hypervisor_url_first_set (uint8_t set_selector,
1798 uint8_t encoding,
1799 uint8_t string_length,
1800 const void *string_block,
1801 unsigned int string_block_length,
1802 fiid_obj_t obj_cmd_rq)
1803 {
1804 if (_fill_cmd_set_system_info_parameters_string_first_set_common (set_selector,
1805 encoding,
1806 string_length,
1807 string_block,
1808 string_block_length,
1809 obj_cmd_rq,
1810 tmpl_cmd_set_system_info_parameters_base_os_hypervisor_url_first_set_rq,
1811 IPMI_SYSTEM_INFO_PARAMETER_BASE_OS_HYPERVISOR_URL) < 0)
1812 {
1813 ERRNO_TRACE (errno);
1814 return (-1);
1815 }
1816
1817 return (0);
1818 }
1819
1820 int
fill_cmd_set_system_info_parameters_base_os_hypervisor_url(uint8_t set_selector,const void * string_block,unsigned int string_block_length,fiid_obj_t obj_cmd_rq)1821 fill_cmd_set_system_info_parameters_base_os_hypervisor_url (uint8_t set_selector,
1822 const void *string_block,
1823 unsigned int string_block_length,
1824 fiid_obj_t obj_cmd_rq)
1825 {
1826 if (_fill_cmd_set_system_info_parameters_string_set_common (set_selector,
1827 string_block,
1828 string_block_length,
1829 obj_cmd_rq,
1830 tmpl_cmd_set_system_info_parameters_base_os_hypervisor_url_rq,
1831 IPMI_SYSTEM_INFO_PARAMETER_BASE_OS_HYPERVISOR_URL) < 0)
1832 {
1833 ERRNO_TRACE (errno);
1834 return (-1);
1835 }
1836
1837 return (0);
1838 }
1839
1840 int
fill_cmd_get_system_info_parameters(uint8_t get_parameter,uint8_t parameter_selector,uint8_t set_selector,uint8_t block_selector,fiid_obj_t obj_cmd_rq)1841 fill_cmd_get_system_info_parameters (uint8_t get_parameter,
1842 uint8_t parameter_selector,
1843 uint8_t set_selector,
1844 uint8_t block_selector,
1845 fiid_obj_t obj_cmd_rq)
1846 {
1847 if (!IPMI_GET_SYSTEM_INFO_PARAMETER_VALID (get_parameter)
1848 || (!IPMI_SYSTEM_INFO_PARAMETER_SELECTOR_VALID (parameter_selector)
1849 && !IPMI_SYSTEM_INFO_PARAMETER_SELECTOR_IS_OEM (parameter_selector))
1850 || !fiid_obj_valid (obj_cmd_rq))
1851 {
1852 SET_ERRNO (EINVAL);
1853 return (-1);
1854 }
1855
1856 if (FIID_OBJ_TEMPLATE_COMPARE (obj_cmd_rq, tmpl_cmd_get_system_info_parameters_rq) < 0)
1857 {
1858 ERRNO_TRACE (errno);
1859 return (-1);
1860 }
1861
1862 FILL_FIID_OBJ_CLEAR (obj_cmd_rq);
1863 FILL_FIID_OBJ_SET (obj_cmd_rq, "cmd", IPMI_CMD_GET_SYSTEM_INFO_PARAMETERS);
1864 FILL_FIID_OBJ_SET (obj_cmd_rq, "reserved", 0);
1865 FILL_FIID_OBJ_SET (obj_cmd_rq, "get_parameter", get_parameter);
1866 FILL_FIID_OBJ_SET (obj_cmd_rq, "parameter_selector", parameter_selector);
1867 FILL_FIID_OBJ_SET (obj_cmd_rq, "set_selector", set_selector);
1868 FILL_FIID_OBJ_SET (obj_cmd_rq, "block_selector", block_selector);
1869
1870 return (0);
1871 }
1872
1873 int
fill_cmd_get_channel_cipher_suites(uint8_t channel_number,uint8_t payload_type,uint8_t list_index,uint8_t list_algorithm_type,fiid_obj_t obj_cmd_rq)1874 fill_cmd_get_channel_cipher_suites (uint8_t channel_number,
1875 uint8_t payload_type,
1876 uint8_t list_index,
1877 uint8_t list_algorithm_type,
1878 fiid_obj_t obj_cmd_rq)
1879 {
1880 if (!IPMI_CHANNEL_NUMBER_VALID (channel_number)
1881 || !IPMI_PAYLOAD_TYPE_VALID (payload_type)
1882 || !IPMI_LIST_ALGORITHM_TYPE_VALID (list_algorithm_type)
1883 || !fiid_obj_valid (obj_cmd_rq))
1884 {
1885 SET_ERRNO (EINVAL);
1886 return (-1);
1887 }
1888
1889 if (FIID_OBJ_TEMPLATE_COMPARE (obj_cmd_rq, tmpl_cmd_get_channel_cipher_suites_rq) < 0)
1890 {
1891 ERRNO_TRACE (errno);
1892 return (-1);
1893 }
1894
1895 FILL_FIID_OBJ_SET (obj_cmd_rq, "cmd", IPMI_CMD_GET_CHANNEL_CIPHER_SUITES);
1896 FILL_FIID_OBJ_SET (obj_cmd_rq, "channel_number", channel_number);
1897 FILL_FIID_OBJ_SET (obj_cmd_rq, "reserved1", 0);
1898 FILL_FIID_OBJ_SET (obj_cmd_rq, "payload_type", payload_type);
1899 FILL_FIID_OBJ_SET (obj_cmd_rq, "reserved2", 0);
1900 FILL_FIID_OBJ_SET (obj_cmd_rq, "list_index", list_index);
1901 FILL_FIID_OBJ_SET (obj_cmd_rq, "reserved3", 0);
1902 FILL_FIID_OBJ_SET (obj_cmd_rq, "list_algorithm_type", list_algorithm_type);
1903 return (0);
1904 }
1905
1906 int
fill_cmd_get_session_challenge(uint8_t authentication_type,const char * user_name,unsigned int user_name_len,fiid_obj_t obj_cmd_rq)1907 fill_cmd_get_session_challenge (uint8_t authentication_type,
1908 const char *user_name,
1909 unsigned int user_name_len,
1910 fiid_obj_t obj_cmd_rq)
1911 {
1912 char buf[IPMI_MAX_USER_NAME_LENGTH];
1913
1914 /* achu: user_name can be IPMI_MAX_USER_NAME_LENGTH length. Null
1915 * termination in IPMI packet not required
1916 */
1917 if (!IPMI_AUTHENTICATION_TYPE_VALID (authentication_type)
1918 || (user_name && user_name_len > IPMI_MAX_USER_NAME_LENGTH)
1919 || !fiid_obj_valid (obj_cmd_rq))
1920 {
1921 SET_ERRNO (EINVAL);
1922 return (-1);
1923 }
1924
1925 if (FIID_OBJ_TEMPLATE_COMPARE (obj_cmd_rq, tmpl_cmd_get_session_challenge_rq) < 0)
1926 {
1927 ERRNO_TRACE (errno);
1928 return (-1);
1929 }
1930
1931 FILL_FIID_OBJ_CLEAR (obj_cmd_rq);
1932 FILL_FIID_OBJ_SET (obj_cmd_rq, "cmd", IPMI_CMD_GET_SESSION_CHALLENGE);
1933 FILL_FIID_OBJ_SET (obj_cmd_rq, "authentication_type", authentication_type);
1934 FILL_FIID_OBJ_SET (obj_cmd_rq, "reserved", 0);
1935
1936 /* achu: user_name must be zero extended */
1937 memset (buf, '\0', IPMI_MAX_USER_NAME_LENGTH);
1938 if (user_name)
1939 strncpy (buf, user_name, IPMI_MAX_USER_NAME_LENGTH);
1940
1941 FILL_FIID_OBJ_SET_DATA (obj_cmd_rq, "user_name", buf, IPMI_MAX_USER_NAME_LENGTH);
1942
1943 return (0);
1944 }
1945
1946 int
fill_cmd_activate_session(uint8_t authentication_type,uint8_t maximum_privilege_level,const void * challenge_string,unsigned int challenge_string_len,uint32_t initial_outbound_sequence_number,fiid_obj_t obj_cmd_rq)1947 fill_cmd_activate_session (uint8_t authentication_type,
1948 uint8_t maximum_privilege_level,
1949 const void *challenge_string,
1950 unsigned int challenge_string_len,
1951 uint32_t initial_outbound_sequence_number,
1952 fiid_obj_t obj_cmd_rq)
1953 {
1954 uint8_t buf[IPMI_CHALLENGE_STRING_LENGTH];
1955
1956 if (!IPMI_AUTHENTICATION_TYPE_VALID (authentication_type)
1957 || !IPMI_PRIVILEGE_LEVEL_VALID (maximum_privilege_level)
1958 || !challenge_string
1959 || (challenge_string_len > IPMI_CHALLENGE_STRING_LENGTH)
1960 || !fiid_obj_valid (obj_cmd_rq))
1961 {
1962 SET_ERRNO (EINVAL);
1963 return (-1);
1964 }
1965
1966 if (FIID_OBJ_TEMPLATE_COMPARE (obj_cmd_rq, tmpl_cmd_activate_session_rq) < 0)
1967 {
1968 ERRNO_TRACE (errno);
1969 return (-1);
1970 }
1971
1972 FILL_FIID_OBJ_CLEAR (obj_cmd_rq);
1973 FILL_FIID_OBJ_SET (obj_cmd_rq, "cmd", IPMI_CMD_ACTIVATE_SESSION);
1974 FILL_FIID_OBJ_SET (obj_cmd_rq, "authentication_type", authentication_type);
1975 FILL_FIID_OBJ_SET (obj_cmd_rq, "reserved1", 0);
1976 FILL_FIID_OBJ_SET (obj_cmd_rq, "maximum_privilege_level", maximum_privilege_level);
1977 FILL_FIID_OBJ_SET (obj_cmd_rq, "reserved2", 0);
1978
1979 /* achu: challenge string must be zero extended */
1980 memset (buf, '\0', IPMI_CHALLENGE_STRING_LENGTH);
1981 memcpy (buf, challenge_string, challenge_string_len);
1982
1983 FILL_FIID_OBJ_SET_DATA (obj_cmd_rq,
1984 "challenge_string",
1985 buf,
1986 IPMI_CHALLENGE_STRING_LENGTH);
1987
1988 FILL_FIID_OBJ_SET (obj_cmd_rq,
1989 "initial_outbound_sequence_number",
1990 initial_outbound_sequence_number);
1991
1992 return (0);
1993 }
1994
1995 int
fill_cmd_set_session_privilege_level(uint8_t privilege_level,fiid_obj_t obj_cmd_rq)1996 fill_cmd_set_session_privilege_level (uint8_t privilege_level,
1997 fiid_obj_t obj_cmd_rq)
1998 {
1999 if (!IPMI_PRIVILEGE_LEVEL_VALID (privilege_level)
2000 || !fiid_obj_valid (obj_cmd_rq))
2001 {
2002 SET_ERRNO (EINVAL);
2003 return (-1);
2004 }
2005
2006 if (FIID_OBJ_TEMPLATE_COMPARE (obj_cmd_rq, tmpl_cmd_set_session_privilege_level_rq) < 0)
2007 {
2008 ERRNO_TRACE (errno);
2009 return (-1);
2010 }
2011
2012 FILL_FIID_OBJ_CLEAR (obj_cmd_rq);
2013 FILL_FIID_OBJ_SET (obj_cmd_rq, "cmd", IPMI_CMD_SET_SESSION_PRIVILEGE_LEVEL);
2014 FILL_FIID_OBJ_SET (obj_cmd_rq, "privilege_level", privilege_level);
2015 FILL_FIID_OBJ_SET (obj_cmd_rq, "reserved1", 0);
2016 return (0);
2017 }
2018
2019 int
fill_cmd_close_session(uint32_t session_id,uint8_t * session_handle,fiid_obj_t obj_cmd_rq)2020 fill_cmd_close_session (uint32_t session_id,
2021 uint8_t *session_handle,
2022 fiid_obj_t obj_cmd_rq)
2023 {
2024 /* if session_handle, session_id must be 0, see spec */
2025 if (!fiid_obj_valid (obj_cmd_rq)
2026 || (session_handle && session_id))
2027 {
2028 SET_ERRNO (EINVAL);
2029 return (-1);
2030 }
2031
2032 if (FIID_OBJ_TEMPLATE_COMPARE (obj_cmd_rq, tmpl_cmd_close_session_rq) < 0)
2033 {
2034 ERRNO_TRACE (errno);
2035 return (-1);
2036 }
2037
2038 FILL_FIID_OBJ_CLEAR (obj_cmd_rq);
2039 FILL_FIID_OBJ_SET (obj_cmd_rq, "cmd", IPMI_CMD_CLOSE_SESSION);
2040 FILL_FIID_OBJ_SET (obj_cmd_rq, "session_id", session_id);
2041 if (session_handle)
2042 FILL_FIID_OBJ_SET (obj_cmd_rq, "session_handle", (*session_handle));
2043 return (0);
2044 }
2045
2046 int
fill_cmd_set_channel_access(uint8_t channel_number,uint8_t ipmi_messaging_access_mode,uint8_t user_level_authentication,uint8_t per_message_authentication,uint8_t pef_alerting,uint8_t channel_access_set,uint8_t channel_privilege_level_limit,uint8_t channel_privilege_level_limit_set,fiid_obj_t obj_cmd_rq)2047 fill_cmd_set_channel_access (uint8_t channel_number,
2048 uint8_t ipmi_messaging_access_mode,
2049 uint8_t user_level_authentication,
2050 uint8_t per_message_authentication,
2051 uint8_t pef_alerting,
2052 uint8_t channel_access_set,
2053 uint8_t channel_privilege_level_limit,
2054 uint8_t channel_privilege_level_limit_set,
2055 fiid_obj_t obj_cmd_rq)
2056 {
2057 if (!IPMI_CHANNEL_NUMBER_VALID (channel_number)
2058 || !IPMI_MESSAGING_ACCESS_MODE_VALID (ipmi_messaging_access_mode)
2059 || !IPMI_USER_LEVEL_AUTHENTICATION_VALID (user_level_authentication)
2060 || !IPMI_PER_MESSAGE_AUTHENTICATION_VALID (per_message_authentication)
2061 || !IPMI_PEF_ALERTING_VALID (pef_alerting)
2062 || !IPMI_CHANNEL_ACCESS_VALID (channel_access_set)
2063 || !IPMI_PRIVILEGE_LEVEL_LIMIT_VALID (channel_privilege_level_limit)
2064 || !IPMI_PRIVILEGE_LEVEL_LIMIT_SET_VALID (channel_privilege_level_limit_set)
2065 || !fiid_obj_valid (obj_cmd_rq))
2066 {
2067 SET_ERRNO (EINVAL);
2068 return (-1);
2069 }
2070
2071 if (FIID_OBJ_TEMPLATE_COMPARE (obj_cmd_rq, tmpl_cmd_set_channel_access_rq) < 0)
2072 {
2073 ERRNO_TRACE (errno);
2074 return (-1);
2075 }
2076
2077 FILL_FIID_OBJ_CLEAR (obj_cmd_rq);
2078 FILL_FIID_OBJ_SET (obj_cmd_rq, "cmd", IPMI_CMD_SET_CHANNEL_ACCESS);
2079 FILL_FIID_OBJ_SET (obj_cmd_rq, "channel_number", channel_number);
2080 FILL_FIID_OBJ_SET (obj_cmd_rq, "reserved1", 0);
2081 FILL_FIID_OBJ_SET (obj_cmd_rq, "ipmi_messaging_access_mode", ipmi_messaging_access_mode);
2082 FILL_FIID_OBJ_SET (obj_cmd_rq, "user_level_authentication", user_level_authentication);
2083 FILL_FIID_OBJ_SET (obj_cmd_rq, "per_message_authentication", per_message_authentication);
2084 FILL_FIID_OBJ_SET (obj_cmd_rq, "pef_alerting", pef_alerting);
2085 FILL_FIID_OBJ_SET (obj_cmd_rq, "channel_access_set", channel_access_set);
2086 FILL_FIID_OBJ_SET (obj_cmd_rq, "channel_privilege_level_limit", channel_privilege_level_limit);
2087 FILL_FIID_OBJ_SET (obj_cmd_rq, "reserved2", 0);
2088 FILL_FIID_OBJ_SET (obj_cmd_rq, "channel_privilege_level_limit_set", channel_privilege_level_limit_set);
2089 return (0);
2090 }
2091
2092 int
fill_cmd_get_channel_access(uint8_t channel_number,uint8_t channel_access_get,fiid_obj_t obj_cmd_rq)2093 fill_cmd_get_channel_access (uint8_t channel_number,
2094 uint8_t channel_access_get,
2095 fiid_obj_t obj_cmd_rq)
2096 {
2097 if (!IPMI_CHANNEL_NUMBER_VALID (channel_number)
2098 || !IPMI_CHANNEL_ACCESS_GET_VALID (channel_access_get)
2099 || !fiid_obj_valid (obj_cmd_rq))
2100 {
2101 SET_ERRNO (EINVAL);
2102 return (-1);
2103 }
2104
2105 if (FIID_OBJ_TEMPLATE_COMPARE (obj_cmd_rq, tmpl_cmd_get_channel_access_rq) < 0)
2106 {
2107 ERRNO_TRACE (errno);
2108 return (-1);
2109 }
2110
2111 FILL_FIID_OBJ_CLEAR (obj_cmd_rq);
2112 FILL_FIID_OBJ_SET (obj_cmd_rq, "cmd", IPMI_CMD_GET_CHANNEL_ACCESS);
2113 FILL_FIID_OBJ_SET (obj_cmd_rq, "channel_number", channel_number);
2114 FILL_FIID_OBJ_SET (obj_cmd_rq, "reserved1", 0);
2115 FILL_FIID_OBJ_SET (obj_cmd_rq, "reserved2", 0);
2116 FILL_FIID_OBJ_SET (obj_cmd_rq, "channel_access_get", channel_access_get);
2117
2118 return (0);
2119 }
2120
2121 int
fill_cmd_get_channel_info(uint8_t channel_number,fiid_obj_t obj_cmd_rq)2122 fill_cmd_get_channel_info (uint8_t channel_number, fiid_obj_t obj_cmd_rq)
2123 {
2124 if (!IPMI_CHANNEL_NUMBER_VALID (channel_number)
2125 || !fiid_obj_valid (obj_cmd_rq))
2126 {
2127 SET_ERRNO (EINVAL);
2128 return (-1);
2129 }
2130
2131 if (FIID_OBJ_TEMPLATE_COMPARE (obj_cmd_rq, tmpl_cmd_get_channel_info_rq) < 0)
2132 {
2133 ERRNO_TRACE (errno);
2134 return (-1);
2135 }
2136
2137 FILL_FIID_OBJ_CLEAR (obj_cmd_rq);
2138 FILL_FIID_OBJ_SET (obj_cmd_rq, "cmd", IPMI_CMD_GET_CHANNEL_INFO_COMMAND);
2139 FILL_FIID_OBJ_SET (obj_cmd_rq, "channel_number", channel_number);
2140 FILL_FIID_OBJ_SET (obj_cmd_rq, "reserved", 0);
2141
2142 return (0);
2143 }
2144
2145 int
fill_cmd_set_channel_security_keys(uint8_t channel_number,uint8_t operation,uint8_t key_id,const void * key_value,unsigned int key_value_len,fiid_obj_t obj_cmd_rq)2146 fill_cmd_set_channel_security_keys (uint8_t channel_number,
2147 uint8_t operation,
2148 uint8_t key_id,
2149 const void *key_value,
2150 unsigned int key_value_len,
2151 fiid_obj_t obj_cmd_rq)
2152 {
2153 if (!IPMI_CHANNEL_NUMBER_VALID (channel_number)
2154 || !IPMI_CHANNEL_SECURITY_KEYS_OPERATION_VALID (operation)
2155 || !IPMI_CHANNEL_SECURITY_KEYS_KEY_ID_VALID (key_id)
2156 || ((key_id == IPMI_CHANNEL_SECURITY_KEYS_KEY_ID_K_R
2157 && key_value)
2158 && key_value_len > IPMI_MAX_K_R_LENGTH)
2159 || ((key_id == IPMI_CHANNEL_SECURITY_KEYS_KEY_ID_K_G
2160 && key_value)
2161 && key_value_len > IPMI_MAX_K_G_LENGTH)
2162 || !fiid_obj_valid (obj_cmd_rq))
2163 {
2164 SET_ERRNO (EINVAL);
2165 return (-1);
2166 }
2167
2168 if (FIID_OBJ_TEMPLATE_COMPARE (obj_cmd_rq, tmpl_cmd_set_channel_security_keys_rq) < 0)
2169 {
2170 ERRNO_TRACE (errno);
2171 return (-1);
2172 }
2173
2174 FILL_FIID_OBJ_CLEAR (obj_cmd_rq);
2175 FILL_FIID_OBJ_SET (obj_cmd_rq, "cmd", IPMI_CMD_SET_CHANNEL_SECURITY_KEYS);
2176 FILL_FIID_OBJ_SET (obj_cmd_rq, "channel_number", channel_number);
2177 FILL_FIID_OBJ_SET (obj_cmd_rq, "reserved1", 0);
2178 FILL_FIID_OBJ_SET (obj_cmd_rq, "operation", operation);
2179 FILL_FIID_OBJ_SET (obj_cmd_rq, "reserved2", 0);
2180 FILL_FIID_OBJ_SET (obj_cmd_rq, "key_id", key_id);
2181 if (operation == IPMI_CHANNEL_SECURITY_KEYS_OPERATION_SET_KEY)
2182 {
2183 uint8_t buf[IPMI_MAX_K_LENGTH];
2184 unsigned int buf_len;
2185
2186 memset (buf, '\0', IPMI_MAX_K_LENGTH);
2187
2188 if (key_value && key_value_len)
2189 memcpy (buf, key_value, key_value_len);
2190
2191 if (key_id == IPMI_CHANNEL_SECURITY_KEYS_KEY_ID_K_R)
2192 buf_len = IPMI_MAX_K_R_LENGTH;
2193 else
2194 buf_len = IPMI_MAX_K_G_LENGTH;
2195
2196 FILL_FIID_OBJ_SET_DATA (obj_cmd_rq,
2197 "key_value",
2198 buf,
2199 buf_len);
2200 }
2201 return (0);
2202 }
2203
2204 int
fill_cmd_set_user_access(uint8_t channel_number,uint8_t user_ipmi_messaging,uint8_t user_link_authentication,uint8_t user_restricted_to_callback,uint8_t change_bits_in_byte,uint8_t user_id,uint8_t user_privilege_level_limit,uint8_t user_session_limit,fiid_obj_t obj_cmd_rq)2205 fill_cmd_set_user_access (uint8_t channel_number,
2206 uint8_t user_ipmi_messaging,
2207 uint8_t user_link_authentication,
2208 uint8_t user_restricted_to_callback,
2209 uint8_t change_bits_in_byte,
2210 uint8_t user_id,
2211 uint8_t user_privilege_level_limit,
2212 uint8_t user_session_limit,
2213 fiid_obj_t obj_cmd_rq)
2214 {
2215 if (!IPMI_CHANNEL_NUMBER_VALID (channel_number)
2216 || !IPMI_USER_IPMI_MESSAGING_VALID (user_ipmi_messaging)
2217 || !IPMI_USER_LINK_AUTHENTICATION_VALID (user_link_authentication)
2218 || !IPMI_USER_RESTRICTED_TO_CALLBACK_VALID (user_restricted_to_callback)
2219 || !IPMI_CHANGE_BITS_VALID (change_bits_in_byte)
2220 || !IPMI_PRIVILEGE_LEVEL_LIMIT_VALID (user_privilege_level_limit)
2221 || !fiid_obj_valid (obj_cmd_rq))
2222 {
2223 SET_ERRNO (EINVAL);
2224 return (-1);
2225 }
2226
2227 if (FIID_OBJ_TEMPLATE_COMPARE (obj_cmd_rq, tmpl_cmd_set_user_access_rq) < 0)
2228 {
2229 ERRNO_TRACE (errno);
2230 return (-1);
2231 }
2232
2233 FILL_FIID_OBJ_CLEAR (obj_cmd_rq);
2234 FILL_FIID_OBJ_SET (obj_cmd_rq, "cmd", IPMI_CMD_SET_USER_ACCESS_COMMAND);
2235 FILL_FIID_OBJ_SET (obj_cmd_rq, "channel_number", channel_number);
2236 FILL_FIID_OBJ_SET (obj_cmd_rq, "user_ipmi_messaging", user_ipmi_messaging);
2237 FILL_FIID_OBJ_SET (obj_cmd_rq, "user_link_authentication", user_link_authentication);
2238 FILL_FIID_OBJ_SET (obj_cmd_rq, "user_restricted_to_callback", user_restricted_to_callback);
2239 FILL_FIID_OBJ_SET (obj_cmd_rq, "change_bits_in_byte", change_bits_in_byte);
2240 FILL_FIID_OBJ_SET (obj_cmd_rq, "user_id", user_id);
2241 FILL_FIID_OBJ_SET (obj_cmd_rq, "reserved1", 0);
2242 FILL_FIID_OBJ_SET (obj_cmd_rq, "user_privilege_level_limit", user_privilege_level_limit);
2243 FILL_FIID_OBJ_SET (obj_cmd_rq, "reserved2", 0);
2244 FILL_FIID_OBJ_SET (obj_cmd_rq, "user_session_limit", user_session_limit);
2245 FILL_FIID_OBJ_SET (obj_cmd_rq, "reserved3", 0);
2246
2247 return (0);
2248 }
2249
2250 int
fill_cmd_get_user_access(uint8_t channel_number,uint8_t user_id,fiid_obj_t obj_cmd_rq)2251 fill_cmd_get_user_access (uint8_t channel_number,
2252 uint8_t user_id,
2253 fiid_obj_t obj_cmd_rq)
2254 {
2255 if (!IPMI_CHANNEL_NUMBER_VALID (channel_number)
2256 || !fiid_obj_valid (obj_cmd_rq))
2257 {
2258 SET_ERRNO (EINVAL);
2259 return (-1);
2260 }
2261
2262 if (FIID_OBJ_TEMPLATE_COMPARE (obj_cmd_rq, tmpl_cmd_get_user_access_rq) < 0)
2263 {
2264 ERRNO_TRACE (errno);
2265 return (-1);
2266 }
2267
2268 FILL_FIID_OBJ_CLEAR (obj_cmd_rq);
2269 FILL_FIID_OBJ_SET (obj_cmd_rq, "cmd", IPMI_CMD_GET_USER_ACCESS_COMMAND);
2270 FILL_FIID_OBJ_SET (obj_cmd_rq, "channel_number", channel_number);
2271 FILL_FIID_OBJ_SET (obj_cmd_rq, "reserved1", 0);
2272 FILL_FIID_OBJ_SET (obj_cmd_rq, "user_id", user_id);
2273 FILL_FIID_OBJ_SET (obj_cmd_rq, "reserved2", 0);
2274
2275 return (0);
2276 }
2277
2278 int
fill_cmd_set_user_name(uint8_t user_id,const char * user_name,unsigned int user_name_len,fiid_obj_t obj_cmd_rq)2279 fill_cmd_set_user_name (uint8_t user_id,
2280 const char *user_name,
2281 unsigned int user_name_len,
2282 fiid_obj_t obj_cmd_rq)
2283 {
2284 char buf[IPMI_MAX_USER_NAME_LENGTH];
2285
2286 /* achu: user_name can be IPMI_MAX_USER_NAME_LENGTH length. Null
2287 * termination in IPMI packet not required
2288 */
2289 if ((user_name && user_name_len > IPMI_MAX_USER_NAME_LENGTH)
2290 || !fiid_obj_valid (obj_cmd_rq))
2291 {
2292 SET_ERRNO (EINVAL);
2293 return (-1);
2294 }
2295
2296 if (FIID_OBJ_TEMPLATE_COMPARE (obj_cmd_rq, tmpl_cmd_set_user_name_rq) < 0)
2297 {
2298 ERRNO_TRACE (errno);
2299 return (-1);
2300 }
2301
2302 FILL_FIID_OBJ_CLEAR (obj_cmd_rq);
2303 FILL_FIID_OBJ_SET (obj_cmd_rq, "cmd", IPMI_CMD_SET_USER_NAME);
2304 FILL_FIID_OBJ_SET (obj_cmd_rq, "user_id", user_id);
2305 FILL_FIID_OBJ_SET (obj_cmd_rq, "user_id.reserved", 0);
2306
2307 /* achu: user_name must be zero extended */
2308 memset (buf, '\0', IPMI_MAX_USER_NAME_LENGTH);
2309 if (user_name)
2310 strncpy (buf, user_name, IPMI_MAX_USER_NAME_LENGTH);
2311
2312 FILL_FIID_OBJ_SET_DATA (obj_cmd_rq, "user_name", buf, IPMI_MAX_USER_NAME_LENGTH);
2313
2314 return (0);
2315 }
2316
2317 int
fill_cmd_get_user_name(uint8_t user_id,fiid_obj_t obj_cmd_rq)2318 fill_cmd_get_user_name (uint8_t user_id, fiid_obj_t obj_cmd_rq)
2319 {
2320 if (!fiid_obj_valid (obj_cmd_rq))
2321 {
2322 SET_ERRNO (EINVAL);
2323 return (-1);
2324 }
2325
2326 if (FIID_OBJ_TEMPLATE_COMPARE (obj_cmd_rq, tmpl_cmd_get_user_name_rq) < 0)
2327 {
2328 ERRNO_TRACE (errno);
2329 return (-1);
2330 }
2331
2332 FILL_FIID_OBJ_CLEAR (obj_cmd_rq);
2333 FILL_FIID_OBJ_SET (obj_cmd_rq, "cmd", IPMI_CMD_GET_USER_NAME_COMMAND);
2334 FILL_FIID_OBJ_SET (obj_cmd_rq, "user_id", user_id);
2335 FILL_FIID_OBJ_SET (obj_cmd_rq, "user_id.reserved", 0);
2336
2337 return (0);
2338 }
2339
2340 int
fill_cmd_set_user_password(uint8_t user_id,uint8_t password_size,uint8_t operation,const char * password,unsigned int password_len,fiid_obj_t obj_cmd_rq)2341 fill_cmd_set_user_password (uint8_t user_id,
2342 uint8_t password_size,
2343 uint8_t operation,
2344 const char *password,
2345 unsigned int password_len,
2346 fiid_obj_t obj_cmd_rq)
2347 {
2348 /* achu: password can be the max length. Null termination in IPMI
2349 * packet not required.
2350 *
2351 * Note that for IPMI 1.5 only machines, > 16 byte passwords will
2352 * simply fail and return an error.
2353 */
2354 if (!IPMI_PASSWORD_OPERATION_VALID (operation)
2355 || !IPMI_PASSWORD_SIZE_VALID (password_size)
2356 || (password
2357 && password_size == IPMI_PASSWORD_SIZE_16_BYTES
2358 && password_len > IPMI_1_5_MAX_PASSWORD_LENGTH)
2359 || (password
2360 && password_size == IPMI_PASSWORD_SIZE_20_BYTES
2361 && password_len > IPMI_2_0_MAX_PASSWORD_LENGTH)
2362 || !fiid_obj_valid (obj_cmd_rq))
2363 {
2364 SET_ERRNO (EINVAL);
2365 return (-1);
2366 }
2367
2368 if (FIID_OBJ_TEMPLATE_COMPARE (obj_cmd_rq, tmpl_cmd_set_user_password_rq) < 0)
2369 {
2370 ERRNO_TRACE (errno);
2371 return (-1);
2372 }
2373
2374 FILL_FIID_OBJ_CLEAR (obj_cmd_rq);
2375 FILL_FIID_OBJ_SET (obj_cmd_rq, "cmd", IPMI_CMD_SET_USER_PASSWORD_COMMAND);
2376 FILL_FIID_OBJ_SET (obj_cmd_rq, "user_id", user_id);
2377 FILL_FIID_OBJ_SET (obj_cmd_rq, "user_id.reserved", 0);
2378 FILL_FIID_OBJ_SET (obj_cmd_rq, "password_size", password_size);
2379 FILL_FIID_OBJ_SET (obj_cmd_rq, "operation", operation);
2380 FILL_FIID_OBJ_SET (obj_cmd_rq, "operation.reserved", 0);
2381
2382 if (operation == IPMI_PASSWORD_OPERATION_SET_PASSWORD
2383 || operation == IPMI_PASSWORD_OPERATION_TEST_PASSWORD)
2384 {
2385 char buf[IPMI_2_0_MAX_PASSWORD_LENGTH];
2386 unsigned int buf_max_len;
2387
2388 if (password_size == IPMI_PASSWORD_SIZE_16_BYTES)
2389 buf_max_len = IPMI_1_5_MAX_PASSWORD_LENGTH;
2390 else
2391 buf_max_len = IPMI_2_0_MAX_PASSWORD_LENGTH;
2392
2393 /* achu: password must be zero extended */
2394 memset (buf, '\0', buf_max_len);
2395 if (password)
2396 strncpy (buf, password, buf_max_len);
2397
2398 FILL_FIID_OBJ_SET_DATA (obj_cmd_rq, "password", buf, buf_max_len);
2399 }
2400
2401 return (0);
2402 }
2403