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