EDGESEC  0.1.0-alpha.0+sha.ca29a8277b72f80785649ea9ef9cd7edf642d939
Secure router - reference implementation
packet_queue.h
Go to the documentation of this file.
1 
11 #ifndef PACKET_QUEUE_H
12 #define PACKET_QUEUE_H
13 
14 #include <stdio.h>
15 #include <stdlib.h>
16 #include <string.h>
17 
18 #include <list.h>
19 #include "packet_decoder.h"
20 
25 struct packet_queue {
26  struct tuple_packet tp;
27  struct dl_list list;
28 };
29 
35 struct packet_queue *init_packet_queue(void);
36 
44 struct packet_queue *push_packet_queue(struct packet_queue *queue,
45  struct tuple_packet tp);
46 
53 struct packet_queue *pop_packet_queue(struct packet_queue *queue);
54 
60 void free_packet_tuple(struct tuple_packet *tp);
61 
67 void free_packet_queue_el(struct packet_queue *el);
68 
75 ssize_t get_packet_queue_length(struct packet_queue *queue);
76 
82 void free_packet_queue(struct packet_queue *queue);
83 
90 int is_packet_queue_empty(struct packet_queue *queue);
91 
92 static inline void free_packet(void *elt) {
93  free_packet_tuple((struct tuple_packet *)elt);
94 }
95 #endif
File containing the definition of the packet decoder utilities.
int is_packet_queue_empty(struct packet_queue *queue)
Checks if packet queue is empty.
Definition: packet_queue.c:89
ssize_t get_packet_queue_length(struct packet_queue *queue)
Returns the packet queue length.
Definition: packet_queue.c:85
void free_packet_queue_el(struct packet_queue *el)
Delete a packet entry.
Definition: packet_queue.c:69
struct packet_queue * push_packet_queue(struct packet_queue *queue, struct tuple_packet tp)
Pushes a packet in the packet queue.
Definition: packet_queue.c:35
void free_packet_tuple(struct tuple_packet *tp)
Frees an allocated packet tuple.
Definition: packet_queue.c:62
void free_packet_queue(struct packet_queue *queue)
Frees the packet queue.
Definition: packet_queue.c:76
struct packet_queue * init_packet_queue(void)
Initialises and empty packet queue.
Definition: packet_queue.c:21
struct packet_queue * pop_packet_queue(struct packet_queue *queue)
Extract the first packet from the packet queueu.
Definition: packet_queue.c:55
Packet queueu structure definition.
Definition: packet_queue.h:25
struct tuple_packet tp
Definition: packet_queue.h:26
struct dl_list list
Definition: packet_queue.h:27
Definition: packet_decoder.h:40