20 #include "../CrFwConstants.h"
31 oldestPckt = pcktQueue->
pckt[posOldest];
32 if (posOldest < (pcktQueue->
size-1))
54 pcktQueue->
pckt[0] = pckt;
80 for (i=pcktQueue->
oldestItem; i<pcktQueue->nextFreeItem; i++)
86 for (i=pcktQueue->
oldestItem; i<pcktQueue->size; i++)
98 if (pcktQueue->
pckt != NULL)
102 for (i=0; i<size; i++)
103 pcktQueue->
pckt[i] = NULL;
107 pcktQueue->
size = size;
113 free(pcktQueue->
pckt);
114 pcktQueue->
pckt = NULL;
137 return pcktQueue->
size;
unsigned char * CrFwPckt_t
Type for packets (see CrFwPckt.h).
int CrFwBool_t
Type used for boolean values (1 represent "true" and 0 represents "false").
Interface for creating and accessing a report or command packet.
void CrFwPcktRelease(CrFwPckt_t pckt)
Release function for command or report packets.
CrFwPckt_t CrFwPcktQueueGetOldest(CrFwPcktQueue_t pcktQueue)
Return the oldest packet from the queue without removing it from the queue.
CrFwBool_t CrFwPcktQueueIsEmpty(CrFwPcktQueue_t pcktQueue)
Return 1 if the packet queue is empty and 0 otherwise.
CrFwCounterU1_t CrFwPcktQueueGetSize(CrFwPcktQueue_t pcktQueue)
Return the size of the packet queue.
CrFwPckt_t CrFwPcktQueuePop(CrFwPcktQueue_t pcktQueue)
Pop a packet from the packet queue.
void CrFwPcktQueueReset(CrFwPcktQueue_t pcktQueue)
Reset the packet queue.
void CrFwPcktQueueInit(CrFwPcktQueue_t pcktQueue, CrFwCounterU1_t size)
Initializes the packet queue.
CrFwBool_t CrFwPcktQueuePush(CrFwPcktQueue_t pcktQueue, CrFwPckt_t pckt)
Push a packet onto the packet queue.
void CrFwPcktQueueShutdown(CrFwPcktQueue_t pcktQueue)
Shutdown the packet queue.
CrFwCounterU1_t CrFwPcktQueueGetNOfPckts(CrFwPcktQueue_t pcktQueue)
Return the number of packets currently in the packet queue.
Definition and management of packet queues.
unsigned char CrFwCounterU1_t
Type used for unsigned integers with a "short" range.
Descriptor for a Packet Queue (PQ) in an OutStream or InStream.
CrFwCounterU1_t oldestItem
The index of the oldest item in the PQ.
CrFwPckt_t * pckt
The list of packets in the PQ.
CrFwCounterU1_t nextFreeItem
Index of the next free slot in the PQ.
CrFwCounterU1_t size
The size of the PQ (the same as the size of the pckt array)
CrFwBool_t isEmpty
Flag indicating whether the PQ is empty.