S101
The S101 protocol is used for framing, allowing the Ember encoded data to be transmitted via any transport layer.
Control bytes
The following control bytes are used in the S101 protocol:
Name | Value | Description |
---|---|---|
BOF | 0xFE | Begin of Frame |
EOF | 0xFF | End of Frame |
CE | 0xFD | Character escape |
XOR | 0x20 | XOR value for Character escape |
BOFNE | Invalid | 0xF8 | Within a variant 1 packet, all bytes above or equal to this value must be escaped. Outside of a frame, this byte indicates a variant 2 packet which uses the Non-Escaping version of S101. |
Messaging
The first byte of the payload in S101 messages is the slot identifier, which is usually set to 0x00. The second byte contains the message type, which is set 0x0E for Ember. The third byte determines the command. The fourth byte determines the version, which is currently set to 0x01.
Value | Command |
---|---|
0x00 | EmBER Packet |
0x01 | Keep Alive Request |
0x02 | Keep Alive Response |
The meaning of the remaining bytes depends on the specified command.
EmBER packet
When the command field is set to 0x00, the payload contains an encoded Ember packet.
Flags
The upper three bits of the flags are used to indicate partitioned ember packets.
Value | Meaning |
---|---|
0xC0 | Single-packet message |
0x80 | First multi-packet message |
0x40 | Last multi-packet message |
0x20 | Empty packet |
0x00 | A packet within a multi-packet message |
DTD
The DTD byte defines the "Design Type Document" that is being used. This value must be set to one, which means that the Glow specification is used.
App Bytes
This field contains the number of bytes that follow before the payload begins.
The current version uses two application bytes, which contain the version number of the Glow DTD.
Payload
The payload contains the BER-encoded data.