Back to Fprime

Svc::FprimeRouter

Svc/FprimeRouter/docs/sdd.md

4.2.24.6 KB
Original Source

Svc::FprimeRouter

The Svc::FprimeRouter component routes F´ packets (such as command or file packets) to other components.

The Svc::FprimeRouter component receives F´ packets (as Fw::Buffer objects) and routes them to other components through synchronous port calls. The input port of type Svc.ComDataWithContext passes this Fw.Buffer object along with optional context data which can help for routing. The current F Prime protocol does not use this context data, but is nevertheless present in the interface for compatibility with other protocols which may for example pass APIDs in the frame headers.

The Svc::FprimeRouter component supports Fw::ComPacketType::FW_PACKET_COMMAND and Fw::ComPacketType::FW_PACKET_FILE packet types. Unknown packet types are forwarded on the unknownDataOut port, which a project-specific component can connect to for custom routing.

About memory management, all buffers sent by Svc::FprimeRouter on the fileOut and unknownDataOut ports are expected to be returned to the router through the fileBufferReturnIn port for deallocation.

Custom Routing

The Svc::FprimeRouter component is designed to be extensible through the use of a project-specific router. The unknownDataOut port can be connected to a project-specific component that can receive all unknown packet types. This component can then implement custom handling of these unknown packets. After processing, the project-specific component shall return the received buffer to the Svc::FprimeRouter component through the fileBufferReturnIn port (named this way as it only receives file packets in the common use-case), which will deallocate the buffer.

Usage Examples

The Svc::FprimeRouter component is used in the uplink stack of many reference F´ application such as the tutorials source code.

Typical Usage

In the canonical uplink communications stack, Svc::FprimeRouter is connected to a Svc::CmdDispatcher and a Svc::FileUplink component, to receive Command and File packets respectively.

Port Descriptions

KindNameTypeDescription
guarded inputdataInSvc.ComDataWithContextReceiving Fw::Buffer with context buffer from Deframer
guarded inputdataReturnOutSvc.ComDataWithContextReturning ownership of buffer received on dataIn
outputcommandOutFw.ComPort for sending command packets as Fw::ComBuffers
outputfileOutFw.BufferSendPort for sending file packets as Fw::Buffer (ownership passed to receiver)
sync inputfileBufferReturnInFw.BufferSendReceiving back ownership of buffer sent on fileOut and unknownDataOut
outputunknownDataOutSvc.ComDataWithContextPort forwarding unknown data (useful for adding custom routing rules with a project-defined router)
outputbufferAllocateFw.BufferGetPort for allocating buffers, allowing copy of received data
outputbufferDeallocateFw.BufferSendPort for deallocating buffers

Requirements

NameDescriptionRationaleValidation
SVC-ROUTER-001Svc::FprimeRouter shall route packets based on their packet type as indicated by the packet headerRouting mechanism of the F´ comms protocolUnit test
SVC-ROUTER-002Svc::FprimeRouter shall route packets of type Fw::ComPacketType::FW_PACKET_COMMAND to the commandOut output port.Routing command packetsUnit test
SVC-ROUTER-003Svc::FprimeRouter shall route packets of type Fw::ComPacketType::FW_PACKET_FILE to the fileOut output port.Routing file packetsUnit test
SVC-ROUTER-004Svc::FprimeRouter shall route data that is neither Fw::ComPacketType::FW_PACKET_COMMAND nor Fw::ComPacketType::FW_PACKET_FILE to the unknownDataOut output port.Allows for projects to provide custom routing for additional (project-specific) uplink data typesUnit test
SVC-ROUTER-005Svc::FprimeRouter shall emit warning events if serialization errors occur during processing of incoming packetsAid in diagnosing uplink issuesUnit test
SVC-ROUTER-005Svc::FprimeRouter shall make a copy of buffers that represent a FW_PACKET_FILEAid in memory management of file buffersUnit test
SVC-ROUTER-005Svc::FprimeRouter shall return ownership of all buffers received on dataIn through dataReturnOutMemory managementUnit test