Loading...
Searching...
No Matches
context.h
Go to the documentation of this file.
/*
* This file is part of the Aaru Data Preservation Suite.
* Copyright (c) 2019-2026 Natalia Portillo.
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 of the
* License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
#ifndef LIBAARUFORMAT_CONTEXT_H
#define LIBAARUFORMAT_CONTEXT_H
#include "blake3.h"
#include "crc64.h"
#include "structs/flux.h"
#include "hash_map.h"
#include "lru.h"
#include "md5.h"
#include "sha1.h"
#include "sha256.h"
#include "spamsum.h"
#include "structs.h"
#include "utarray.h"
typedef struct FluxCaptureMapEntry FluxCaptureMapEntry;
#ifndef MD5_DIGEST_LENGTH
#define MD5_DIGEST_LENGTH 16
#endif
#ifndef SHA1_DIGEST_LENGTH
#define SHA1_DIGEST_LENGTH 20
#endif
#ifndef SHA256_DIGEST_LENGTH
#define SHA256_DIGEST_LENGTH 32
#endif
typedef struct CdEccContext
{
bool inited_edc;
uint8_t *ecc_b_table;
uint8_t *ecc_f_table;
uint32_t *edc_table;
} CdEccContext;
typedef struct Checksums
{
bool hasMd5;
bool hasSha1;
bool hasSha256;
bool hasBlake3;
bool hasSpamSum;
uint8_t md5[MD5_DIGEST_LENGTH];
uint8_t sha1[SHA1_DIGEST_LENGTH];
uint8_t sha256[SHA256_DIGEST_LENGTH];
uint8_t blake3[BLAKE3_OUT_LEN];
uint8_t *spamsum;
} Checksums;
typedef struct mediaTagEntry
{
uint8_t *data;
int32_t type;
uint32_t length;
UT_hash_handle hh;
} mediaTagEntry;
typedef struct TapeFileHashEntry
{
uint64_t key;
TapeFileEntry fileEntry;
UT_hash_handle hh;
} tapeFileHashEntry;
typedef struct TapePartitionHashEntry
{
uint8_t key;
TapePartitionEntry partitionEntry;
UT_hash_handle hh;
} TapePartitionHashEntry;
typedef struct TapeDdtHashEntry
{
uint64_t key;
uint64_t value;
UT_hash_handle hh;
} TapeDdtHashEntry;
typedef struct aaruformat_context
{
/* Core & header */
uint64_t magic;
AaruHeaderV2 header;
FILE *imageStream;
uint8_t library_major_version;
uint8_t library_minor_version;
/* Deduplication tables (DDT) */
uint64_t *user_data_ddt;
TapeDdtHashEntry *tape_ddt;
uint32_t *sector_prefix_ddt;
uint32_t *sector_suffix_ddt;
uint64_t *sector_prefix_ddt2;
uint64_t *sector_suffix_ddt2;
uint64_t *user_data_ddt2;
uint64_t *cached_secondary_ddt2;
DdtHeader2 user_data_ddt_header;
uint64_t cached_ddt_offset;
uint64_t cached_ddt_position;
uint64_t primary_ddt_offset;
size_t mapped_memory_ddt_size;
int ddt_version;
uint8_t shift;
bool in_memory_ddt;
/* Optical auxiliary buffers (NULL if not present) */
uint8_t *sector_prefix;
uint8_t *sector_prefix_corrected;
uint8_t *sector_suffix;
uint8_t *sector_suffix_corrected;
uint8_t *sector_subchannel;
uint8_t *mode2_subheaders;
uint8_t *sector_id;
uint8_t *sector_ied;
uint8_t *sector_cpr_mai;
uint8_t *sector_edc;
uint8_t *sector_decrypted_title_key;
/* Metadata & geometry */
struct DumpHardwareEntriesWithData *dump_hardware_entries_with_data;
uint8_t *metadata_block;
uint8_t *cicm_block;
uint8_t *json_block;
uint8_t *creator;
uint8_t *media_title;
uint8_t *comments;
uint8_t *media_manufacturer;
uint8_t *media_model;
uint8_t *media_serial_number;
uint8_t *media_barcode;
uint8_t *media_part_number;
uint8_t *drive_manufacturer;
uint8_t *drive_model;
uint8_t *drive_serial_number;
uint8_t
*drive_firmware_revision;
GeometryBlockHeader geometry_block;
MetadataBlockHeader metadata_block_header;
CicmMetadataBlock cicm_block_header;
DumpHardwareHeader dump_hardware_header;
AaruMetadataJsonBlockHeader json_block_header;
uint32_t cylinders;
uint32_t heads;
uint32_t sectors_per_track;
int32_t media_sequence;
int32_t last_media_sequence;
/* Optical information */
TrackEntry *track_entries;
TrackEntry *data_tracks;
TracksHeader tracks_header;
uint8_t number_of_data_tracks;
/* Integrity & ECC */
CdEccContext *ecc_cd_context;
crc64_ctx *crc64_context;
/* Index & deduplication lookup */
UT_array *index_entries;
hash_map_t *sector_hash_map;
/* Caches */
struct CacheHeader block_header_cache;
struct CacheHeader block_cache;
/* High-level summary */
ImageInfo image_info;
/* Tags */
bool *readableSectorTags;
mediaTagEntry *mediaTags;
/* Checksums */
spamsum_ctx *spamsum_context;
blake3_hasher *blake3_context;
Checksums checksums;
md5_ctx md5_context;
sha1_ctx sha1_context;
sha256_ctx sha256_context;
bool calculating_md5;
bool calculating_sha1;
bool calculating_sha256;
bool calculating_spamsum;
bool calculating_blake3;
/* Write path */
uint8_t *writing_buffer;
BlockHeader current_block_header;
uint64_t next_block_position;
uint64_t last_written_block;
size_t sector_prefix_length;
size_t sector_suffix_length;
size_t sector_prefix_offset;
size_t sector_suffix_offset;
int current_block_offset;
int writing_buffer_position;
uint8_t current_track_type;
bool is_writing;
bool rewinded;
bool writing_long;
bool block_zero_written;
/* Options */
uint32_t lzma_dict_size;
bool deduplicate;
bool compression_enabled;
/* Tape-specific structures */
tapeFileHashEntry *tape_files;
TapePartitionHashEntry *tape_partitions;
bool is_tape;
/* Flux data structures */
FluxHeader flux_data_header;
FluxEntry *flux_entries;
UT_array *flux_captures;
FluxCaptureMapEntry *flux_map;
/* Dirty flags (controls write behavior in close.c) */
bool dirty_secondary_ddt;
bool dirty_primary_ddt;
bool dirty_single_level_ddt;
bool dirty_checksum_block;
bool dirty_tracks_block;
bool dirty_mode2_subheaders_block;
bool dirty_sector_prefix_block;
bool dirty_sector_prefix_ddt;
bool dirty_sector_suffix_block;
bool dirty_sector_suffix_ddt;
bool dirty_sector_subchannel_block;
bool dirty_dvd_long_sector_blocks;
bool dirty_dvd_title_key_decrypted_block;
bool dirty_media_tags;
bool dirty_tape_ddt;
bool dirty_tape_file_block;
bool dirty_tape_partition_block;
bool dirty_geometry_block;
bool dirty_metadata_block;
bool dirty_dumphw_block;
bool dirty_cicm_block;
bool dirty_json_block;
bool dirty_flux_block;
bool dirty_index_block;
} aaruformat_context;
typedef struct DumpHardwareEntriesWithData
{
DumpHardwareEntry entry;
struct DumpExtent *extents;
uint8_t *manufacturer;
uint8_t *model;
uint8_t *revision;
uint8_t *firmware;
uint8_t *serial;
uint8_t *softwareName;
uint8_t *softwareVersion;
uint8_t *softwareOperatingSystem;
} DumpHardwareEntriesWithData;
#pragma pack(push, 1)
typedef struct DumpExtent
{
uint64_t start;
uint64_t end;
} DumpExtent;
#pragma pack(pop)
#endif // LIBAARUFORMAT_CONTEXT_H
MD5_DIGEST_LENGTH
#define MD5_DIGEST_LENGTH
Definition context.h:72
FluxCaptureMapEntry
struct FluxCaptureMapEntry FluxCaptureMapEntry
Definition context.h:34
tapeFileHashEntry
struct TapeFileHashEntry tapeFileHashEntry
crc64.h
CRC64 (ECMA-182) core context and precomputed slicing-by-4 tables.
flux.h
Data structures for flux transition capture support in Aaru disk images.
hash_map.h
lru.h
md5.h
sha1.h
SHA1_DIGEST_LENGTH
#define SHA1_DIGEST_LENGTH
Definition sha1.h:39
sha256.h
SHA256_DIGEST_LENGTH
#define SHA256_DIGEST_LENGTH
Definition sha256.h:38
spamsum.h
AaruHeaderV2
Version 2 container header with GUID, alignment shifts, and feature negotiation bitmaps.
Definition header.h:107
AaruMetadataJsonBlockHeader
Header for an Aaru metadata JSON block (identifier == BlockType::AaruMetadataJsonBlock).
Definition metadata.h:120
BlockHeader
Header preceding the compressed data payload of a data block (BlockType::DataBlock).
Definition data.h:71
CacheHeader
Cache top-level descriptor encapsulating the hash table root and capacity limit.
Definition lru.h:46
CdEccContext
Lookup tables and state for Compact Disc EDC/ECC (P/Q) regeneration / verification.
Definition context.h:89
CdEccContext::ecc_f_table
uint8_t * ecc_f_table
Forward (F) ECC table.
Definition context.h:92
CdEccContext::inited_edc
bool inited_edc
True once EDC/ECC tables have been initialized.
Definition context.h:90
CdEccContext::edc_table
uint32_t * edc_table
EDC (CRC) lookup table.
Definition context.h:93
CdEccContext::ecc_b_table
uint8_t * ecc_b_table
Backward (B) ECC table (allocated, size implementation-defined).
Definition context.h:91
Checksums
Collected whole‑image checksums / hashes present in a checksum block.
Definition context.h:103
Checksums::spamsum
uint8_t * spamsum
SpamSum fuzzy hash (ASCII), allocated length+1 with trailing 0.
Definition context.h:113
Checksums::hasSha256
bool hasSha256
True if sha256[] buffer populated.
Definition context.h:106
Checksums::sha1
uint8_t sha1[20]
SHA-1 digest (20 bytes).
Definition context.h:110
Checksums::sha256
uint8_t sha256[32]
SHA-256 digest (32 bytes).
Definition context.h:111
Checksums::md5
uint8_t md5[16]
MD5 digest (16 bytes).
Definition context.h:109
Checksums::hasSpamSum
bool hasSpamSum
True if spamsum pointer allocated and signature read.
Definition context.h:108
Checksums::hasSha1
bool hasSha1
True if sha1[] buffer populated.
Definition context.h:105
Checksums::blake3
uint8_t blake3[BLAKE3_OUT_LEN]
BLAKE3 digest (32 bytes).
Definition context.h:112
Checksums::hasMd5
bool hasMd5
True if md5[] buffer populated.
Definition context.h:104
Checksums::hasBlake3
bool hasBlake3
True if blake3[] buffer populated.
Definition context.h:107
CicmMetadataBlock
Header for a CICM XML metadata block (identifier == BlockType::CicmBlock).
Definition metadata.h:108
DdtHeader2
Header preceding a version 2 hierarchical deduplication table.
Definition ddt.h:142
DumpExtent
Inclusive [start,end] logical sector range contributed by a single hardware environment.
Definition context.h:369
DumpExtent::end
uint64_t end
Ending LBA (inclusive); >= start.
Definition context.h:371
DumpExtent::start
uint64_t start
Starting LBA (inclusive).
Definition context.h:370
DumpHardwareEntriesWithData
In-memory representation of a dump hardware entry plus decoded variable-length fields & extents.
Definition context.h:350
DumpHardwareEntriesWithData::firmware
uint8_t * firmware
Firmware version string or NULL.
Definition context.h:356
DumpHardwareEntriesWithData::revision
uint8_t * revision
Hardware revision string or NULL.
Definition context.h:355
DumpHardwareEntriesWithData::model
uint8_t * model
Model string or NULL.
Definition context.h:354
DumpHardwareEntriesWithData::softwareName
uint8_t * softwareName
Dump software name or NULL.
Definition context.h:358
DumpHardwareEntriesWithData::extents
struct DumpExtent * extents
Array of extents (entry.extents elements) or NULL.
Definition context.h:352
DumpHardwareEntriesWithData::manufacturer
uint8_t * manufacturer
Manufacturer string (UTF-8) or NULL.
Definition context.h:353
DumpHardwareEntriesWithData::softwareVersion
uint8_t * softwareVersion
Dump software version or NULL.
Definition context.h:359
DumpHardwareEntriesWithData::serial
uint8_t * serial
Serial number string or NULL.
Definition context.h:357
DumpHardwareEntriesWithData::entry
DumpHardwareEntry entry
Fixed-size header with lengths & counts.
Definition context.h:351
DumpHardwareEntriesWithData::softwareOperatingSystem
uint8_t * softwareOperatingSystem
Host operating system string or NULL.
Definition context.h:360
DumpHardwareEntry
Per-environment length table describing subsequent UTF-8 strings and optional extent array.
Definition dump.h:113
DumpHardwareHeader
Header that precedes a sequence of dump hardware entries and their variable-length payload.
Definition dump.h:91
FluxCaptureMapEntry
Internal hash table entry for flux capture lookup.
Definition flux.c:34
FluxEntry
Metadata entry describing a single flux capture in the FluxDataBlock.
Definition flux.h:156
FluxHeader
Header structure for a FluxDataBlock containing flux capture metadata.
Definition flux.h:117
GeometryBlockHeader
Legacy CHS style logical geometry metadata (BlockType::GeometryBlock).
Definition data.h:91
ImageInfo
High-level summary of an opened Aaru image containing metadata and media characteristics.
Definition aaru.h:932
MetadataBlockHeader
Header for a metadata block containing offsets and lengths to UTF-16LE descriptive strings.
Definition metadata.h:69
TapeDdtHashEntry
Definition context.h:144
TapeDdtHashEntry::hh
UT_hash_handle hh
UTHASH handle.
Definition context.h:147
TapeDdtHashEntry::key
uint64_t key
Key: sector address.
Definition context.h:145
TapeDdtHashEntry::value
uint64_t value
Value: DDT entry.
Definition context.h:146
TapeFileEntry
Describes a single logical file on a tape medium.
Definition tape.h:134
TapeFileHashEntry
Definition context.h:130
TapeFileHashEntry::hh
UT_hash_handle hh
UTHASH handle.
Definition context.h:133
TapeFileHashEntry::key
uint64_t key
Composite key: partition << 32 | file.
Definition context.h:131
TapeFileHashEntry::fileEntry
TapeFileEntry fileEntry
The actual tape file data.
Definition context.h:132
TapePartitionEntry
Describes a single physical partition on a tape medium.
Definition tape.h:320
TapePartitionHashEntry
Definition context.h:137
TapePartitionHashEntry::hh
UT_hash_handle hh
UTHASH handle.
Definition context.h:140
TapePartitionHashEntry::key
uint8_t key
Key: partition.
Definition context.h:138
TapePartitionHashEntry::partitionEntry
TapePartitionEntry partitionEntry
The actual tape partition data.
Definition context.h:139
TrackEntry
Single optical disc track descriptor (sequence, type, LBAs, session, ISRC, flags).
Definition optical.h:72
TracksHeader
Header for an optical tracks block listing track entries.
Definition optical.h:62
aaruformat_context
Master context representing an open or in‑creation Aaru image.
Definition context.h:175
aaruformat_context::media_barcode
uint8_t * media_barcode
Barcode of the media represented by the image.
Definition context.h:225
aaruformat_context::user_data_ddt_header
DdtHeader2 user_data_ddt_header
Active user data DDT v2 header (primary table meta).
Definition context.h:192
aaruformat_context::checksums
Checksums checksums
Whole-image checksums discovered.
Definition context.h:272
aaruformat_context::library_major_version
uint8_t library_major_version
Linked library major version.
Definition context.h:180
aaruformat_context::creator
uint8_t * creator
Who (person) created the image?
Definition context.h:219
aaruformat_context::dirty_checksum_block
bool dirty_checksum_block
True if checksum block should be written during close.
Definition context.h:320
aaruformat_context::deduplicate
bool deduplicate
Storage deduplication active (duplicates coalesce).
Definition context.h:302
aaruformat_context::sector_suffix_length
size_t sector_suffix_length
Length of sector_suffix.
Definition context.h:288
aaruformat_context::compression_enabled
bool compression_enabled
True if block compression enabled (writing path).
Definition context.h:303
aaruformat_context::last_written_block
uint64_t last_written_block
Last written block number (write path).
Definition context.h:286
aaruformat_context::cicm_block
uint8_t * cicm_block
CICM XML payload.
Definition context.h:217
aaruformat_context::sector_cpr_mai
uint8_t * sector_cpr_mai
DVD sector CPR_MAI (6 bytes) if present.
Definition context.h:210
aaruformat_context::dirty_media_tags
bool dirty_media_tags
True if media tags should be written during close.
Definition context.h:330
aaruformat_context::sector_hash_map
hash_map_t * sector_hash_map
Deduplication hash map (fingerprint->entry mapping).
Definition context.h:256
aaruformat_context::flux_data_header
FluxHeader flux_data_header
Flux data header (if present).
Definition context.h:311
aaruformat_context::sector_prefix_corrected
uint8_t * sector_prefix_corrected
Corrected variant (post error correction) if stored.
Definition context.h:203
aaruformat_context::user_data_ddt
uint64_t * user_data_ddt
Legacy flat DDT pointer (NULL when using v2 mini/big arrays).
Definition context.h:184
aaruformat_context::flux_captures
UT_array * flux_captures
Pending flux capture payloads (write path).
Definition context.h:313
aaruformat_context::sha256_context
sha256_ctx sha256_context
Opaque SHA-256 context for streaming updates.
Definition context.h:275
aaruformat_context::data_tracks
TrackEntry * data_tracks
Filtered list of data tracks (subset of trackEntries).
Definition context.h:246
aaruformat_context::cylinders
uint32_t cylinders
Cylinders of the media represented by the image.
Definition context.h:237
aaruformat_context::calculating_sha256
bool calculating_sha256
True if whole-image SHA-256 being calculated on-the-fly.
Definition context.h:278
aaruformat_context::dirty_primary_ddt
bool dirty_primary_ddt
True if primary DDT table should be written during close.
Definition context.h:318
aaruformat_context::drive_firmware_revision
uint8_t * drive_firmware_revision
Firmware revision of the drive used to read the media represented by the image.
Definition context.h:231
aaruformat_context::media_serial_number
uint8_t * media_serial_number
Serial number of the media represented by the image.
Definition context.h:224
aaruformat_context::block_header_cache
struct CacheHeader block_header_cache
LRU/Cache header for block headers.
Definition context.h:259
aaruformat_context::sector_ied
uint8_t * sector_ied
DVD sector IED (2 bytes) if present.
Definition context.h:209
aaruformat_context::md5_context
md5_ctx md5_context
Opaque MD5 context for streaming updates.
Definition context.h:273
aaruformat_context::dirty_sector_suffix_block
bool dirty_sector_suffix_block
True if sector suffix block should be written during close.
Definition context.h:325
aaruformat_context::user_data_ddt2
uint64_t * user_data_ddt2
DDT entries (big variant) primary/secondary current.
Definition context.h:190
aaruformat_context::metadata_block_header
MetadataBlockHeader metadata_block_header
Metadata block header.
Definition context.h:233
aaruformat_context::media_sequence
int32_t media_sequence
Number in sequence for the media represented by the image.
Definition context.h:241
aaruformat_context::shift
uint8_t shift
Legacy overall shift (deprecated by data_shift/table_shift).
Definition context.h:198
aaruformat_context::sector_prefix
uint8_t * sector_prefix
Raw per-sector prefix (e.g., sync+header) uncorrected.
Definition context.h:202
aaruformat_context::dirty_dvd_title_key_decrypted_block
bool dirty_dvd_title_key_decrypted_block
True if decrypted title key block should be written during close.
Definition context.h:329
aaruformat_context::flux_map
FluxCaptureMapEntry * flux_map
Hash map for flux capture lookup by head/track/subtrack/capture index.
Definition context.h:314
aaruformat_context::sector_suffix_ddt2
uint64_t * sector_suffix_ddt2
CD sector suffix DDT V2.
Definition context.h:189
aaruformat_context::tape_files
tapeFileHashEntry * tape_files
Hash table root for tape files.
Definition context.h:306
aaruformat_context::dirty_mode2_subheaders_block
bool dirty_mode2_subheaders_block
True if MODE2 subheader block should be written during close.
Definition context.h:322
aaruformat_context::dirty_tape_partition_block
bool dirty_tape_partition_block
True if tape partition block should be written during close.
Definition context.h:333
aaruformat_context::cached_ddt_offset
uint64_t cached_ddt_offset
File offset of currently cached secondary DDT (0=none).
Definition context.h:193
aaruformat_context::dirty_cicm_block
bool dirty_cicm_block
True if CICM metadata block should be written during close.
Definition context.h:337
aaruformat_context::is_tape
bool is_tape
True if the image is a tape image.
Definition context.h:308
aaruformat_context::sector_edc
uint8_t * sector_edc
DVD sector EDC (4 bytes) if present.
Definition context.h:211
aaruformat_context::calculating_sha1
bool calculating_sha1
True if whole-image SHA-1 being calculated on-the-fly.
Definition context.h:277
aaruformat_context::media_model
uint8_t * media_model
Model of the media represented by the image.
Definition context.h:223
aaruformat_context::dirty_tracks_block
bool dirty_tracks_block
True if tracks block should be written during close.
Definition context.h:321
aaruformat_context::drive_serial_number
uint8_t * drive_serial_number
Serial number of the drive used to read the media represented by the image.
Definition context.h:229
aaruformat_context::ecc_cd_context
CdEccContext * ecc_cd_context
CD ECC/EDC helper tables (allocated on demand).
Definition context.h:251
aaruformat_context::rewinded
bool rewinded
True if stream has been rewound after open (write path).
Definition context.h:296
aaruformat_context::block_cache
struct CacheHeader block_cache
LRU/Cache header for block payloads.
Definition context.h:260
aaruformat_context::sector_suffix_ddt
uint32_t * sector_suffix_ddt
Legacy CD sector suffix DDT.
Definition context.h:187
aaruformat_context::dirty_sector_prefix_block
bool dirty_sector_prefix_block
True if sector prefix block should be written during close.
Definition context.h:323
aaruformat_context::drive_manufacturer
uint8_t * drive_manufacturer
Manufacturer of the drive used to read the media represented by the image.
Definition context.h:227
aaruformat_context::in_memory_ddt
bool in_memory_ddt
True if primary (and possibly secondary) DDT loaded.
Definition context.h:199
aaruformat_context::dirty_index_block
bool dirty_index_block
True if index block should be written during close.
Definition context.h:340
aaruformat_context::sector_suffix
uint8_t * sector_suffix
Raw per-sector suffix (EDC/ECC) uncorrected.
Definition context.h:204
aaruformat_context::header
AaruHeaderV2 header
Parsed container header (v2).
Definition context.h:178
aaruformat_context::current_block_offset
int current_block_offset
Logical offset inside block (units: bytes or sectors depending on path).
Definition context.h:291
aaruformat_context::flux_entries
FluxEntry * flux_entries
Array of flux entries (flux_data_header.entries elements).
Definition context.h:312
aaruformat_context::dirty_json_block
bool dirty_json_block
True if JSON metadata block should be written during close.
Definition context.h:338
aaruformat_context::is_writing
bool is_writing
True if context opened/created for writing.
Definition context.h:295
aaruformat_context::tape_ddt
TapeDdtHashEntry * tape_ddt
Hash table root for tape DDT entries.
Definition context.h:185
aaruformat_context::spamsum_context
spamsum_ctx * spamsum_context
Opaque SpamSum context for streaming updates.
Definition context.h:270
aaruformat_context::cicm_block_header
CicmMetadataBlock cicm_block_header
CICM metadata header (if present).
Definition context.h:234
aaruformat_context::sector_prefix_offset
size_t sector_prefix_offset
Current position in sector_prefix.
Definition context.h:289
aaruformat_context::drive_model
uint8_t * drive_model
Model of the drive used to read the media represented by the image.
Definition context.h:228
aaruformat_context::current_block_header
BlockHeader current_block_header
Header for block currently being assembled (write path).
Definition context.h:284
aaruformat_context::dirty_single_level_ddt
bool dirty_single_level_ddt
True if single-level DDT should be written during close.
Definition context.h:319
aaruformat_context::ddt_version
int ddt_version
DDT version in use (1=legacy, 2=v2 hierarchical).
Definition context.h:197
aaruformat_context::magic
uint64_t magic
File magic (AARU_MAGIC) post-open.
Definition context.h:177
aaruformat_context::writing_buffer
uint8_t * writing_buffer
Accumulation buffer for current block data.
Definition context.h:283
aaruformat_context::sector_prefix_ddt2
uint64_t * sector_prefix_ddt2
CD sector prefix DDT V2.
Definition context.h:188
aaruformat_context::calculating_spamsum
bool calculating_spamsum
True if whole-image SpamSum being calculated on-the-fly.
Definition context.h:279
aaruformat_context::primary_ddt_offset
uint64_t primary_ddt_offset
File offset of the primary DDT v2 table.
Definition context.h:195
aaruformat_context::sector_prefix_length
size_t sector_prefix_length
Length of sector_prefix.
Definition context.h:287
aaruformat_context::mediaTags
mediaTagEntry * mediaTags
Hash table of extra media tags (uthash root).
Definition context.h:267
aaruformat_context::blake3_context
blake3_hasher * blake3_context
Opaque BLAKE3 context for streaming updates.
Definition context.h:271
aaruformat_context::calculating_blake3
bool calculating_blake3
True if whole-image BLAKE3 being calculated on-the-fly.
Definition context.h:280
aaruformat_context::library_minor_version
uint8_t library_minor_version
Linked library minor version;.
Definition context.h:181
aaruformat_context::dump_hardware_entries_with_data
struct DumpHardwareEntriesWithData * dump_hardware_entries_with_data
Array of dump hardware entries + strings.
Definition context.h:215
aaruformat_context::next_block_position
uint64_t next_block_position
Absolute file offset where next block will be written.
Definition context.h:285
aaruformat_context::calculating_md5
bool calculating_md5
True if whole-image MD5 being calculated on-the-fly.
Definition context.h:276
aaruformat_context::dirty_sector_suffix_ddt
bool dirty_sector_suffix_ddt
True if sector suffix DDT should be written during close.
Definition context.h:326
aaruformat_context::geometry_block
GeometryBlockHeader geometry_block
Logical geometry block (if present).
Definition context.h:232
aaruformat_context::sector_suffix_offset
size_t sector_suffix_offset
Current position in sector_suffix.
Definition context.h:290
aaruformat_context::cached_secondary_ddt2
uint64_t * cached_secondary_ddt2
Cached secondary table (big entries) or NULL.
Definition context.h:191
aaruformat_context::json_block
uint8_t * json_block
JSON metadata block payload (UTF-8).
Definition context.h:218
aaruformat_context::media_part_number
uint8_t * media_part_number
Part number of the media represented by the image.
Definition context.h:226
aaruformat_context::sector_decrypted_title_key
uint8_t * sector_decrypted_title_key
DVD decrypted title key (5 bytes) if present.
Definition context.h:212
aaruformat_context::dirty_dumphw_block
bool dirty_dumphw_block
True if dump hardware block should be written during close.
Definition context.h:336
aaruformat_context::json_block_header
AaruMetadataJsonBlockHeader json_block_header
JSON metadata block header (if present).
Definition context.h:236
aaruformat_context::writing_buffer_position
int writing_buffer_position
Current size / position within writingBuffer.
Definition context.h:292
aaruformat_context::dirty_metadata_block
bool dirty_metadata_block
True if metadata block should be written during close.
Definition context.h:335
aaruformat_context::block_zero_written
bool block_zero_written
True if block zero has been written (writing path).
Definition context.h:298
aaruformat_context::crc64_context
crc64_ctx * crc64_context
Opaque CRC64 context for streaming updates.
Definition context.h:252
aaruformat_context::sectors_per_track
uint32_t sectors_per_track
Sectors per track of the media represented by the image (for variable image, the smallest).
Definition context.h:239
aaruformat_context::sector_subchannel
uint8_t * sector_subchannel
Raw 96-byte subchannel (if captured).
Definition context.h:206
aaruformat_context::comments
uint8_t * comments
Image comments.
Definition context.h:221
aaruformat_context::heads
uint32_t heads
Heads of the media represented by the image.
Definition context.h:238
aaruformat_context::dirty_sector_subchannel_block
bool dirty_sector_subchannel_block
True if subchannel block should be written during close.
Definition context.h:327
aaruformat_context::imageStream
FILE * imageStream
Underlying FILE* stream (binary mode).
Definition context.h:179
aaruformat_context::dirty_dvd_long_sector_blocks
bool dirty_dvd_long_sector_blocks
True if DVD long sector blocks should be written during close.
Definition context.h:328
aaruformat_context::dirty_sector_prefix_ddt
bool dirty_sector_prefix_ddt
True if sector prefix DDT should be written during close.
Definition context.h:324
aaruformat_context::index_entries
UT_array * index_entries
Flattened index entries (UT_array of IndexEntry).
Definition context.h:255
aaruformat_context::dirty_tape_file_block
bool dirty_tape_file_block
True if tape file block should be written during close.
Definition context.h:332
aaruformat_context::mode2_subheaders
uint8_t * mode2_subheaders
MODE2 Form1/Form2 8-byte subheaders (concatenated).
Definition context.h:207
aaruformat_context::image_info
ImageInfo image_info
Exposed high-level image info summary.
Definition context.h:263
aaruformat_context::dirty_flux_block
bool dirty_flux_block
True if flux block should be written during close.
Definition context.h:339
aaruformat_context::sector_id
uint8_t * sector_id
DVD sector ID (4 bytes) if present.
Definition context.h:208
aaruformat_context::dump_hardware_header
DumpHardwareHeader dump_hardware_header
Dump hardware header.
Definition context.h:235
aaruformat_context::sha1_context
sha1_ctx sha1_context
Opaque SHA-1 context for streaming updates.
Definition context.h:274
aaruformat_context::dirty_secondary_ddt
bool dirty_secondary_ddt
True if secondary DDT tables should be written during close.
Definition context.h:317
aaruformat_context::readableSectorTags
bool * readableSectorTags
Per-sector boolean array (optical tags read successfully?).
Definition context.h:266
aaruformat_context::dirty_tape_ddt
bool dirty_tape_ddt
True if tape DDT should be written during close.
Definition context.h:331
aaruformat_context::tape_partitions
TapePartitionHashEntry * tape_partitions
Hash table root for tape partitions.
Definition context.h:307
aaruformat_context::sector_prefix_ddt
uint32_t * sector_prefix_ddt
Legacy CD sector prefix DDT (deprecated by *2).
Definition context.h:186
aaruformat_context::lzma_dict_size
uint32_t lzma_dict_size
LZMA dictionary size (writing path).
Definition context.h:301
aaruformat_context::track_entries
TrackEntry * track_entries
Full track list (tracksHeader.entries elements).
Definition context.h:245
aaruformat_context::number_of_data_tracks
uint8_t number_of_data_tracks
Count of tracks considered "data" (sequence 1..99 heuristics).
Definition context.h:248
aaruformat_context::sector_suffix_corrected
uint8_t * sector_suffix_corrected
Corrected suffix if stored separately.
Definition context.h:205
aaruformat_context::metadata_block
uint8_t * metadata_block
Raw metadata UTF-16LE concatenated strings.
Definition context.h:216
aaruformat_context::cached_ddt_position
uint64_t cached_ddt_position
Position index of cached secondary DDT.
Definition context.h:194
aaruformat_context::current_track_type
uint8_t current_track_type
Current track type (when writing optical images with tracks, needed for block compression type).
Definition context.h:293
aaruformat_context::writing_long
bool writing_long
True if writing long sectors.
Definition context.h:297
aaruformat_context::media_title
uint8_t * media_title
Title of the media represented by the image.
Definition context.h:220
aaruformat_context::dirty_geometry_block
bool dirty_geometry_block
True if geometry block should be written during close.
Definition context.h:334
aaruformat_context::last_media_sequence
int32_t last_media_sequence
Last media of the sequence the media represented by the image corresponds to.
Definition context.h:242
aaruformat_context::mapped_memory_ddt_size
size_t mapped_memory_ddt_size
Length of mmapped DDT if userDataDdt is mmapped.
Definition context.h:196
aaruformat_context::media_manufacturer
uint8_t * media_manufacturer
Manufacturer of the media represented by the image.
Definition context.h:222
aaruformat_context::tracks_header
TracksHeader tracks_header
Tracks header (optical) if present.
Definition context.h:247
crc64_ctx
Minimal ECMA-182 CRC64 incremental state container (running value only).
Definition crc64.h:56
hash_map_t
Minimal open-addressing hash map for 64-bit key/value pairs used in deduplication lookup.
Definition hash_map.h:50
md5_ctx
Definition md5.h:32
mediaTagEntry
Hash table entry for an arbitrary media tag (e.g., proprietary drive/medium descriptor).
Definition context.h:122
mediaTagEntry::data
uint8_t * data
Tag data blob (opaque to library core); length bytes long.
Definition context.h:123
mediaTagEntry::type
int32_t type
Numeric type identifier.
Definition context.h:124
mediaTagEntry::length
uint32_t length
Length in bytes of data.
Definition context.h:125
mediaTagEntry::hh
UT_hash_handle hh
uthash linkage.
Definition context.h:126
structs.h
sha1_ctx
Definition sha1.h:43
sha256_ctx
Definition sha256.h:42
spamsum_ctx
Definition spamsum.h:51