aklog-heimdal-integration-20050630
[openafs.git] / src / aklog / linked_list.h
1 /* 
2  * $Id$
3  *
4  * This is the header file for a general list linked package.
5  * 
6  * Copyright 1990,1991 by the Massachusetts Institute of Technology
7  * For distribution and copying rights, see the file "mit-copyright.h"
8  */
9
10 #ifndef __LINKED_LIST_H__
11 #define __LINKED_LIST_H__
12
13 #if !defined(lint) && !defined(SABER)
14 static char *rcsid_linked_list_h = "$Id$";
15 #endif /* lint || SABER */
16
17 #define LL_SUCCESS 0
18 #define LL_FAILURE -1
19
20 typedef struct _ll_node {
21     struct _ll_node *prev;
22     struct _ll_node *next;
23     char *data;
24 } ll_node;
25
26 typedef struct {
27     ll_node *first;
28     ll_node *last;
29     int nelements;
30 } linked_list;
31
32 typedef enum {ll_head, ll_tail} ll_end;
33 typedef enum {ll_s_add, ll_s_check} ll_s_action;
34
35
36 /*
37  * ll_add_data just assigns the data field of node to be d.
38  * If this were c++, this would be an inline function and d
39  * would be a void *, but we'll take what we can get...
40  */
41 #define ll_add_data(n,d) (((n)->data)=(char*)(d))
42
43 #ifdef __STDC__
44
45 void ll_init(linked_list *list);
46 ll_node *ll_add_node(linked_list *list, ll_end which_end);
47 int ll_delete_node(linked_list *list, ll_node *node);
48 int ll_string(linked_list *, ll_s_action, char *);
49
50 #else /* __STDC__ */
51
52 void ll_init();
53 ll_node *ll_add_node();
54 int ll_delete_node();
55 int ll_string();
56
57 #endif /* __STDC__ */
58
59 #endif /* __LINKED_LIST_H__ */