EDGESEC  0.1.0-alpha.0+sha.ca29a8277b72f80785649ea9ef9cd7edf642d939
Secure router - reference implementation
Data Structures | Functions
packet_queue.h File Reference

File containing the definition of the packet queue utilities. More...

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <list.h>
#include "packet_decoder.h"
Include dependency graph for packet_queue.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  packet_queue
 Packet queueu structure definition. More...
 

Functions

struct packet_queueinit_packet_queue (void)
 Initialises and empty packet queue. More...
 
struct packet_queuepush_packet_queue (struct packet_queue *queue, struct tuple_packet tp)
 Pushes a packet in the packet queue. More...
 
struct packet_queuepop_packet_queue (struct packet_queue *queue)
 Extract the first packet from the packet queueu. More...
 
void free_packet_tuple (struct tuple_packet *tp)
 Frees an allocated packet tuple. More...
 
void free_packet_queue_el (struct packet_queue *el)
 Delete a packet entry. More...
 
ssize_t get_packet_queue_length (struct packet_queue *queue)
 Returns the packet queue length. More...
 
void free_packet_queue (struct packet_queue *queue)
 Frees the packet queue. More...
 
int is_packet_queue_empty (struct packet_queue *queue)
 Checks if packet queue is empty. More...
 

Detailed Description

File containing the definition of the packet queue utilities.

Author
Alexandru Mereacre
Date
2021

Function Documentation

◆ free_packet_queue()

void free_packet_queue ( struct packet_queue queue)

Frees the packet queue.

Parameters
queueThe pointer to the packet queue

◆ free_packet_queue_el()

void free_packet_queue_el ( struct packet_queue el)

Delete a packet entry.

Parameters
elThe packet queue entry

◆ free_packet_tuple()

void free_packet_tuple ( struct tuple_packet tp)

Frees an allocated packet tuple.

Parameters
tpThe pointer to the packet tuple

◆ get_packet_queue_length()

ssize_t get_packet_queue_length ( struct packet_queue queue)

Returns the packet queue length.

Parameters
queueThe pointer to the packet queue
Returns
ssize_t The packet queue length

◆ init_packet_queue()

struct packet_queue* init_packet_queue ( void  )

Initialises and empty packet queue.

Returns
struct packet_queue* Returned initialised empty packet queue

◆ is_packet_queue_empty()

int is_packet_queue_empty ( struct packet_queue queue)

Checks if packet queue is empty.

Parameters
queueThe pointer to the packet queue
Returns
1, is empty, 0 otherwise, -1 for error

◆ pop_packet_queue()

struct packet_queue* pop_packet_queue ( struct packet_queue queue)

Extract the first packet from the packet queueu.

Parameters
queueThe packet queue
Returns
struct packet_queue* The returned packet (NULL if queue is empty)

◆ push_packet_queue()

struct packet_queue* push_packet_queue ( struct packet_queue queue,
struct tuple_packet  tp 
)

Pushes a packet in the packet queue.

Parameters
queueThe packet queue
tpThe packet tuple
Returns
struct packet_queue* Returned the packet queue element