// /*************************************************************************** // Aaru Data Preservation Suite // ---------------------------------------------------------------------------- // // Filename : IMediaImage.cs // Author(s) : Natalia Portillo // // Component : Common structures. // // --[ Description ] ---------------------------------------------------------- // // Defines structures to be used by media image plugins. // // --[ License ] -------------------------------------------------------------- // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be included // in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // // ---------------------------------------------------------------------------- // Copyright © 2011-2023 Natalia Portillo // ****************************************************************************/ using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; namespace Aaru.CommonTypes.Structs; /// Contains information about a dump image and its contents public struct ImageInfo { /// Image contains partitions (or tracks for optical media) public bool HasPartitions; /// Image contains sessions (optical media only) public bool HasSessions; /// Size of the image without headers public ulong ImageSize; /// Sectors contained in the image public ulong Sectors; /// Size of sectors contained in the image public uint SectorSize; /// Media tags contained by the image public List ReadableMediaTags; /// Sector tags contained by the image public List ReadableSectorTags; /// Image version public string Version; /// Application that created the image public string Application; /// Version of the application that created the image public string ApplicationVersion; /// Who (person) created the image? public string Creator; /// Image creation time public DateTime CreationTime; /// Image last modification time public DateTime LastModificationTime; /// Title of the media represented by the image public string MediaTitle; /// Image comments public string Comments; /// Manufacturer of the media represented by the image public string MediaManufacturer; /// Model of the media represented by the image public string MediaModel; /// Serial number of the media represented by the image public string MediaSerialNumber; /// Barcode of the media represented by the image public string MediaBarcode; /// Part number of the media represented by the image public string MediaPartNumber; /// Media type represented by the image public MediaType MediaType; /// Number in sequence for the media represented by the image public int MediaSequence; /// Last media of the sequence the media represented by the image corresponds to public int LastMediaSequence; /// Manufacturer of the drive used to read the media represented by the image public string DriveManufacturer; /// Model of the drive used to read the media represented by the image public string DriveModel; /// Serial number of the drive used to read the media represented by the image public string DriveSerialNumber; /// Firmware revision of the drive used to read the media represented by the image public string DriveFirmwareRevision; /// Type of the media represented by the image to use in XML sidecars public XmlMediaType XmlMediaType; // CHS geometry... /// Cylinders of the media represented by the image public uint Cylinders; /// Heads of the media represented by the image public uint Heads; /// Sectors per track of the media represented by the image (for variable image, the smallest) public uint SectorsPerTrack; } /// Session defining structure. public struct Session { /// Session number, 1-started public ushort Sequence; /// First track present on this session public uint StartTrack; /// Last track present on this session public uint EndTrack; /// First sector present on this session public ulong StartSector; /// Last sector present on this session public ulong EndSector; } /// Track defining structure. public class Track { /// How many main channel / user data bytes are per sector in this track public int BytesPerSector; /// Information that does not find space in this struct public string Description; /// Track ending sector public ulong EndSector; /// Which file stores this track public string File; /// Starting at which byte is this track stored public ulong FileOffset; /// What kind of file is storing this track public string FileType; /// Which filter stores this track public IFilter Filter; /// Indexes, 00 to 99 and sector offset public Dictionary Indexes; /// Track pre-gap public ulong Pregap; /// How many main channel bytes per sector are in the file with this track public int RawBytesPerSector; /// Track number, 1-started public uint Sequence; /// Session this track belongs to public ushort Session; /// Track starting sector public ulong StartSector; /// Which file stores this track's subchannel public string SubchannelFile; /// Which filter stores this track's subchannel public IFilter SubchannelFilter; /// Starting at which byte are this track's subchannel stored public ulong SubchannelOffset; /// Type of subchannel stored for this track public TrackSubchannelType SubchannelType; /// Partition type public TrackType Type; /// Initializes an empty instance of this structure public Track() => Indexes = new Dictionary(); } /// Floppy physical characteristics structure. public struct FloppyInfo { /// Physical floppy type. public FloppyTypes Type; /// Bitrate in bits per second used to write the floppy, 0 if unknown or track-variable. public uint Bitrate; /// Physical magnetic density (coercivity) of floppy medium. public FloppyDensities Coercivity; /// How many physical tracks are actually written in the floppy image. public ushort Tracks; /// How many physical heads are actually written in the floppy image. public byte Heads; /// How many tracks per inch are actually written in the floppy image. public ushort TrackDensity; } /// Provides a map for linear memory structure public struct LinearMemoryMap { /// List of devices that are mapped to linear memory [NotNull] public LinearMemoryDevice[] Devices { get; set; } } /// Provides information about a linear memory device public struct LinearMemoryDevice { /// Device manufacturer public string Manufacturer { get; set; } /// Device model public string Model { get; set; } /// Device package, e.g. DIP28 public string Package { get; set; } /// Device location marking in PCB, e.g. U28 public string Location { get; set; } /// Device functional type public LinearMemoryType Type { get; set; } /// Arbitrary device information public string Description { get; set; } /// /// Physical addressing is the address considering all devices in the linear memory media, starting at the lowest /// marking in PCB and going up incrementally. This is the view of the memory inside Aaru. /// public LinearMemoryAddressing PhysicalAddress { get; set; } /// /// Virtual addressing is the address as seen by the hardware directly accessing the linear memory media. This /// allows devices to be overlapped or banked. /// public LinearMemoryAddressing VirtualAddress { get; set; } } /// Maps the addressing of a linear memory device public class LinearMemoryAddressing { /// Start in memory where the device is mapped public ulong Start { get; set; } /// Length in bytes of the device, not including interleaving public ulong Length { get; set; } /// Interleaving information public LinearMemoryInterleave Interleave { get; set; } } /// Provides information about a device interleaving public class LinearMemoryInterleave { /// How many bytes to skip from start of map before device first byte starts public uint Offset { get; set; } /// How many bytes in memory to skip every device byte public uint Value { get; set; } }