Add OpenSSL linking exemption to GPL license.
[radsecproxy.git] / list.h
1 /* Copyright (c) 2006-2009, Stig Venaas, UNINETT AS.
2  * Copyright (c) 2010, UNINETT AS, NORDUnet A/S.
3  * Copyright (c) 2010-2012, NORDUnet A/S. */
4 /* See LICENSE for licensing information. */
5
6 #ifdef SYS_SOLARIS9
7 #include <sys/inttypes.h>
8 #else
9 #include <stdint.h>
10 #endif
11
12 struct list_node {
13     struct list_node *next;
14     void *data;
15 };
16
17 struct list {
18     struct list_node *first, *last;
19     uint32_t count;
20 };
21
22 /* allocates and initialises list structure; returns NULL if malloc fails */
23 struct list *list_create();
24
25 /* frees all memory associated with the list */
26 void list_destroy(struct list *list);
27
28 /* appends entry to list; returns 1 if ok, 0 if malloc fails */
29 int list_push(struct list *list, void *data);
30
31 /* removes first entry from list and returns data */
32 void *list_shift(struct list *list);
33
34 /* removes first entry with matching data pointer */
35 void list_removedata(struct list *list, void *data);
36
37 /* returns first node */
38 struct list_node *list_first(struct list *list);
39
40 /* returns the next node after the argument */
41 struct list_node *list_next(struct list_node *node);
42
43 /* returns number of nodes */
44 uint32_t list_count(struct list *list);
45
46 /* Local Variables: */
47 /* c-file-style: "stroustrup" */
48 /* End: */