Initial VES for DANOS vRouter
[demo.git] / vnfs / VESreporting_vFW5.0_DANOS / evel / evel-library / code / evel_library / double_list.h
1 /*************************************************************************//**
2  *
3  * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
4  *
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
9  *
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.
15  *
16  ****************************************************************************/
17
18 /**************************************************************************//**
19  * @file
20  * A simple double-linked list.
21  *
22  * @note  No thread protection so you will need to use appropriate
23  * synchronization if use spans multiple threads.
24  *
25  ****************************************************************************/
26
27 #ifndef DOUBLE_LIST_INCLUDED
28 #define DOUBLE_LIST_INCLUDED
29
30 typedef struct dlist_item
31 {
32   struct dlist_item * previous;
33   struct dlist_item * next;
34   void * item;
35 } DLIST_ITEM;
36
37 /**************************************************************************//**
38  * Double-linked list structure
39  *****************************************************************************/
40 typedef struct dlist
41 {
42   DLIST_ITEM * head;
43   DLIST_ITEM * tail;
44 } DLIST;
45
46
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);
56
57 #endif