Skip to main content

Image

Struct Image 

Source
pub struct Image { /* private fields */ }
Expand description

Opened EWF image and logical media reader.

Implementations§

Source§

impl Image

Source

pub fn open(path: impl AsRef<Path>) -> Result<Self>

Opens an EWF image from the first segment path.

Adjacent segments are discovered automatically from the first path.

§Errors

Returns an error if no segment set can be discovered, a segment cannot be read, or the image is unsupported or malformed.

Source

pub fn open_with_options( path: impl AsRef<Path>, options: OpenOptions, ) -> Result<Self>

Opens an EWF image from the first segment path with explicit options.

§Errors

Returns an error if no segment set can be discovered, a segment cannot be read, or the image is unsupported or malformed.

Source

pub fn open_segments<P, I>(paths: I) -> Result<Self>
where P: AsRef<Path>, I: IntoIterator<Item = P>,

Opens an EWF image from an explicit ordered segment path list.

§Errors

Returns an error if the list is empty, a segment cannot be read, or the image is unsupported or malformed.

Source

pub fn open_segments_with_options<P, I>( paths: I, options: OpenOptions, ) -> Result<Self>
where P: AsRef<Path>, I: IntoIterator<Item = P>,

Opens an EWF image from explicit ordered segment paths with options.

§Errors

Returns an error if the list is empty, a segment cannot be read, or the image is unsupported or malformed.

Source

pub fn open_readers<N, R, I>(segments: I) -> Result<Self>
where N: Into<PathBuf>, R: SegmentReader + 'static, I: IntoIterator<Item = (N, R)>,

Opens an EWF image from supplied readers and segment labels.

Supplied readers are kept by the image and are not reopened from the filesystem. Labels are used anywhere this crate reports segment paths.

§Errors

Returns an error if the list is empty, a reader fails, or the image is unsupported or malformed.

Source

pub fn open_readers_with_options<N, R, I>( segments: I, options: OpenOptions, ) -> Result<Self>
where N: Into<PathBuf>, R: SegmentReader + 'static, I: IntoIterator<Item = (N, R)>,

Opens an EWF image from supplied readers with explicit options.

§Errors

Returns an error if the list is empty, a reader fails, or the image is unsupported or malformed.

Source

pub fn info(&self) -> &ImageInfo

Returns parsed image metadata and geometry.

Source

pub fn reader_statistics(&self) -> Option<ReaderStatistics>

Returns cumulative reader counters when statistics were enabled at open time.

Snapshots are shared across clones and cursors created from this image.

Source

pub fn reader_cache_info(&self) -> ReaderCacheInfo

Returns configured capacities and retained table-page payload bytes.

Source

pub fn filename(&self) -> &Path

Returns the first segment filename or supplied-reader label.

Source

pub fn number_of_segments(&self) -> usize

Returns the number of segments in the opened image.

Source

pub fn maximum_number_of_open_handles(&self) -> Result<Option<usize>>

Returns the configured maximum number of open segment handles.

§Errors

Returns an error if the internal segment pool lock is poisoned.

Source

pub fn set_maximum_number_of_open_handles( &self, maximum_open_handles: Option<usize>, ) -> Result<()>

Updates the maximum number of open segment handles.

None allows all handles to remain open. Supplied-reader images cannot evict and reopen readers, so this value is validated against the reader set.

§Errors

Returns an error if the value is invalid for supplied readers or if the internal segment pool lock is poisoned.

Source

pub fn number_of_open_segment_handles(&self) -> Result<usize>

Returns the current number of open segment handles.

§Errors

Returns an error if the internal segment pool lock is poisoned.

Source

pub fn segment_filenames(&self) -> &[PathBuf]

Returns all segment filenames or supplied-reader labels.

Source

pub fn segment_filename(&self, index: usize) -> Option<&Path>

Returns one segment filename or supplied-reader label by index.

Source

pub fn segment_set_size(&self) -> Result<u64>

Returns the total byte size of all opened segment containers.

For supplied readers, this uses SegmentReader::segment_len.

§Errors

Returns an error if a segment length cannot be read, the internal segment pool lock is poisoned, or the total size overflows u64.

Source

pub fn segment_files_corrupted(&self) -> Result<bool>

Probes path-backed segment files for corruption-style structural errors.

Images opened from supplied readers return false because there are no filesystem paths to reprobe.

§Errors

Returns an error if a path-backed probe fails unexpectedly.

Source

pub fn segment_files_encrypted(&self) -> Result<bool>

Probes path-backed segment files for EWF2 encryption markers.

Images opened from supplied readers return false because there are no filesystem paths to reprobe.

§Errors

Returns an error if a path-backed probe fails unexpectedly.

Source

pub fn segment_filename_for_chunk(&self, chunk_index: u64) -> Result<&Path>

Returns the segment containing a logical chunk.

§Errors

Returns an error if chunk_index is outside the parsed chunk index or if the chunk index references a missing segment.

Source

pub fn segment_filename_for_offset(&self, offset: u64) -> Result<Option<&Path>>

Returns the segment containing a logical byte offset.

