// /*************************************************************************** // Aaru Data Preservation Suite // ---------------------------------------------------------------------------- // // Filename : IOpticalMediaImage.cs // Author(s) : Natalia Portillo // // Component : Disc image plugins. // // --[ Description ] ---------------------------------------------------------- // // Defines the interface to be implemented by optical disc 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-2025 Natalia Portillo // ****************************************************************************/ using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Structs; namespace Aaru.CommonTypes.Interfaces; /// /// Abstract class to implement disk image reading plugins. [SuppressMessage("ReSharper", "UnusedMember.Global")] [SuppressMessage("ReSharper", "UnusedMemberInSuper.Global")] [SuppressMessage("ReSharper", "UnusedMethodReturnValue.Global")] public interface IOpticalMediaImage : IMediaImage, IPartitionableMediaImage, IVerifiableSectorsImage { /// Gets the disc track extents (start, length). /// The track extents. List Tracks { get; } /// Gets the sessions (optical discs only). /// The sessions. List Sessions { get; } /// Reads a sector's user data, relative to track. /// The sector's user data. /// Sector address (relative LBA). /// Track. /// The sector's user data. /// The status of the sector. ErrorNumber ReadSector(ulong sectorAddress, uint track, out byte[] buffer, out SectorStatus sectorStatus); /// Reads a sector's tag, relative to track. /// The sector's tag. /// Sector address (relative LBA). /// Track. /// Tag type. /// The sector's tag. ErrorNumber ReadSectorTag(ulong sectorAddress, uint track, SectorTagType tag, out byte[] buffer); /// Reads user data from several sectors, relative to track. /// The sectors user data. /// Starting sector address (relative LBA). /// How many sectors to read. /// Track. /// The sectors user data. /// The status of each sector. ErrorNumber ReadSectors(ulong sectorAddress, uint length, uint track, out byte[] buffer, out SectorStatus[] sectorStatus); /// Reads tag from several sectors, relative to track. /// The sectors tag. /// Starting sector address (relative LBA). /// How many sectors to read. /// Track. /// Tag type. /// The sectors tag. ErrorNumber ReadSectorsTag(ulong sectorAddress, uint length, uint track, SectorTagType tag, out byte[] buffer); /// Reads a complete sector (user data + all tags), relative to track. /// The complete sector. Format depends on disk type. /// Sector address (relative LBA). /// Track. /// The complete sector. /// The status of the sector. ErrorNumber ReadSectorLong(ulong sectorAddress, uint track, out byte[] buffer, out SectorStatus sectorStatus); /// Reads several complete sector (user data + all tags), relative to track. /// The complete sectors. Format depends on disk type. /// Starting sector address (relative LBA). /// How many sectors to read. /// Track. /// The complete sectors. /// The status of each sector. ErrorNumber ReadSectorsLong(ulong sectorAddress, uint length, uint track, out byte[] buffer, out SectorStatus[] sectorStatus); /// Gets the disc track extents for a specified session. /// The track extents for that session. /// Session. List GetSessionTracks(Session session); /// Gets the disc track extents for a specified session. /// The track extents for that session. /// Session. List GetSessionTracks(ushort session); /// Verifies several sectors, relative to track. /// True if all are correct, false if any is incorrect, null if any is uncheckable. /// Starting sector address (relative LBA). /// How many sectors to read. /// Track. /// List of incorrect sectors. /// List of uncheckable sectors. bool? VerifySectors(ulong sectorAddress, uint length, uint track, out List failingLbas, out List unknownLbas); }