00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef RDATA_IN_1_DHCID_49_C
00022 #define RDATA_IN_1_DHCID_49_C 1
00023
00024 #define RRTYPE_DHCID_ATTRIBUTES 0
00025
00026 static inline isc_result_t
00027 fromtext_in_dhcid(ARGS_FROMTEXT) {
00028
00029 REQUIRE(type == 49);
00030 REQUIRE(rdclass == 1);
00031
00032 UNUSED(type);
00033 UNUSED(rdclass);
00034 UNUSED(origin);
00035 UNUSED(options);
00036 UNUSED(callbacks);
00037
00038 return (isc_base64_tobuffer(lexer, target, -1));
00039 }
00040
00041 static inline isc_result_t
00042 totext_in_dhcid(ARGS_TOTEXT) {
00043 isc_region_t sr;
00044 char buf[sizeof(" ; 64000 255 64000")];
00045 size_t n;
00046
00047 REQUIRE(rdata->type == 49);
00048 REQUIRE(rdata->rdclass == 1);
00049 REQUIRE(rdata->length != 0);
00050
00051 dns_rdata_toregion(rdata, &sr);
00052
00053 if ((tctx->flags & DNS_STYLEFLAG_MULTILINE) != 0)
00054 RETERR(str_totext("( " , target));
00055 if (tctx->width == 0)
00056 RETERR(isc_base64_totext(&sr, 60, "", target));
00057 else
00058 RETERR(isc_base64_totext(&sr, tctx->width - 2,
00059 tctx->linebreak, target));
00060 if ((tctx->flags & DNS_STYLEFLAG_MULTILINE) != 0) {
00061 RETERR(str_totext( " )", target));
00062 if (rdata->length > 2) {
00063 n = snprintf(buf, sizeof(buf), " ; %u %u %u",
00064 sr.base[0] * 256 + sr.base[1],
00065 sr.base[2], rdata->length - 3);
00066 INSIST(n < sizeof(buf));
00067 RETERR(str_totext(buf, target));
00068 }
00069 }
00070 return (ISC_R_SUCCESS);
00071 }
00072
00073 static inline isc_result_t
00074 fromwire_in_dhcid(ARGS_FROMWIRE) {
00075 isc_region_t sr;
00076
00077 REQUIRE(type == 49);
00078 REQUIRE(rdclass == 1);
00079
00080 UNUSED(type);
00081 UNUSED(rdclass);
00082 UNUSED(dctx);
00083 UNUSED(options);
00084
00085 isc_buffer_activeregion(source, &sr);
00086 if (sr.length == 0)
00087 return (ISC_R_UNEXPECTEDEND);
00088
00089 isc_buffer_forward(source, sr.length);
00090 return (mem_tobuffer(target, sr.base, sr.length));
00091 }
00092
00093 static inline isc_result_t
00094 towire_in_dhcid(ARGS_TOWIRE) {
00095 isc_region_t sr;
00096
00097 REQUIRE(rdata->type == 49);
00098 REQUIRE(rdata->rdclass == 1);
00099 REQUIRE(rdata->length != 0);
00100
00101 UNUSED(cctx);
00102
00103 dns_rdata_toregion(rdata, &sr);
00104 return (mem_tobuffer(target, sr.base, sr.length));
00105 }
00106
00107 static inline int
00108 compare_in_dhcid(ARGS_COMPARE) {
00109 isc_region_t r1;
00110 isc_region_t r2;
00111
00112 REQUIRE(rdata1->type == rdata2->type);
00113 REQUIRE(rdata1->rdclass == rdata2->rdclass);
00114 REQUIRE(rdata1->type == 49);
00115 REQUIRE(rdata1->rdclass == 1);
00116 REQUIRE(rdata1->length != 0);
00117 REQUIRE(rdata2->length != 0);
00118
00119 dns_rdata_toregion(rdata1, &r1);
00120 dns_rdata_toregion(rdata2, &r2);
00121 return (isc_region_compare(&r1, &r2));
00122 }
00123
00124 static inline isc_result_t
00125 fromstruct_in_dhcid(ARGS_FROMSTRUCT) {
00126 dns_rdata_in_dhcid_t *dhcid = source;
00127
00128 REQUIRE(type == 49);
00129 REQUIRE(rdclass == 1);
00130 REQUIRE(source != NULL);
00131 REQUIRE(dhcid->common.rdtype == type);
00132 REQUIRE(dhcid->common.rdclass == rdclass);
00133 REQUIRE(dhcid->length != 0);
00134
00135 UNUSED(type);
00136 UNUSED(rdclass);
00137
00138 return (mem_tobuffer(target, dhcid->dhcid, dhcid->length));
00139 }
00140
00141 static inline isc_result_t
00142 tostruct_in_dhcid(ARGS_TOSTRUCT) {
00143 dns_rdata_in_dhcid_t *dhcid = target;
00144 isc_region_t region;
00145
00146 REQUIRE(rdata->type == 49);
00147 REQUIRE(rdata->rdclass == 1);
00148 REQUIRE(target != NULL);
00149 REQUIRE(rdata->length != 0);
00150
00151 dhcid->common.rdclass = rdata->rdclass;
00152 dhcid->common.rdtype = rdata->type;
00153 ISC_LINK_INIT(&dhcid->common, link);
00154
00155 dns_rdata_toregion(rdata, ®ion);
00156
00157 dhcid->dhcid = mem_maybedup(mctx, region.base, region.length);
00158 if (dhcid->dhcid == NULL)
00159 return (ISC_R_NOMEMORY);
00160
00161 dhcid->mctx = mctx;
00162 return (ISC_R_SUCCESS);
00163 }
00164
00165 static inline void
00166 freestruct_in_dhcid(ARGS_FREESTRUCT) {
00167 dns_rdata_in_dhcid_t *dhcid = source;
00168
00169 REQUIRE(dhcid != NULL);
00170 REQUIRE(dhcid->common.rdtype == 49);
00171 REQUIRE(dhcid->common.rdclass == 1);
00172
00173 if (dhcid->mctx == NULL)
00174 return;
00175
00176 if (dhcid->dhcid != NULL)
00177 isc_mem_free(dhcid->mctx, dhcid->dhcid);
00178 dhcid->mctx = NULL;
00179 }
00180
00181 static inline isc_result_t
00182 additionaldata_in_dhcid(ARGS_ADDLDATA) {
00183 REQUIRE(rdata->type == 49);
00184 REQUIRE(rdata->rdclass == 1);
00185
00186 UNUSED(rdata);
00187 UNUSED(add);
00188 UNUSED(arg);
00189
00190 return (ISC_R_SUCCESS);
00191 }
00192
00193 static inline isc_result_t
00194 digest_in_dhcid(ARGS_DIGEST) {
00195 isc_region_t r;
00196
00197 REQUIRE(rdata->type == 49);
00198 REQUIRE(rdata->rdclass == 1);
00199
00200 dns_rdata_toregion(rdata, &r);
00201
00202 return ((digest)(arg, &r));
00203 }
00204
00205 static inline isc_boolean_t
00206 checkowner_in_dhcid(ARGS_CHECKOWNER) {
00207
00208 REQUIRE(type == 49);
00209 REQUIRE(rdclass == 1);
00210
00211 UNUSED(name);
00212 UNUSED(type);
00213 UNUSED(rdclass);
00214 UNUSED(wildcard);
00215
00216 return (ISC_TRUE);
00217 }
00218
00219 static inline isc_boolean_t
00220 checknames_in_dhcid(ARGS_CHECKNAMES) {
00221
00222 REQUIRE(rdata->type == 49);
00223 REQUIRE(rdata->rdclass == 1);
00224
00225 UNUSED(rdata);
00226 UNUSED(owner);
00227 UNUSED(bad);
00228
00229 return (ISC_TRUE);
00230 }
00231
00232 static inline int
00233 casecompare_in_dhcid(ARGS_COMPARE) {
00234 return (compare_in_dhcid(rdata1, rdata2));
00235 }
00236
00237 #endif