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... | |
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... | |
CrFwDestSrc_t | CrFwInStreamGetSrc (FwSmDesc_t smDesc) |
Get the currently defined packet source of an InStream. More... | |
CrFwSeqCnt_t | CrFwInStreamGetSeqCnt (FwSmDesc_t smDesc, CrFwGroup_t group) |
Return the value of the sequence counter of the last packet successfully collected by the InStream for a group. More... | |
void | CrFwInStreamSetSeqCnt (FwSmDesc_t smDesc, 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 (FwSmDesc_t smDesc) |
Return the number of groups associated to the InStream. 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. More... | |
static CrFwCounterU1_t | inStreamPcktQueueSize [CR_FW_NOF_INSTREAM] = CR_FW_INSTREAM_PQSIZE |
The sizes of the packet queues in the InStream components. More... | |
static CrFwGroup_t | inStreamNOfGroups [CR_FW_NOF_INSTREAM] = CR_FW_INSTREAM_NOF_GROUPS |
The number of groups associated to the InStream components. More... | |
static CrFwPcktCollect_t | inStreamPcktCollect [CR_FW_NOF_INSTREAM] = CR_FW_INSTREAM_PCKTCOLLECT |
The functions implementing the packet hand-over operations for the InStream components. More... | |
static CrFwPcktAvailCheck_t | inStreamPcktAvailCheck [CR_FW_NOF_INSTREAM] = CR_FW_INSTREAM_PCKTAVAILCHECK |
The functions implementing the packet available check operations for the InStream components. More... | |
static FwPrAction_t | inStreamInitCheck [CR_FW_NOF_INSTREAM] = CR_FW_INSTREAM_INITCHECK |
The functions implementing the initialization checks for the InStream components. More... | |
static FwPrAction_t | inStreamInitAction [CR_FW_NOF_INSTREAM] = CR_FW_INSTREAM_INITACTION |
The functions implementing the initialization actions for the InStream components. More... | |
static FwPrAction_t | inStreamConfigCheck [CR_FW_NOF_INSTREAM] = CR_FW_INSTREAM_CONFIGCHECK |
The functions implementing the configuration checks for the InStream components. More... | |
static FwPrAction_t | inStreamConfigAction [CR_FW_NOF_INSTREAM] = CR_FW_INSTREAM_CONFIGACTION |
The functions implementing the configuration actions for the InStream components. More... | |
static FwSmAction_t | inStreamShutdownAction [CR_FW_NOF_INSTREAM] = CR_FW_INSTREAM_SHUTDOWNACTION |
The functions implementing the shutdown actions for the InStream components. More... | |
static CrFwDestSrc_t | inStreamSrc [CR_FW_NOF_INSTREAM] = CR_FW_INSTREAM_SRC |
The sources associated to the InStream components. More... | |
static FwSmDesc_t | inStreamDesc [CR_FW_NOF_INSTREAM] |
The descriptors of the InStream State Machines. More... | |
static CrFwCmpData_t | inStreamData [CR_FW_NOF_INSTREAM] |
The data structures for the InStream State Machines and their Procedures. More... | |
static CrFwInStreamData_t | inStreamCmpSpecificData [CR_FW_NOF_INSTREAM] |
The component-specific data for the InStream State Machines and their Procedures. More... | |
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. 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 288 of file CrFwInStream.c.
void CrFwInStreamDefInitAction | ( | FwPrDesc_t | prDesc | ) |
Default initialization action for an InStream.
This function: (a) allocates the memory for the packet queue of the InStream; (b) allocates the memory for the array holding the sequence counters for the destination/source groups associated to the Instream; and (c) initializes all data structures implementing 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 312 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 releases the memory allocated to the array holding the sequence counters.
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 301 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 a certain packet source. 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 211 of file CrFwInStream.c.
CrFwGroup_t CrFwInStreamGetNOfGroups | ( | FwSmDesc_t | smDesc | ) |
Return the number of groups associated to the InStream.
smDesc | the descriptor of the Base State Machine of the InStream. |
Definition at line 275 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 268 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 232 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 281 of file CrFwInStream.c.
CrFwSeqCnt_t CrFwInStreamGetSeqCnt | ( | FwSmDesc_t | smDesc, |
CrFwGroup_t | group | ||
) |
Return the value of the sequence counter of the last packet successfully collected by the InStream for a group.
If no packet has yet been collected for that group after the InStream was reset, the sequence counter is equal to zero.
smDesc | the descriptor of the InStream State Machine |
group | the identifier of the group |
Definition at line 253 of file CrFwInStream.c.
CrFwDestSrc_t CrFwInStreamGetSrc | ( | FwSmDesc_t | smDesc | ) |
Get the currently defined packet source of an InStream.
An InStream can receive packets from one (and only one) source. A source has an identifier of type CrFwDestSrc_t
.
smDesc | the descriptor of the Base State Machine of the InStream. |
Definition at line 246 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 227 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 222 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 121 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 241 of file CrFwInStream.c.
void CrFwInStreamSetSeqCnt | ( | FwSmDesc_t | smDesc, |
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.
smDesc | the descriptor of the InStream State Machine |
group | the identifier of the group |
seqCnt | the InStream sequence counter |
Definition at line 260 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 322 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 329 of file CrFwInStream.c.
|
static |
Function which checks if a packet is available.
This function is used as guard for the transition into state WAITING.
smDesc | the state machine descriptor |
Definition at line 363 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 371 of file CrFwInStream.c.
|
static |
Base InStream from which all other InStreams are derived.
Definition at line 46 of file CrFwInStream.c.
|
static |
The component-specific data for the InStream State Machines and their Procedures.
Definition at line 85 of file CrFwInStream.c.
|
static |
The functions implementing the configuration actions for the InStream components.
Definition at line 70 of file CrFwInStream.c.
|
static |
The functions implementing the configuration checks for the InStream components.
Definition at line 67 of file CrFwInStream.c.
|
static |
The data structures for the InStream State Machines and their Procedures.
Definition at line 82 of file CrFwInStream.c.
|
static |
The descriptors of the InStream State Machines.
Definition at line 79 of file CrFwInStream.c.
|
static |
The functions implementing the initialization actions for the InStream components.
Definition at line 64 of file CrFwInStream.c.
|
static |
The functions implementing the initialization checks for the InStream components.
Definition at line 61 of file CrFwInStream.c.
|
static |
The number of groups associated to the InStream components.
Definition at line 52 of file CrFwInStream.c.
|
static |
The functions implementing the packet available check operations for the InStream components.
Definition at line 58 of file CrFwInStream.c.
|
static |
The functions implementing the packet hand-over operations for the InStream components.
Definition at line 55 of file CrFwInStream.c.
|
static |
The sizes of the packet queues in the InStream components.
Definition at line 49 of file CrFwInStream.c.
|
static |
The functions implementing the shutdown actions for the InStream components.
Definition at line 73 of file CrFwInStream.c.
|
static |
The sources associated to the InStream components.
Definition at line 76 of file CrFwInStream.c.