Add BIND 9.2.4rc7.
[dragonfly.git] / contrib / bind-9.2.4rc7 / lib / isccc / include / isccc / sexpr.h
blob30b95e1a37313233f991d476dae2d3e4584daadf
1 /*
2 * Portions Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC")
3 * Portions Copyright (C) 2001 Internet Software Consortium.
4 * Portions Copyright (C) 2001 Nominum, Inc.
6 * Permission to use, copy, modify, and distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
10 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC AND NOMINUM DISCLAIMS ALL
11 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
12 * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY
13 * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19 /* $Id: sexpr.h,v 1.3.2.1 2004/03/09 06:12:28 marka Exp $ */
21 #ifndef ISCCC_SEXPR_H
22 #define ISCCC_SEXPR_H 1
24 #include <stdio.h>
26 #include <isc/lang.h>
27 #include <isccc/types.h>
29 ISC_LANG_BEGINDECLS
31 struct isccc_dottedpair {
32 isccc_sexpr_t *car;
33 isccc_sexpr_t *cdr;
36 struct isccc_sexpr {
37 unsigned int type;
38 union {
39 char * as_string;
40 isccc_dottedpair_t as_dottedpair;
41 isccc_region_t as_region;
42 } value;
45 #define ISCCC_SEXPRTYPE_NONE 0x00 /* Illegal. */
46 #define ISCCC_SEXPRTYPE_T 0x01
47 #define ISCCC_SEXPRTYPE_STRING 0x02
48 #define ISCCC_SEXPRTYPE_DOTTEDPAIR 0x03
49 #define ISCCC_SEXPRTYPE_BINARY 0x04
51 #define ISCCC_SEXPR_CAR(s) (s)->value.as_dottedpair.car
52 #define ISCCC_SEXPR_CDR(s) (s)->value.as_dottedpair.cdr
54 isccc_sexpr_t *
55 isccc_sexpr_cons(isccc_sexpr_t *car, isccc_sexpr_t *cdr);
57 isccc_sexpr_t *
58 isccc_sexpr_tconst(void);
60 isccc_sexpr_t *
61 isccc_sexpr_fromstring(const char *str);
63 isccc_sexpr_t *
64 isccc_sexpr_frombinary(const isccc_region_t *region);
66 void
67 isccc_sexpr_free(isccc_sexpr_t **sexprp);
69 void
70 isccc_sexpr_print(isccc_sexpr_t *sexpr, FILE *stream);
72 isccc_sexpr_t *
73 isccc_sexpr_car(isccc_sexpr_t *list);
75 isccc_sexpr_t *
76 isccc_sexpr_cdr(isccc_sexpr_t *list);
78 void
79 isccc_sexpr_setcar(isccc_sexpr_t *pair, isccc_sexpr_t *car);
81 void
82 isccc_sexpr_setcdr(isccc_sexpr_t *pair, isccc_sexpr_t *cdr);
84 isccc_sexpr_t *
85 isccc_sexpr_addtolist(isccc_sexpr_t **l1p, isccc_sexpr_t *l2);
87 isc_boolean_t
88 isccc_sexpr_listp(isccc_sexpr_t *sexpr);
90 isc_boolean_t
91 isccc_sexpr_emptyp(isccc_sexpr_t *sexpr);
93 isc_boolean_t
94 isccc_sexpr_stringp(isccc_sexpr_t *sexpr);
96 isc_boolean_t
97 isccc_sexpr_binaryp(isccc_sexpr_t *sexpr);
99 char *
100 isccc_sexpr_tostring(isccc_sexpr_t *sexpr);
102 isccc_region_t *
103 isccc_sexpr_tobinary(isccc_sexpr_t *sexpr);
105 ISC_LANG_ENDDECLS
107 #endif /* ISCCC_SEXPR_H */