1 package org.metricshub.ipmi.core.coding.payload;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 public enum CompletionCode {
25
26
27
28 Ok(CompletionCode.OK),
29
30
31
32 InsufficientResources(CompletionCode.INSUFFICIENTRESOURCES),
33
34
35
36 UnauthorizedRole(CompletionCode.UNAUTHORIZEDROLE),
37
38
39
40 InsufficientResourcesForRole(CompletionCode.INSUFFICIENTRESOURCESFORROLE),
41
42
43
44 InvalidNameLength(CompletionCode.INVALIDNAMELENGTH),
45
46
47
48 Frudevicebusy(CompletionCode.FRUDEVICEBUSY),
49
50
51
52 UnauthorizedName(CompletionCode.UNAUTHORIZEDNAME),
53
54
55
56 InvalidSessionId(CompletionCode.INVALIDSESSIONID),
57
58
59
60 InvalidSessionHandle(CompletionCode.INVALIDSESSIONHANDLE),
61
62
63
64 UnauthorizedGuid(CompletionCode.UNAUTHORIZEDGUID),
65
66
67
68 InvalidIntegrityCheckValue(CompletionCode.INVALIDINTEGRITYCHECKVALUE),
69
70
71
72 InvalidConfidentialityAlgorithm(CompletionCode.INVALIDCONFIDENTIALITYALGORITHM),
73
74
75
76 NoMatchingCipherSuite(CompletionCode.NOMATCHINGCIPHERSUITE),
77
78
79
80 IllegalOrUnrecognizedParameter(CompletionCode.ILLEGALORUNRECOGNIZEDPARAMETER),
81
82
83
84 NodeBusy(CompletionCode.NODEBUSY),
85
86
87
88 InvalidCommand(CompletionCode.INVALIDCOMMAND),
89
90
91
92 InvalidLun(CompletionCode.INVALIDLUN),
93
94
95
96 Timeout(CompletionCode.TIMEOUT),
97
98
99
100 OutOfSpace(CompletionCode.OUTOFSPACE),
101
102
103
104 ReservationCanceled(CompletionCode.RESERVATIONCANCELED),
105
106
107
108 RequestTruncated(CompletionCode.REQUESTTRUNCATED),
109
110
111
112 InvalidRequestLength(CompletionCode.INVALIDREQUESTLENGTH),
113
114
115
116 InvalidId(CompletionCode.INVALIDID),
117
118
119
120 LengthLimitExceeded(CompletionCode.LENGTHLIMITEXCEEDED),
121
122
123
124 ParameterOutOfRange(CompletionCode.PARAMETEROUTOFRANGE),
125
126
127
128 CannotRespond(CompletionCode.CANNOTRESPOND),
129
130
131
132 DataNotPresent(CompletionCode.DATANOTPRESENT),
133
134
135
136 InvalidData(CompletionCode.INVALIDDATA),
137
138
139
140 IllegalCommand(CompletionCode.ILLEGALCOMMAND),
141
142
143
144 ResponseUnavailable(CompletionCode.RESPONSEUNAVAILABLE),
145
146
147
148 DuplicatedRequest(CompletionCode.DUPLICATEDREQUEST),
149
150
151
152 SdrUpdating(CompletionCode.SDRUPDATING),
153
154
155
156 FirmwareUpdating(CompletionCode.FIRMWAREUPDATING),
157
158
159
160 InitializationInProgress(CompletionCode.INITIALIZATIONINPROGRESS),
161
162
163
164 DestinationUnavailable(CompletionCode.DESTINATIONUNAVAILABLE),
165
166
167
168 InsufficentPrivilege(CompletionCode.INSUFFICENTPRIVILEGE),
169
170
171
172 CommandNotSupported(CompletionCode.COMMANDNOTSUPPORTED),
173
174
175
176 IllegalParameter(CompletionCode.ILLEGALPARAMETER),
177
178
179
180 UnspecifiedError(CompletionCode.UNSPECIFIEDERROR),
181
182
183
184 InvalidPayloadType(CompletionCode.INVALIDPAYLOADTYPE),
185
186
187
188 InvalidAuthenticationAlgorithm(CompletionCode.INVALIDAUTHENTICATIONALGORITHM),
189
190
191
192 InvalidIntegrityAlgorithm(CompletionCode.INVALIDINTEGRITYALGORITHM),
193
194
195
196 NoMatchingAuthenticationPayload(CompletionCode.NOMATCHINGAUTHENTICATIONPAYLOAD),
197
198
199
200 NoMatchingIntegrityPayload(CompletionCode.NOMATCHINGINTEGRITYPAYLOAD),
201
202
203
204 InactiveSessionID(CompletionCode.INACTIVESESSIONID),
205
206
207
208 InvalidRole(CompletionCode.INVALIDROLE),
209 ;
210 private static final int OK = 0;
211 private static final int INSUFFICIENTRESOURCES = 1;
212 private static final int UNAUTHORIZEDROLE = 10;
213 private static final int INSUFFICIENTRESOURCESFORROLE = 11;
214 private static final int INVALIDNAMELENGTH = 12;
215 private static final int FRUDEVICEBUSY = 129;
216 private static final int UNAUTHORIZEDNAME = 13;
217 private static final int INVALIDSESSIONID = 135;
218 private static final int INVALIDSESSIONHANDLE = 136;
219 private static final int UNAUTHORIZEDGUID = 14;
220 private static final int INVALIDINTEGRITYCHECKVALUE = 15;
221 private static final int INVALIDCONFIDENTIALITYALGORITHM = 16;
222 private static final int NOMATCHINGCIPHERSUITE = 17;
223 private static final int ILLEGALORUNRECOGNIZEDPARAMETER = 18;
224 private static final int NODEBUSY = 192;
225 private static final int INVALIDCOMMAND = 193;
226 private static final int INVALIDLUN = 194;
227 private static final int TIMEOUT = 195;
228 private static final int OUTOFSPACE = 196;
229 private static final int RESERVATIONCANCELED = 197;
230 private static final int REQUESTTRUNCATED = 198;
231 private static final int INVALIDREQUESTLENGTH = 199;
232 private static final int INVALIDID = 2;
233 private static final int LENGTHLIMITEXCEEDED = 200;
234 private static final int PARAMETEROUTOFRANGE = 201;
235 private static final int CANNOTRESPOND = 202;
236 private static final int DATANOTPRESENT = 203;
237 private static final int INVALIDDATA = 204;
238 private static final int ILLEGALCOMMAND = 205;
239 private static final int RESPONSEUNAVAILABLE = 206;
240 private static final int DUPLICATEDREQUEST = 207;
241 private static final int SDRUPDATING = 208;
242 private static final int FIRMWAREUPDATING = 209;
243 private static final int INITIALIZATIONINPROGRESS = 210;
244 private static final int DESTINATIONUNAVAILABLE = 211;
245 private static final int INSUFFICENTPRIVILEGE = 212;
246 private static final int COMMANDNOTSUPPORTED = 213;
247 private static final int ILLEGALPARAMETER = 214;
248 private static final int UNSPECIFIEDERROR = 255;
249 private static final int INVALIDPAYLOADTYPE = 3;
250 private static final int INVALIDAUTHENTICATIONALGORITHM = 4;
251 private static final int INVALIDINTEGRITYALGORITHM = 5;
252 private static final int NOMATCHINGAUTHENTICATIONPAYLOAD = 6;
253 private static final int NOMATCHINGINTEGRITYPAYLOAD = 7;
254 private static final int INACTIVESESSIONID = 8;
255 private static final int INVALIDROLE = 9;
256
257 private int code;
258
259 CompletionCode(int code) {
260 this.code = code;
261 }
262 public int getCode() {
263 return code;
264 }
265 public static CompletionCode parseInt(int value) {
266 switch(value) {
267 case OK:
268 return Ok;
269 case INSUFFICIENTRESOURCES:
270 return InsufficientResources;
271 case UNAUTHORIZEDROLE:
272 return UnauthorizedRole;
273 case INSUFFICIENTRESOURCESFORROLE:
274 return InsufficientResourcesForRole;
275 case INVALIDNAMELENGTH:
276 return InvalidNameLength;
277 case FRUDEVICEBUSY:
278 return Frudevicebusy;
279 case UNAUTHORIZEDNAME:
280 return UnauthorizedName;
281 case INVALIDSESSIONID:
282 return InvalidSessionId;
283 case INVALIDSESSIONHANDLE:
284 return InvalidSessionHandle;
285 case UNAUTHORIZEDGUID:
286 return UnauthorizedGuid;
287 case INVALIDINTEGRITYCHECKVALUE:
288 return InvalidIntegrityCheckValue;
289 case INVALIDCONFIDENTIALITYALGORITHM:
290 return InvalidConfidentialityAlgorithm;
291 case NOMATCHINGCIPHERSUITE:
292 return NoMatchingCipherSuite;
293 case ILLEGALORUNRECOGNIZEDPARAMETER:
294 return IllegalOrUnrecognizedParameter;
295 case NODEBUSY:
296 return NodeBusy;
297 case INVALIDCOMMAND:
298 return InvalidCommand;
299 case INVALIDLUN:
300 return InvalidLun;
301 case TIMEOUT:
302 return Timeout;
303 case OUTOFSPACE:
304 return OutOfSpace;
305 case RESERVATIONCANCELED:
306 return ReservationCanceled;
307 case REQUESTTRUNCATED:
308 return RequestTruncated;
309 case INVALIDREQUESTLENGTH:
310 return InvalidRequestLength;
311 case INVALIDID:
312 return InvalidId;
313 case LENGTHLIMITEXCEEDED:
314 return LengthLimitExceeded;
315 case PARAMETEROUTOFRANGE:
316 return ParameterOutOfRange;
317 case CANNOTRESPOND:
318 return CannotRespond;
319 case DATANOTPRESENT:
320 return DataNotPresent;
321 case INVALIDDATA:
322 return InvalidData;
323 case ILLEGALCOMMAND:
324 return IllegalCommand;
325 case RESPONSEUNAVAILABLE:
326 return ResponseUnavailable;
327 case DUPLICATEDREQUEST:
328 return DuplicatedRequest;
329 case SDRUPDATING:
330 return SdrUpdating;
331 case FIRMWAREUPDATING:
332 return FirmwareUpdating;
333 case INITIALIZATIONINPROGRESS:
334 return InitializationInProgress;
335 case DESTINATIONUNAVAILABLE:
336 return DestinationUnavailable;
337 case INSUFFICENTPRIVILEGE:
338 return InsufficentPrivilege;
339 case COMMANDNOTSUPPORTED:
340 return CommandNotSupported;
341 case ILLEGALPARAMETER:
342 return IllegalParameter;
343 case UNSPECIFIEDERROR:
344 return UnspecifiedError;
345 case INVALIDPAYLOADTYPE:
346 return InvalidPayloadType;
347 case INVALIDAUTHENTICATIONALGORITHM:
348 return InvalidAuthenticationAlgorithm;
349 case INVALIDINTEGRITYALGORITHM:
350 return InvalidIntegrityAlgorithm;
351 case NOMATCHINGAUTHENTICATIONPAYLOAD:
352 return NoMatchingAuthenticationPayload;
353 case NOMATCHINGINTEGRITYPAYLOAD:
354 return NoMatchingIntegrityPayload;
355 case INACTIVESESSIONID:
356 return InactiveSessionID;
357 case INVALIDROLE:
358 return InvalidRole;
359 default:
360 throw new IllegalArgumentException("Invalid value: " + value);
361 }
362 }
363 public String getMessage() {
364 switch(code) {
365 case OK:
366 return "Command completed normally.";
367 case INSUFFICIENTRESOURCES:
368 return "Insufficient resources to create a session.";
369 case UNAUTHORIZEDROLE:
370 return "Unauthorized role or privilege level requested.";
371 case INSUFFICIENTRESOURCESFORROLE:
372 return "Insufficient resources to create a session at the requested role.";
373 case INVALIDNAMELENGTH:
374 return "Invalid name length.";
375 case FRUDEVICEBUSY:
376 return "FRU device busy. The requested cannot be completed because the implementation of the logical FRU device is in a state where the FRU information is temporarily unavailable. This could be due to a condition such as a los s of arbitration if the FRU is implemented as a device on a shared bus.";
377 case UNAUTHORIZEDNAME:
378 return "Unauthorized name.";
379 case INVALIDSESSIONID:
380 return "Invalid Session ID in request.";
381 case INVALIDSESSIONHANDLE:
382 return "Invalid Session Handle in request.";
383 case UNAUTHORIZEDGUID:
384 return "GUID that BMC submitted in RAKP Message 2 was not accepted by remote console.";
385 case INVALIDINTEGRITYCHECKVALUE:
386 return "Invalid integrity check value.";
387 case INVALIDCONFIDENTIALITYALGORITHM:
388 return "Invalid confidentiality algorithm.";
389 case NOMATCHINGCIPHERSUITE:
390 return "No Cipher Suite match with proposed security algorithms.";
391 case ILLEGALORUNRECOGNIZEDPARAMETER:
392 return "Illegal or unrecognized parameter.";
393 case NODEBUSY:
394 return "Command could not be processed because command processing resources are temporarily unavailable.";
395 case INVALIDCOMMAND:
396 return "Used to indicate an unrecognized or unsupported command.";
397 case INVALIDLUN:
398 return "Command invalid for given LUN.";
399 case TIMEOUT:
400 return "Timeout while processing command. Response unavailable.";
401 case OUTOFSPACE:
402 return "Out of space. Command could not be completed because of a lack of storage space required to execute the given command operation.";
403 case RESERVATIONCANCELED:
404 return "Reservation Canceled or Invalid Reservation ID.";
405 case REQUESTTRUNCATED:
406 return "Request data truncated.";
407 case INVALIDREQUESTLENGTH:
408 return "Request data length invalid.";
409 case INVALIDID:
410 return "Invalid session ID.";
411 case LENGTHLIMITEXCEEDED:
412 return "Request data field length limit exceeded.";
413 case PARAMETEROUTOFRANGE:
414 return "Parameter out of range. One or more parameters in the data field of the Request are out of range. This is different from {@link #InvalidData} (CCh) code in that it indicates that the erroneous field(s) has a contiguous range of possible values.";
415 case CANNOTRESPOND:
416 return "Cannot return number of requested data bytes.";
417 case DATANOTPRESENT:
418 return "Requested Sensor, data, or record not present.";
419 case INVALIDDATA:
420 return "Invalid data field in Request.";
421 case ILLEGALCOMMAND:
422 return "Command illegal for specified sensor or record type.";
423 case RESPONSEUNAVAILABLE:
424 return "Command response could not be provided.";
425 case DUPLICATEDREQUEST:
426 return "Cannot execute duplicated request. This completion code is for devices which cannot return the response that was returned for the original instance of the request. Such devices should provide separate commands that allow the completion status of the original request to be determined. An Event Receiver does not use this completion code, but returns the 00h completion code in the response to (valid) duplicated requests.";
427 case SDRUPDATING:
428 return "Command response could not be provided. SDR Repository in update mode.";
429 case FIRMWAREUPDATING:
430 return "Command response could not be provided. Device in firmware update mode.";
431 case INITIALIZATIONINPROGRESS:
432 return "Command response could not be provided. BMC initialization or initialization agent in progress.";
433 case DESTINATIONUNAVAILABLE:
434 return "Destination unavailable. Cannot deliver request to selected destination. E.g. this code can be returned if a request message is targeted to SMS, but receive message queue reception is disabled for the particular channel.";
435 case INSUFFICENTPRIVILEGE:
436 return "Cannot execute command due to insufficient privilege level or other security - based restriction (e.g. disabled for 'firmware firewall').";
437 case COMMANDNOTSUPPORTED:
438 return "Cannot execute command. Command, or request parameter(s), not supported in present state.";
439 case ILLEGALPARAMETER:
440 return "Cannot execute command. Parameter is illegal because command sub-function has been disabled or is unavailable (e.g. disabled for 'firmware firewall').";
441 case UNSPECIFIEDERROR:
442 return "Unspecified error.";
443 case INVALIDPAYLOADTYPE:
444 return "Invalid payload type.";
445 case INVALIDAUTHENTICATIONALGORITHM:
446 return "Invalid authentication algorithm.";
447 case INVALIDINTEGRITYALGORITHM:
448 return "Invalid integrity algorithm.";
449 case NOMATCHINGAUTHENTICATIONPAYLOAD:
450 return "No matching authentication payload.";
451 case NOMATCHINGINTEGRITYPAYLOAD:
452 return "No matching integrity payload.";
453 case INACTIVESESSIONID:
454 return "Inactive session ID.";
455 case INVALIDROLE:
456 return "Invalid role.";
457 default:
458 throw new IllegalArgumentException("Invalid value: " + code);
459 }
460 }
461 }