|
| 1 | +using System; |
| 2 | +using System.Collections.Generic; |
| 3 | +using System.Text; |
| 4 | + |
| 5 | +namespace DiscUtils.Iscsi; |
| 6 | + |
| 7 | +#pragma warning disable CA1069 // Enums values should not be duplicated |
| 8 | + |
| 9 | +public enum ScsiOpServiceAction : byte |
| 10 | +{ |
| 11 | + // Common service actions for 0x9E |
| 12 | + ReadCapacity16 = 0x10, // SA=0x10 for opcode 0x9E |
| 13 | + GetLBAStatus = 0x12, |
| 14 | + Read16 = 0x88, // effectively READ(16) |
| 15 | + Write16 = 0x8A, // effectively WRITE(16) |
| 16 | +} |
| 17 | + |
| 18 | +/// <summary> |
| 19 | +/// SCSI Command Descriptor Block (CDB) opcodes from SPC, SBC, SSC, MMC. |
| 20 | +/// Only the commonly used standard commands are included. |
| 21 | +/// </summary> |
| 22 | +public enum ScsiOpCode : byte |
| 23 | +{ |
| 24 | + // ------------------------- |
| 25 | + // 6-byte CDB commands |
| 26 | + // ------------------------- |
| 27 | + TestUnitReady = 0x00, |
| 28 | + RezeroUnit = 0x01, // legacy |
| 29 | + RequestSense = 0x03, |
| 30 | + FormatUnit = 0x04, |
| 31 | + Read6 = 0x08, |
| 32 | + Write6 = 0x0A, |
| 33 | + Seek6 = 0x0B, |
| 34 | + Inquiry = 0x12, |
| 35 | + ModeSelect6 = 0x15, |
| 36 | + ModeSense6 = 0x1A, |
| 37 | + StartStopUnit = 0x1B, |
| 38 | + ReceiveDiagnosticResults = 0x1C, |
| 39 | + SendDiagnostic = 0x1D, |
| 40 | + PreventAllowMediumRemoval = 0x1E, |
| 41 | + |
| 42 | + // ------------------------- |
| 43 | + // 10-byte CDB commands |
| 44 | + // ------------------------- |
| 45 | + ReadCapacity10 = 0x25, |
| 46 | + Read10 = 0x28, |
| 47 | + Write10 = 0x2A, |
| 48 | + Seek10 = 0x2B, |
| 49 | + WriteVerify10 = 0x2E, |
| 50 | + Verify10 = 0x2F, |
| 51 | + SynchronizeCache10 = 0x35, |
| 52 | + WriteBuffer = 0x3B, |
| 53 | + ReadBuffer = 0x3C, |
| 54 | + ReadLong10 = 0x3E, |
| 55 | + WriteLong10 = 0x3F, |
| 56 | + |
| 57 | + // ------------------------- |
| 58 | + // Service Action opcodes (0x9E, 0x9F) |
| 59 | + // ------------------------- |
| 60 | + ServiceActionIn = 0x9E, |
| 61 | + ServiceActionOut = 0x9F, |
| 62 | + |
| 63 | + // ------------------------- |
| 64 | + // 12-byte CDB commands |
| 65 | + // ------------------------- |
| 66 | + Read12 = 0xA8, |
| 67 | + Write12 = 0xAA, |
| 68 | + WriteVerify12 = 0xAE, |
| 69 | + Verify12 = 0xAF, |
| 70 | + |
| 71 | + // ------------------------- |
| 72 | + // 16-byte CDB commands |
| 73 | + // ------------------------- |
| 74 | + Read16 = 0x88, |
| 75 | + Write16 = 0x8A, |
| 76 | + Verify16 = 0x8F, |
| 77 | + WriteVerify16 = 0x8E, |
| 78 | + SynchronizeCache16 = 0x91, |
| 79 | + WriteAtomic16 = 0x9C, |
| 80 | + |
| 81 | + // ------------------------- |
| 82 | + // SPC (control / management) |
| 83 | + // ------------------------- |
| 84 | + ReportLuns = 0xA0, |
| 85 | + ReportSupportedOpCodes = 0xA3, |
| 86 | + ReportSupportedTaskManagement = 0xA4, |
| 87 | + ReportIdentifiers = 0xA1, |
| 88 | + PersistentReserveIn = 0x5E, |
| 89 | + PersistentReserveOut = 0x5F, |
| 90 | + ReadAttribute = 0x8C, |
| 91 | + WriteAttribute = 0x8D, |
| 92 | + ModeSelect10 = 0x55, |
| 93 | + ModeSense10 = 0x5A, |
| 94 | + |
| 95 | + // ------------------------- |
| 96 | + // Block Commands (SBC) |
| 97 | + // ------------------------- |
| 98 | + ReadDefectData10 = 0x37, |
| 99 | + ReadDefectData12 = 0xB7, |
| 100 | + CompareAndWrite = 0x89, |
| 101 | + OrWrite = 0x8B, |
| 102 | + WriteSame10 = 0x41, |
| 103 | + WriteSame16 = 0x93, |
| 104 | + WriteStream16 = 0x9B, |
| 105 | + ReadStream16 = 0x9A, |
| 106 | + |
| 107 | + // ------------------------- |
| 108 | + // Synchronization / cache |
| 109 | + // ------------------------- |
| 110 | + SynchronizeCache = 0x35, |
| 111 | + |
| 112 | + // ------------------------- |
| 113 | + // MMC (optical media) |
| 114 | + // ------------------------- |
| 115 | + ReadTocPmaAtip = 0x43, |
| 116 | + ReadDiscInformation = 0x51, |
| 117 | + ReadTrackInformation = 0x52, |
| 118 | + ReserveTrack = 0x53, |
| 119 | + SendOpcInformation = 0x54, |
| 120 | + |
| 121 | + // ------------------------- |
| 122 | + // SSC (tape devices) |
| 123 | + // ------------------------- |
| 124 | + Locate = 0x2B, |
| 125 | + ReadPosition = 0x34, |
| 126 | + LoadUnload = 0x1B, |
| 127 | + Space = 0x11, |
| 128 | + WriteFilemarks = 0x10 |
| 129 | +} |
0 commit comments