The FastRPC protocol 2.0 extension specification

FastRPC 2.0 uses two new integer types (Integer8 positive and Integer8 negative) instead old integer.

Integer values (integer data type and size of multioctet types) are encoded in 1 - 8 octets and the additional type info (000 - 111 [0-7]) says the number of octets used (1 - 8). This is the main change.

Type: 5bAdd: 3b

Integer8 positive

00111XXXdata (0-7 means 1-8 octets)

Absolute integer value stored in little endian convention. Additional type info says how much octets follows (1 - 8).

Integer8 negative

01000XXXdata (0-7 means 1-8 octets)

Absolute integer value stored in little endian convention. Additional type info says how much octets follows (1 - 8).

String

00100XXXdata-size (0-7 means 1-8 octets)data (data-size octets)

UTF-8 encoded not null terminated strings without any escaping. Additonal info specifies length of data-size field.

Binary

00110XXXdata-size (0-7 means 1-8 octets)data (data-size octets)

Binary data are sent as they are. Exact number of octets is stored data-size field. No encoding is used. This type maps to Base64 data type of XML-RPC.

Null

01100000

Null data type, carrying no value.

Struct

01010XXX num-members (0-7 means 1-8 octets)
num-members*name-size (1 octet)name (1-255 octets)DATATYPE

Member name is encoded in the UTF-8 encoding.

Array

01011XXXnum-items (0-7 means 1-8 octets)
num-items*DATATYPE

The FastRPC protocol 1.0 specification

FastRPC uses 8 data types: 6 scalar (integer, boolean, double, string, date and binary) and 2 structured (struct and array). It also has 3 non-data types (method call, method response and fault response). These types precisely mirrors XML-RPC'2 data types.

Every (non-)data type begins with just one octet. This octet identifies the type and also can hold some additional type info and it can even hold the value itself. Integer values (integer data type and size of multioctet types) are encoded in 1, 2 3 or 4 octets and the additional type info says the number of octets used.

Type: 5bAdd: 3b

Integer

00001XXXdata (1-4 means 1-4 octets)

Signed integer value stored in little endian convention. Additional type info says how much octets follows (1, 2, 3 or 4).

Boolean

0001000V

Value is stored in the least significant bit of type definition octet (bit marked as V).

Double

00011000data (8 octets)

Floating-point number in double precision as specified by the IEEE 754 standard. The additional type info should by always zero.

String

00100XXXdata-size (1-4 means 1-4 octets)data (data-size octets)

UTF-8 encoded not null terminated strings without any escaping. Additonal info specifies length of data-size field.

Datetime

00101000zone (8b)unix timestamp (32b)week day (3b)
sec (6b)min (6b)hour (5b)
day (5b)month (4b)year (11b)

year is offset (0-2047) from AD 1600
month is 1-12
hour is 0-23
min is 0-59
sec is 0-59 (leap seconds not implemented)
week dat is 0 (sunday) - 6 (saturday)
unix timestamp is number of seconds from the Epox (1970-Jan-01 00:00:00 UTC)
zone is specified as relative number of localtime hour quarters ((-128..+12) * 15 min) added to UTC

Unix timestamp is stored in little endian order like integer. Other values are in the network order. Whole object always holds local time of specified timezone except the unix timestamp which is always in UTC. Unix timestamp is set to -1 (invalid) for dates outside Epoch.

Binary

00110XXXdata-size (1-4 means 1-4 octets)data (data-size octets)

Binary data are sent as they are. Exact number of octets is stored data-size field. No encoding is used. This type maps to Base64 data type of XML-RPC.

Struct

01010XXX num-members (1-4 means 1-4 octets)
num-members*name-size (1 octet)name (1-255 octets)DATATYPE

Member name is encoded in the UTF-8 encoding.

Array

01011XXXnum-items (1-4 means 1-4 octets)
num-items*DATATYPE

Non-data types

Every non-data type represents complex data structure returned by the server or sent by the client. Data always start with magic ("CALL" in hex) and protocol version (major/minor octet pair)

0xCA0x11version majorversion minor

Method call

01101000name-size (1 octet)name (1-255 octets)PARAMETERS

Method parameters are encoded as a series of values although XML-RPC has a distinct data type for them. Method name should be in the UTF-8 encoding. Additional type info should be zero.

Method reponse

01110000DATATYPE

Method is allowed to return just one value. Additional type info should be zero.

Fault reponse

01111000INT (fault number)STRING (fault message)

Additional type info should be zero.