CORDET Framework - C2 Implementation
CrFwPcktQueue.c File Reference

Implementation of Packet Queue Management. More...

Go to the source code of this file.

Functions

CrFwPckt_t CrFwPcktQueuePop (CrFwPcktQueue_t pcktQueue)
 Pop a packet from the packet queue. More...
 
CrFwPckt_t CrFwPcktQueueGetOldest (CrFwPcktQueue_t pcktQueue)
 Return the oldest packet from the queue without removing it from the queue. More...
 
CrFwBool_t CrFwPcktQueuePush (CrFwPcktQueue_t pcktQueue, CrFwPckt_t pckt)
 Push a packet onto the packet queue. More...
 
void CrFwPcktQueueReset (CrFwPcktQueue_t pcktQueue)
 Reset the packet queue. More...
 
void CrFwPcktQueueInit (CrFwPcktQueue_t pcktQueue, CrFwCounterU1_t size)
 Initializes the packet queue. More...
 
void CrFwPcktQueueShutdown (CrFwPcktQueue_t pcktQueue)
 Shutdown the packet queue. More...
 
CrFwBool_t CrFwPcktQueueIsEmpty (CrFwPcktQueue_t pcktQueue)
 Return 1 if the packet queue is empty and 0 otherwise. More...
 
CrFwCounterU1_t CrFwPcktQueueGetNOfPckts (CrFwPcktQueue_t pcktQueue)
 Return the number of packets currently in the packet queue. More...
 
CrFwCounterU1_t CrFwPcktQueueGetSize (CrFwPcktQueue_t pcktQueue)
 Return the size of the packet queue. More...
 

Detailed Description

Implementation of Packet Queue Management.

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 CrFwPcktQueue.c.

Function Documentation

CrFwCounterU1_t CrFwPcktQueueGetNOfPckts ( CrFwPcktQueue_t  pcktQueue)

Return the number of packets currently in the packet queue.

Parameters
pcktQueuethe packet queue
Returns
the number of packets currently in the packet queue.

Definition at line 123 of file CrFwPcktQueue.c.

CrFwPckt_t CrFwPcktQueueGetOldest ( CrFwPcktQueue_t  pcktQueue)

Return the oldest packet from the queue without removing it from the queue.

If the packet queue is not empty, this function returns the oldest packet in the queue but does not remove the packet from queue. If the packet queue is empty, this function returns NULL.

Parameters
pcktQueuethe packet queue.
Returns
the oldest packet on the packet or NULL if the packet queue was empty.

Definition at line 44 of file CrFwPcktQueue.c.

CrFwCounterU1_t CrFwPcktQueueGetSize ( CrFwPcktQueue_t  pcktQueue)

Return the size of the packet queue.

Parameters
pcktQueuethe packet queue
Returns
the packet queue size.

Definition at line 135 of file CrFwPcktQueue.c.

void CrFwPcktQueueInit ( CrFwPcktQueue_t  pcktQueue,
CrFwCounterU1_t  size 
)

Initializes the packet queue.

This function allocates the memory for the packet queue and then initializes it to represent an empty packet queue. The initialization of a packet queue can only be done once. If the packet queue has already been initialized, this function returns without doing anything. The situation where the memory allocation operation for the packet queue fails is not handled and will result in undefined behaviour (probably, a run-time exception).

Parameters
pcktQueuethe packet queue.
sizethe size of the packet queue

Definition at line 95 of file CrFwPcktQueue.c.

CrFwBool_t CrFwPcktQueueIsEmpty ( CrFwPcktQueue_t  pcktQueue)

Return 1 if the packet queue is empty and 0 otherwise.

Parameters
pcktQueuethe packet queue.
Returns
1 if the packet queue is empty and 0 otherwise.

Definition at line 118 of file CrFwPcktQueue.c.

CrFwPckt_t CrFwPcktQueuePop ( CrFwPcktQueue_t  pcktQueue)

Pop a packet from the packet queue.

If the packet queue is not empty, this function returns the oldest packet in the queue. If the packet queue is empty, this function returns NULL.

Parameters
pcktQueuethe packet queue.
Returns
the oldest packet on the packet or NULL if the packet queue was empty.

Definition at line 25 of file CrFwPcktQueue.c.

CrFwBool_t CrFwPcktQueuePush ( CrFwPcktQueue_t  pcktQueue,
CrFwPckt_t  pckt 
)

Push a packet onto the packet queue.

If the packet queue is not full, this function adds the packet to the packet queue and return 1. If the packet queue is full, this function does nothing and returns 0.

Parameters
pcktQueuethe packet queue
pcktthe packet to be pushed onto the packet queue.
Returns
1 if the push operation was successful, or 0 if the push operation failed because the packet queue was full.

Definition at line 52 of file CrFwPcktQueue.c.

void CrFwPcktQueueReset ( CrFwPcktQueue_t  pcktQueue)

Reset the packet queue.

This function clears all entries in the packet queue and releases all packets which are in the packet queue.

Parameters
pcktQueuethe packet queue.

Definition at line 73 of file CrFwPcktQueue.c.

void CrFwPcktQueueShutdown ( CrFwPcktQueue_t  pcktQueue)

Shutdown the packet queue.

This function resets the packet queue (using function CrFwPcktQueueReset) and then releases the memory which allocated for the packet queue through function CrFwPcktQueueInit.

Parameters
pcktQueuethe packet queue.

Definition at line 111 of file CrFwPcktQueue.c.

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