getchunks8, getchunks16, getchunks32, decode — functions for decoding chunks from server's data blocks and decoding data from chunks
All the data is encoded in network (big endian) order.
Chunks are stored in table {id = chunk_id, data = chunk_data}
.
So chunk list looks like {{id = id1, data = data1}, {id = id2, data = data2}, ...}
Format string for decoding is list of entries
"<bytes>[.count]<data_type>"
,
where count is number of entries (1 <= count
<= 256),
data_type
is <i|f|s>
.
For (data_type == 'i')
bytes
can be
1
, 2
and 4
.
That means uint8_t
, uint16_t
and uint32_t
respectively.
For (data_type == 'f')
bytes
can be 4
and 8
.
That means float
and double
respectively.
For (data_type == 's')
bytes
can be 1
and 2
.
That means uint8_t
or uint16_t
to describe length of string
and then given bytes of string data.
getchunks8 ();
Extracts and returns chunk list from given data block. ID and size take by 8 bits.
getchunks16 ();
Extracts and returns chunk list from given data block. ID and size take by 16 bits.
getchunks32 ();
Extracts and returns chunk list from given data block. ID and size take by 32 bits.
decode (format_string, data);
Extracts table of numbers and strings decoded from
data
using format_string
.