Appendix A: Marshalling Protocol
215
NetLinx Programming Language Reference Guide
Appendix A: Marshalling Protocol
Marshalling Protocol (Group of Bytes)
The protocol assumes that every logical field (group of bytes) is prefixed with type/size information. For
example, if there is a 4 byte long integer field within a structure, the byte stream representing that field
consists of 5 bytes. The first byte (0xE3) specifies that a long integer follows and then the 4 remaining
bytes contain the value of the long integer.
This concept is extended to all primitive, structure and array types. The type of a field is always stored as
a single byte. The size of a field may or may not be stored depending upon the field type (fields with
know lengths do not have a size prefix). The specific formats of all the supported types are described in
the table below.
Marshalled Stream Format
The following table describes the byte format of the various types supported in the marshaller (fields
within <>'s indicate actual data bytes):
Byte Formats Supported in the Marshaller
Type Description Stream Format
BYTE Unsigned char/byte value. 0xE1
<BYTE>
WORD Unsigned short value. 0xE2
<WORD Hi>
<WORD Lo>
DWORD 4-byte value (could be an unsigned long integer or a float). 0xE3
<DWORD MSB>
.
.
<DWORD LSB>
QWORD 8-byte value (could be an unsigned Quad-word or a double). 0xE4
<QWORD MSB>
.
.
.
.
.
.
<QWORD LSB>
BYTESTR Sequence of BYTE's whose element count is <= 64K. 0xE5
Length Hi
Length Lo
<BYTE Sequence>
.
.