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);
30 struct queue *queue_new(void);
31 void queue_destroy(struct queue *queue, queue_destroy_func_t destroy);
33 bool queue_push_tail(struct queue *queue, void *data);
34 bool queue_push_head(struct queue *queue, void *data);
35 void *queue_pop_head(struct queue *queue);
36 void *queue_peek_head(struct queue *queue);
37 void *queue_peek_tail(struct queue *queue);
39 typedef void (*queue_foreach_func_t)(void *data, void *user_data);
41 void queue_foreach(struct queue *queue, queue_foreach_func_t function,
44 typedef bool (*queue_match_func_t)(const void *a, const void *b);
46 void *queue_find(struct queue *queue, queue_match_func_t function,
49 void *queue_remove_if(struct queue *queue, queue_match_func_t function,
51 unsigned int queue_remove_all(struct queue *queue, queue_match_func_t function,
52 void *user_data, queue_destroy_func_t destroy);
54 unsigned int queue_length(struct queue *queue);
55 bool queue_isempty(struct queue *queue);