1/* 2 * Copyright (C) 2004, 2007, 2009 Internet Systems Consortium, Inc. ("ISC") 3 * Copyright (C) 1998-2002 Internet Software Consortium. 4 * 5 * Permission to use, copy, modify, and/or distribute this software for any 6 * purpose with or without fee is hereby granted, provided that the above 7 * copyright notice and this permission notice appear in all copies. 8 * 9 * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH 10 * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 11 * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, 12 * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 13 * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE 14 * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 15 * PERFORMANCE OF THIS SOFTWARE. 16 */ 17 18/* $Id: proforma.c,v 1.38 2009/12/04 22:06:37 tbox Exp $ */ 19 20#ifndef RDATA_GENERIC_#_#_C 21#define RDATA_GENERIC_#_#_C 22 23#define RRTYPE_#_ATTRIBUTES (0) 24 25static inline isc_result_t 26fromtext_#(ARGS_FROMTEXT) { 27 isc_token_t token; 28 29 REQUIRE(type == #); 30 REQUIRE(rdclass == #); 31 32 RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string, 33 ISC_FALSE)); 34 35 return (ISC_R_NOTIMPLEMENTED); 36} 37 38static inline isc_result_t 39totext_#(ARGS_TOTEXT) { 40 41 REQUIRE(rdata->type == #); 42 REQUIRE(rdata->rdclass == #); 43 REQUIRE(rdata->length != 0); /* XXX */ 44 45 return (ISC_R_NOTIMPLEMENTED); 46} 47 48static inline isc_result_t 49fromwire_#(ARGS_FROMWIRE) { 50 51 REQUIRE(type == #); 52 REQUIRE(rdclass == #); 53 54 /* NONE or GLOBAL14 */ 55 dns_decompress_setmethods(dctx, DNS_COMPRESS_NONE); 56 57 return (ISC_R_NOTIMPLEMENTED); 58} 59 60static inline isc_result_t 61towire_#(ARGS_TOWIRE) { 62 63 REQUIRE(rdata->type == #); 64 REQUIRE(rdata->rdclass == #); 65 REQUIRE(rdata->length != 0); /* XXX */ 66 67 /* NONE or GLOBAL14 */ 68 dns_compress_setmethods(cctx, DNS_COMPRESS_NONE); 69 70 return (ISC_R_NOTIMPLEMENTED); 71} 72 73static inline int 74compare_#(ARGS_COMPARE) { 75 isc_region_t r1; 76 isc_region_t r2; 77 78 REQUIRE(rdata1->type == rdata2->type); 79 REQUIRE(rdata1->rdclass == rdata2->rdclass); 80 REQUIRE(rdata1->type == #); 81 REQUIRE(rdata1->rdclass == #); 82 REQUIRE(rdata1->length != 0); /* XXX */ 83 REQUIRE(rdata2->length != 0); /* XXX */ 84 85 dns_rdata_toregion(rdata1, &r1); 86 dns_rdata_toregion(rdata2, &r2); 87 return (isc_region_compare(&r1, &r2)); 88} 89 90static inline isc_result_t 91fromstruct_#(ARGS_FROMSTRUCT) { 92 dns_rdata_#_t *# = source; 93 94 REQUIRE(type == #); 95 REQUIRE(rdclass == #); 96 REQUIRE(source != NULL); 97 REQUIRE(#->common.rdtype == type); 98 REQUIRE(#->common.rdclass == rdclass); 99 100 return (ISC_R_NOTIMPLEMENTED); 101} 102 103static inline isc_result_t 104tostruct_#(ARGS_TOSTRUCT) { 105 106 REQUIRE(rdata->type == #); 107 REQUIRE(rdata->rdclass == #); 108 REQUIRE(rdata->length != 0); /* XXX */ 109 110 return (ISC_R_NOTIMPLEMENTED); 111} 112 113static inline void 114freestruct_#(ARGS_FREESTRUCT) { 115 dns_rdata_#_t *# = source; 116 117 REQUIRE(source != NULL); 118 REQUIRE(#->common.rdtype == #); 119 REQUIRE(#->common.rdclass == #); 120 121} 122 123static inline isc_result_t 124additionaldata_#(ARGS_ADDLDATA) { 125 REQUIRE(rdata->type == #); 126 REQUIRE(rdata->rdclass == #); 127 128 (void)add; 129 (void)arg; 130 131 return (ISC_R_SUCCESS); 132} 133 134static inline isc_result_t 135digest_#(ARGS_DIGEST) { 136 isc_region_t r; 137 138 REQUIRE(rdata->type == #); 139 REQUIRE(rdata->rdclass == #); 140 141 dns_rdata_toregion(rdata, &r); 142 143 return ((digest)(arg, &r)); 144} 145 146static inline isc_boolean_t 147checkowner_#(ARGS_CHECKOWNER) { 148 149 REQUIRE(type == #); 150 REQUIRE(rdclass == #); 151 152 UNUSED(name); 153 UNUSED(type); 154 UNUSED(rdclass); 155 UNUSED(wildcard); 156 157 return (ISC_TRUE); 158} 159 160static inline isc_boolean_t 161checknames_#(ARGS_CHECKNAMES) { 162 163 REQUIRE(rdata->type == #); 164 REQUIRE(rdata->rdclass == #); 165 166 UNUSED(rdata); 167 UNUSED(owner); 168 UNUSED(bad); 169 170 return (ISC_TRUE); 171} 172 173static inline int 174casecompare_#(ARGS_COMPARE) { 175 isc_region_t r1; 176 isc_region_t r2; 177 178 REQUIRE(rdata1->type == rdata2->type); 179 REQUIRE(rdata1->rdclass == rdata2->rdclass); 180 REQUIRE(rdata1->type == #); 181 REQUIRE(rdata1->rdclass == #); 182 REQUIRE(rdata1->length != 0); /* XXX */ 183 REQUIRE(rdata2->length != 0); /* XXX */ 184 185 dns_rdata_toregion(rdata1, &r1); 186 dns_rdata_toregion(rdata2, &r2); 187 return (isc_region_compare(&r1, &r2)); 188} 189 190#endif /* RDATA_GENERIC_#_#_C */ 191