Files
mars-tinyldap/FORMAT
2002-03-24 03:08:04 +00:00

41 lines
1.7 KiB
Plaintext

Data format for a read-only LDAP data store. LDAP defines access to
records, each of them having n attributes. Mandatory attributes are
"dn" and "objectClass".
The string table stores all strings, zero-terminated.
An Index is an array of uint32_t, each an offset inside the file to the
corresponding string.
Each Record is an array of uint32_t, each an offset inside the file to
the corresponding string. Entries are in pairs, where the first
uint32_t points to the attribute name, the second points to the
attribute value. Each record starts with a pair <number-of-attributes,0>.
The number of attributes equals the number of 64-bit pairs (including
this length pair itself). The second pair is
<value-of-dn,value-of-objectClass>, the following pairs are all
<name-of-attribute,value-of-attribute>.
The Record Index is a table of offsets to the corresponding record.
All integers are stored LITTLE ENDIAN.
const uint32_t magic = 0xfefe1da9; /* 1da9 == "LDAP" ;-) */
uint32_t attribute_count, record_count, indices_offset, size_of_string_table;
char string_table[size_of_string_table];
uint32_t attribute_names[attribute_count];
uint32_t attribute_flags[attribute_count]; /* 1: match case insensitively */
uint32_t records[record_count][];
/* indices_offset points here */
uint32_t record_index[record_count];
struct {
uint32_t index_type; /* 0 == sorted array of pointers, rest reserved */
uint32_t next; /* offset of next index */
/* for index_type==0: */
uint32_t indexed_attribute; /* offset of attribute name */
uint32_t record_offsets[record_count];
}
The indices are at the end to make it possible to add more indices.
The next pointer is there to make extensions possible.