Important notice - 06 April 2013

All eosgarden activities have been closed forever, in order to focus on new projects.
The content of this website will stay as is, for archive purpose, but won't be updated anymore.
eosgarden software are still available for download, but are no longer maintained. Support is no longer available.
 
 

GitHub

All our OpenSource projects have been migrated to GitHub.
Feel free to fork!

File format specification

About

EGPack uses its own specific file format, which is not compatible with other archive formats, such as the TAR format.

Format

The EGPack format consists of several specific header blocks, followed by the file(s) content.
An EPKG file must start with the main header, which is 72 bytes long.
The first four bytes represent the file format signature, which consists of the ASCII `EGPK` characters (0x45 0x47 0x50 0x4B).
The next four bytes are used to store the archive creation time.
Other bytes are reserved for format extension, and should be all zeros.
In C, the EGPK header is represented the following way:
struct egpack_header
{
uint8_t id[ 4 ];
uint32_t ctime;
uint8_t pad[ 64 ];
};
Each file or directory entry is preceded by an entry header, which is 72 bytes long.
The first byte is used for the entry type. It's value can be:
  • 0: Regular file
  • 1: Directory
  • 2: Symbolic link
The second four bytes are used to store the depth of the file, from the archive's root directory.
In order to avoid limitations on the path length, all filenames are stored without the path (only the basename with extension).
So the depth value is used to indicate the file or directory depth, relative to the previous entry.
Other bytes are reserved for format extension, and should be all zeros.
In C, an entry header is represented the following way:
struct egpack_header_entry
{
uint8_t type;
uint32_t depth;
uint8_t pad[ 64 ];
};
Depending on the entry type, the following bytes are used to represents a file, directory, or symbolic link informations.
An file entry header is 641 bytes long
The first 512 bytes are used for the filename, which is a NULL terminated string.
The next four bytes are used to store the file size, in bytes.
Following 12 bytes represents respectively the file's creation time, the last modification time, and the last access time.
Each value is 4 bytes long.
The next fours bytes are used for the file's permissions.
The next eight bytes represents respectively the owner ID and the group ID.
Each value is 4 bytes long.
Following 33 bytes are the MD5 checksum of the file.
The value is a NULL terminated string.
Other bytes are reserved for format extension, and should be all zeros.
In C, a file entry header is represented the following way:
struct egpack_header_entry_file
{
uint8_t name[ 512 ];
uint64_t size;
uint32_t ctime;
uint32_t mtime;
uint32_t atime;
uint32_t mode;
uint32_t uid;
uint32_t gid;
uint8_t md5[ 33 ];
uint8_t pad[ 64 ];
};
A directory entry header contains the same fields, except the `size` and `md5` fields.
A directory header is 600 bytes long.
In C, a file entry header is represented the following way:
struct egpack_header_entry_dir
{
uint8_t name[ 512 ];
uint32_t ctime;
uint32_t mtime;
uint32_t atime;
uint32_t mode;
uint32_t uid;
uint32_t gid;
uint8_t pad[ 64 ];
};
A symbolic link header is the same as a file entry header, with the addition of a `target` field, representing the symbolic link target file, and without the `md5` field.
A directory header is 1632 bytes long.
In C, a file entry header is represented the following way:
struct egpack_header_entry_symlink
{
uint8_t name[ 512 ];
uint8_t target[ 1024 ];
uint32_t ctime;
uint32_t mtime;
uint32_t atime;
uint32_t mode;
uint32_t uid;
uint32_t gid;
uint8_t pad[ 64 ];
};
For files, the entry is followed by the file's data.
For directories, the directory header is immediately followed by other entries headers.