Loading...
Searching...
No Matches
header.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_HEADER_H
#define LIBAARUFORMAT_HEADER_H
#define AARU_HEADER_APP_NAME_LEN 64
#define GUID_SIZE 16
#pragma pack(push, 1)
typedef struct AaruHeader
{
uint64_t identifier;
uint8_t application[AARU_HEADER_APP_NAME_LEN];
uint8_t imageMajorVersion;
uint8_t imageMinorVersion;
uint8_t applicationMajorVersion;
uint8_t applicationMinorVersion;
uint32_t mediaType;
uint64_t indexOffset;
int64_t creationTime;
int64_t lastWrittenTime;
} AaruHeader;
typedef struct AaruHeaderV2
{
uint64_t identifier;
uint8_t application[AARU_HEADER_APP_NAME_LEN];
uint8_t imageMajorVersion;
uint8_t imageMinorVersion;
uint8_t applicationMajorVersion;
uint8_t applicationMinorVersion;
uint32_t mediaType;
uint64_t indexOffset;
int64_t creationTime;
int64_t lastWrittenTime;
uint8_t guid[GUID_SIZE];
uint8_t blockAlignmentShift;
uint16_t biggestSectorSize;
uint64_t featureCompatible;
uint64_t featureCompatibleRo;
uint64_t featureIncompatible;
} AaruHeaderV2;
#pragma pack(pop)
#endif // LIBAARUFORMAT_HEADER_H
GUID_SIZE
#define GUID_SIZE
Size in bytes of GUID / UUID-like binary identifier.
Definition header.h:60
AARU_HEADER_APP_NAME_LEN
#define AARU_HEADER_APP_NAME_LEN
Size in bytes (UTF-16LE) of application name field (32 UTF-16 code units).
Definition header.h:59
AaruHeaderV2
Version 2 container header with GUID, alignment shifts, and feature negotiation bitmaps.
Definition header.h:107
AaruHeaderV2::application
uint8_t application[64]
UTF-8 creator application name (fixed 64 bytes).
Definition header.h:109
AaruHeaderV2::applicationMajorVersion
uint8_t applicationMajorVersion
Creator application major version.
Definition header.h:112
AaruHeaderV2::identifier
uint64_t identifier
File magic (AARU_MAGIC).
Definition header.h:108
AaruHeaderV2::featureIncompatible
uint64_t featureIncompatible
Feature bits: any unimplemented -> abort (cannot open safely).
Definition header.h:123
AaruHeaderV2::lastWrittenTime
int64_t lastWrittenTime
Last modification FILETIME (100 ns since 1601-01-01 UTC).
Definition header.h:117
AaruHeaderV2::featureCompatible
uint64_t featureCompatible
Feature bits: unimplemented bits are ignorable (still R/W safe).
Definition header.h:121
AaruHeaderV2::indexOffset
uint64_t indexOffset
Absolute byte offset to primary index block (MUST be > 0; 0 => corrupt/unreadable).
Definition header.h:115
AaruHeaderV2::applicationMinorVersion
uint8_t applicationMinorVersion
Creator application minor / patch version.
Definition header.h:113
AaruHeaderV2::guid
uint8_t guid[16]
128-bit image GUID (binary, not text); stable across children.
Definition header.h:118
AaruHeaderV2::mediaType
uint32_t mediaType
Media type enumeration (value from MediaType).
Definition header.h:114
AaruHeaderV2::featureCompatibleRo
uint64_t featureCompatibleRo
Feature bits: unimplemented -> degrade to read-only access.
Definition header.h:122
AaruHeaderV2::biggestSectorSize
uint16_t biggestSectorSize
size of biggest sector in the image (in bytes).
Definition header.h:120
AaruHeaderV2::blockAlignmentShift
uint8_t blockAlignmentShift
log2 block alignment (block size alignment = 2^blockAlignmentShift bytes).
Definition header.h:119
AaruHeaderV2::imageMinorVersion
uint8_t imageMinorVersion
Container format minor version.
Definition header.h:111
AaruHeaderV2::creationTime
int64_t creationTime
Creation FILETIME (100 ns since 1601-01-01 UTC).
Definition header.h:116
AaruHeaderV2::imageMajorVersion
uint8_t imageMajorVersion
Container format major version.
Definition header.h:110
AaruHeader
Version 1 container header placed at offset 0 for legacy / initial format.
Definition header.h:77
AaruHeader::lastWrittenTime
int64_t lastWrittenTime
Last modification FILETIME (100 ns since 1601-01-01 UTC).
Definition header.h:87
AaruHeader::applicationMinorVersion
uint8_t applicationMinorVersion
Creator application minor / patch version.
Definition header.h:83
AaruHeader::applicationMajorVersion
uint8_t applicationMajorVersion
Creator application major version.
Definition header.h:82
AaruHeader::application
uint8_t application[64]
UTF-16LE creator application name (fixed-size buffer).
Definition header.h:79
AaruHeader::imageMajorVersion
uint8_t imageMajorVersion
Container format major version (incompatible changes when incremented).
Definition header.h:80
AaruHeader::imageMinorVersion
uint8_t imageMinorVersion
Container format minor version (backward compatible evolutions).
Definition header.h:81
AaruHeader::indexOffset
uint64_t indexOffset
Absolute byte offset to primary index block (MUST be > 0; 0 => corrupt/unreadable).
Definition header.h:85
AaruHeader::mediaType
uint32_t mediaType
Media type enumeration (value from MediaType).
Definition header.h:84
AaruHeader::identifier
uint64_t identifier
File magic (AARU_MAGIC).
Definition header.h:78
AaruHeader::creationTime
int64_t creationTime
Creation FILETIME (100 ns since 1601-01-01 UTC).
Definition header.h:86