P2P Transmitter
Loading...
Searching...
No Matches
packet-queue.h
1#ifndef P2P_TRANSMITTER_PACKET_QUEUE_H
2#define P2P_TRANSMITTER_PACKET_QUEUE_H
3
4#include <stdint.h>
5#include "packet.h"
6
7typedef struct PacketQueueNode {
8 Packet* value;
9 struct PacketQueueNode* next;
10 struct PacketQueueNode* prev;
12
13typedef struct PacketQueue {
14 int length;
15 PacketQueueNode* first;
16 PacketQueueNode* last;
18
19// Initializes a Queue and returns the pointer
20PacketQueue* createQueue();
21
22// Initializes a QueueNode containing the given Packet and returns the pointer
23PacketQueueNode* createQueueNode(Packet* p);
24
25// Removes the first item from the queue and returns it
26PacketQueueNode* popQueue(PacketQueue* q);
27
28// Adds an item to the end of the queue
29void pushQueue(PacketQueue* q, PacketQueueNode* n);
30
31// Frees the associated Packet and itself
32void freePacketQueueNode(PacketQueueNode* n);
33
34// Frees all contained PacketQueueNodes, Packets, and itself
35void freePacketQueue(PacketQueue* q);
36
37// Prints each packet contained within the Queue
38void printPacketQueue(PacketQueue* q);
39
40#endif //P2P_TRANSMITTER_PACKET_QUEUE_H
Definition packet-queue.h:7
Definition packet-queue.h:13
Definition packet.h:20