00001
00005 #ifndef __ENET_LIST_H__
00006 #define __ENET_LIST_H__
00007
00008 #include <stdlib.h>
00009
00010 typedef struct _ENetListNode
00011 {
00012 struct _ENetListNode * next;
00013 struct _ENetListNode * previous;
00014 } ENetListNode;
00015
00016 typedef ENetListNode * ENetListIterator;
00017
00018 typedef struct _ENetList
00019 {
00020 ENetListNode sentinel;
00021 } ENetList;
00022
00023 extern void enet_list_clear (ENetList *);
00024
00025 extern ENetListIterator enet_list_insert (ENetListIterator, void *);
00026 extern void * enet_list_remove (ENetListIterator);
00027
00028 extern size_t enet_list_size (ENetList *);
00029
00030 #define enet_list_begin(list) ((list) -> sentinel.next)
00031 #define enet_list_end(list) (& (list) -> sentinel)
00032
00033 #define enet_list_empty(list) (enet_list_begin (list) == enet_list_end (list))
00034
00035 #define enet_list_next(iterator) ((iterator) -> next)
00036 #define enet_list_previous(iterator) ((iterator) -> previous)
00037
00038 #define enet_list_front(list) ((void *) (list) -> sentinel.next)
00039 #define enet_list_back(list) ((void *) (list) -> sentinel.previous)
00040
00041 #endif
00042