Files
libaaruformat/docs/spec/definitions.adoc

51 lines
2.4 KiB
Plaintext
Raw Normal View History

== Definitions
=== Types
All binary types used in this specification are stored as little-endian values on the file.
This specification follows the C syntax to denote hexadecimal values, and requires the reader have some knowledge on programming.
=== Endianness
Unless otherwise specified, all fields in this specification are considered to be in __Little-Endian__ format, that is the hexadecimal number `0x12345678` is stored in disk as the following sequence of bytes: `0x78 0x56 0x34 0x12`.
=== Header identifiers
Header identifiers are 4 `ASCII` characters stored as a sequence of bytes inside a single 32 bits pack.
They are shown in this specification enclosed in single quotes.
For example, the header identifier `AARU` should be stored on disk as `0x41 0x41 0x52 0x55`.
=== Integers
Integer values are designated in this specification if unsigned (U) and no letter for signed, continuing with `int`, the number of bits able to be stored in them, and finishing with `_t`.
That so, the signed integers should be: `int8_t`, `int16_t`, `int32_t`, `int64_t` and `int128_t`.
And the unsigned integers should be: `uint8_t`, `uint16_t`, `uint32_t`, `uint64_t` , `uint128_t`.
=== Strings
All strings are stored as a sequence of bytes, in Unicode's `UTF-16` little endian encoding and terminated and filled with `NULL` (`0x00`) bytes.
`String8` values mean the string is stored in Unicodes `UTF-8` encoding and terminated and filled with `NULL` (`0x00`) bytes.
`StringA` values mean the string is stored in `ASCII` encoding and terminated and filled with `NULL` (`0x00`) bytes.
=== Timestamp
All timestamps used in this specification are stored as a signed 64bit integer (`int64_t`) counting the number of nanoseconds in the UTC timezone after/before the epoch of 1st January 1601 at 00:00 of the Gregorian Calendar.
This epoch is chosen because it is when the leap-year scheme was adopted.
=== Media tag
A media tag is a piece of data that is physically present in the media but its not part of the user data.
It can be the table of contents, some manufacturing information, sector replacement tables, etc.
=== Sector tag
A sector tag is a piece of data that is physically present in the media, once per each sector, but its not part of the user data.
It can be addressing information, error detection or correction information, encryption metadata, etc.
=== NULL
NULLs are `0x00` bytes.