You are on page 1of 2

Wasp Reference

Introduction
Wasp is the underlying network protocol for Vespa. A Wasp message
specifies actions that one peer should take on behalf of another. These
actions include the creation of data objects (i.e. deserialization) and
the invocation of functions. Wasp can run on top of any lower-level
protocol with ordered, reliable delivery, but TCP/IP is the most likely
choice. Wasp has both textual and binary representations.

Each Wasp message consists of zero or more headers following the


standard email header syntax (RFC 822), followed by a blank line and
then the body of the message. (The headers are always text, even if
the body is binary.) If headers are omitted, the blank line can be
omitted too. Wasp determines whether there are headers by seeing if
the first line of the message conforms to header syntax.

Standard Headers
User: the logname of the person submitting the message. E.g. jba, lin.
Host: the name of the machine sending the message.
Content-Length: the number of bytes following the blank line.
Content-Type: MIME type of the body. Should be either wasp/text or
wasp/binary.
[headers for signing, such as hash value, hash algorithm, timestamp]

Body Syntax
The Wasp textual notation has a recursive syntax similar to Lisp’s. Each Wasp token is
either:
• An open parenthesis.
• A closed parenthesis.
• An integer, with the usual notation
• A floating-point number, with the usual notation
• An identifier: a sequence of letters, numbers and underscores beginning with a
letter or underscore.
• A string: a sequence of bytes between double quotes. All bytes representing non-
printing ASCII characters, as well as the backslash and double-quote characters,
are escaped by writing \xx, where each x is a hexadecimal digit. Note that strings
allow arbitrary binary data to be represented, and assume only ASCII encoding.
To represent a Unicode string, first pick an encoding (e.g. UTF-8), then express
that encoding’s bytes as above. Wasp does not specify a Unicode encoding.

Wasp’s binary syntax


record Point {
int x;
int y;
}

You might also like