2019-10-12 19:26:28 +01:00
|
|
|
using System.Runtime.InteropServices;
|
2019-10-14 01:02:25 +01:00
|
|
|
using DiscImageChef.CommonTypes.Enums;
|
2019-10-14 00:42:13 +01:00
|
|
|
using DiscImageChef.Decoders.ATA;
|
2019-10-12 19:26:28 +01:00
|
|
|
|
|
|
|
|
namespace DiscImageChef.Devices.Remote
|
|
|
|
|
{
|
2019-10-12 22:34:27 +01:00
|
|
|
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
|
2019-10-12 19:53:12 +01:00
|
|
|
public struct DicPacketHeader
|
2019-10-12 19:26:28 +01:00
|
|
|
{
|
2019-10-12 22:13:33 +01:00
|
|
|
public ulong id;
|
2019-10-12 19:26:28 +01:00
|
|
|
|
|
|
|
|
public uint len;
|
|
|
|
|
public byte version;
|
|
|
|
|
public DicPacketType packetType;
|
|
|
|
|
|
|
|
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
|
2019-10-12 22:34:27 +01:00
|
|
|
public readonly byte[] spare;
|
2019-10-12 19:26:28 +01:00
|
|
|
}
|
|
|
|
|
|
2019-10-12 22:34:27 +01:00
|
|
|
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
|
2019-10-12 19:53:12 +01:00
|
|
|
public struct DicPacketHello
|
2019-10-12 19:26:28 +01:00
|
|
|
{
|
|
|
|
|
public DicPacketHeader hdr;
|
|
|
|
|
|
|
|
|
|
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)]
|
|
|
|
|
public string application;
|
|
|
|
|
|
|
|
|
|
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 64)]
|
|
|
|
|
public string version;
|
|
|
|
|
|
|
|
|
|
public byte maxProtocol;
|
|
|
|
|
|
|
|
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
|
2019-10-12 22:34:27 +01:00
|
|
|
public readonly byte[] spare;
|
2019-10-12 19:26:28 +01:00
|
|
|
|
|
|
|
|
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
|
|
|
|
|
public string sysname;
|
|
|
|
|
|
|
|
|
|
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
|
|
|
|
|
public string release;
|
|
|
|
|
|
|
|
|
|
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
|
|
|
|
|
public string machine;
|
|
|
|
|
}
|
2019-10-12 22:34:27 +01:00
|
|
|
|
|
|
|
|
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
|
|
|
|
|
public struct DicPacketCommandListDevices
|
|
|
|
|
{
|
|
|
|
|
public DicPacketHeader hdr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
|
|
|
|
|
public struct DicPacketResponseListDevices
|
|
|
|
|
{
|
|
|
|
|
public readonly DicPacketHeader hdr;
|
|
|
|
|
public readonly ushort devices;
|
|
|
|
|
}
|
2019-10-13 20:54:10 +01:00
|
|
|
|
|
|
|
|
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
|
|
|
|
|
public struct DicPacketNop
|
|
|
|
|
{
|
|
|
|
|
public DicPacketHeader hdr;
|
2019-10-13 22:29:09 +01:00
|
|
|
public DicNopReason reasonCode;
|
2019-10-13 20:54:10 +01:00
|
|
|
|
|
|
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
|
|
|
|
|
public readonly byte[] spare;
|
|
|
|
|
|
|
|
|
|
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
|
|
|
|
|
public string reason;
|
2019-10-13 21:19:21 +01:00
|
|
|
|
|
|
|
|
public int errno;
|
2019-10-13 20:54:10 +01:00
|
|
|
}
|
2019-10-13 21:59:19 +01:00
|
|
|
|
|
|
|
|
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
|
|
|
|
|
public struct DicPacketCommandOpenDevice
|
|
|
|
|
{
|
|
|
|
|
public DicPacketHeader hdr;
|
|
|
|
|
|
|
|
|
|
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 1024)]
|
|
|
|
|
public string device_path;
|
|
|
|
|
}
|
2019-10-14 00:42:13 +01:00
|
|
|
|
|
|
|
|
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
|
|
|
|
|
public struct DicPacketCmdScsi
|
|
|
|
|
{
|
|
|
|
|
public DicPacketHeader hdr;
|
|
|
|
|
public uint cdb_len;
|
|
|
|
|
public uint buf_len;
|
|
|
|
|
public int direction;
|
|
|
|
|
public uint timeout;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
|
|
|
|
|
public struct DicPacketResScsi
|
|
|
|
|
{
|
|
|
|
|
public DicPacketHeader hdr;
|
|
|
|
|
public uint sense_len;
|
|
|
|
|
public uint buf_len;
|
|
|
|
|
public uint duration;
|
|
|
|
|
public uint sense;
|
2019-10-17 22:15:01 +01:00
|
|
|
public uint error_no;
|
2019-10-14 00:42:13 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
|
|
|
|
|
public struct DicPacketCmdAtaChs
|
|
|
|
|
{
|
|
|
|
|
public DicPacketHeader hdr;
|
|
|
|
|
public uint buf_len;
|
|
|
|
|
public AtaRegistersChs registers;
|
|
|
|
|
public byte protocol;
|
|
|
|
|
public byte transferRegister;
|
2019-10-19 03:11:27 +01:00
|
|
|
[MarshalAs(UnmanagedType.U1)] public bool transferBlocks;
|
2019-10-14 00:42:13 +01:00
|
|
|
public byte spare;
|
|
|
|
|
public uint timeout;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
|
|
|
|
|
public struct DicPacketResAtaChs
|
|
|
|
|
{
|
|
|
|
|
public DicPacketHeader hdr;
|
|
|
|
|
public uint buf_len;
|
|
|
|
|
public AtaErrorRegistersChs registers;
|
|
|
|
|
public uint duration;
|
|
|
|
|
public uint sense;
|
2019-10-17 22:15:01 +01:00
|
|
|
public uint error_no;
|
2019-10-14 00:42:13 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
|
|
|
|
|
public struct DicPacketCmdAtaLba28
|
|
|
|
|
{
|
|
|
|
|
public DicPacketHeader hdr;
|
|
|
|
|
public uint buf_len;
|
|
|
|
|
public AtaRegistersLba28 registers;
|
|
|
|
|
public byte protocol;
|
|
|
|
|
public byte transferRegister;
|
2019-10-19 03:11:27 +01:00
|
|
|
[MarshalAs(UnmanagedType.U1)] public bool transferBlocks;
|
2019-10-14 00:42:13 +01:00
|
|
|
public byte spare;
|
|
|
|
|
public uint timeout;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
|
|
|
|
|
public struct DicPacketResAtaLba28
|
|
|
|
|
{
|
|
|
|
|
public DicPacketHeader hdr;
|
|
|
|
|
public uint buf_len;
|
|
|
|
|
public AtaErrorRegistersLba28 registers;
|
|
|
|
|
public uint duration;
|
|
|
|
|
public uint sense;
|
2019-10-17 22:15:01 +01:00
|
|
|
public uint error_no;
|
2019-10-14 00:42:13 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
|
|
|
|
|
public struct DicPacketCmdAtaLba48
|
|
|
|
|
{
|
|
|
|
|
public DicPacketHeader hdr;
|
|
|
|
|
public uint buf_len;
|
|
|
|
|
public AtaRegistersLba48 registers;
|
|
|
|
|
public byte protocol;
|
|
|
|
|
public byte transferRegister;
|
2019-10-19 03:11:27 +01:00
|
|
|
[MarshalAs(UnmanagedType.U1)] public bool transferBlocks;
|
2019-10-14 00:42:13 +01:00
|
|
|
public byte spare;
|
|
|
|
|
public uint timeout;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
|
|
|
|
|
public struct DicPacketResAtaLba48
|
|
|
|
|
{
|
|
|
|
|
public DicPacketHeader hdr;
|
|
|
|
|
public uint buf_len;
|
|
|
|
|
public AtaErrorRegistersLba48 registers;
|
|
|
|
|
public uint duration;
|
|
|
|
|
public uint sense;
|
2019-10-17 22:15:01 +01:00
|
|
|
public uint error_no;
|
2019-10-14 00:42:13 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
|
|
|
|
|
public struct DicPacketCmdSdhci
|
|
|
|
|
{
|
|
|
|
|
public DicPacketHeader hdr;
|
|
|
|
|
public MmcCommands command;
|
|
|
|
|
[MarshalAs(UnmanagedType.U1)] public bool write;
|
|
|
|
|
[MarshalAs(UnmanagedType.U1)] public bool application;
|
|
|
|
|
public MmcFlags flags;
|
|
|
|
|
public uint argument;
|
|
|
|
|
public uint block_size;
|
|
|
|
|
public uint blocks;
|
|
|
|
|
public uint buf_len;
|
|
|
|
|
public uint timeout;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
|
|
|
|
|
public struct DicPacketResSdhci
|
|
|
|
|
{
|
|
|
|
|
public DicPacketHeader hdr;
|
|
|
|
|
public uint buf_len;
|
|
|
|
|
|
|
|
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
|
|
|
|
|
public uint[] response;
|
|
|
|
|
|
|
|
|
|
public uint duration;
|
|
|
|
|
public uint sense;
|
2019-10-17 22:15:01 +01:00
|
|
|
public uint error_no;
|
2019-10-14 00:42:13 +01:00
|
|
|
}
|
2019-10-14 01:02:25 +01:00
|
|
|
|
|
|
|
|
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
|
|
|
|
|
public struct DicPacketCmdGetDeviceType
|
|
|
|
|
{
|
2019-10-14 01:27:05 +01:00
|
|
|
public DicPacketHeader hdr;
|
2019-10-14 01:02:25 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
|
|
|
|
|
public struct DicPacketResGetDeviceType
|
|
|
|
|
{
|
2019-10-14 01:27:05 +01:00
|
|
|
public DicPacketHeader hdr;
|
|
|
|
|
public DeviceType device_type;
|
2019-10-14 01:02:25 +01:00
|
|
|
}
|
2019-10-14 01:11:20 +01:00
|
|
|
|
|
|
|
|
public struct DicPacketCmdGetSdhciRegisters
|
|
|
|
|
{
|
2019-10-14 01:27:05 +01:00
|
|
|
public DicPacketHeader hdr;
|
2019-10-14 01:11:20 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public struct DicPacketResGetSdhciRegisters
|
|
|
|
|
{
|
2019-10-14 01:27:05 +01:00
|
|
|
public DicPacketHeader hdr;
|
2019-10-14 01:11:20 +01:00
|
|
|
[MarshalAs(UnmanagedType.U1)] public bool isSdhci;
|
|
|
|
|
|
|
|
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
|
|
|
|
|
public byte[] csd;
|
|
|
|
|
|
|
|
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
|
|
|
|
|
public byte[] cid;
|
|
|
|
|
|
|
|
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
|
|
|
|
|
public byte[] ocr;
|
|
|
|
|
|
|
|
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
|
|
|
|
|
public byte[] scr;
|
2019-10-18 00:27:53 +01:00
|
|
|
|
|
|
|
|
public uint csd_len;
|
|
|
|
|
public uint cid_len;
|
|
|
|
|
public uint ocr_len;
|
|
|
|
|
public uint scr_len;
|
2019-10-14 01:11:20 +01:00
|
|
|
}
|
2019-10-14 01:27:05 +01:00
|
|
|
|
|
|
|
|
public struct DicPacketCmdGetUsbData
|
|
|
|
|
{
|
|
|
|
|
public DicPacketHeader hdr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public struct DicPacketResGetUsbData
|
|
|
|
|
{
|
|
|
|
|
public DicPacketHeader hdr;
|
|
|
|
|
[MarshalAs(UnmanagedType.U1)] public bool isUsb;
|
|
|
|
|
public ushort descLen;
|
|
|
|
|
|
|
|
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 65536)]
|
|
|
|
|
public byte[] descriptors;
|
|
|
|
|
|
|
|
|
|
public ushort idVendor;
|
|
|
|
|
public ushort idProduct;
|
|
|
|
|
|
2019-10-18 23:41:58 +01:00
|
|
|
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
|
2019-10-14 01:27:05 +01:00
|
|
|
public string manufacturer;
|
|
|
|
|
|
2019-10-18 23:41:58 +01:00
|
|
|
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
|
2019-10-14 01:27:05 +01:00
|
|
|
public string product;
|
|
|
|
|
|
2019-10-18 23:41:58 +01:00
|
|
|
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
|
2019-10-14 01:27:05 +01:00
|
|
|
public string serial;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public struct DicPacketCmdGetFireWireData
|
|
|
|
|
{
|
|
|
|
|
public DicPacketHeader hdr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public struct DicPacketResGetFireWireData
|
|
|
|
|
{
|
|
|
|
|
public DicPacketHeader hdr;
|
|
|
|
|
[MarshalAs(UnmanagedType.U1)] public bool isFireWire;
|
|
|
|
|
public uint idModel;
|
|
|
|
|
public uint idVendor;
|
|
|
|
|
public ulong guid;
|
|
|
|
|
|
2019-10-18 23:41:58 +01:00
|
|
|
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
|
2019-10-14 01:27:05 +01:00
|
|
|
public string vendor;
|
|
|
|
|
|
2019-10-18 23:41:58 +01:00
|
|
|
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
|
2019-10-14 01:27:05 +01:00
|
|
|
public string model;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public struct DicPacketCmdGetPcmciaData
|
|
|
|
|
{
|
|
|
|
|
public DicPacketHeader hdr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public struct DicPacketResGetPcmciaData
|
|
|
|
|
{
|
|
|
|
|
public DicPacketHeader hdr;
|
|
|
|
|
[MarshalAs(UnmanagedType.U1)] public bool isPcmcia;
|
|
|
|
|
public ushort cis_len;
|
|
|
|
|
|
|
|
|
|
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 65536)]
|
|
|
|
|
public byte[] cis;
|
|
|
|
|
}
|
2019-10-12 19:26:28 +01:00
|
|
|
}
|