1/*
2 * queue.h, queue
3 *
4 * Copyright (c) 2009-2010 Wind River Systems, Inc.
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18
19#ifndef __QUEUE_H
20#define __QUEUE_H
21
22#include "list.h"
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
28struct queue {
29	struct list *head;
30	struct list *tail;
31	int  length;
32};
33
34void __queue_init(struct queue *queue);
35struct queue *queue_alloc(void);
36/* FIXME */
37inline void __queue_free(struct queue *queue);
38/* FIXME */
39void queue_free_all(struct queue *queue);
40
41void __queue_push_head(struct queue *queue, struct list *entry);
42int queue_push_head(struct queue *queue, void *data);
43void __queue_push_tail(struct queue *queue, struct list *entry);
44int queue_push_tail(struct queue *queue, void *data);
45
46struct list *__queue_pop_head(struct queue *queue);
47void *queue_pop_head(struct queue *queue);
48struct list *__queue_pop_tail(struct queue *queue);
49void *queue_pop_tail(struct queue *queue);
50
51inline struct list *__queue_peek_head(struct queue *queue);
52inline struct list *__queue_peek_tail(struct queue *queue);
53inline void *queue_peek_head(struct queue *queue);
54inline void *queue_peek_tail(struct queue *queue);
55
56int queue_length(struct queue *queue);
57
58#ifdef __cplusplus
59} /* extern "C" */
60#endif
61
62#endif /* __QUEUE_H */
63