Sync usage with man page.
[netbsd-mini2440.git] / external / apache2 / mDNSResponder / dist / mDNSShared / GenLinkedList.h
blob033860c9952a938ed7ef50863f8993a97f6416a1
1 /* -*- Mode: C; tab-width: 4 -*-
3 * Copyright (c) 2003 Apple Computer, Inc. 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 *
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 File: GenLinkedList.c
19 Contains: interface to generic linked lists.
21 Version: 1.0
22 Tabs: 4 spaces
24 Change History (most recent first):
26 Log: GenLinkedList.h,v $
27 Revision 1.3 2006/08/14 23:24:56 cheshire
28 Re-licensed mDNSResponder daemon source code under Apache License, Version 2.0
30 Revision 1.2 2004/02/05 07:41:08 cheshire
31 Add Log header
35 #ifndef __GenLinkedList__
36 #define __GenLinkedList__
39 #include <stddef.h>
42 struct GenLinkedList
44 void *Head,
45 *Tail;
46 size_t LinkOffset;
48 typedef struct GenLinkedList GenLinkedList;
51 void InitLinkedList( GenLinkedList *pList, size_t linkOffset);
53 void AddToHead( GenLinkedList *pList, void *elem);
54 void AddToTail( GenLinkedList *pList, void *elem);
56 int RemoveFromList( GenLinkedList *pList, void *elem);
58 int ReplaceElem( GenLinkedList *pList, void *elemInList, void *newElem);
62 struct GenDoubleLinkedList
64 void *Head,
65 *Tail;
66 size_t FwdLinkOffset,
67 BackLinkOffset;
69 typedef struct GenDoubleLinkedList GenDoubleLinkedList;
72 void InitDoubleLinkedList( GenDoubleLinkedList *pList, size_t fwdLinkOffset,
73 size_t backLinkOffset);
75 void DLLAddToHead( GenDoubleLinkedList *pList, void *elem);
77 void DLLRemoveFromList( GenDoubleLinkedList *pList, void *elem);
81 /* A GenLinkedOffsetList is like a GenLinkedList that stores the *Next field as a signed */
82 /* offset from the address of the beginning of the element, rather than as a pointer. */
84 struct GenLinkedOffsetList
86 size_t Head,
87 Tail;
88 size_t LinkOffset;
90 typedef struct GenLinkedOffsetList GenLinkedOffsetList;
93 void InitLinkedOffsetList( GenLinkedOffsetList *pList, size_t linkOffset);
95 void *GetHeadPtr( GenLinkedOffsetList *pList);
96 void *GetTailPtr( GenLinkedOffsetList *pList);
97 void *GetOffsetLink( GenLinkedOffsetList *pList, void *elem);
99 void OffsetAddToHead( GenLinkedOffsetList *pList, void *elem);
100 void OffsetAddToTail( GenLinkedOffsetList *pList, void *elem);
102 int OffsetRemoveFromList( GenLinkedOffsetList *pList, void *elem);
104 int OffsetReplaceElem( GenLinkedOffsetList *pList, void *elemInList, void *newElem);
107 #endif // __GenLinkedList__