Atlas binary1_beta2 codec specification

The Atlas binary1_beta2 codec is a binary codec for the Atlas protocol. It defines type flags and specific binary encoding methods for each supported type. This particular version includes all basic Atlas primitives, but does not provide support for advanced features such as sized numeric types, user defined types, arrays, tunneling self encoded byte streams, or secondary transport layer connections such as UDP.

A. Atlas types

Atlas types are encoded as integers. Bit 6 is not anymore reserved for possible future use as an array type flag. Array types will be defined by user in binary2. The current type values and descriptions are as follows:

Value Description
0 Possible future flag for user defined types
1 Positive Integer
2 Negative Integer
3 Floating point encoded as two integers a and b where value = a * 2^b
4 Floating point encoded as two integers a and b where value = a * 2^-b
5 Floating point encoded as two integers a and b where value = -a * 2^b
6 Floating point encoded as two integers a and b where value = -a * 2^-b
7 Special floating point values encoded as an integer where 0 = NaN, 1 = +Inf, 2 = -Inf
8 String with fixed length
9 List with fixed length
10 Map with fixed length
11 String with unknown length
12 List with unknown length
13 Map with unknown length

B. Specific Encodings

Most Atlas primitives are encoded as 'type' followed by 'value'. The Atlas 'type' is encoded as a positive integer. Specific encoding methods are as follows:

  1. Integer encoding - bit 7 is used as a flag to indicate the presence of additional bytes, Thus each byte represents a magnitude of 0-127 and each subsequent byte position has a multiplier of 128 * the previous byte position's multiplier. Of course the first byte has a multiplier of 0. This allows for integers of any size.
  2. Normal Floats are encoded as mantissa exponent pairs with both the mantissa and exponent represented as integers. Special floats have a single integer value, 0 = NaN, 1 = +Infinity, 2 = -Infinity.
  3. Strings are encoded as a length integer followed by a sequence of length bytes
  4. Lists are encoded as a size integer followed by size * ( type, value ) pairs
  5. Maps are encoded as a size integer followed by size * (type, name, value ) triplets where name is encoded as a string value.
  6. Unknown length strings/lists/maps are encoded just like normal, except that after this sequence follows either another unknown length sequence or known length sequence (fixed length string/list/map). String/list/map started with unknown length type always end with fixed length sequence of same type.



Credits for Binary1_beta by using cvs log message:
date: 2001/03/01 00:35:32;  author: blprice;  state: Exp;
binary1_beta.html added to forge/protocols/atlas/spec - based on irc discussion with Aloril
To Top