Karoo project protocol

Basic Protocol

A datagram is a block of data, usually max 1K long, containing data, and some header information.

Each message follows the same basic protocol, with the exception of the ROCK_ACK_MESSAGE

The basic protocol is:

type, seq, port, name, followed by message-specific-data.

I.e. every message starts with 4 fields, type, seq, port, and name.

The message-specific-data can be anything that the application wishes to place there. This data can be made up of unsigned and signed integers (8, 16, 32, and 64 bit), 32 bit float, 64 bit double precision float, or long double precision float (64 bit mantissa followed by 32 bit exponent).

The port and IP address (of the datagram) make up the full address of the sender from the point of view of the operating system, and its name is the way a rock application addresses it. (From an application's perspective, messages are sent to a rock, addressed by "name", which the rock infrastructure converts to address:port.) This is convenient, because the rock manager starts up all the rocks, and configures them on hosts and ports. The application software is abstracted from this, which allows rocks to be restarted at different address:port without any effect on the applications.

The one exception to this basic protocol is the ROCK_ACK_MESSAGE, whose 'header' is just the type and sequence number. However, following the sequence number, the ack message can contain command-specific data (specific to the type of command it is acknowledging), which is a way to return context information or a 'return value'.

Pre-defined Protocol Messages

As explained above, the very first 4 bytes in a message are the message type. Message type zero is the ROCK_ACK_MESSAGE, message type 1 is the ROCK_HELLO_MESSAGE, and so on. Following is a description of each of the pre-defined messages:

Reply Message Protocol

There is a difference between the reply message protocol, and a normal message - in that a normal message is sent to a known rock. A reply message could be sent to anyone. Therefore, if a reply message message-type must be unique... but how can it be unique? Impossible, because The Karoo System will be used by many different developers and there is no central registration for message type numbers.

Therefore... a "reply message" is one who's message-type's MSB is set, and the receiver will then switch not just on the message-type, but also on the sender's rock name.


Generated on Tue Feb 16 15:04:29 2010 for Karoo by  doxygen 1.5.8