Offsets at or beyond the logical media size return Ok(None).

§Errors

Returns an error if the chunk geometry is malformed.

Source

pub fn format(&self) -> Format

Returns the top-level EWF format generation.

Source

pub fn format_profile(&self) -> FormatProfile

Returns the inferred format profile.

Source

pub fn chunk_size(&self) -> u64

Returns the logical chunk size in bytes.

Source

pub fn media_size(&self) -> u64

Returns the logical media size in bytes.

Source

pub fn header_codepage(&self) -> HeaderCodepage

Returns the header codepage used for decoded EWF1 values.

Source

pub fn header_values_date_format(&self) -> HeaderDateFormat

Returns the date format applied to header date values.

Source

pub fn sectors_per_chunk(&self) -> Option<u64>

Returns sectors per chunk from media metadata.

Source

pub fn bytes_per_sector(&self) -> Option<u64>

Returns bytes per sector from media metadata.

Source

pub fn number_of_sectors(&self) -> Option<u64>

Returns the logical sector count from media metadata.

Source

pub fn number_of_chunks(&self) -> Option<u64>

Returns the logical chunk count from media metadata.

Source

pub fn error_granularity(&self) -> Option<u64>

Returns error granularity in sectors from media metadata.

Source

pub fn segment_file_set_identifier(&self) -> Option<[u8; 16]>

Returns the segment set identifier.

Source

pub fn segment_file_version(&self) -> Option<SegmentFileVersion>

Returns the EWF2 segment file version.

Source

pub fn compression_method(&self) -> Option<CompressionMethod>

Returns the stored compression method metadata.

Source

pub fn compression_values(&self) -> CompressionValues

Returns stored compression level and flags metadata.

Source

pub fn media_type(&self) -> Option<MediaType>

Returns media type metadata.

Source

pub fn media_flags(&self) -> MediaFlags

Returns media flag metadata.

Source

pub fn memory_extents(&self) -> &[MemoryExtent]

Returns memory acquisition extents.

Source

pub fn number_of_memory_extents(&self) -> usize

Returns the number of memory acquisition extents.

Source

pub fn memory_extent(&self, index: usize) -> Option<&MemoryExtent>

Returns one memory acquisition extent by index.

Source

pub fn ewf2_increment_data(&self) -> &[Vec<u8>]

Returns raw EWF2 increment data sections.

Source

pub fn number_of_ewf2_increment_data_sections(&self) -> usize

Returns the number of EWF2 increment data sections.

Source

pub fn ewf2_increment_data_section(&self, index: usize) -> Option<&[u8]>

Returns one raw EWF2 increment data section by index.

Source

pub fn ewf2_final_information(&self) -> Option<&[u8]>

Returns the raw EWF2 final information section.

Source

pub fn ewf2_restart_data(&self) -> Option<&str>

Returns EWF2 restart data text.

Source

pub fn ewf2_analytical_data(&self) -> Option<&str>

Returns EWF2 analytical data text.

Source

pub fn header_value(&self, identifier: &str) -> Option<Cow<'_, str>>

Returns a header value by its EWF identifier.

Source

pub fn number_of_header_values(&self) -> usize

Returns the number of available header values.

Source

pub fn header_value_identifier(&self, index: usize) -> Option<&str>

Returns a header value identifier by enumeration index.

Source

pub fn hash_value(&self, identifier: &str) -> Option<&str>

Returns a stored hash string by identifier.

Source

pub fn number_of_hash_values(&self) -> usize

Returns the number of stored hash strings.

Source

pub fn hash_value_identifier(&self, index: usize) -> Option<&str>

Returns a stored hash identifier by enumeration index.

Source

pub fn cursor(&self) -> ImageCursor

Returns a seekable cursor over the logical media stream.

Source

pub fn read_at(&self, buf: &mut [u8], offset: u64) -> Result<usize>

Reads logical media bytes at an absolute byte offset.

Returns Ok(0) when buf is empty or offset is at or beyond the logical media size.

§Errors

Returns an error if chunk lookup, decoding, checksum validation, or segment I/O fails, or if Image::signal_abort has been called.

Source

pub fn read_buffer_at_offset( &self, buf: &mut [u8], offset: u64, ) -> Result<usize>

Alias for Image::read_at.

§Errors

Returns the same errors as Image::read_at.

Source

pub fn read_single_file_at( &self, entry: &SingleFileEntry, buf: &mut [u8], offset: u64, ) -> Result<usize>

Reads bytes from a logical single-file catalog entry.

Sparse extents read as zeroes. Duplicate-data entries read from their referenced media offset.

§Errors

Returns an error if the entry metadata is inconsistent, the requested file range is not covered by extents, underlying image reads fail, or Image::signal_abort has been called.

Source

pub fn read_file_entry_at( &self, entry: &SingleFileEntry, buf: &mut [u8], offset: u64, ) -> Result<usize>

Alias for Image::read_single_file_at.

§Errors

Returns the same errors as Image::read_single_file_at.

Source

pub fn root_file_entry(&self) -> Option<&SingleFileEntry>

