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_NSAP_PTR_23_C
00025 #define RDATA_IN_1_NSAP_PTR_23_C
00026
00027 #define RRTYPE_NSAP_PTR_ATTRIBUTES (0)
00028
00029 static inline isc_result_t
00030 fromtext_in_nsap_ptr(ARGS_FROMTEXT) {
00031 isc_token_t token;
00032 dns_name_t name;
00033 isc_buffer_t buffer;
00034
00035 REQUIRE(type == 23);
00036 REQUIRE(rdclass == 1);
00037
00038 UNUSED(type);
00039 UNUSED(rdclass);
00040 UNUSED(callbacks);
00041
00042 RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string,
00043 ISC_FALSE));
00044
00045 dns_name_init(&name, NULL);
00046 buffer_fromregion(&buffer, &token.value.as_region);
00047 origin = (origin != NULL) ? origin : dns_rootname;
00048 RETTOK(dns_name_fromtext(&name, &buffer, origin, options, target));
00049 return (ISC_R_SUCCESS);
00050 }
00051
00052 static inline isc_result_t
00053 totext_in_nsap_ptr(ARGS_TOTEXT) {
00054 isc_region_t region;
00055 dns_name_t name;
00056 dns_name_t prefix;
00057 isc_boolean_t sub;
00058
00059 REQUIRE(rdata->type == 23);
00060 REQUIRE(rdata->rdclass == 1);
00061 REQUIRE(rdata->length != 0);
00062
00063 dns_name_init(&name, NULL);
00064 dns_name_init(&prefix, NULL);
00065
00066 dns_rdata_toregion(rdata, ®ion);
00067 dns_name_fromregion(&name, ®ion);
00068
00069 sub = name_prefix(&name, tctx->origin, &prefix);
00070
00071 return (dns_name_totext(&prefix, sub, target));
00072 }
00073
00074 static inline isc_result_t
00075 fromwire_in_nsap_ptr(ARGS_FROMWIRE) {
00076 dns_name_t name;
00077
00078 REQUIRE(type == 23);
00079 REQUIRE(rdclass == 1);
00080
00081 UNUSED(type);
00082 UNUSED(rdclass);
00083
00084 dns_decompress_setmethods(dctx, DNS_COMPRESS_NONE);
00085
00086 dns_name_init(&name, NULL);
00087 return (dns_name_fromwire(&name, source, dctx, options, target));
00088 }
00089
00090 static inline isc_result_t
00091 towire_in_nsap_ptr(ARGS_TOWIRE) {
00092 dns_name_t name;
00093 dns_offsets_t offsets;
00094 isc_region_t region;
00095
00096 REQUIRE(rdata->type == 23);
00097 REQUIRE(rdata->rdclass == 1);
00098 REQUIRE(rdata->length != 0);
00099
00100 dns_compress_setmethods(cctx, DNS_COMPRESS_NONE);
00101 dns_name_init(&name, offsets);
00102 dns_rdata_toregion(rdata, ®ion);
00103 dns_name_fromregion(&name, ®ion);
00104
00105 return (dns_name_towire(&name, cctx, target));
00106 }
00107
00108 static inline int
00109 compare_in_nsap_ptr(ARGS_COMPARE) {
00110 dns_name_t name1;
00111 dns_name_t name2;
00112 isc_region_t region1;
00113 isc_region_t region2;
00114
00115 REQUIRE(rdata1->type == rdata2->type);
00116 REQUIRE(rdata1->rdclass == rdata2->rdclass);
00117 REQUIRE(rdata1->type == 23);
00118 REQUIRE(rdata1->rdclass == 1);
00119 REQUIRE(rdata1->length != 0);
00120 REQUIRE(rdata2->length != 0);
00121
00122 dns_name_init(&name1, NULL);
00123 dns_name_init(&name2, NULL);
00124
00125 dns_rdata_toregion(rdata1, ®ion1);
00126 dns_rdata_toregion(rdata2, ®ion2);
00127
00128 dns_name_fromregion(&name1, ®ion1);
00129 dns_name_fromregion(&name2, ®ion2);
00130
00131 return (dns_name_rdatacompare(&name1, &name2));
00132 }
00133
00134 static inline isc_result_t
00135 fromstruct_in_nsap_ptr(ARGS_FROMSTRUCT) {
00136 dns_rdata_in_nsap_ptr_t *nsap_ptr = source;
00137 isc_region_t region;
00138
00139 REQUIRE(type == 23);
00140 REQUIRE(rdclass == 1);
00141 REQUIRE(source != NULL);
00142 REQUIRE(nsap_ptr->common.rdtype == type);
00143 REQUIRE(nsap_ptr->common.rdclass == rdclass);
00144
00145 UNUSED(type);
00146 UNUSED(rdclass);
00147
00148 dns_name_toregion(&nsap_ptr->owner, ®ion);
00149 return (isc_buffer_copyregion(target, ®ion));
00150 }
00151
00152 static inline isc_result_t
00153 tostruct_in_nsap_ptr(ARGS_TOSTRUCT) {
00154 isc_region_t region;
00155 dns_rdata_in_nsap_ptr_t *nsap_ptr = target;
00156 dns_name_t name;
00157
00158 REQUIRE(rdata->type == 23);
00159 REQUIRE(rdata->rdclass == 1);
00160 REQUIRE(target != NULL);
00161 REQUIRE(rdata->length != 0);
00162
00163 nsap_ptr->common.rdclass = rdata->rdclass;
00164 nsap_ptr->common.rdtype = rdata->type;
00165 ISC_LINK_INIT(&nsap_ptr->common, link);
00166
00167 dns_name_init(&name, NULL);
00168 dns_rdata_toregion(rdata, ®ion);
00169 dns_name_fromregion(&name, ®ion);
00170 dns_name_init(&nsap_ptr->owner, NULL);
00171 RETERR(name_duporclone(&name, mctx, &nsap_ptr->owner));
00172 nsap_ptr->mctx = mctx;
00173 return (ISC_R_SUCCESS);
00174 }
00175
00176 static inline void
00177 freestruct_in_nsap_ptr(ARGS_FREESTRUCT) {
00178 dns_rdata_in_nsap_ptr_t *nsap_ptr = source;
00179
00180 REQUIRE(source != NULL);
00181 REQUIRE(nsap_ptr->common.rdclass == 1);
00182 REQUIRE(nsap_ptr->common.rdtype == 23);
00183
00184 if (nsap_ptr->mctx == NULL)
00185 return;
00186
00187 dns_name_free(&nsap_ptr->owner, nsap_ptr->mctx);
00188 nsap_ptr->mctx = NULL;
00189 }
00190
00191 static inline isc_result_t
00192 additionaldata_in_nsap_ptr(ARGS_ADDLDATA) {
00193 REQUIRE(rdata->type == 23);
00194 REQUIRE(rdata->rdclass == 1);
00195
00196 UNUSED(rdata);
00197 UNUSED(add);
00198 UNUSED(arg);
00199
00200 return (ISC_R_SUCCESS);
00201 }
00202
00203 static inline isc_result_t
00204 digest_in_nsap_ptr(ARGS_DIGEST) {
00205 isc_region_t r;
00206 dns_name_t name;
00207
00208 REQUIRE(rdata->type == 23);
00209 REQUIRE(rdata->rdclass == 1);
00210
00211 dns_rdata_toregion(rdata, &r);
00212 dns_name_init(&name, NULL);
00213 dns_name_fromregion(&name, &r);
00214
00215 return (dns_name_digest(&name, digest, arg));
00216 }
00217
00218 static inline isc_boolean_t
00219 checkowner_in_nsap_ptr(ARGS_CHECKOWNER) {
00220
00221 REQUIRE(type == 23);
00222 REQUIRE(rdclass == 1);
00223
00224 UNUSED(name);
00225 UNUSED(type);
00226 UNUSED(rdclass);
00227 UNUSED(wildcard);
00228
00229 return (ISC_TRUE);
00230 }
00231
00232 static inline isc_boolean_t
00233 checknames_in_nsap_ptr(ARGS_CHECKNAMES) {
00234
00235 REQUIRE(rdata->type == 23);
00236 REQUIRE(rdata->rdclass == 1);
00237
00238 UNUSED(rdata);
00239 UNUSED(owner);
00240 UNUSED(bad);
00241
00242 return (ISC_TRUE);
00243 }
00244
00245 static inline int
00246 casecompare_in_nsap_ptr(ARGS_COMPARE) {
00247 return (compare_in_nsap_ptr(rdata1, rdata2));
00248 }
00249
00250 #endif