CORDET Framework - C2 Implementation
|
Implementation of OutStream State Machine. More...
Go to the source code of this file.
Functions | |
static void | EnqueuePckt (FwSmDesc_t smDesc) |
Function which enqueues a packet on the packet queue. More... | |
static void | FlushPcktQueue (FwSmDesc_t smDesc) |
Function which flushes the packet queue. More... | |
static void | ResetSeqCounter (FwSmDesc_t smDesc) |
Function which resets to 1 the sequence counter of an out-going packet. More... | |
static void | SendOrEnqueue (FwSmDesc_t smDesc) |
Function which first attempts to hand over a packet to the middleware and, if this fails, it pushes it on the packet queue. More... | |
static int | IsPacketQueueEmpty (FwSmDesc_t smDesc) |
Function which checks if the packet queue is empty. More... | |
FwSmDesc_t | CrFwOutStreamMake (CrFwInstanceId_t i) |
Factory function to retrieve the i-th OutStream State Machine instance. More... | |
CrFwBool_t | CrFwOutStreamIsInReady (FwSmDesc_t smDesc) |
Return true if the argument OutStream is in state READY. More... | |
CrFwBool_t | CrFwOutStreamIsInBuffering (FwSmDesc_t smDesc) |
Return true if the argument OutStream is in state BUFFERING. More... | |
FwSmDesc_t | CrFwOutStreamGet (CrFwDestSrc_t dest) |
Getter function for the OutStream corresponding to the argument destination. More... | |
void | CrFwOutStreamSend (FwSmDesc_t smDesc, CrFwPckt_t pckt) |
Send a packet to the OutStream. More... | |
void | CrFwOutStreamConnectionAvail (FwSmDesc_t smDesc) |
Signal that the out-going middleware connection has become available. More... | |
CrFwDestSrc_t | CrFwOutStreamGetDest (FwSmDesc_t smDesc) |
Get the destination for an OutStream. More... | |
CrFwSeqCnt_t | CrFwOutStreamGetSeqCnt (FwSmDesc_t smDesc, CrFwGroup_t group) |
Return the value of the sequence counter for one of the groups maintained by an OutStream. More... | |
void | CrFwOutStreamSetSeqCnt (FwSmDesc_t smDesc, CrFwGroup_t group, CrFwSeqCnt_t seqCnt) |
Sets the value of the sequence counter for one of the groups maintained by an OutStream. More... | |
CrFwCounterU1_t | CrFwOutStreamGetNOfPendingPckts (FwSmDesc_t smDesc) |
Return the number of packets currently in the packet queue of an OutStream. More... | |
CrFwGroup_t | CrFwOutStreamGetNOfGroups (FwSmDesc_t smDesc) |
Return the number of groups associated to the OutStream. More... | |
CrFwCounterU1_t | CrFwOutStreamGetPcktQueueSize (FwSmDesc_t smDesc) |
Return the size of the packet queue of the OutStream. More... | |
void | CrFwOutStreamDefConfigAction (FwPrDesc_t prDesc) |
Default configuration action for an OutStream. More... | |
void | CrFwOutStreamDefShutdownAction (FwSmDesc_t smDesc) |
Default shutdown action for an OutStream. More... | |
void | CrFwOutStreamDefInitAction (FwPrDesc_t prDesc) |
Default initialization action for an OutStream. More... | |
Variables | |
static FwSmDesc_t | baseOutStreamSmDesc = NULL |
Base OutStream from which all other OutStreams are derived. More... | |
static CrFwCounterU1_t | outStreamPcktQueueSize [CR_FW_NOF_OUTSTREAM] = CR_FW_OUTSTREAM_PQSIZE |
The sizes of the packet queues in the OutStream components. More... | |
static CrFwDestSrc_t | outStreamDest [CR_FW_NOF_OUTSTREAM] = CR_FW_OUTSTREAM_DEST |
The destinations associated to the OutStream components. More... | |
static CrFwGroup_t | outStreamNOfGroups [CR_FW_NOF_OUTSTREAM] = CR_FW_OUTSTREAM_NOF_GROUPS |
The number of groups associated to the OutStream components. More... | |
static CrFwPcktHandover_t | outStreamHandoverPckt [CR_FW_NOF_OUTSTREAM] = CR_FW_OUTSTREAM_PCKTHANDOVER |
The functions implementing the packet hand-over operations for the OutStream components. | |
static FwPrAction_t | outStreamInitCheck [CR_FW_NOF_OUTSTREAM] = CR_FW_OUTSTREAM_INITCHECK |
The functions implementing the initialization checks for the InStream components. More... | |
static FwPrAction_t | outStreamInitAction [CR_FW_NOF_OUTSTREAM] = CR_FW_OUTSTREAM_INITACTION |
The functions implementing the initialization actions for the InStream components. More... | |
static FwPrAction_t | outStreamConfigCheck [CR_FW_NOF_OUTSTREAM] = CR_FW_OUTSTREAM_CONFIGCHECK |
The functions implementing the configuration checks for the InStream components. More... | |
static FwPrAction_t | outStreamConfigAction [CR_FW_NOF_OUTSTREAM] = CR_FW_OUTSTREAM_CONFIGACTION |
The functions implementing the configuration actions for the InStream components. More... | |
static FwSmAction_t | outStreamShutdownAction [CR_FW_NOF_OUTSTREAM] = CR_FW_OUTSTREAM_SHUTDOWNACTION |
The functions implementing the shutdown actions for the InStream components. More... | |
static FwSmDesc_t | outStreamDesc [CR_FW_NOF_OUTSTREAM] |
The descriptors of the OutStream State Machines. More... | |
static CrFwCmpData_t | outStreamData [CR_FW_NOF_OUTSTREAM] |
The base data structures for the OutStream State Machines and their Procedures. More... | |
static CrFwOutStreamData_t | outStreamCmpSpecificData [CR_FW_NOF_OUTSTREAM] |
The component-specific data for the OutStream State Machines and their Procedures. More... | |
Implementation of OutStream 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 CrFwOutStream.c.
void CrFwOutStreamConnectionAvail | ( | FwSmDesc_t | smDesc | ) |
Signal that the out-going middleware connection has become available.
This function sends the ConnectionAvailable command to the OutStream State Machine.
smDesc | the descriptor of the OutStream State Machine. |
Definition at line 245 of file CrFwOutStream.c.
void CrFwOutStreamDefConfigAction | ( | FwPrDesc_t | prDesc | ) |
Default configuration action for an OutStream.
This function resets the packet queue of the OutStream.
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 OutStream |
Definition at line 292 of file CrFwOutStream.c.
void CrFwOutStreamDefInitAction | ( | FwPrDesc_t | prDesc | ) |
Default initialization action for an OutStream.
This function: (a) allocates the memory for the packet queue of the OutStream; (b) allocates the memory for the array holding the sequence counters for the groups attached to the OutStream; and (c) initializes all data structures implementing the OutStream. 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 OutStream |
Definition at line 312 of file CrFwOutStream.c.
void CrFwOutStreamDefShutdownAction | ( | FwSmDesc_t | smDesc | ) |
Default shutdown action for an OutStream.
This function releases the memory allocated to the packet queue of the OutStream 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 OutStream State Machine |
Definition at line 303 of file CrFwOutStream.c.
FwSmDesc_t CrFwOutStreamGet | ( | CrFwDestSrc_t | dest | ) |
Getter function for the OutStream corresponding to the argument destination.
Nominally, each OutStream is associated to a certain destination. The binding between an OutStream and its destination is done statically in the configuration file CrFwOutStreamUserPar.h
.
If the value of the destination argument is illegal (i.e. if no OutStream has been bound to it), this function returns NULL and sets the application error code to: crOutStreamUndefDest
.
This function should only be called after all OutStreams have been built through calls to function CrFwOutStreamMake
. If this pre-condition is not satisfied, execution of this function could result in an access to a NULL pointer.
dest | the destination associated to the OutStream |
Definition at line 226 of file CrFwOutStream.c.
CrFwDestSrc_t CrFwOutStreamGetDest | ( | FwSmDesc_t | smDesc | ) |
Get the destination for an OutStream.
smDesc | the descriptor of the OutStream State Machine. |
Definition at line 250 of file CrFwOutStream.c.
CrFwGroup_t CrFwOutStreamGetNOfGroups | ( | FwSmDesc_t | smDesc | ) |
Return the number of groups associated to the OutStream.
smDesc | the descriptor of the OutStream State Machine. |
Definition at line 279 of file CrFwOutStream.c.
CrFwCounterU1_t CrFwOutStreamGetNOfPendingPckts | ( | FwSmDesc_t | smDesc | ) |
Return the number of packets currently in the packet queue of an OutStream.
smDesc | the descriptor of the OutStream State Machine. |
Definition at line 272 of file CrFwOutStream.c.
CrFwCounterU1_t CrFwOutStreamGetPcktQueueSize | ( | FwSmDesc_t | smDesc | ) |
Return the size of the packet queue of the OutStream.
smDesc | the descriptor of the OutStream State Machine. |
Definition at line 285 of file CrFwOutStream.c.
CrFwSeqCnt_t CrFwOutStreamGetSeqCnt | ( | FwSmDesc_t | smDesc, |
CrFwGroup_t | group | ||
) |
Return the value of the sequence counter for one of the groups maintained by an OutStream.
The group identifier is passed as an argument to the function call. No check is performed on the validity of the group identifier.
smDesc | the descriptor of the OutStream State Machine. |
group | the identifier of the group |
Definition at line 257 of file CrFwOutStream.c.
CrFwBool_t CrFwOutStreamIsInBuffering | ( | FwSmDesc_t | smDesc | ) |
Return true if the argument OutStream is in state BUFFERING.
smDesc | the descriptor of the Base State Machine of the OutStream |
Definition at line 221 of file CrFwOutStream.c.
CrFwBool_t CrFwOutStreamIsInReady | ( | FwSmDesc_t | smDesc | ) |
Return true if the argument OutStream is in state READY.
smDesc | the descriptor of the Base State Machine of the OutStream |
Definition at line 216 of file CrFwOutStream.c.
FwSmDesc_t CrFwOutStreamMake | ( | CrFwInstanceId_t | outStreamId | ) |
Factory function to retrieve the i-th OutStream State Machine instance.
The first time this function is called with a certain value of the argument i, it creates the i-th OutStream State Machine instance. Subsequent calls returns the same instance.
The OutStream identifier i must be in the range: [0, CR_FW_NOF_OUTSTREAM
-1]. If the identifier is out of range, the function returns NULL and sets the application error code to: crOutStreamIllId
.
The first time this function is called with a certain value of i, it returns an OutStream State Machine which has been started but which still needs to be initialized and configured.
outStreamId | the identifier of the Base State Machine of the OutStream |
Definition at line 131 of file CrFwOutStream.c.
void CrFwOutStreamSend | ( | FwSmDesc_t | smDesc, |
CrFwPckt_t | pckt | ||
) |
Send a packet to the OutStream.
This function hands over the argument packet to the OutStream and then it sends command "Send" to its state machine. This causes the OutStream to try to send the packet to the destination associated to the OutStream. If the middleware is not ready to accept the packet, then a copy of the packet is made and is stored in the OutStream's Packet Queue from where it will be sent to the middleware at a later time. If the packet copy cannot be done because no more free packets are available, error crOutStreamNoMorePckt
is generated. If the Packet Queue is full, the packet is released and error crOutStreamPQFull
is generated.
If packet cannot be sent to the middleware (or to make a copy of the packet and buffer the copy internally if the middleware is currently not available).
The argument pckt
is a pointer to the out-going packet. This pointer is "owned" by the caller of function CrFwOutStreamSend
who remains responsible for releasing it when it is no longer needed. The function only uses the pointer during its execution.
smDesc | the descriptor of the OutStream State Machine. |
pckt | the packet to be sent by the OutStream |
Definition at line 237 of file CrFwOutStream.c.
void CrFwOutStreamSetSeqCnt | ( | FwSmDesc_t | smDesc, |
CrFwGroup_t | group, | ||
CrFwSeqCnt_t | seqCnt | ||
) |
Sets the value of the sequence counter for one of the groups maintained by an OutStream.
The group identifier is passed as an argument to the function call. No check is performed on the validity of the group identifier.
smDesc | the descriptor of the OutStream State Machine. |
group | the identifier of the group |
seqCnt | the OutStream sequence counter |
Definition at line 264 of file CrFwOutStream.c.
|
static |
Function which enqueues a packet on the packet queue.
The packet to be enqueued is taken from the data associated to OutStream State Machine. This function is used as the transition action for the self-transition on the BUFFERING state and as a transition action on the transition out of the READY state. If the packet cannot be enqueued because the packet queue is full, an error is generated and the packet is released.
smDesc | the state machine descriptor |
Definition at line 323 of file CrFwOutStream.c.
|
static |
Function which flushes the packet queue.
This function is used as the transition action on the transition out of state BUFFERING.
smDesc | the state machine descriptor |
Definition at line 346 of file CrFwOutStream.c.
|
static |
Function which checks if the packet queue is empty.
This function is used as guard for the transition into state READY.
smDesc | the state machine descriptor |
Definition at line 425 of file CrFwOutStream.c.
|
static |
Function which resets to 1 the sequence counter of an out-going packet.
This function is used as transition action on the transition out of the initial state.
smDesc | the state machine descriptor |
Definition at line 378 of file CrFwOutStream.c.
|
static |
Function which first attempts to hand over a packet to the middleware and, if this fails, it pushes it on the packet queue.
This function is used as the transition action out of state READY.
smDesc | the state machine descriptor |
Definition at line 387 of file CrFwOutStream.c.
|
static |
Base OutStream from which all other OutStreams are derived.
Definition at line 47 of file CrFwOutStream.c.
|
static |
The component-specific data for the OutStream State Machines and their Procedures.
Definition at line 83 of file CrFwOutStream.c.
|
static |
The functions implementing the configuration actions for the InStream components.
Definition at line 71 of file CrFwOutStream.c.
|
static |
The functions implementing the configuration checks for the InStream components.
Definition at line 68 of file CrFwOutStream.c.
|
static |
The base data structures for the OutStream State Machines and their Procedures.
Definition at line 80 of file CrFwOutStream.c.
|
static |
The descriptors of the OutStream State Machines.
Definition at line 77 of file CrFwOutStream.c.
|
static |
The destinations associated to the OutStream components.
Definition at line 53 of file CrFwOutStream.c.
|
static |
The functions implementing the initialization actions for the InStream components.
Definition at line 65 of file CrFwOutStream.c.
|
static |
The functions implementing the initialization checks for the InStream components.
Definition at line 62 of file CrFwOutStream.c.
|
static |
The number of groups associated to the OutStream components.
Definition at line 56 of file CrFwOutStream.c.
|
static |
The sizes of the packet queues in the OutStream components.
Definition at line 50 of file CrFwOutStream.c.
|
static |
The functions implementing the shutdown actions for the InStream components.
Definition at line 74 of file CrFwOutStream.c.