1 package org.jscsi.target.scsi.cdb; 2 3 4 import org.jscsi.target.scsi.lun.AddressMethod; 5 6 7 /** 8 * The SELECT REPORT field is a member of the {@link ReportLunsCDB} and specifies the types of logical unit addresses 9 * that shall be reported. 10 * <p> 11 * The field is two bits long. 12 * 13 * @author Andreas Ergenzinger 14 */ 15 public enum SelectReport { 16 17 /** 18 * The list shall contain the logical units accessible to the I_T nexus with the following addressing methods (see 19 * SAM): 20 * <ol> 21 * <li>{@link AddressMethod#LOGICAL_UNIT_ADDRESSING_METHOD},</li> 22 * <li>{@link AddressMethod#PERIPHERAL_DEVICE_ADDRESSING_METHOD}, and</li> 23 * <li>{@link AddressMethod#FLAT_SPACE_ADDRESSING_METHOD}.</li> 24 * </ol> 25 * If there are no logical units, the LUN LIST LENGTH field shall be zero. 26 */ 27 SELECTED_ADDRESSING_METHODS((byte) 0), 28 /** 29 * The list shall contain only well known logical units, if any. If there are no well known logical units, the LUN 30 * LIST LENGTH field shall be zero. 31 */ 32 WELL_KNOWN_LUNS_ONLY((byte) 1), 33 /** 34 * The list shall contain all logical units accessible to the I_T nexus. 35 */ 36 ALL((byte) 2); 37 // all other values are reserved 38 39 /** 40 * The serialized value of this {@link SelectReport} object. 41 */ 42 private final byte value; 43 44 private SelectReport (final byte value) { 45 this.value = value; 46 } 47 48 /** 49 * Returns the serialized value of this {@link SelectReport} object. 50 * 51 * @return the serialized value of this {@link SelectReport} object 52 */ 53 public byte getValue () { 54 return value; 55 } 56 57 /** 58 * Returns the {@link SelectReport} corresponding to the passed value. 59 * 60 * @param value the value of a SELECT REPORT field 61 * @return the {@link SelectReport} corresponding to the passed value or <code>null</code> if none exists 62 */ 63 public final static SelectReport getValue (byte value) { 64 if (0 <= value && value <= 2) return values()[value]; 65 return null; 66 } 67 }