From 59df8ab361af79b506aa2c0051a8a17bf9a5c4b8 Mon Sep 17 00:00:00 2001 From: Max Kofler Date: Tue, 30 Jul 2024 13:23:02 +0200 Subject: [PATCH] Add documentation for object files --- src/files/object.aobj.md | 66 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 64 insertions(+), 2 deletions(-) diff --git a/src/files/object.aobj.md b/src/files/object.aobj.md index 4749eeb..03474a9 100644 --- a/src/files/object.aobj.md +++ b/src/files/object.aobj.md @@ -2,6 +2,68 @@ An object file (or object) is simply a binary blob that can be anything. -Each object gets identified by the `sha256` hash of its contents. +# Binary structure -Typically, the objects are named after the base64 representation of the object's hash. In this case, the `URL` alphabet is used ([`RFC 4648 §5`](https://datatracker.ietf.org/doc/html/rfc4648#section-5)) and padding is used. +The file is stored in `little-endian` binary format, using `UTF-8` for all of its strings, which are not `NULL` - terminated as their length is always defined. + +The file starts with the following structure: + +| Offset | Count | Description | +| :----: | :---: | ------------------ | +| 0 | 4 | File magic: `AOBJ` | +| 4 | 1 | Version: `0x00` | + +## Version 0 + +For version `0x00`, the file continues with the following data: + +| Offset | Count | Description | +| :----: | :---: | -------------------------- | +| 0 | 32 | Sha256 Hash of Data | +| 32 | 2 | Object type | +| 34 | 2 | Compression type | +| 36 | 2 | GPG Signature length (`s`) | +| 38 | 2 | Dependencies count (`d`) | +| 40 | 8 | Data length (`b`) | +| 48 | `s` | GPG Signature data | +| | `d` | Dependencies | +| | `b` | Data | + +The Sha256 hash is the result of hashing the binary data wrapped in the object file in raw form without any compression applied to it. This is the object ID. + +### Dependencies + +A dependency declares where an object expects an other object to exist, the dependency is identified with its object ID and the path it expects the object to be at. The path is relative to the path of the depending object. + +| Offset | Count | Description | +| :----: | :---: | --------------- | +| 0 | 4 | OID length | +| 4 | 4 | Path length | +| | | Object id `OID` | +| |   | Path | + +# Object type ??? + +There are different types of objects: + +- `0x1___`: AcaciaLinux object + + - `0x1 + +- `0x2___`: Object + + - `0x21__`: Executable files + + - `0x210_`: Other + + - `0x211_`: ELF files + - `0x2111`: Executable file + - `0x2112`: Shared object + - `0x2113`: Relocatable file + - `0x2114`: Core file + + - Other + - ELF + - + +- `0x2___`: Index