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/Reply | Value | Definition |
InterfaceRequest | 1 | Retrieve the server's capabilites. |
InterfaceReply | 2 | Return the server capabilities. |
LoginRequest | 3 | Not used. |
ChallengeResponse | 4 | Not used. |
ChallengeReply | 5 | Not used. |
LoginReply | 6 | Not used. |
CreateRequest | 7 | Request the server to create a client instance, i.e. start a gateway session. |
CreateReply | 8 | Client instance has been created. |
DestroyRequest | 9 | Request the server to destroy a "client" instance, i.e. terminate a gateway session. |
DestroyReply | 10 | Client instance has been destroyed. |
SendRequest | 11 | Request the server to execute a
or
call. |
SendReply | 12 | Return the send/send_w_s result to the client. |
ReceiveRequest | 13 | Request the server to execute a receive or receive_w_tmo call. |
ReceiveReply | 14 | Return the receive/receive_w_tmo result to the client. |
HuntRequest | 15 | Request the server to execute a hunt call. |
HuntReply | 16 | Return the hunt result to the client. |
AttachRequest | 17 | Request the server to execute a attach call. |
AttachReply | 18 | Return the attach result to the client. |
DetachRequest | 19 | Request the server to execute a detach call. |
DetachReply | 20 | Return the deatch result to the client. |
NameRequest | 21 | Retrieve the server's name. |
NameReply | 22 | Return server name. |
All requests/replies starts with this header.
Table 8.2 Generic gateway request/reply header description
byte0 | byte1 | byte2 | byte3 | Description |
payload_type | Type of request/reply, see table Table 8.1 Gateway request/reply codes (i.e. payload type). | |||
payload_len | Number of bytes for the type specific part, see the request/reply tables below. |
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
byte0 | byte1 | byte2 | byte3 | Description |
cli_version | The client implements this protocol version (100). | |||
cli_flags | Bit field. Bit0 indicates client's endian (0=big, 1=little). Other bits are reserved. |
Table 8.4 Interface reply payload description
byte0 | byte1 | byte2 | byte3 | Description |
status | On success, zero is returned, on error, -1 is returned. | |||
srv_version | The server implements this protocol version (100). | |||
srv_flags | Bit field. Bit0 indicates the server's endian (0=big, 1=little). Other bits are reserved. | |||
types_len | Length of payload_types array (i.e. number of supported requests). | |||
payload_types | Array of the supported requests. Each entry is 4 bytes. |
This request is used to create a "client" instance on the server that the client communicates with.
Table 8.5 Interface request payload description
byte0 | byte1 | byte2 | byte3 | Description |
user | Must be 0 | |||
my_name | "A client identifier". 0-terminated string. |
Table 8.6 Interface reply payload description
byte0 | byte1 | byte2 | byte3 | Description |
status | On success, 0 is returned, on error, -1 is returned. | |||
pid | A handle that should be used in the destroy request. | |||
max_sigsize | Maximum signal size that the server can handle. |
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
byte0 | byte1 | byte2 | byte3 | Description |
pid | Destroy this client (see create request). |
Table 8.8 Destroy reply payload description
byte0 | byte1 | byte2 | byte3 | Description |
status | On success, 0 is returned, on error, -1 is returned. |
This request is used to ask the gateway server to execute a
or
send
call.send_w_s
Table 8.9 Send request payload description
byte0 | byte1 | byte2 | byte3 | Description |
from_pid | Send signal with this pid as sender (send_w_s) or 0 (send). | |||
dest_pid | Send signal to this pid. | |||
sig_len | Signal size (including signal number). | |||
sig_no | Signal number. | |||
sig_data | Signal data (except signal number). |
Table 8.10 Send reply payload description
byte0 | byte1 | byte2 | byte3 | Description |
status | On success, 0 is returned, on error, -1 is returned. |
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
byte0 | byte1 | byte2 | byte3 | Description |
timeout | Receive timeout in milli-seconds
(receive_w_tmo ) or -1 for infinity
(receive ). | |||
sigsel_len | Number of elements in sigsel_list
array. 0 means cancel previous receive
request. | |||
sigsel_list | Array of signal numbers to receive. |
Table 8.12 Receive reply payload description
byte0 | byte1 | byte2 | byte3 | Description |
status | On success, 0 is returned, on error, -1 is returned. | |||
sender_pid | Received signal's sender (return value from sender). | |||
addressee_pid | Received signal's original addressee (return value from addressee). | |||
sig_len | Received signal's size (including signal number). 0 means "cancel receive request"-reply. | |||
sig_no | Received signal number. | |||
sig_data | Received signal's data (except signal number). |
This request is used to ask the gateway server to execute a hunt call.
Table 8.13 Hunt request payload description
byte0 | byte1 | byte2 | byte3 | Description |
user | Must be 0. | |||
name_index | Hunt name, offset (in bytes) into data. | |||
sig_index | Hunt signal data (except signal number), offset (in bytes) into data. | |||
sig_len | Hunt signal size (including signal number), 0 if no hunt signal is supplied. | |||
sig_no | Hunt signal number. | |||
data | Signal and process name storage. |
Table 8.14 Hunt reply payload description
byte0 | byte1 | byte2 | byte3 | Description |
status | On success, 0 is returned, on error, -1 is returned. | |||
pid | The pid returned by the hunt call or 0 if no process was found. |
This request is used to ask the gateway server to execute an attach call.
Table 8.15 Attach request payload description
byte0 | byte1 | byte2 | byte3 | Description |
pid | Attach to this pid. | |||
sig_len | Attach signal size (including signal number), 0 if no attach signal is supplied. | |||
sig_no | Attach signal number. | |||
sig_data | Attach signal data (except signal number). |
Table 8.16 Attach reply payload description
byte0 | byte1 | byte2 | byte3 | Description |
status | On success, 0 is returned, on error, -1 is returned. | |||
attref | Return value from the attach call. |
This request is used to ask the gateway server to execute a detach call.
Table 8.17 Detach request payload description
byte0 | byte1 | byte2 | byte3 | Description |
attref | Cancel this attach. Value returned in a previous attach reply. |
Table 8.18 Detach reply payload description
byte0 | byte1 | byte2 | byte3 | Description |
status | On success, 0 is returned, on error, -1 is returned. |