EDGESEC  0.1.0-alpha.0+sha.ca29a8277b72f80785649ea9ef9cd7edf642d939
Secure router - reference implementation
squeue.h
Go to the documentation of this file.
1 
11 #ifndef SQUEUE_H
12 #define SQUEUE_H
13 
14 #include <sys/types.h> // For ssize_t
15 
16 #include <list.h>
17 
18 #include "./attributes.h"
19 
24 struct string_queue {
25  char *str;
26  ssize_t max_length;
27  struct dl_list list;
28 };
29 
37 
45 int push_string_queue(struct string_queue *queue, const char *str);
46 
55 int pop_string_queue(struct string_queue *queue, char **str);
56 
65 int peek_string_queue(const struct string_queue *queue, char **str);
66 
73 void empty_string_queue(struct string_queue *queue, ssize_t count);
74 
80 void free_string_queue_el(struct string_queue *el);
81 
88 ssize_t get_string_queue_length(const struct string_queue *queue);
89 
95 void free_string_queue(struct string_queue *queue);
96 
105 __must_free char *concat_string_queue(const struct string_queue *queue,
106  ssize_t count);
107 #endif
File containing macros for compiler attributes, if they are supported.
#define __must_free
Definition: attributes.h:94
void free_string_queue(struct string_queue *queue)
Frees the string queue.
Definition: squeue.c:114
int pop_string_queue(struct string_queue *queue, char **str)
Extract the first string from the string queueu.
Definition: squeue.c:90
void free_string_queue_el(struct string_queue *el)
Delete a string entry.
Definition: squeue.c:67
int peek_string_queue(const struct string_queue *queue, char **str)
Peek the first string from the string queueu.
Definition: squeue.c:75
int push_string_queue(struct string_queue *queue, const char *str)
Pushes a string in the string queue.
Definition: squeue.c:34
void empty_string_queue(struct string_queue *queue, ssize_t count)
Empty a string entry.
Definition: squeue.c:102
__must_free char * concat_string_queue(const struct string_queue *queue, ssize_t count)
Concat the first count string in the queue.
Definition: squeue.c:125
ssize_t get_string_queue_length(const struct string_queue *queue)
Returns the string queue length.
Definition: squeue.c:121
struct string_queue * init_string_queue(ssize_t max_length)
Initialises and empty string queue.
Definition: squeue.c:18
String queue structure definition.
Definition: squeue.h:24
char * str
Definition: squeue.h:25
struct dl_list list
Definition: squeue.h:27
ssize_t max_length
Definition: squeue.h:26