]>
Commit | Line | Data |
---|---|---|
74971473 JG |
1 | /* |
2 | * This file is part of the PCEPlib, a PCEP protocol library. | |
3 | * | |
4 | * Copyright (C) 2020 Volta Networks https://voltanet.io/ | |
5 | * | |
6 | * This library is free software; you can redistribute it and/or | |
7 | * modify it under the terms of the GNU Lesser General Public | |
8 | * License as published by the Free Software Foundation; either | |
9 | * version 2 of the License, or (at your option) any later version. | |
10 | * | |
11 | * This library is distributed in the hope that it will be useful, | |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
14 | * Lesser General Public License for more details. | |
15 | * | |
16 | * You should have received a copy of the GNU General Public License | |
17 | * along with this program. If not, see <https://www.gnu.org/licenses/>. | |
18 | * | |
19 | * Author : Brady Johnson <brady@voltanet.io> | |
20 | * | |
21 | */ | |
22 | ||
23 | ||
24 | #ifndef INCLUDE_PCEPUTILSQUEUE_H_ | |
25 | #define INCLUDE_PCEPUTILSQUEUE_H_ | |
26 | ||
27 | typedef struct queue_node_ { | |
28 | struct queue_node_ *next_node; | |
29 | void *data; | |
30 | ||
31 | } queue_node; | |
32 | ||
33 | typedef struct queue_handle_ { | |
34 | queue_node *head; | |
35 | queue_node *tail; | |
36 | unsigned int num_entries; | |
37 | /* Set to 0 to disable */ | |
38 | unsigned int max_entries; | |
39 | ||
40 | } queue_handle; | |
41 | ||
42 | queue_handle *queue_initialize(void); | |
43 | queue_handle *queue_initialize_with_size(unsigned int max_entries); | |
44 | void queue_destroy(queue_handle *handle); | |
45 | void queue_destroy_with_data(queue_handle *handle); | |
46 | queue_node *queue_enqueue(queue_handle *handle, void *data); | |
47 | void *queue_dequeue(queue_handle *handle); | |
48 | ||
49 | #endif /* INCLUDE_PCEPUTILSQUEUE_H_ */ |