blob: d3f8c20ca65f3e4e00cafdb138ed4737138d8840 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
// SPDX-License-Identifier: LGPL-2.1-or-later
/*
* This file is part of the PCEPlib, a PCEP protocol library.
*
* Copyright (C) 2020 Volta Networks https://voltanet.io/
*
* Author : Brady Johnson <brady@voltanet.io>
*
*/
#ifndef INCLUDE_PCEPUTILSQUEUE_H_
#define INCLUDE_PCEPUTILSQUEUE_H_
typedef struct queue_node_ {
struct queue_node_ *next_node;
void *data;
} queue_node;
typedef struct queue_handle_ {
queue_node *head;
queue_node *tail;
unsigned int num_entries;
/* Set to 0 to disable */
unsigned int max_entries;
} queue_handle;
queue_handle *queue_initialize(void);
queue_handle *queue_initialize_with_size(unsigned int max_entries);
void queue_destroy(queue_handle *handle);
void queue_destroy_with_data(queue_handle *handle);
queue_node *queue_enqueue(queue_handle *handle, void *data);
void *queue_dequeue(queue_handle *handle);
#endif /* INCLUDE_PCEPUTILSQUEUE_H_ */
|