3 * BlueZ - Bluetooth protocol stack for Linux
5 * Copyright (C) 2012-2014 Intel Corporation. All rights reserved.
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26 typedef void (*queue_destroy_func_t)(void *data);
32 struct queue_entry *next;
35 struct queue *queue_new(void);
36 void queue_destroy(struct queue *queue, queue_destroy_func_t destroy);
38 bool queue_push_tail(struct queue *queue, void *data);
39 bool queue_push_head(struct queue *queue, void *data);
40 bool queue_push_after(struct queue *queue, void *entry, void *data);
41 void *queue_pop_head(struct queue *queue);
42 void *queue_peek_head(struct queue *queue);
43 void *queue_peek_tail(struct queue *queue);
45 typedef void (*queue_foreach_func_t)(void *data, void *user_data);
47 void queue_foreach(struct queue *queue, queue_foreach_func_t function,
50 typedef bool (*queue_match_func_t)(const void *data, const void *match_data);
52 void *queue_find(struct queue *queue, queue_match_func_t function,
53 const void *match_data);
55 bool queue_remove(struct queue *queue, void *data);
56 void *queue_remove_if(struct queue *queue, queue_match_func_t function,
58 unsigned int queue_remove_all(struct queue *queue, queue_match_func_t function,
59 void *user_data, queue_destroy_func_t destroy);
61 const struct queue_entry *queue_get_entries(struct queue *queue);
63 unsigned int queue_length(struct queue *queue);
64 bool queue_isempty(struct queue *queue);