libaaruformat 1.0 Aaru Data Preservation Suite - Format Library

Loading...
Searching...
No Matches
header.h
Go to the documentation of this file.
1/*
2 * This file is part of the Aaru Data Preservation Suite.
3 * Copyright (c) 2019-2025 Natalia Portillo.
4 *
5 * This library is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU Lesser General Public License as
7 * published by the Free Software Foundation; either version 2.1 of the
8 * License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
17 */
18
19#ifndef LIBAARUFORMAT_HEADER_H
20#define LIBAARUFORMAT_HEADER_H
21
58
59#define AARU_HEADER_APP_NAME_LEN 64
60#define GUID_SIZE 16
61
62#pragma pack(push, 1)
63
76 typedef struct AaruHeader
77{
78 uint64_t identifier;
79 uint8_t application[AARU_HEADER_APP_NAME_LEN];
80 uint8_t imageMajorVersion;
81 uint8_t imageMinorVersion;
82 uint8_t applicationMajorVersion;
83 uint8_t applicationMinorVersion;
84 uint32_t mediaType;
85 uint64_t indexOffset;
86 int64_t creationTime;
87 int64_t lastWrittenTime;
88} AaruHeader;
89
106 typedef struct AaruHeaderV2
107{
108 uint64_t identifier;
109 uint8_t application[AARU_HEADER_APP_NAME_LEN];
110 uint8_t imageMajorVersion;
111 uint8_t imageMinorVersion;
112 uint8_t applicationMajorVersion;
113 uint8_t applicationMinorVersion;
114 uint32_t mediaType;
115 uint64_t indexOffset;
116 int64_t creationTime;
117 int64_t lastWrittenTime;
118 uint8_t guid[GUID_SIZE];
119 uint8_t blockAlignmentShift;
120 uint8_t dataShift;
121 uint8_t tableShift;
122 uint64_t featureCompatible;
123 uint64_t featureCompatibleRo;
124 uint64_t featureIncompatible;
125} AaruHeaderV2;
126
127#pragma pack(pop)
128
129#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::tableShift
uint8_t tableShift
log2 sectors spanned by each primary DDT entry (0 = single-level).
Definition header.h:121
AaruHeaderV2::featureIncompatible
uint64_t featureIncompatible
Feature bits: any unimplemented -> abort (cannot open safely).
Definition header.h:124
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:122
AaruHeaderV2::indexOffset
uint64_t indexOffset
Absolute byte offset to primary index block (MUST be > 0; 0 => corrupt/unreadable).
Definition header.h:115
AaruHeaderV2::dataShift
uint8_t dataShift
log2 sectors/items per block-index increment in DDT entries (2^dataShift).
Definition header.h:120
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:123
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