Returns the root logical single-file entry, if present.

Source

pub fn file_entry_by_path(&self, path: &str) -> Result<Option<&SingleFileEntry>>

Returns a logical single-file entry by path.

§Errors

Returns an error if path contains an empty entry name.

Source

pub fn source_for_file_entry( &self, entry: &SingleFileEntry, ) -> Option<&SingleFileSource>

Returns the source record associated with a logical single-file entry.

Source

pub fn subject_for_file_entry( &self, entry: &SingleFileEntry, ) -> Option<&SingleFileSubject>

Returns the subject record associated with a logical single-file entry.

Source

pub fn access_control_entries_for_file_entry( &self, entry: &SingleFileEntry, ) -> &[SingleFilePermission]

Returns access-control entries associated with a logical single-file entry.

Source

pub fn number_of_access_control_entries_for_file_entry( &self, entry: &SingleFileEntry, ) -> usize

Returns the number of access-control entries for a logical single-file entry.

Source

pub fn access_control_entry_for_file_entry( &self, entry: &SingleFileEntry, index: usize, ) -> Option<&SingleFilePermission>

Returns one access-control entry for a logical single-file entry by index.

Source

pub fn md5_hash(&self) -> Option<[u8; 16]>

Returns the stored MD5 hash bytes.

Source

pub fn sha1_hash(&self) -> Option<[u8; 20]>

Returns the stored SHA1 hash bytes.

Source

pub fn acquisition_errors(&self) -> &[AcquisitionError]

Returns acquisition error ranges.

Source

pub fn number_of_acquisition_errors(&self) -> usize

Returns the number of acquisition error ranges.

Source

pub fn acquisition_error(&self, index: usize) -> Option<&AcquisitionError>

Returns one acquisition error range by index.

Source

pub fn sessions(&self) -> &[SectorRange]

Returns session sector ranges.

Source

pub fn number_of_sessions(&self) -> usize

Returns the number of session sector ranges.

Source

pub fn session(&self, index: usize) -> Option<&SectorRange>

Returns one session sector range by index.

Source

pub fn tracks(&self) -> &[SectorRange]

Returns track sector ranges.

Source

pub fn number_of_tracks(&self) -> usize

Returns the number of track sector ranges.

Source

pub fn track(&self, index: usize) -> Option<&SectorRange>

Returns one track sector range by index.

Source

pub fn read_zero_chunk_on_error(&self) -> bool

Returns whether checksum-failed chunks are read as zero-filled data.

Source

pub fn set_read_zero_chunk_on_error(&self, zero_on_error: bool)

Sets whether checksum-failed chunks are read as zero-filled data.

Source

pub fn signal_abort(&self)

Signals future reads and verification to abort with EwfError::Aborted.

Source

pub fn checksum_errors(&self) -> Result<Vec<SectorRange>>

Returns checksum error ranges observed while reading.

§Errors

Returns an error if the internal checksum-error lock is poisoned.

Source

pub fn number_of_checksum_errors(&self) -> Result<usize>

Returns the number of checksum error ranges observed while reading.

§Errors

Returns an error if the internal checksum-error lock is poisoned.

Source

pub fn checksum_error(&self, index: usize) -> Result<Option<SectorRange>>

Returns one checksum error range observed while reading.

§Errors

Returns an error if the internal checksum-error lock is poisoned.

Source

pub fn single_file_cursor(&self, entry: &SingleFileEntry) -> SingleFileCursor

Returns a seekable cursor over a logical single-file entry.

Source

pub fn single_file_cursor_by_path( &self, path: &str, ) -> Result<Option<SingleFileCursor>>

Returns a seekable cursor over a logical single-file entry by path.

§Errors

Returns an error if path contains an empty entry name.

Source

pub fn read_data_chunk(&self, chunk_index: u64) -> Result<DataChunk>

Reads and decodes one logical data chunk.

§Errors

Returns an error if the chunk index is invalid, segment I/O fails, decoding fails, checksum validation fails under the current policy, or Image::signal_abort has been called.

Source

pub fn read_encoded_data_chunk( &self, chunk_index: u64, ) -> Result<EncodedDataChunk>

Reads one encoded data chunk without decoding the payload.

§Errors

Returns an error if the chunk index is invalid, segment I/O fails, or Image::signal_abort has been called.

Source§

impl Image

Source

pub fn verify(&self) -> Result<VerifyResult>

Computes streamed MD5 and SHA1 hashes for the logical media stream.

The returned VerifyResult contains computed hashes and optional match results. Match values are None when the image did not store the corresponding expected hash.

§Errors

Returns an error if reading the logical media stream fails, if the read reaches EOF before ImageInfo::logical_size, or if the image has been aborted with Image::signal_abort.

Trait Implementations§

Source§

impl Clone for Image

Source§

fn clone(&self) -> Image

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Image

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Image

§

impl RefUnwindSafe for Image

§

impl Send for Image

§

impl Sync for Image

§

impl Unpin for Image

§

impl UnsafeUnpin for Image

§

impl UnwindSafe for Image

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.