CORDET Framework - C2 Implementation
|
Implementation of InStream State Machine. More...
Go to the source code of this file.
Functions | |
static int | IsPcktQueueEmpty (FwSmDesc_t smDesc) |
Function which checks if the packet queue is empty. More... | |
static int | IsPcktAvail (FwSmDesc_t smDesc) |
Function which checks if a packet is available. More... | |
static void | DoActionA (FwSmDesc_t smDesc) |
Function which performs Action A in the InStream State Machine. More... | |
static void | DoActionB (FwSmDesc_t smDesc) |
Function which performs Action b in the InStream State Machine. More... | |
FwSmDesc_t | CrFwInStreamMake (CrFwInstanceId_t i) |
Factory function to retrieve the i-th InStream State Machine instance. More... | |
FwSmDesc_t | CrFwInStreamGet (CrFwDestSrc_t src) |
Getter function for the InStream corresponding to the argument source. More... | |
CrFwDestSrc_t | CrFwInStreamGetSrc (FwSmDesc_t smDesc, CrFwCounterU1_t i) |
Get the i-th packet source of the argument InStream. More... | |
CrFwCounterU1_t | CrFwInStreamGetNOfSrc (FwSmDesc_t smDesc) |
Get the number of packet sources of the argument InStream. More... | |
CrFwBool_t | CrFwInStreamIsInWaiting (FwSmDesc_t smDesc) |
Return true if the argument InStream is in state WAITING. More... | |
CrFwBool_t | CrFwInStreamIsInPcktAvail (FwSmDesc_t smDesc) |
Return true if the argument InStream is in state PCKT_AVAIL. More... | |
CrFwPckt_t | CrFwInStreamGetPckt (FwSmDesc_t smDesc) |
Retrieve a packet from the InStream. More... | |
void | CrFwInStreamPcktAvail (FwSmDesc_t smDesc) |
Query the middleware for available packets and collect them if they are available. More... | |
CrFwSeqCnt_t | CrFwInStreamGetSeqCnt (CrFwGroup_t group) |
Return the value of the sequence counter of the last packet successfully collected by the InStreams for the argument group. More... | |
void | CrFwInStreamSetSeqCnt (CrFwGroup_t group, CrFwSeqCnt_t seqCnt) |
Overwrites the sequence counter value of the last packet for a group. More... | |
CrFwCounterU1_t | CrFwInStreamGetNOfPendingPckts (FwSmDesc_t smDesc) |
Return the number of packets currently in the packet queue of an InStream. More... | |
CrFwGroup_t | CrFwInStreamGetNOfGroups () |
Return the number of groups managed by the InStreams. More... | |
CrFwCounterU1_t | CrFwInStreamGetPcktQueueSize (FwSmDesc_t smDesc) |
Return the size of the packet queue of the InStream. More... | |
void | CrFwInStreamDefConfigAction (FwPrDesc_t prDesc) |
Default configuration action for an InStream. More... | |
void | CrFwInStreamDefShutdownAction (FwSmDesc_t smDesc) |
Default shutdown action for an InStream. More... | |
void | CrFwInStreamDefInitAction (FwPrDesc_t prDesc) |
Default initialization action for an InStream. More... | |
Variables | |
static FwSmDesc_t | baseInStreamSmDesc = NULL |
Base InStream from which all other InStreams are derived. | |
static CrFwCounterU1_t | inStreamPcktQueueSize [CR_FW_NOF_INSTREAM] = CR_FW_INSTREAM_PQSIZE |
The sizes of the packet queues in the InStream components. | |
static CrFwSeqCnt_t | inStreamSeqCounter [CR_FW_INSTREAM_NOF_GROUPS] |
The sequence counters managed by the OutStreams. | |
static CrFwPcktCollect_t | inStreamPcktCollect [CR_FW_NOF_INSTREAM] = CR_FW_INSTREAM_PCKTCOLLECT |
The functions implementing the packet hand-over operations for the InStream components. | |
static CrFwPcktAvailCheck_t | inStreamPcktAvailCheck [CR_FW_NOF_INSTREAM] = CR_FW_INSTREAM_PCKTAVAILCHECK |
The functions implementing the packet available check operations for the InStream components. | |
static FwPrAction_t | inStreamInitCheck [CR_FW_NOF_INSTREAM] = CR_FW_INSTREAM_INITCHECK |
The functions implementing the initialization checks for the InStream components. | |
static FwPrAction_t | inStreamInitAction [CR_FW_NOF_INSTREAM] = CR_FW_INSTREAM_INITACTION |
The functions implementing the initialization actions for the InStream components. | |
static FwPrAction_t | inStreamConfigCheck [CR_FW_NOF_INSTREAM] = CR_FW_INSTREAM_CONFIGCHECK |
The functions implementing the configuration checks for the InStream components. | |
static FwPrAction_t | inStreamConfigAction [CR_FW_NOF_INSTREAM] = CR_FW_INSTREAM_CONFIGACTION |
The functions implementing the configuration actions for the InStream components. | |
static FwSmAction_t | inStreamShutdownAction [CR_FW_NOF_INSTREAM] = CR_FW_INSTREAM_SHUTDOWNACTION |
The functions implementing the shutdown actions for the InStream components. | |
static CrFwDestSrc_t | inStreamSrcPairs [CR_FW_INSTREAM_NOF_SRCS][2] = CR_FW_INSTREAM_SRC_PAIRS |
The association between sources and inSreams. | |
static CrFwDestSrc_t * | inStreamSrc [CR_FW_NOF_INSTREAM] |
The sources associated to each inStream. | |
static CrFwDestSrc_t | inStreamNofSrc [CR_FW_NOF_INSTREAM] |
The number of sources associated to each inStream. | |
static FwSmDesc_t | inStreamDesc [CR_FW_NOF_INSTREAM] |
The descriptors of the InStream State Machines. | |
static CrFwCmpData_t | inStreamData [CR_FW_NOF_INSTREAM] |
The data structures for the InStream State Machines and their Procedures. | |
static CrFwInStreamData_t | inStreamCmpSpecificData [CR_FW_NOF_INSTREAM] |
The component-specific data for the InStream State Machines and their Procedures. | |
Implementation of InStream State Machine.
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 CrFwInStream.c.
void CrFwInStreamDefConfigAction | ( | FwPrDesc_t | prDesc | ) |
Default configuration action for an InStream.
This function resets the packet queue of the InStream and resets the expected sequence counters associated to the InStreams to zero. Configuration actions have an outcome (see CrFwResetProc.h
). The outcome of this configuration action is always: "success".
This function should never be directly called by the end-application. It is declared as a public function so that it may be used in application-specific Configuration Actions.
prDesc | the descriptor of the Reset Procedure of the InStream |
Definition at line 298 of file CrFwInStream.c.
void CrFwInStreamDefInitAction | ( | FwPrDesc_t | prDesc | ) |
Default initialization action for an InStream.
This function allocates the memory for the packet queue of the InStream and for the array holding the sources associated to the InStream. Initialization actions have an outcome (see CrFwResetProc.h
). The situation of where the memory allocation fails is not handled and therefore the outcome of this configuration action is always "success".
This function should never be directly called by the end-application. It is declared as a public function so that it may be used in application-specific Initialization Actions.
prDesc | the descriptor of the Initialization Procedure of the InStream |
Definition at line 324 of file CrFwInStream.c.
void CrFwInStreamDefShutdownAction | ( | FwSmDesc_t | smDesc | ) |
Default shutdown action for an InStream.
This function releases the memory allocated to the packet queue of the InStream and to the array holding the sources of the InStream.
This function should never be directly called by the end-application. It is declared as a public function so that it may be used in application-specific Shutdown Actions.
smDesc | the descriptor of the InStream State Machine |
Definition at line 311 of file CrFwInStream.c.
FwSmDesc_t CrFwInStreamGet | ( | CrFwDestSrc_t | src | ) |
Getter function for the InStream corresponding to the argument source.
Nominally, each InStream is associated to one or more packet sources. The binding between an InStream and its source is done statically in the configuration file CrFwInStreamUserPar.h
.
If the value of the source argument is illegal (i.e. if no InStream has been bound to it), this function returns NULL and sets the application error code to: crInStreamUndefDest
.
This function should only be called after all InStreams have been built through calls to function CrFwInStreamMake
. If this pre-condition is not satisfied, execution of this function could result in an access to a NULL pointer.
src | the packet source associated to the InStream |
Definition at line 217 of file CrFwInStream.c.
CrFwGroup_t CrFwInStreamGetNOfGroups | ( | ) |
Return the number of groups managed by the InStreams.
Definition at line 286 of file CrFwInStream.c.
CrFwCounterU1_t CrFwInStreamGetNOfPendingPckts | ( | FwSmDesc_t | smDesc | ) |
Return the number of packets currently in the packet queue of an InStream.
smDesc | the descriptor of the InStream State Machine |
Definition at line 279 of file CrFwInStream.c.
CrFwCounterU1_t CrFwInStreamGetNOfSrc | ( | FwSmDesc_t | smDesc | ) |
Get the number of packet sources of the argument InStream.
An InStream can receive packets from one or more sources. A source has an identifier of type CrFwDestSrc_t
. The association between packet sources and InStream is done statically in CR_FW_INSTREAM_SRC_PAIRS
. This function may only be called after the argument InStream has been initialized.
smDesc | the descriptor of the Base State Machine of the InStream. |
Definition at line 236 of file CrFwInStream.c.
CrFwPckt_t CrFwInStreamGetPckt | ( | FwSmDesc_t | smDesc | ) |
Retrieve a packet from the InStream.
This function sends the GetPacket command to the InStream State Machine. If, at the time the function is called, the InStream is in state PCKT_AVAIL (i.e. if the InStream is configured and its packet queue is not empty), the function returns the oldest packet currently in the Packet Queue of the InStream; otherwise, the function return NULL.
smDesc | the descriptor of the Base State Machine of the InStream. |
Definition at line 253 of file CrFwInStream.c.
CrFwCounterU1_t CrFwInStreamGetPcktQueueSize | ( | FwSmDesc_t | smDesc | ) |
Return the size of the packet queue of the InStream.
smDesc | the descriptor of the InStream State Machine |
Definition at line 291 of file CrFwInStream.c.
CrFwSeqCnt_t CrFwInStreamGetSeqCnt | ( | CrFwGroup_t | group | ) |
Return the value of the sequence counter of the last packet successfully collected by the InStreams for the argument group.
If no packet has yet been collected for that group after the InStream was reset, the sequence counter returned by the function is set equal to zero.
group | the identifier of the group |
Definition at line 267 of file CrFwInStream.c.
CrFwDestSrc_t CrFwInStreamGetSrc | ( | FwSmDesc_t | smDesc, |
CrFwCounterU1_t | i | ||
) |
Get the i-th packet source of the argument InStream.
An InStream can receive packets from one or more sources. A source has an identifier of type CrFwDestSrc_t
. The association between packet sources and InStream is done statically in CR_FW_INSTREAM_SRC_PAIRS
. The value of i must be between 1 and the number of packets sources associated to the argument InStream (as returned by function CrFwInStreamGetNOfSrc
). If this constraint is violated, the return value of the function is indeterminate. This function may only be called after the argument InStream has been initialized.
smDesc | the descriptor of the Base State Machine of the InStream. |
i | the index of the source (starting from 1) |
Definition at line 228 of file CrFwInStream.c.
CrFwBool_t CrFwInStreamIsInPcktAvail | ( | FwSmDesc_t | smDesc | ) |
Return true if the argument InStream is in state PCKT_AVAIL.
smDesc | the descriptor of the Base State Machine of the InStream. |
Definition at line 248 of file CrFwInStream.c.
CrFwBool_t CrFwInStreamIsInWaiting | ( | FwSmDesc_t | smDesc | ) |
Return true if the argument InStream is in state WAITING.
smDesc | the descriptor of the Base State Machine of the InStream. |
Definition at line 243 of file CrFwInStream.c.
FwSmDesc_t CrFwInStreamMake | ( | CrFwInstanceId_t | inStreamId | ) |
Factory function to retrieve the i-th InStream State Machine instance.
The first time this function is called with a certain value of the argument i, it creates the i-th InStream State Machine instance. Subsequent calls returns the same instance.
The InStream identifier i must be in the range: [0, CR_FW_NOF_INSTREAM
-1]. If the identifier is out of range, the function returns NULL and sets the application error code to: crInStreamIllId
.
The first time this function is called with a certain value of i, it returns an InStream State Machine which has been started but which must still be initialized and configured.
inStreamId | the identifier of the InStream |
Definition at line 128 of file CrFwInStream.c.
void CrFwInStreamPcktAvail | ( | FwSmDesc_t | smDesc | ) |
Query the middleware for available packets and collect them if they are available.
This function sends the PacketAvailable command to the InStream State Machine. This command may be sent to the InStream by the middleware to signal the arrival of a new packet at the connection controlled by the InStream or it may be sent to poll the middleware and check whether any packets are available. If packets are available at the middleware, they are collected and stored in the InStream's Packet Queue.
smDesc | the descriptor of the Base State Machine of the InStream. |
Definition at line 262 of file CrFwInStream.c.
void CrFwInStreamSetSeqCnt | ( | CrFwGroup_t | group, |
CrFwSeqCnt_t | seqCnt | ||
) |
Overwrites the sequence counter value of the last packet for a group.
Can be used to update the expected sequence counter value for the next packet.
group | the identifier of the group |
seqCnt | the InStream sequence counter |
Definition at line 273 of file CrFwInStream.c.
|
static |
Function which performs Action A in the InStream State Machine.
This function is used as a transition action in the InStream State Machine.
smDesc | the state machine descriptor |
Definition at line 351 of file CrFwInStream.c.
|
static |
Function which performs Action b in the InStream State Machine.
This function is used as a transition action in the InStream State Machine.
smDesc | the state machine descriptor |
Definition at line 358 of file CrFwInStream.c.
|
static |
Function which checks if a packet is available.
This function is used as guard for the transition into state PCKT_AVAIL.
smDesc | the state machine descriptor |
Definition at line 394 of file CrFwInStream.c.
|
static |
Function which checks if the packet queue is empty.
This function is used as guard for the transition into state WAITING.
smDesc | the state machine descriptor |
Definition at line 404 of file CrFwInStream.c.