1 /*	$NetBSD: alist.h,v 1.4 2014/12/10 04:38:01 christos Exp $	*/
2 
3 /*
4  * Portions Copyright (C) 2004-2007  Internet Systems Consortium, Inc. ("ISC")
5  * Portions Copyright (C) 2001  Internet Software Consortium.
6  *
7  * Permission to use, copy, modify, and/or distribute this software for any
8  * purpose with or without fee is hereby granted, provided that the above
9  * copyright notice and this permission notice appear in all copies.
10  *
11  * THE SOFTWARE IS PROVIDED "AS IS" AND ISC AND NOMINUM DISCLAIMS ALL
12  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
13  * OF MERCHANTABILITY AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY
14  * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18  *
19  * Portions Copyright (C) 2001  Nominum, Inc.
20  *
21  * Permission to use, copy, modify, and/or distribute this software for any
22  * purpose with or without fee is hereby granted, provided that the above
23  * copyright notice and this permission notice appear in all copies.
24  *
25  * THE SOFTWARE IS PROVIDED "AS IS" AND ISC AND NOMINUM DISCLAIMS ALL
26  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
27  * OF MERCHANTABILITY AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY
28  * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
29  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
30  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
31  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
32  */
33 
34 /* Id: alist.h,v 1.10 2007/08/28 07:20:43 tbox Exp  */
35 
36 #ifndef ISCCC_ALIST_H
37 #define ISCCC_ALIST_H 1
38 
39 /*! \file isccc/alist.h */
40 
41 #include <stdio.h>
42 
43 #include <isc/lang.h>
44 #include <isccc/types.h>
45 
46 ISC_LANG_BEGINDECLS
47 
48 isccc_sexpr_t *
49 isccc_alist_create(void);
50 
51 isc_boolean_t
52 isccc_alist_alistp(isccc_sexpr_t *alist);
53 
54 isc_boolean_t
55 isccc_alist_emptyp(isccc_sexpr_t *alist);
56 
57 isccc_sexpr_t *
58 isccc_alist_first(isccc_sexpr_t *alist);
59 
60 isccc_sexpr_t *
61 isccc_alist_assq(isccc_sexpr_t *alist, const char *key);
62 
63 void
64 isccc_alist_delete(isccc_sexpr_t *alist, const char *key);
65 
66 isccc_sexpr_t *
67 isccc_alist_define(isccc_sexpr_t *alist, const char *key, isccc_sexpr_t *value);
68 
69 isccc_sexpr_t *
70 isccc_alist_definestring(isccc_sexpr_t *alist, const char *key, const char *str);
71 
72 isccc_sexpr_t *
73 isccc_alist_definebinary(isccc_sexpr_t *alist, const char *key, isccc_region_t *r);
74 
75 isccc_sexpr_t *
76 isccc_alist_lookup(isccc_sexpr_t *alist, const char *key);
77 
78 isc_result_t
79 isccc_alist_lookupstring(isccc_sexpr_t *alist, const char *key, char **strp);
80 
81 isc_result_t
82 isccc_alist_lookupbinary(isccc_sexpr_t *alist, const char *key, isccc_region_t **r);
83 
84 void
85 isccc_alist_prettyprint(isccc_sexpr_t *sexpr, unsigned int indent, FILE *stream);
86 
87 ISC_LANG_ENDDECLS
88 
89 #endif /* ISCCC_ALIST_H */
90