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

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

#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <pcap.h>
#include <string.h>
#include <list.h>
#include "../../../utils/attributes.h"
Include dependency graph for pcap_queue.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  pcap_queue
 pcap queueu structure definition More...
 

Macros

#define __must_free_pcap_queue   __must_check
 

Functions

struct pcap_queuepush_pcap_queue (struct pcap_queue *queue, struct pcap_pkthdr *header, uint8_t *packet)
 Pushes a packet in the pcap queue. More...
 
struct pcap_queuepop_pcap_queue (struct pcap_queue *queue)
 Extract the first pcap element from the pcap queueu. More...
 
void free_pcap_queue_el (struct pcap_queue *el)
 Delete a pcap entry. More...
 
ssize_t get_pcap_queue_length (struct pcap_queue *queue)
 Returns the pcap queue length. More...
 
void free_pcap_queue (struct pcap_queue *queue)
 Frees the pcap queue. More...
 
int is_pcap_queue_empty (struct pcap_queue *queue)
 Checks if pcap queue is empty. More...
 
__must_free_pcap_queue struct pcap_queueinit_pcap_queue (void)
 Initialises an empty pcap queue. More...
 

Detailed Description

File containing the definition of the pcap queue utilities.

Author
Alexandru Mereacre
Date
2021

Macro Definition Documentation

◆ __must_free_pcap_queue

#define __must_free_pcap_queue   __must_check

Function Documentation

◆ free_pcap_queue()

void free_pcap_queue ( struct pcap_queue queue)

Frees the pcap queue.

Parameters
queueThe pointer to the pcap queue

◆ free_pcap_queue_el()

void free_pcap_queue_el ( struct pcap_queue el)

Delete a pcap entry.

Parameters
elThe pcap queue entry

◆ get_pcap_queue_length()

ssize_t get_pcap_queue_length ( struct pcap_queue queue)

Returns the pcap queue length.

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

◆ init_pcap_queue()

__must_free_pcap_queue struct pcap_queue* init_pcap_queue ( void  )

Initialises an empty pcap queue.

Returns
Returned initialised empty pcap queue, or NULL on error. You must free this using free_pcap_queue().

◆ is_pcap_queue_empty()

int is_pcap_queue_empty ( struct pcap_queue queue)

Checks if pcap queue is empty.

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

◆ pop_pcap_queue()

struct pcap_queue* pop_pcap_queue ( struct pcap_queue queue)

Extract the first pcap element from the pcap queueu.

Parameters
queueThe pcap queue
Returns
struct pcap_queue* The returned pcap (NULL if queue is empty)

◆ push_pcap_queue()

struct pcap_queue* push_pcap_queue ( struct pcap_queue queue,
struct pcap_pkthdr *  header,
uint8_t *  packet 
)

Pushes a packet in the pcap queue.

Parameters
queueThe pcap queue
headerThe pcap header
packetThe pcap packet
Returns
struct pcap_queue* Returned the pcap queue element