public interface IAdditionSubtraction<T> where T : IAdditionSubtraction<T>
public interface ISAS<T> where T: ISspIu
void sendSsp(SspFrame<T> ssp);
void sendAddr(Addrframe addr);
public class MySAS<T> : ISAS<T> where T: ISspIu
void sendAddr(Addrframe addr)
public void sendSsp(SspFrame<T> ssp)
public class MySAS : ISAS<DataFrameIU>
void sendAddr(Addrframe addr)
public void sendSsp(SspFrame<DataFrameIU> ssp)
public record Addrframe(int type);
SspFrameType FrameType { get; }
public record SspFrame<T> (
UInt32 HashedDestinationSASAddress,
UInt32 HashedSourceSASAddress,
UInt16 InitiatorPortTransferTag,
SspTLRControl TLRControl = SspTLRControl.UseModePage,
bool RetryDataFrames = false,
bool ChangingDataPointer = false,
UInt16 TargetPortTransferTag = 0,
byte NumberOfFillBytes = 0,
public SspFrameType FrameType => IU.FrameType;
public enum SspFrameType : byte
public enum SspTLRControl : byte
public enum SspTaskAttribute : byte
public enum SspTaskManagementFunction : byte
LOGICAL_UNIT_RESET = 0x08,
QUERY_ASYNCHRONOUS_EVENT = 0x82,
public enum SspDataPres : byte
public enum SspResponseCode : byte
TASK_MANAGEMENT_FUNCTION_COMPLETE = 0x00,
TASK_MANAGEMENT_FUNCTION_NOT_SUPPORTED = 0x04,
TASK_MANAGEMENT_FUNCTION_FAILED = 0x05,
TASK_MANAGEMENT_FUNCTION_SUCCEEDED = 0x08,
INCORRECT_LOGICAL_UNIT_NUMBER = 0x09,
OVERLAPPED_INITIATOR_PORT_TRANSFER_TAG_ATTEMPTED = 0x0A,
public record CommandFrameIU(
ReadOnlyMemory<byte> CDB,
ReadOnlyMemory<byte> EntireCDB,
ReadOnlyMemory<byte> AdditionalCDBBytes,
UInt64 LogicalUnitNumber = 0,
byte EnableFirstBurst = 0,
byte CommandPriority = 0,
SspTaskAttribute TaskAttribute = 0,
byte AdditionalCDBLength = 0 ) : ISspIu
public SspFrameType FrameType => SspFrameType.COMMAND;
public record TaskFrameIU(
uint IntiatorPortTransferTagToManage,
UInt64 LogicalUnitNumber = 0,
SspTaskManagementFunction TaskManagementFunction = 0) : ISspIu
public SspFrameType FrameType => SspFrameType.TASK;
public record Xfer_RdyFrameIU(
UInt32 WriteDataLength) : ISspIu
public SspFrameType FrameType => SspFrameType.XFER_RDY;
public record DataFrameIU(ReadOnlyMemory<byte> Data) : ISspIu
public SspFrameType FrameType => SspFrameType.DATA;
public record ResponseFrameIU(
UInt32 ResponseDataLength,
ReadOnlyMemory<byte> ResponseData,
ReadOnlyMemory<byte> SenseData,
ReadOnlyMemory<byte> AdditionalResponseInformation,
SspResponseCode ResponseCode) : ISspIu
public SspFrameType FrameType => SspFrameType.RESPONSE;
public static void Main()
Console.WriteLine("Hello World");
var myCustomerData = Encoding.ASCII.GetBytes("My important Customer Data");
var myDataIU = new DataFrameIU(myCustomerData);
var myDataFrame = new SspFrame<DataFrameIU>( 1, 2, 0, myDataIU);
var myXFer_RdyIU = new Xfer_RdyFrameIU(0,0x100);
var myXferRdyframe = new SspFrame<Xfer_RdyFrameIU>( 1, 2, 1, myXFer_RdyIU, CRC: true);
var myXferRdyframe1 = new SspFrame<Xfer_RdyFrameIU>( 1, 2, 2, new Xfer_RdyFrameIU(0,0x100));
var responseData = new byte[] {0,1,2,3,4,5};
var senseData = new byte[] {11,22,33,44,55};
byte[] additionalResponseInfo = null;
var myResponseIU = new ResponseFrameIU(0, SspDataPres.NO_DATA, 0, 0, 0, responseData, senseData, additionalResponseInfo, SspResponseCode.TASK_MANAGEMENT_FUNCTION_COMPLETE);
var myResponseframe = new SspFrame<ResponseFrameIU>( 1, 2, 3, myResponseIU);
Console.WriteLine(myDataFrame);
Console.WriteLine(myDataFrame.IU);
Console.WriteLine(myXferRdyframe);
Console.WriteLine(myXferRdyframe.IU);
Console.WriteLine(myXferRdyframe1);
Console.WriteLine(myXferRdyframe1.IU);
Console.WriteLine(myResponseframe);
Console.WriteLine(myResponseframe.IU);