00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef RDATA_IN_1_AAAA_28_C
00025 #define RDATA_IN_1_AAAA_28_C
00026
00027 #include <isc/net.h>
00028
00029 #define RRTYPE_AAAA_ATTRIBUTES (0)
00030
00031 static inline isc_result_t
00032 fromtext_in_aaaa(ARGS_FROMTEXT) {
00033 isc_token_t token;
00034 unsigned char addr[16];
00035 isc_region_t region;
00036
00037 REQUIRE(type == 28);
00038 REQUIRE(rdclass == 1);
00039
00040 UNUSED(type);
00041 UNUSED(origin);
00042 UNUSED(options);
00043 UNUSED(rdclass);
00044 UNUSED(callbacks);
00045
00046 RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string,
00047 ISC_FALSE));
00048
00049 if (inet_pton(AF_INET6, DNS_AS_STR(token), addr) != 1)
00050 RETTOK(DNS_R_BADAAAA);
00051 isc_buffer_availableregion(target, ®ion);
00052 if (region.length < 16)
00053 return (ISC_R_NOSPACE);
00054 memmove(region.base, addr, 16);
00055 isc_buffer_add(target, 16);
00056 return (ISC_R_SUCCESS);
00057 }
00058
00059 static inline isc_result_t
00060 totext_in_aaaa(ARGS_TOTEXT) {
00061 isc_region_t region;
00062
00063 UNUSED(tctx);
00064
00065 REQUIRE(rdata->type == 28);
00066 REQUIRE(rdata->rdclass == 1);
00067 REQUIRE(rdata->length == 16);
00068
00069 dns_rdata_toregion(rdata, ®ion);
00070 return (inet_totext(AF_INET6, ®ion, target));
00071 }
00072
00073 static inline isc_result_t
00074 fromwire_in_aaaa(ARGS_FROMWIRE) {
00075 isc_region_t sregion;
00076 isc_region_t tregion;
00077
00078 REQUIRE(type == 28);
00079 REQUIRE(rdclass == 1);
00080
00081 UNUSED(type);
00082 UNUSED(dctx);
00083 UNUSED(options);
00084 UNUSED(rdclass);
00085
00086 isc_buffer_activeregion(source, &sregion);
00087 isc_buffer_availableregion(target, &tregion);
00088 if (sregion.length < 16)
00089 return (ISC_R_UNEXPECTEDEND);
00090 if (tregion.length < 16)
00091 return (ISC_R_NOSPACE);
00092
00093 memmove(tregion.base, sregion.base, 16);
00094 isc_buffer_forward(source, 16);
00095 isc_buffer_add(target, 16);
00096 return (ISC_R_SUCCESS);
00097 }
00098
00099 static inline isc_result_t
00100 towire_in_aaaa(ARGS_TOWIRE) {
00101 isc_region_t region;
00102
00103 UNUSED(cctx);
00104
00105 REQUIRE(rdata->type == 28);
00106 REQUIRE(rdata->rdclass == 1);
00107 REQUIRE(rdata->length == 16);
00108
00109 isc_buffer_availableregion(target, ®ion);
00110 if (region.length < rdata->length)
00111 return (ISC_R_NOSPACE);
00112 memmove(region.base, rdata->data, rdata->length);
00113 isc_buffer_add(target, 16);
00114 return (ISC_R_SUCCESS);
00115 }
00116
00117 static inline int
00118 compare_in_aaaa(ARGS_COMPARE) {
00119 isc_region_t r1;
00120 isc_region_t r2;
00121
00122 REQUIRE(rdata1->type == rdata2->type);
00123 REQUIRE(rdata1->rdclass == rdata2->rdclass);
00124 REQUIRE(rdata1->type == 28);
00125 REQUIRE(rdata1->rdclass == 1);
00126 REQUIRE(rdata1->length == 16);
00127 REQUIRE(rdata2->length == 16);
00128
00129 dns_rdata_toregion(rdata1, &r1);
00130 dns_rdata_toregion(rdata2, &r2);
00131 return (isc_region_compare(&r1, &r2));
00132 }
00133
00134 static inline isc_result_t
00135 fromstruct_in_aaaa(ARGS_FROMSTRUCT) {
00136 dns_rdata_in_aaaa_t *aaaa = source;
00137
00138 REQUIRE(type == 28);
00139 REQUIRE(rdclass == 1);
00140 REQUIRE(source != NULL);
00141 REQUIRE(aaaa->common.rdtype == type);
00142 REQUIRE(aaaa->common.rdclass == rdclass);
00143
00144 UNUSED(type);
00145 UNUSED(rdclass);
00146
00147 return (mem_tobuffer(target, aaaa->in6_addr.s6_addr, 16));
00148 }
00149
00150 static inline isc_result_t
00151 tostruct_in_aaaa(ARGS_TOSTRUCT) {
00152 dns_rdata_in_aaaa_t *aaaa = target;
00153 isc_region_t r;
00154
00155 REQUIRE(rdata->type == 28);
00156 REQUIRE(rdata->rdclass == 1);
00157 REQUIRE(target != NULL);
00158 REQUIRE(rdata->length == 16);
00159
00160 UNUSED(mctx);
00161
00162 aaaa->common.rdclass = rdata->rdclass;
00163 aaaa->common.rdtype = rdata->type;
00164 ISC_LINK_INIT(&aaaa->common, link);
00165
00166 dns_rdata_toregion(rdata, &r);
00167 INSIST(r.length == 16);
00168 memmove(aaaa->in6_addr.s6_addr, r.base, 16);
00169
00170 return (ISC_R_SUCCESS);
00171 }
00172
00173 static inline void
00174 freestruct_in_aaaa(ARGS_FREESTRUCT) {
00175 dns_rdata_in_aaaa_t *aaaa = source;
00176
00177 REQUIRE(source != NULL);
00178 REQUIRE(aaaa->common.rdclass == 1);
00179 REQUIRE(aaaa->common.rdtype == 28);
00180
00181 UNUSED(aaaa);
00182 }
00183
00184 static inline isc_result_t
00185 additionaldata_in_aaaa(ARGS_ADDLDATA) {
00186 REQUIRE(rdata->type == 28);
00187 REQUIRE(rdata->rdclass == 1);
00188
00189 UNUSED(rdata);
00190 UNUSED(add);
00191 UNUSED(arg);
00192
00193 return (ISC_R_SUCCESS);
00194 }
00195
00196 static inline isc_result_t
00197 digest_in_aaaa(ARGS_DIGEST) {
00198 isc_region_t r;
00199
00200 REQUIRE(rdata->type == 28);
00201 REQUIRE(rdata->rdclass == 1);
00202
00203 dns_rdata_toregion(rdata, &r);
00204
00205 return ((digest)(arg, &r));
00206 }
00207
00208 static inline isc_boolean_t
00209 checkowner_in_aaaa(ARGS_CHECKOWNER) {
00210
00211 REQUIRE(type == 28);
00212 REQUIRE(rdclass == 1);
00213
00214 UNUSED(type);
00215 UNUSED(rdclass);
00216
00217 return (dns_name_ishostname(name, wildcard));
00218 }
00219
00220 static inline isc_boolean_t
00221 checknames_in_aaaa(ARGS_CHECKNAMES) {
00222
00223 REQUIRE(rdata->type == 28);
00224 REQUIRE(rdata->rdclass == 1);
00225
00226 UNUSED(rdata);
00227 UNUSED(owner);
00228 UNUSED(bad);
00229
00230 return (ISC_TRUE);
00231 }
00232
00233 static inline int
00234 casecompare_in_aaaa(ARGS_COMPARE) {
00235 return (compare_in_aaaa(rdata1, rdata2));
00236 }
00237 #endif