isc_result_t
dns_name_towire(const dns_name_t *name, dns_compress_t *cctx,
- isc_buffer_t *target);
-isc_result_t
-dns_name_towire2(const dns_name_t *name, dns_compress_t *cctx,
- isc_buffer_t *target, uint16_t *comp_offsetp);
+ isc_buffer_t *target, uint16_t *comp_offsetp);
/*%<
* Convert 'name' into wire format, compressing it as specified by the
* compression context 'cctx', and storing the result in 'target'.
isc_result_t
dns_name_towire(const dns_name_t *name, dns_compress_t *cctx,
- isc_buffer_t *target) {
- return (dns_name_towire2(name, cctx, target, NULL));
-}
-
-isc_result_t
-dns_name_towire2(const dns_name_t *name, dns_compress_t *cctx,
- isc_buffer_t *target, uint16_t *name_coff) {
+ isc_buffer_t *target, uint16_t *name_coff) {
bool compress;
dns_offsets_t clo;
dns_name_t clname;
* Write the name.
*/
dns_compress_setpermitted(cctx, true);
- result = dns_name_towire(&name, cctx, target);
+ result = dns_name_towire(&name, cctx, target, NULL);
if (result != ISC_R_SUCCESS) {
goto rollback;
}
dns_rdata_toregion(rdata, &sr);
dns_name_init(&name, offsets);
dns_name_fromregion(&name, &sr);
- RETERR(dns_name_towire(&name, cctx, target));
+ RETERR(dns_name_towire(&name, cctx, target, NULL));
isc_region_consume(&sr, name_length(&name));
return (mem_tobuffer(target, sr.base, sr.length));
}
dns_name_fromregion(&name, &sregion);
isc_region_consume(&sregion, name_length(&name));
- RETERR(dns_name_towire(&name, cctx, target));
+ RETERR(dns_name_towire(&name, cctx, target, NULL));
isc_buffer_availableregion(target, &tregion);
if (tregion.length < 2) {
dns_name_init(&name, offsets);
dns_name_fromregion(&name, &sr);
- return (dns_name_towire(&name, cctx, target));
+ return (dns_name_towire(&name, cctx, target, NULL));
}
static int
dns_rdata_toregion(rdata, ®ion);
dns_name_fromregion(&name, ®ion);
- return (dns_name_towire(&name, cctx, target));
+ return (dns_name_towire(&name, cctx, target, NULL));
}
static int
dns_rdata_toregion(rdata, ®ion);
dns_name_fromregion(&name, ®ion);
- return (dns_name_towire(&name, cctx, target));
+ return (dns_name_towire(&name, cctx, target, NULL));
}
static int
dns_rdata_toregion(rdata, ®ion);
dns_name_fromregion(&name, ®ion);
- return (dns_name_towire(&name, cctx, target));
+ return (dns_name_towire(&name, cctx, target, NULL));
}
static int
dns_rdata_toregion(rdata, ®ion);
dns_name_fromregion(&name, ®ion);
- return (dns_name_towire(&name, cctx, target));
+ return (dns_name_towire(&name, cctx, target, NULL));
}
static int
dns_rdata_toregion(rdata, ®ion);
dns_name_fromregion(&name, ®ion);
- return (dns_name_towire(&name, cctx, target));
+ return (dns_name_towire(&name, cctx, target, NULL));
}
static int
dns_rdata_toregion(rdata, ®ion);
dns_name_fromregion(&name, ®ion);
- return (dns_name_towire(&name, cctx, target));
+ return (dns_name_towire(&name, cctx, target, NULL));
}
static int
dns_name_fromregion(&rmail, ®ion);
isc_region_consume(®ion, name_length(&rmail));
- RETERR(dns_name_towire(&rmail, cctx, target));
+ RETERR(dns_name_towire(&rmail, cctx, target, NULL));
dns_name_fromregion(&rmail, ®ion);
isc_region_consume(®ion, rmail.length);
- return (dns_name_towire(&rmail, cctx, target));
+ return (dns_name_towire(&rmail, cctx, target, NULL));
}
static int
dns_rdata_toregion(rdata, ®ion);
dns_name_fromregion(&name, ®ion);
- return (dns_name_towire(&name, cctx, target));
+ return (dns_name_towire(&name, cctx, target, NULL));
}
static int
dns_name_init(&name, offsets);
dns_name_fromregion(&name, ®ion);
- return (dns_name_towire(&name, cctx, target));
+ return (dns_name_towire(&name, cctx, target, NULL));
}
static int
*/
dns_name_init(&name, offsets);
dns_name_fromregion(&name, &sr);
- return (dns_name_towire(&name, cctx, target));
+ return (dns_name_towire(&name, cctx, target, NULL));
}
static int
dns_rdata_toregion(rdata, ®ion);
dns_name_fromregion(&name, ®ion);
- return (dns_name_towire(&name, cctx, target));
+ return (dns_name_towire(&name, cctx, target, NULL));
}
static int
dns_rdata_toregion(rdata, &sr);
dns_name_fromregion(&name, &sr);
isc_region_consume(&sr, name_length(&name));
- RETERR(dns_name_towire(&name, cctx, target));
+ RETERR(dns_name_towire(&name, cctx, target, NULL));
return (mem_tobuffer(target, sr.base, sr.length));
}
dns_rdata_toregion(rdata, &sr);
dns_name_fromregion(&name, &sr);
isc_region_consume(&sr, name_length(&name));
- RETERR(dns_name_towire(&name, cctx, target));
+ RETERR(dns_name_towire(&name, cctx, target, NULL));
return (mem_tobuffer(target, sr.base, sr.length));
}
dns_rdata_toregion(rdata, ®ion);
dns_name_fromregion(&name, ®ion);
- return (dns_name_towire(&name, cctx, target));
+ return (dns_name_towire(&name, cctx, target, NULL));
}
static int
dns_name_fromregion(&rmail, ®ion);
isc_region_consume(®ion, rmail.length);
- RETERR(dns_name_towire(&rmail, cctx, target));
+ RETERR(dns_name_towire(&rmail, cctx, target, NULL));
dns_name_fromregion(&rmail, ®ion);
isc_region_consume(®ion, rmail.length);
- return (dns_name_towire(&rmail, cctx, target));
+ return (dns_name_towire(&rmail, cctx, target, NULL));
}
static int
dns_name_init(&name, offsets);
dns_name_fromregion(&name, &sr);
isc_region_consume(&sr, name_length(&name));
- RETERR(dns_name_towire(&name, cctx, target));
+ RETERR(dns_name_towire(&name, cctx, target, NULL));
/*
* Signature.
dns_name_init(&name, offsets);
dns_name_fromregion(&name, ®ion);
- return (dns_name_towire(&name, cctx, target));
+ return (dns_name_towire(&name, cctx, target, NULL));
}
static int
dns_name_init(&name, offsets);
dns_name_fromregion(&name, &sr);
isc_region_consume(&sr, name_length(&name));
- RETERR(dns_name_towire(&name, cctx, target));
+ RETERR(dns_name_towire(&name, cctx, target, NULL));
/*
* Signature.
dns_name_fromregion(&mname, &sregion);
isc_region_consume(&sregion, name_length(&mname));
- RETERR(dns_name_towire(&mname, cctx, target));
+ RETERR(dns_name_towire(&mname, cctx, target, NULL));
dns_name_fromregion(&rname, &sregion);
isc_region_consume(&sregion, name_length(&rname));
- RETERR(dns_name_towire(&rname, cctx, target));
+ RETERR(dns_name_towire(&rname, cctx, target, NULL));
isc_buffer_availableregion(target, &tregion);
if (tregion.length < 20) {
dns_name_fromregion(&prev, &sregion);
isc_region_consume(&sregion, name_length(&prev));
- RETERR(dns_name_towire(&prev, cctx, target));
+ RETERR(dns_name_towire(&prev, cctx, target, NULL));
dns_name_fromregion(&next, &sregion);
isc_region_consume(&sregion, name_length(&next));
- return (dns_name_towire(&next, cctx, target));
+ return (dns_name_towire(&next, cctx, target, NULL));
}
static int
dns_rdata_toregion(rdata, &sr);
dns_name_init(&name, offsets);
dns_name_fromregion(&name, &sr);
- RETERR(dns_name_towire(&name, cctx, target));
+ RETERR(dns_name_towire(&name, cctx, target, NULL));
isc_region_consume(&sr, name_length(&name));
return (mem_tobuffer(target, sr.base, sr.length));
dns_name_init(&name, offsets);
dns_name_fromregion(&name, &sr);
- return (dns_name_towire(&name, cctx, target));
+ return (dns_name_towire(&name, cctx, target, NULL));
}
static int
dns_name_init(&name, offsets);
dns_name_fromregion(&name, ®ion);
- return (dns_name_towire(&name, cctx, target));
+ return (dns_name_towire(&name, cctx, target, NULL));
}
static int
dns_rdata_toregion(rdata, ®ion);
dns_name_fromregion(&name, ®ion);
- return (dns_name_towire(&name, cctx, target));
+ return (dns_name_towire(&name, cctx, target, NULL));
}
static int
*/
dns_name_init(&name, offsets);
dns_name_fromregion(&name, ®ion);
- RETERR(dns_name_towire(&name, cctx, target));
+ RETERR(dns_name_towire(&name, cctx, target, NULL));
isc_region_consume(®ion, name_length(&name));
/*
*/
dns_name_init(&name, offsets);
dns_name_fromregion(&name, ®ion);
- return (dns_name_towire(&name, cctx, target));
+ return (dns_name_towire(&name, cctx, target, NULL));
}
static int
*/
dns_name_init(&name, offsets);
dns_name_fromregion(&name, &sr);
- return (dns_name_towire(&name, cctx, target));
+ return (dns_name_towire(&name, cctx, target, NULL));
}
static int
*/
dns_name_init(&name, offsets);
dns_name_fromregion(&name, ®ion);
- RETERR(dns_name_towire(&name, cctx, target));
+ RETERR(dns_name_towire(&name, cctx, target, NULL));
isc_region_consume(®ion, name_length(&name));
/*
rrbuffer = *target;
dns_compress_setpermitted(cctx, true);
- result = dns_name_towire2(name, cctx, target, &offset);
+ result = dns_name_towire(name, cctx, target, &offset);
if (result != ISC_R_SUCCESS) {
goto rollback;
}
memset(&zr, 0, sizeof(zr));
isc_buffer_init(&zb, zone, sizeof(zone));
dns_compress_setpermitted(&cctx, false);
- result = dns_name_towire(fctx->domain, &cctx, &zb);
+ result = dns_name_towire(fctx->domain, &cctx, &zb, NULL);
if (result == ISC_R_SUCCESS) {
isc_buffer_usedregion(&zb, &zr);
}
dns_compress_init(&cctx, fctx->mctx, 0);
dns_compress_setpermitted(&cctx, false);
isc_buffer_init(&zb, zone, sizeof(zone));
- result = dns_name_towire(fctx->domain, &cctx, &zb);
+ result = dns_name_towire(fctx->domain, &cctx, &zb, NULL);
if (result == ISC_R_SUCCESS) {
isc_buffer_usedregion(&zb, &zr);
}
isc_buffer_init(&b, zone, sizeof(zone));
dns_compress_setpermitted(&cctx, false);
- eresult = dns_name_towire(zo, &cctx, &b);
+ eresult = dns_name_towire(zo, &cctx, &b, NULL);
if (eresult == ISC_R_SUCCESS) {
isc_buffer_usedregion(&b, &zr);
}
for (unsigned int i = 0; i < count; i++) {
dns_name_t *name = dns_fixedname_name(&fixedname[i]);
- result = dns_name_towire(name, &cctx, &buf);
+ result = dns_name_towire(name, &cctx, &buf, NULL);
if (result == ISC_R_NOSPACE) {
dns_compress_invalidate(&cctx);
dns_compress_init(&cctx, mctx, 0);
isc_buffer_init(&zb, zone, sizeof(zone));
dns_compress_init(&cctx, mctx, 0);
dns_compress_setpermitted(&cctx, false);
- result = dns_name_towire(zname, &cctx, &zb);
+ result = dns_name_towire(zname, &cctx, &zb, NULL);
assert_int_equal(result, ISC_R_SUCCESS);
dns_compress_invalidate(&cctx);
isc_buffer_usedregion(&zb, &zr);
if (rdata) {
/* RDATA compression */
- assert_int_equal(dns_name_towire(name1, cctx, &source),
+ assert_int_equal(dns_name_towire(name1, cctx, &source, NULL),
ISC_R_SUCCESS);
- assert_int_equal(dns_name_towire(name2, cctx, &source),
+ assert_int_equal(dns_name_towire(name2, cctx, &source, NULL),
ISC_R_SUCCESS);
- assert_int_equal(dns_name_towire(name2, cctx, &source),
+ assert_int_equal(dns_name_towire(name2, cctx, &source, NULL),
ISC_R_SUCCESS);
- assert_int_equal(dns_name_towire(name3, cctx, &source),
+ assert_int_equal(dns_name_towire(name3, cctx, &source, NULL),
ISC_R_SUCCESS);
} else {
/* Owner name compression */
uint16_t offset = 0xffff;
- assert_int_equal(
- dns_name_towire2(name1, cctx, &source, &offset),
- ISC_R_SUCCESS);
+ assert_int_equal(dns_name_towire(name1, cctx, &source, &offset),
+ ISC_R_SUCCESS);
offset = 0xffff;
- assert_int_equal(
- dns_name_towire2(name2, cctx, &source, &offset),
- ISC_R_SUCCESS);
- assert_int_equal(
- dns_name_towire2(name2, cctx, &source, &offset),
- ISC_R_SUCCESS);
+ assert_int_equal(dns_name_towire(name2, cctx, &source, &offset),
+ ISC_R_SUCCESS);
+ assert_int_equal(dns_name_towire(name2, cctx, &source, &offset),
+ ISC_R_SUCCESS);
offset = 0xffff;
- assert_int_equal(
- dns_name_towire2(name3, cctx, &source, &offset),
- ISC_R_SUCCESS);
+ assert_int_equal(dns_name_towire(name3, cctx, &source, &offset),
+ ISC_R_SUCCESS);
}
assert_int_equal(source.used, compressed_length);
assert_true(memcmp(source.base, compressed, source.used) == 0);
}
dns_compress_rollback(&cctx, coff);
- result = dns_name_towire(&name, &cctx, &message);
+ result = dns_name_towire(&name, &cctx, &message, NULL);
assert_int_equal(result, ISC_R_SUCCESS);
/* we must be able to find the name we just added */