mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-14 19:59:05 +01:00
Specify order of BDF dictionary keys
18
BDF.markdown
18
BDF.markdown
@@ -1,15 +1,17 @@
|
||||
BDF is a data format designed for simplicity and compactness. It has six primitive types (null, boolean, integer, float, string, raw) and two container types (list, dictionary).
|
||||
BDF is a binary data format designed for simplicity and compactness. It has six primitive types (null, boolean, integer, float, string, raw) and two container types (list, dictionary).
|
||||
|
||||
Each object consists of a type, length and value. The first four bits give the type. Depending on the type, the next four bits either give the length of the value, or the length of the length of the value. All lengths are measured in bytes.
|
||||
The first four bits of each object give the type. Depending on the type, the next four bits either give the value, the length of the value, or the length of the length of the value. All lengths are measured in bytes.
|
||||
|
||||
* **0: Null** - Length is 0, value is empty.
|
||||
* **1: Boolean** - Length is 1, value is 0 or 1.
|
||||
* **0: Null** - Value is 0.
|
||||
* **1: Boolean** - Value is 0 or 1.
|
||||
* **2: Integer** - Length is 0, 1, 2, 4 or 8. Value is an integer with the specified length.
|
||||
* **3: Float** - Length is 4 or 8. Value is a floating point number with the specified length.
|
||||
* **4: String** - Length-of-length is 0, 1, 2, 4 or 8. Length is an integer with the specified length. Value is a string with its length given by the integer.
|
||||
* **5: Raw** - Length-of-length is 0, 1, 2, 4 or 8. Length is an integer with the specified length. Value is raw data with its length given by the integer.
|
||||
* **6: List** - Length is 0. Value consists of zero or more objects of any type followed by an end marker.
|
||||
* **7: Dictionary** - Length is 0. Value consists of zero or more key-value pairs followed by an end marker. Keys are strings and values may be of any type.
|
||||
* **8: End** - Length is 0, value is empty. Marks the end of a list or dictionary.
|
||||
* **6: List** - Value is 0. Followed by zero or more objects of any type and an end marker.
|
||||
* **7: Dictionary** - Value is 0. Followed by zero or more key-value pairs and an end marker. Keys are strings, values may be of any type.
|
||||
* **8: End** - Value is 0. Marks the end of a list or dictionary.
|
||||
|
||||
Lengths are big-endian unsigned, integers are big-endian two's complement, floating point numbers are IEEE 754, and strings are UTF-8. Integers and lengths must be represented using the minimum number of bytes. Dictionary keys must all be different, may not be empty, and must be in lexicographic order when compared as byte strings.
|
||||
Integers and lengths are big-endian two's complement, floating point numbers are IEEE 754, and strings are UTF-8.
|
||||
|
||||
Integers and lengths must be represented using the minimum number of bytes. Dictionary keys must all be different, and must be in lexicographic order when compared as byte strings.
|
||||
|
||||
Reference in New Issue
Block a user