libaaruformat 1.0 Aaru Data Preservation Suite - Format Library

Loading...
Searching...
No Matches
metadata.h File Reference

Packed on-disk metadata block headers for descriptive strings and CICM XML (if present). More...

Go to the source code of this file.

## Data Structures
struct | MetadataBlockHeader
| Header for a metadata block containing offsets and lengths to UTF-16LE descriptive strings. More...
struct | CicmMetadataBlock
| Header for a CICM XML metadata block (identifier == BlockType::CicmBlock). More...
struct | AaruMetadataJsonBlockHeader
| Header for an Aaru metadata JSON block (identifier == BlockType::AaruMetadataJsonBlock). More...

## Typedefs
typedef struct MetadataBlockHeader | MetadataBlockHeader
typedef struct CicmMetadataBlock | CicmMetadataBlock
typedef struct AaruMetadataJsonBlockHeader | AaruMetadataJsonBlockHeader

## Detailed Description

Packed on-disk metadata block headers for descriptive strings and CICM XML (if present).

Two metadata-related block header layouts are defined:

- MetadataBlockHeader (BlockType::MetadataBlock): offsets + lengths for several UTF-16LE strings.
- CicmMetadataBlock (BlockType::CicmBlock): length of embedded CICM XML metadata payload.

All multi-byte integers are little-endian. Structures are packed (1-byte alignment). All textual fields referenced by offsets are UTF-16LE, null-terminated (0x0000). Length fields include the terminating null (i.e. length >= 2 and an even number). Offsets are relative to the start of the corresponding block header (byte 0 = first byte of the header). No padding is implicitly added between strings; producers may pack them tightly or align them manually (alignment not required by the specification).

Metadata block layout (conceptual): MetadataBlockHeader (fixed size) <variable region holding each present UTF-16LE string in any order chosen by the writer>

Invariants / validation recommendations for MetadataBlockHeader:

- identifier == BlockType::MetadataBlock
- blockSize >= sizeof(MetadataBlockHeader)
- For every (offset,length) pair where length > 0:
  - offset >= sizeof(MetadataBlockHeader)
  - offset + length <= blockSize
  - length % 2 == 0
  - The 16-bit code unit at (offset + length - 2) == 0x0000 (null terminator)
- mediaSequence >= 0 and lastMediaSequence >= 0; if lastMediaSequence > 0 then 0 <= mediaSequence < lastMediaSequence

CICM metadata block layout: CicmMetadataBlock (header) <length bytes of UTF-8 or XML text payload (implementation-defined, not null-terminated)>

NOTE: The library code reading these blocks must not assume strings are present; a zero length means the corresponding field is omitted. Offsets for omitted fields MAY be zero or arbitrary; readers should skip them whenever length == 0.

Definition in file metadata.h.

## Typedef Documentation

## ◆ AaruMetadataJsonBlockHeader

typedef struct AaruMetadataJsonBlockHeader AaruMetadataJsonBlockHeader

## ◆ CicmMetadataBlock

typedef struct CicmMetadataBlock CicmMetadataBlock

## ◆ MetadataBlockHeader

typedef struct MetadataBlockHeader MetadataBlockHeader