Monday, 3 February 2014

Today I've committed to the Subversion repository the first implementation of the Argot Message format. This is a feature I've been wanting to add for sometime, and a project I'm currently working on has given me the excuse to get it done. The idea of the Argot Message format is that a binary message contains both the data and data dictionary with little overhead.

It's easiest to understand with a demonstration. As part of the Argot test code I've defined a data type called 'demo':

definition demo 1.0:
{
@short #int8;
@byte #int16;
@text #u8utf8;
};

This rudimentary type contains three fields named 'short', 'byte' and 'text'. If an instance of this data type were written to a stream it would look like:

The message is now 51 bytes, however, contains a full description of the data format along with the actual data. Breaking the format down:

A - Magic value indicating this is an Argot message format.0x13 - Version of the Argot meta dictionary and Argot message format being used.0x01 - The number of data types defined. One here but could be thousands.

Each data type contains a unique identifier, a type name identifier and a type definition. In this message it contains:

The first data type is defined as type 50 in this case as the format version 1.3 specifies that the reader assumes that the first 49 data types are known to the recipient. The other 49 data types include all the Argot meta data types and the following base types:

The base types allow any other data types to be defined. The data dictionary in the message could contain a large and complex set of data with every part of the data defined. To write the message in Argot was simply:

As I work with this new format, I may add additional elements. One such idea is to include a reference to a known data dictionary provided by a URL. In this way no data dictionary is required, yet, both sender and recipient will have a reference to the data types used. This may be beneficial in Internet of Things applications where an additional 50 bytes may be considered too large.