Requirements#

System Requirements#

MessagePassing.SafetyCertifiedTransportMechanismUnderQNX#

On the QNX operating system, the message passing component shall use the QNX-message-passing as the underlying IPC mechanism.

MessagePassing.TransportMechanismOnLinux#

On the Linux operating system, the message passing component shall use unix domain-sockets as the underlying IPC mechanism.

MessagePassing.OSProvidedSenderIdentity#

The message passing server shall be able to identify the sender of each received message by the sender’s OS-provided user ID (UID).

MessagePassing.UnforgableSenderIdentity#

The transport mechanism shall ensure that the UID used to identify a message, cannot be forged by the client.

Behaviour Requirements#

MessagePassing.ServerCallbacksAreSequential#

The server shall serialize all callbacks belonging to the same server instance, such that no two such callbacks execute concurrently.

MessagePassing.ServerProcessesSinglePendingRequest#

The server shall not dispatch a new sent-with-reply message callback on a given ServerConnection until the preceding request has been replied to.

MessagePassing.ClientConnectionMaintainsStateMachine#

The ClientConnection shall maintain a state machine with the states Starting, Ready, Stopping, and Stopped.

MessagePassing.SynchronousSendBlocksUntilServerReceives#

The ClientConnection shall block the calling thread during a Send call until the message has been and accepted by the server’s receive buffer, when no client-side send queue is configured.

MessagePassing.AsynchronousSendReturnsAfterLocalAcceptance#

The ClientConnection shall return from a Send call after the message has been accepted by the local message passing layer, when a client-side send queue is configured.

MessagePassing.SendWaitReplyBlocksUntilServerReply#

The ClientConnection shall block the calling thread during a SendWaitReply call until a reply from the server is received or an error is detected.

MessagePassing.MessageOrderPreservationPerConnection#

The message passing component shall deliver messages of the same delivery type from the same IClientConnection instance to the server in the order they were sent.

MessagePassing.SingleServerInstancePerServiceIdentifier#

The message passing component shall prevent more than one active IServer instance serves a any given service identifier at any point in time.

API Requirements#

MessagePassing.IServerStartListeningAPI#

IServer shall provide a StartListening method that registers connection, disconnection, fire-and-forget message, and sent-with-reply message callbacks.

MessagePassing.IServerStopListeningAPI#

IServer shall provide a StopListening method that releases all registered callbacks and closes all active server connections.

MessagePassing.IClientConnectionSendAPI#

IClientConnection shall provide a Send method that accepts a byte-span message and transmits it to the server.

MessagePassing.IClientConnectionSendWaitReplyAPI#

IClientConnection shall provide a SendWaitReply method that accepts a message byte span and a reply buffer span and returns the received reply payload trimmed to its actual size.

MessagePassing.IClientConnectionSendWithCallbackAPI#

IClientConnection shall provide a SendWithCallback method that accepts a message byte span and a reply callback and returns after the message has been accepted by the local message passing layer.

MessagePassing.IServerConnectionReplyAPI#

IServerConnection shall provide a Reply method that accepts a byte-span message and delivers it as the reply to the pending REQUEST from the client.

MessagePassing.IServerConnectionNotifyAPI#

IServerConnection shall provide a Notify method that accepts a byte-span message and sends it as an asynchronous notification to the client.

MessagePassing.ClientFactoryCreateAPI#

IClientFactory shall provide a Create method that accepts a ServiceProtocolConfig and a ClientConfig and returns a new IClientConnection instance configured for the service specified by the ServiceProtocolConfig.

MessagePassing.ServerFactoryCreateAPI#

IServerFactory shall provide a Create method that accepts a ServiceProtocolConfig and a ServerConfig and returns a new IServer instance configured for the service specified by the ServiceProtocolConfig.

MessagePassing.IClientConnectionGetStateAPI#

IClientConnection shall provide a GetState method that returns the current connection state.

Server Unit Requirements#

MessagePassing.ServerPreallocatesConnectionObjects#

The server shall preallocate memory for the number of IServerConnection objects specified by ServerConfig::pre_alloc_connections at construction time, without allocating additional memory for each incoming client connection.

MessagePassing.ServerRingBufferQueueSizeConfigurable#

The server shall implement the shared incoming message queue as a ring buffer with the number of slots equal to ServerConfig::max_queued_sends, configured at construction time.

MessagePassing.ServerConnectionRefusal#

The server shall enable the connection callback to reject an incoming client connection by returning an error, without establishing a server connection for the rejected client.

MessagePassing.ServerIConnectionHandlerDispatch#

The server shall invoke the IConnectionHandler virtual methods of the UserData object for a given IServerConnection in place of the server-wide callbacks, when the UserData holds an IConnectionHandler instance.

Client Unit Requirements (client_connection)#

MessagePassing.ClientConnectionSendQueuePreallocation#

The ClientConnection shall preallocate send queue storage for the number of asynchronous messages specified by ClientConfig::max_queued_sends at construction time.

MessagePassing.ClientConnectionSharedResourceEngineInjection#

The ClientConnection shall accept an ISharedResourceEngine instance as a constructor parameter, which shouldbe the exclusive provider forall shared resources.

MessagePassing.ClientConnectionMockInjectionForTesting#

The ClientConnection shall use the ISharedResourceEngine interface for all OS interactions.

MessagePassing.ClientConnectionSendFailsWhenStopped#

The ClientConnection shall return an error for a Send call when the connection is in the Stopped state.

MessagePassing.ClientConnectionSendWaitReplyFailsWhenStopped#

The ClientConnection shall return an error for a SendWaitReply call when the connection is in the Stopped state.

MessagePassing.ClientConnectionSendWithCallbackFailsWhenStopped#

The ClientConnection shall return an error for a SendWithCallback call when the connection is in the Stopped state.

MessagePassing.ClientConnectionStateCallbackInvocation#

The ClientConnection shall invoke the registered StateCallback each time the connection state changes, passing the new state as the argument.