Skip to content

protocol definition

Tanner Mickelson edited this page Apr 27, 2016 · 34 revisions

RRDTP version 1a (alpha version - subject to change)

Overview

RRDTP version 1 is a data streaming protocol. One host acts as the server, and is the authoritative source for all data values. Multiple clients can connect to the server to send and receive updates to data values. Values can be stored hierarchically in categories. The design of RRDTP draws inspiration from WPI Network Tables, but is designed to be simpler and more easily portable to resource-limited platforms.

Events

Each packet will contain an event type. The currently defined event types are listed below.

Event Type Enum Value
Set Value 0
Delete Value 1

Data types

Data can be one of 7 types.

Type Size Format Enum Value
int 4 bytes 2's complement 0
long 8 bytes 2's complement 1
float 4 bytes IEEE 754 binary32 2
double 8 bytes IEEE 754 binary64 3
boolean 1 byte raw binary 4
string n>2 bytes 2 byte unsigned integer size + n bytes ASCII/UTF8 text 5
unformatted n bytes 2 byte unsigned integer size + n bytes raw data 6

Value identifiers

Values are identified by an identifier string with a hierarchical format. An identifier begins with zero or more categories separated by periods '.' and ending with the name of the value. Identifiers are case sensitive ("Value1" != "VALUE1") and have a maximum length of 255 characters and can contain only upper and lowercase letters, numbers, dashes '-' and underscores '_'. Some examples of valid identifiers:
sensor1
sensors.sensor_1
Arm.Motors.motor_1-power

Protocol

Connection

RRDTP is based on TCP sockets. The server is responsible for accepting or denying TCP connections on the port being used by RRDTP (default 4309). When a new client connects, a "set value" packet must be sent to it by the server for all entries in order to synchronize the client with the latest values.

Header

All RRDTP packets begin with a header containing the protocol version and the event type. After the header, the packet format will be different depending on the event type.

Field Name Type Size
Protocol Version int 1 byte
Event Type int 1 byte

Set value

Sent to create or update a value entry. The system that creates the value (sends the set packet first) is considered to own the value, and is (by default) the only system allowed to update that value later. The data is encoded according to the format specified above in the data types section.

Field Name Type Size
Identifier Length int 1 byte
Identifier String string n<256 bytes
Data Type int 1 byte
Data variable n bytes

Delete value

Sent to indicate that a value entry can be deleted. A value deletion packet can only be sent by the owner of the value entry. If a host besides the owner sends a deletion packet, then it will be ignored.

Field Name Type Size
Identifier Length int 1 byte
Identifier String string n<256 bytes
Clone this wiki locally