1 /*************************************************************************//**
3 * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 ****************************************************************************/
18 /**************************************************************************//**
20 * A simple double-linked list.
22 * @note No thread protection so you will need to use appropriate
23 * synchronization if use spans multiple threads.
25 ****************************************************************************/
27 #ifndef DOUBLE_LIST_INCLUDED
28 #define DOUBLE_LIST_INCLUDED
30 typedef struct dlist_item
32 struct dlist_item * previous;
33 struct dlist_item * next;
37 /**************************************************************************//**
38 * Double-linked list structure
39 *****************************************************************************/
47 void dlist_initialize(DLIST * list);
48 void * dlist_pop_last(DLIST * list);
49 void dlist_push_first(DLIST * list, void * item);
50 void dlist_push_last(DLIST * list, void * item);
51 DLIST_ITEM * dlist_get_first(DLIST * list);
52 DLIST_ITEM * dlist_get_last(DLIST * list);
53 DLIST_ITEM * dlist_get_next(DLIST_ITEM * item);
54 int dlist_is_empty(DLIST * list);
55 int dlist_count(DLIST * list);