]> git.proxmox.com Git - mirror_frr.git/blame - lib/pqueue.h
plist: Delete prefix-list by sequence number
[mirror_frr.git] / lib / pqueue.h
CommitLineData
6708fa3c 1/* Priority queue functions.
896014f4
DL
2 * Copyright (C) 2003 Yasuhiro Ohara
3 *
4 * This file is part of GNU Zebra.
5 *
6 * GNU Zebra is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published
8 * by the Free Software Foundation; either version 2, or (at your
9 * option) any later version.
10 *
11 * GNU Zebra is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; see the file COPYING; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */
6708fa3c 20
21#ifndef _ZEBRA_PQUEUE_H
22#define _ZEBRA_PQUEUE_H
23
5e244469
RW
24#ifdef __cplusplus
25extern "C" {
26#endif
27
d62a17ae 28struct pqueue {
29 void **array;
30 int array_size;
31 int size;
32
33 int (*cmp)(void *, void *);
34 void (*update)(void *node, int actual_position);
6708fa3c 35};
36
37#define PQUEUE_INIT_ARRAYSIZE 32
38
d62a17ae 39extern struct pqueue *pqueue_create(void);
40extern void pqueue_delete(struct pqueue *queue);
6708fa3c 41
d62a17ae 42extern void pqueue_enqueue(void *data, struct pqueue *queue);
43extern void *pqueue_dequeue(struct pqueue *queue);
44extern void pqueue_remove_at(int index, struct pqueue *queue);
45extern void pqueue_remove(void *data, struct pqueue *queue);
6708fa3c 46
d62a17ae 47extern void trickle_down(int index, struct pqueue *queue);
48extern void trickle_up(int index, struct pqueue *queue);
c3c07f28 49
5e244469
RW
50#ifdef __cplusplus
51}
52#endif
53
6708fa3c 54#endif /* _ZEBRA_PQUEUE_H */