sexpr.h

Go to the documentation of this file.
00001 /*
00002  * Portions Copyright (C) 2004-2007  Internet Systems Consortium, Inc. ("ISC")
00003  * Portions Copyright (C) 2001  Internet Software Consortium.
00004  *
00005  * Permission to use, copy, modify, and/or distribute this software for any
00006  * purpose with or without fee is hereby granted, provided that the above
00007  * copyright notice and this permission notice appear in all copies.
00008  *
00009  * THE SOFTWARE IS PROVIDED "AS IS" AND ISC AND NOMINUM DISCLAIMS ALL
00010  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
00011  * OF MERCHANTABILITY AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY
00012  * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
00013  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
00014  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
00015  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
00016  *
00017  * Portions Copyright (C) 2001  Nominum, Inc.
00018  *
00019  * Permission to use, copy, modify, and/or distribute this software for any
00020  * purpose with or without fee is hereby granted, provided that the above
00021  * copyright notice and this permission notice appear in all copies.
00022  *
00023  * THE SOFTWARE IS PROVIDED "AS IS" AND ISC AND NOMINUM DISCLAIMS ALL
00024  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
00025  * OF MERCHANTABILITY AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY
00026  * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
00027  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
00028  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
00029  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
00030  */
00031 
00032 /* $Id: sexpr.h,v 1.11 2007/08/28 07:20:43 tbox Exp $ */
00033 
00034 #ifndef ISCCC_SEXPR_H
00035 #define ISCCC_SEXPR_H 1
00036 
00037 /*! \file isccc/sexpr.h */
00038 
00039 #include <stdio.h>
00040 
00041 #include <isc/lang.h>
00042 #include <isccc/types.h>
00043 
00044 ISC_LANG_BEGINDECLS
00045 
00046 /*% dotted pair structure */
00047 struct isccc_dottedpair {
00048         isccc_sexpr_t *car;
00049         isccc_sexpr_t *cdr;
00050 };
00051 
00052 /*% iscc_sexpr structure */
00053 struct isccc_sexpr {
00054         unsigned int                    type;
00055         union {
00056                 char *                  as_string;
00057                 isccc_dottedpair_t      as_dottedpair;
00058                 isccc_region_t          as_region;
00059         }                               value;
00060 };
00061 
00062 #define ISCCC_SEXPRTYPE_NONE            0x00    /*%< Illegal. */
00063 #define ISCCC_SEXPRTYPE_T                       0x01
00064 #define ISCCC_SEXPRTYPE_STRING          0x02
00065 #define ISCCC_SEXPRTYPE_DOTTEDPAIR      0x03
00066 #define ISCCC_SEXPRTYPE_BINARY          0x04
00067 
00068 #define ISCCC_SEXPR_CAR(s)              (s)->value.as_dottedpair.car
00069 #define ISCCC_SEXPR_CDR(s)              (s)->value.as_dottedpair.cdr
00070 
00071 isccc_sexpr_t *
00072 isccc_sexpr_cons(isccc_sexpr_t *car, isccc_sexpr_t *cdr);
00073 
00074 isccc_sexpr_t *
00075 isccc_sexpr_tconst(void);
00076 
00077 isccc_sexpr_t *
00078 isccc_sexpr_fromstring(const char *str);
00079 
00080 isccc_sexpr_t *
00081 isccc_sexpr_frombinary(const isccc_region_t *region);
00082 
00083 void
00084 isccc_sexpr_free(isccc_sexpr_t **sexprp);
00085 
00086 void
00087 isccc_sexpr_print(isccc_sexpr_t *sexpr, FILE *stream);
00088 
00089 isccc_sexpr_t *
00090 isccc_sexpr_car(isccc_sexpr_t *list);
00091 
00092 isccc_sexpr_t *
00093 isccc_sexpr_cdr(isccc_sexpr_t *list);
00094 
00095 void
00096 isccc_sexpr_setcar(isccc_sexpr_t *pair, isccc_sexpr_t *car);
00097 
00098 void
00099 isccc_sexpr_setcdr(isccc_sexpr_t *pair, isccc_sexpr_t *cdr);
00100 
00101 isccc_sexpr_t *
00102 isccc_sexpr_addtolist(isccc_sexpr_t **l1p, isccc_sexpr_t *l2);
00103 
00104 isc_boolean_t
00105 isccc_sexpr_listp(isccc_sexpr_t *sexpr);
00106 
00107 isc_boolean_t
00108 isccc_sexpr_emptyp(isccc_sexpr_t *sexpr);
00109 
00110 isc_boolean_t
00111 isccc_sexpr_stringp(isccc_sexpr_t *sexpr);
00112 
00113 isc_boolean_t
00114 isccc_sexpr_binaryp(isccc_sexpr_t *sexpr);
00115 
00116 char *
00117 isccc_sexpr_tostring(isccc_sexpr_t *sexpr);
00118 
00119 isccc_region_t *
00120 isccc_sexpr_tobinary(isccc_sexpr_t *sexpr);
00121 
00122 ISC_LANG_ENDDECLS
00123 
00124 #endif /* ISCCC_SEXPR_H */

Generated on Tue Apr 28 17:41:06 2015 by Doxygen 1.5.4 for BIND9 Internals 9.11.0pre-alpha