CORDET Framework - C2 Implementation
CrFwInLoader.c File Reference

Implementation of InManager State Machine. More...

Go to the source code of this file.

Functions

static void InLoaderExecAction (FwPrDesc_t execPr)
 Implement the logic of the InLoader Execution Procedure (see figure below). More...
 
static void InLoaderLoadCmdRep (CrFwPckt_t pckt)
 Load the command or report encapsulated in the argument packet into an InManager. More...
 
FwSmDesc_t CrFwInLoaderMake ()
 Factory function to retrieve the state machine implementing the InLoader singleton component. More...
 
void CrFwInLoaderSetInStream (FwSmDesc_t inStream)
 Set the InStream from which the packets will be retrieved the next time the InLoader is executed. More...
 
CrFwDestSrc_t CrFwInLoaderDefGetReroutingDestination (CrFwDestSrc_t pcktDest)
 Default implementation of the function which checks the legality of a destination and returns the re-routing destination. More...
 
CrFwDestSrc_t CrFwInLoaderDefNoRerouting (CrFwDestSrc_t pcktDest)
 Default implementation of the function which checks the legality of a destination and returns the re-routing destination. More...
 
CrFwInstanceId_t CrFwInLoaderDefGetInManager (CrFwServType_t servType, CrFwServSubType_t servSubType, CrFwDiscriminant_t discriminant, CrFwCmdRepType_t cmdRepFlag)
 Default implementation of the function which selects the InManager to which an incoming InReport or InCommand must be loaded. More...
 

Variables

static FwSmDesc_t inLoader = NULL
 The InLoader singleton.
 
static CrFwCmpData_t inLoaderData
 The data structure for the InLoader.
 
static CrFwInLoaderData_t inLoaderCmpSpecificData
 The component-specific data for the InLoader.
 
static CrFwInLoaderGetReroutingDest_t getReroutingDest = CR_FW_INLOADER_DET_REROUTING_DEST
 Pointer to function which takes a packet's destination as argument and returns the destination to which a packet should be re-routed or zero if the destination is invalid.
 
static CrFwInLoaderGetInManager_t getInManager = CR_FW_INLOADER_SEL_INMANAGER
 Pointer to function which selects the InManager.
 

Detailed Description

Implementation of InManager State Machine.

Author
Vaclav Cechticky vacla.nosp@m.v.ce.nosp@m.chtic.nosp@m.ky@p.nosp@m.np-so.nosp@m.ftwa.nosp@m.re.co.nosp@m.m
Alessandro Pasetti paset.nosp@m.ti@p.nosp@m.np-so.nosp@m.ftwa.nosp@m.re.co.nosp@m.m

This file is part of the CORDET Framework.

This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.

For information on alternative licensing, please contact P&P Software GmbH.

Definition in file CrFwInLoader.c.

Function Documentation

◆ CrFwInLoaderDefGetInManager()

CrFwInstanceId_t CrFwInLoaderDefGetInManager ( CrFwServType_t  servType,
CrFwServSubType_t  servSubType,
CrFwDiscriminant_t  discriminant,
CrFwCmdRepType_t  cmdRepFlag 
)

Default implementation of the function which selects the InManager to which an incoming InReport or InCommand must be loaded.

This default implementation returns 0 if the component to be loaded is an InCommand (namely if argument cmdRepFlag is equal to crCmdType) and it returns 1 if the component to be loaded is an InReport (namely if argument cmdRepFlag is equal to crRepType). This function must conform to the prototype defined by CrFwInLoaderGetInManager_t.

Parameters
servTypethe service type of the incoming InCommand or InReport.
servSubTypethe service sub-type of the incoming InCommand or InReport.
discriminantthe discriminant of the incoming InCommand or InReport.
cmdRepFlaga flag indicating whether the item to be loaded is an InCommand or an InReport.
Returns
the identifier of the InManager into which the incoming InCommand or InReport must be loaded.

Definition at line 245 of file CrFwInLoader.c.

◆ CrFwInLoaderDefGetReroutingDestination()

CrFwDestSrc_t CrFwInLoaderDefGetReroutingDestination ( CrFwDestSrc_t  pcktDest)

Default implementation of the function which checks the legality of a destination and returns the re-routing destination.

This default implementation always assumes that the argument destination is valid and it returns it unchanged. This default implementation is suitable for applications which are acting as gateways with one level of indirection (i.e. a situation where a packet is generated by application A for application B as its final destination, but the packet is sent to application C as a re-routing destination so that the packet travels from A to B and then from B to C). This function must conform to the prototype defined by CrFwInLoaderGetReroutingDest_t.

Parameters
pcktDestthe packet destination.
Returns
the value of pcktDest.

Definition at line 234 of file CrFwInLoader.c.

◆ CrFwInLoaderDefNoRerouting()

CrFwDestSrc_t CrFwInLoaderDefNoRerouting ( CrFwDestSrc_t  pcktDest)

Default implementation of the function which checks the legality of a destination and returns the re-routing destination.

This default implementation always assumes that the argument destination is invalid and therefore it always returns zero. This default implementation is suitable for applications which do not perform any packet re-routing (i.e. applications where a packet is always sent to its final destination). This function must conform to the prototype defined by CrFwInLoaderGetReroutingDest_t.

Parameters
pcktDestthe packet destination.
Returns
the value of pcktDest.

Definition at line 239 of file CrFwInLoader.c.

◆ CrFwInLoaderMake()

FwSmDesc_t CrFwInLoaderMake ( )

Factory function to retrieve the state machine implementing the InLoader singleton component.

The first time this function is called, it creates the InLoader State Machine singleton instance. Subsequent calls returns the same instance.

The first time this function is called, it returns the InLoader State Machine after it has been started but before it has been initialized and configured.

Returns
the descriptor of the InLoader State Machine or NULL if the state machine could not be created.

Definition at line 90 of file CrFwInLoader.c.

◆ CrFwInLoaderSetInStream()

void CrFwInLoaderSetInStream ( FwSmDesc_t  inStream)

Set the InStream from which the packets will be retrieved the next time the InLoader is executed.

Parameters
inStreamthe InStream from which the packets will be retrieved the next time the InLoader is executed.

Definition at line 132 of file CrFwInLoader.c.

◆ InLoaderExecAction()

static void InLoaderExecAction ( FwPrDesc_t  execPr)
static

Implement the logic of the InLoader Execution Procedure (see figure below).

This function is executed every time the Execution Procedure of the InLoader is executed.

Parameters
execPrthe Execution Procedure of the InManager

Definition at line 137 of file CrFwInLoader.c.

◆ InLoaderLoadCmdRep()

static void InLoaderLoadCmdRep ( CrFwPckt_t  pckt)
static

Load the command or report encapsulated in the argument packet into an InManager.

This function implements the logic shown in the figure.

Parameters
pcktthe packet to be loaded in the InManager

Definition at line 172 of file CrFwInLoader.c.

P&P Software GmbH, Copyright 2012-2013, All Rights Reserved