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

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

#include <sys/types.h>
#include <list.h>
#include "./attributes.h"
Include dependency graph for squeue.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  string_queue
 String queue structure definition. More...
 

Functions

struct string_queueinit_string_queue (ssize_t max_length)
 Initialises and empty string queue. More...
 
int push_string_queue (struct string_queue *queue, const char *str)
 Pushes a string in the string queue. More...
 
int pop_string_queue (struct string_queue *queue, char **str)
 Extract the first string from the string queueu. More...
 
int peek_string_queue (const struct string_queue *queue, char **str)
 Peek the first string from the string queueu. More...
 
void empty_string_queue (struct string_queue *queue, ssize_t count)
 Empty a string entry. More...
 
void free_string_queue_el (struct string_queue *el)
 Delete a string entry. More...
 
ssize_t get_string_queue_length (const struct string_queue *queue)
 Returns the string queue length. More...
 
void free_string_queue (struct string_queue *queue)
 Frees the string queue. More...
 
__must_free char * concat_string_queue (const struct string_queue *queue, ssize_t count)
 Concat the first count string in the queue. More...
 

Detailed Description

File containing the definition of the string queue utilities.

Author
Alexandru Mereacre
Date
2021

Function Documentation

◆ concat_string_queue()

__must_free char* concat_string_queue ( const struct string_queue queue,
ssize_t  count 
)

Concat the first count string in the queue.

Parameters
[in]queueThe pointer to the string queue
countNumber of queue strings to concat, if -1 concat the entire queue
Returns
char* The pointer to the concatenated string, NULL for failure or empty queue

◆ empty_string_queue()

void empty_string_queue ( struct string_queue queue,
ssize_t  count 
)

Empty a string entry.

Parameters
[in,out]queueThe string queue
countNumber of elements to remove, -1 for all

◆ free_string_queue()

void free_string_queue ( struct string_queue queue)

Frees the string queue.

Parameters
[in]queueThe pointer to the string queue

◆ free_string_queue_el()

void free_string_queue_el ( struct string_queue el)

Delete a string entry.

Parameters
[in]elThe string queue entry

◆ get_string_queue_length()

ssize_t get_string_queue_length ( const struct string_queue queue)

Returns the string queue length.

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

◆ init_string_queue()

struct string_queue* init_string_queue ( ssize_t  max_length)

Initialises and empty string queue.

Parameters
max_lengthMaximum queue size, -1 for unlimited
Returns
struct string_queue* Returned initialised empty string queue

◆ peek_string_queue()

int peek_string_queue ( const struct string_queue queue,
char **  str 
)

Peek the first string from the string queueu.

Parameters
[in]queueThe string queue
[out]strThe returned string. Please free() this variable when done with it.
Returns
int 0 on success, -1 on failure

◆ pop_string_queue()

int pop_string_queue ( struct string_queue queue,
char **  str 
)

Extract the first string from the string queueu.

Parameters
[in,out]queueThe string queue
[out]strThe returned string. Please free() this variable when done with it.
Returns
int 0 on success, -1 on failure

◆ push_string_queue()

int push_string_queue ( struct string_queue queue,
const char *  str 
)

Pushes a string in the string queue.

Parameters
[in,out]queueThe string queue
[in]strThe string value
Returns
0 on success, -1 on failure