xref: /NextBSD/usr.sbin/notifyd/table.h (revision 33da5adc555b3bc29986eeadca03829e4ad06b1e)
1 /*
2  * Copyright (c) 2003-2011 Apple Inc. All rights reserved.
3  *
4  * @APPLE_LICENSE_HEADER_START@
5  *
6  * This file contains Original Code and/or Modifications of Original Code
7  * as defined in and that are subject to the Apple Public Source License
8  * Version 2.0 (the 'License'). You may not use this file except in
9  * compliance with the License. Please obtain a copy of the License at
10  * http://www.opensource.apple.com/apsl/ and read it before using this
11  * file.
12  *
13  * The Original Code and all software distributed under the License are
14  * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17  * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18  * Please see the License for the specific language governing rights and
19  * limitations under the License.
20  *
21  * @APPLE_LICENSE_HEADER_END@
22  */
23 
24 #ifndef _NOTIFY_TABLE_H_
25 #define _NOTIFY_TABLE_H_
26 
27 #include <stdint.h>
28 
29 typedef struct __table_private table_t;
30 typedef struct __list_private list_t;
31 
32 extern table_t *_nc_table_new(uint32_t n);
33 
34 extern void _nc_table_insert(table_t *t, const char *key, void *datum);
35 extern void _nc_table_insert_no_copy(table_t *t, const char *key, void *datum);
36 extern void _nc_table_insert_n(table_t *t, uint32_t key, void *datum);
37 extern void _nc_table_insert_64(table_t *t, uint64_t key, void *datum);
38 
39 extern void *_nc_table_find(table_t *t, const char *key);
40 extern void *_nc_table_find_n(table_t *t, uint32_t key);
41 extern void *_nc_table_find_64(table_t *t, uint64_t key);
42 
43 extern void _nc_table_delete(table_t *t, const char *key);
44 extern void _nc_table_delete_n(table_t *t, uint32_t key);
45 extern void _nc_table_delete_64(table_t *t, uint64_t key);
46 
47 extern void *_nc_table_traverse_start(table_t *tin);
48 extern void *_nc_table_traverse(table_t *tin, void *ttin);
49 extern void _nc_table_traverse_end(table_t *tin, void *ttin);
50 
51 extern void _nc_table_free(table_t *tin);
52 
53 extern list_t *_nc_list_new(void *d);
54 
55 extern list_t *_nc_list_retain(list_t *l);
56 extern list_t *_nc_list_retain_list(list_t *l);
57 
58 extern void _nc_list_release(list_t *l);
59 extern void _nc_list_release_list(list_t *l);
60 
61 extern list_t *_nc_list_prev(list_t *l);
62 extern list_t *_nc_list_next(list_t *l);
63 
64 extern void _nc_list_set_next(list_t *l, list_t *n);
65 extern void _nc_list_set_prev(list_t *l, list_t *p);
66 
67 extern list_t *_nc_list_head(list_t *l);
68 extern list_t *_nc_list_tail(list_t *l);
69 
70 extern list_t *_nc_list_prepend(list_t *l, list_t *n);
71 extern list_t *_nc_list_append(list_t *l, list_t *n);
72 
73 extern list_t *_nc_list_concat(list_t *a, list_t *b);
74 
75 extern void *_nc_list_data(list_t *l);
76 extern void _nc_list_set_data(list_t *l, void *d);
77 
78 extern list_t *_nc_list_find(list_t *l, void *d);
79 extern list_t *_nc_list_find_release(list_t *l, void *d);
80 
81 extern list_t * _nc_list_reverse(list_t *l);
82 extern uint32_t _nc_list_count(list_t *l);
83 extern list_t *_nc_list_extract(list_t *n);
84 extern list_t *_nc_list_chop(list_t *l);
85 
86 #endif /* _NOTIFY_TABLE_H_ */
87