8.1 Gateway Protocol Description

The requests and replies must be coded in big-endian format. All requests and replies start with a 8 byte header followed by a variable part. The content of the variable part depends on the request/reply. These request/reply pairs are described in detail below.

Table 8.1 Gateway request/reply codes (i.e. payload type)

Request/ReplyValueDefinition
InterfaceRequest1Retrieve the server's capabilites.
InterfaceReply2Return the server capabilities.
LoginRequest3Not used.
ChallengeResponse4Not used.
ChallengeReply5Not used.
LoginReply6Not used.
CreateRequest7Request the server to create a client instance, i.e. start a gateway session.
CreateReply8Client instance has been created.
DestroyRequest9Request the server to destroy a "client" instance, i.e. terminate a gateway session.
DestroyReply10Client instance has been destroyed.
SendRequest11Request the server to execute a send or send_w_s call.
SendReply12Return the send/send_w_s result to the client.
ReceiveRequest13Request the server to execute a receive or receive_w_tmo call.
ReceiveReply14Return the receive/receive_w_tmo result to the client.
HuntRequest15Request the server to execute a hunt call.
HuntReply16Return the hunt result to the client.
AttachRequest17Request the server to execute a attach call.
AttachReply18Return the attach result to the client.
DetachRequest19Request the server to execute a detach call.
DetachReply20Return the deatch result to the client.
NameRequest21Retrieve the server's name.
NameReply22Return server name.

8.1.1 Generic Request/Reply Header

All requests/replies starts with this header.

Table 8.2 Generic gateway request/reply header description

byte0byte1byte2byte3Description
payload_typeType of request/reply, see table Table 8.1 Gateway request/reply codes (i.e. payload type).
payload_lenNumber of bytes for the type specific part, see the request/reply tables below.

8.1.2 Interface Request/Reply Payload

This request has two purposes. The client sends this request to retrieve information about the gateway server, e.g. supported requests, protocol version etc. It is also used as a "ping-message" to check that the server is alive, see receive request section for more information.

Table 8.3 Interface request payload description

byte0byte1byte2byte3Description
cli_versionThe client implements this protocol version (100).
cli_flagsBit field. Bit0 indicates client's endian (0=big, 1=little). Other bits are reserved.

Table 8.4 Interface reply payload description

byte0byte1byte2byte3Description
statusOn success, zero is returned, on error, -1 is returned.
srv_versionThe server implements this protocol version (100).
srv_flagsBit field. Bit0 indicates the server's endian (0=big, 1=little). Other bits are reserved.
types_lenLength of payload_types array (i.e. number of supported requests).
payload_typesArray of the supported requests. Each entry is 4 bytes.

8.1.3 Create Request/Reply Payload

This request is used to create a "client" instance on the server that the client communicates with.

Table 8.5 Interface request payload description

byte0byte1byte2byte3Description
userMust be 0
my_name"A client identifier". 0-terminated string.

Table 8.6 Interface reply payload description

byte0byte1byte2byte3Description
statusOn success, 0 is returned, on error, -1 is returned.
pidA handle that should be used in the destroy request.
max_sigsizeMaximum signal size that the server can handle.

8.1.4 Destroy Request/Reply Payload

This request is used to remove a "client" instance on the server, i.e. end the session that was started with the create request.

Table 8.7 Destroy request payload description

byte0byte1byte2byte3Description
pidDestroy this client (see create request).

Table 8.8 Destroy reply payload description

byte0byte1byte2byte3Description
statusOn success, 0 is returned, on error, -1 is returned.

8.1.5 Send Request/Reply Payload

This request is used to ask the gateway server to execute a send or send_w_s call.

Table 8.9 Send request payload description

byte0byte1byte2byte3Description
from_pidSend signal with this pid as sender (send_w_s) or 0 (send).
dest_pidSend signal to this pid.
sig_lenSignal size (including signal number).
sig_noSignal number.
sig_dataSignal data (except signal number).

Table 8.10 Send reply payload description

byte0byte1byte2byte3Description
statusOn success, 0 is returned, on error, -1 is returned.

8.1.6 Receive Request/Reply Payload

This request is used to ask the server to execute a receive or a receive_w_tmo call. It differs from other requests, because the client may send a second receive request or an interface request before it has received the reply from the previous receive request. The client may send a second receive request to cancel the first one. Beware that server may already have sent a receive reply before the "cancel request" was received, in this case the client must also wait for the "cancel reply". The client may send an interface request to the server, which returns an interface reply. This is used by the client to detect if the server has die while waiting for a receive reply.

Table 8.11 Receive request payload description

byte0byte1byte2byte3Description
timeoutReceive timeout in milli-seconds (receive_w_tmo) or -1 for infinity (receive).
sigsel_lenNumber of elements in sigsel_list array. 0 means cancel previous receive request.
sigsel_listArray of signal numbers to receive.

Table 8.12 Receive reply payload description

byte0byte1byte2byte3Description
statusOn success, 0 is returned, on error, -1 is returned.
sender_pidReceived signal's sender (return value from sender).
addressee_pidReceived signal's original addressee (return value from addressee).
sig_lenReceived signal's size (including signal number). 0 means "cancel receive request"-reply.
sig_noReceived signal number.
sig_dataReceived signal's data (except signal number).

8.1.7 Hunt Request/Reply Payload

This request is used to ask the gateway server to execute a hunt call.

Table 8.13 Hunt request payload description

byte0byte1byte2byte3Description
userMust be 0.
name_indexHunt name, offset (in bytes) into data.
sig_indexHunt signal data (except signal number), offset (in bytes) into data.
sig_lenHunt signal size (including signal number), 0 if no hunt signal is supplied.
sig_noHunt signal number.
dataSignal and process name storage.

Table 8.14 Hunt reply payload description

byte0byte1byte2byte3Description
statusOn success, 0 is returned, on error, -1 is returned.
pidThe pid returned by the hunt call or 0 if no process was found.

8.1.8 Attach Request/Reply Payload

This request is used to ask the gateway server to execute an attach call.

Table 8.15 Attach request payload description

byte0byte1byte2byte3Description
pidAttach to this pid.
sig_lenAttach signal size (including signal number), 0 if no attach signal is supplied.
sig_noAttach signal number.
sig_dataAttach signal data (except signal number).

Table 8.16 Attach reply payload description

byte0byte1byte2byte3Description
statusOn success, 0 is returned, on error, -1 is returned.
attrefReturn value from the attach call.

8.1.9 Detach Request/Reply Payload

This request is used to ask the gateway server to execute a detach call.

Table 8.17 Detach request payload description

byte0byte1byte2byte3Description
attrefCancel this attach. Value returned in a previous attach reply.

Table 8.18 Detach reply payload description

byte0byte1byte2byte3Description
statusOn success, 0 is returned, on error, -1 is returned.

8.1.10 Name Request/Reply Payload

This request is used to retrieve the gateway server's name.

Table 8.19 Name request payload description

byte0byte1byte2byte3Description
reservedReserved

Table 8.20 Name reply payload description

byte0byte1byte2byte3Description
statusOn success, 0 is returned, on error, -1 is returned.
name_lenLength of server name, including '\0'.
nameServer name. 0-terminate string.