Commit cdc50af0 authored by Brian Wellington's avatar Brian Wellington
Browse files

In the towire_* and additionaldata_* routines, add an offsets table to names

passed into dns_name_toregion().  This is effectively free, and reduces the
number of calls to set_offsets() and dns_name_clone() in name compression.
parent 9b6398ef
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: tsig_250.c,v 1.47 2001/01/09 21:53:48 bwelling Exp $ */
/* $Id: tsig_250.c,v 1.48 2001/02/12 03:04:37 bwelling Exp $ */
/* Reviewed: Thu Mar 16 13:39:43 PST 2000 by gson */
......@@ -306,6 +306,7 @@ static inline isc_result_t
towire_any_tsig(ARGS_TOWIRE) {
isc_region_t sr;
dns_name_t name;
dns_offsets_t offsets;
REQUIRE(rdata->type == 250);
REQUIRE(rdata->rdclass == 255);
......@@ -313,7 +314,7 @@ towire_any_tsig(ARGS_TOWIRE) {
dns_compress_setmethods(cctx, DNS_COMPRESS_NONE);
dns_rdata_toregion(rdata, &sr);
dns_name_init(&name, NULL);
dns_name_init(&name, offsets);
dns_name_fromregion(&name, &sr);
RETERR(dns_name_towire(&name, cctx, target));
isc_region_consume(&sr, name_length(&name));
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: afsdb_18.c,v 1.35 2001/01/09 21:53:50 bwelling Exp $ */
/* $Id: afsdb_18.c,v 1.36 2001/02/12 03:04:38 bwelling Exp $ */
/* Reviewed: Wed Mar 15 14:59:00 PST 2000 by explorer */
......@@ -112,6 +112,7 @@ towire_afsdb(ARGS_TOWIRE) {
isc_region_t tr;
isc_region_t sr;
dns_name_t name;
dns_offsets_t offsets;
REQUIRE(rdata->type == 18);
REQUIRE(rdata->length != 0);
......@@ -125,7 +126,7 @@ towire_afsdb(ARGS_TOWIRE) {
isc_region_consume(&sr, 2);
isc_buffer_add(target, 2);
dns_name_init(&name, NULL);
dns_name_init(&name, offsets);
dns_name_fromregion(&name, &sr);
return (dns_name_towire(&name, cctx, target));
......@@ -227,11 +228,12 @@ freestruct_afsdb(ARGS_FREESTRUCT) {
static inline isc_result_t
additionaldata_afsdb(ARGS_ADDLDATA) {
dns_name_t name;
dns_offsets_t offsets;
isc_region_t region;
REQUIRE(rdata->type == 18);
dns_name_init(&name, NULL);
dns_name_init(&name, offsets);
dns_rdata_toregion(rdata, &region);
isc_region_consume(&region, 2);
dns_name_fromregion(&name, &region);
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: cname_5.c,v 1.39 2001/01/09 21:53:55 bwelling Exp $ */
/* $Id: cname_5.c,v 1.40 2001/02/12 03:04:39 bwelling Exp $ */
/* reviewed: Wed Mar 15 16:48:45 PST 2000 by brister */
......@@ -82,6 +82,7 @@ fromwire_cname(ARGS_FROMWIRE) {
static inline isc_result_t
towire_cname(ARGS_TOWIRE) {
dns_name_t name;
dns_offsets_t offsets;
isc_region_t region;
REQUIRE(rdata->type == 5);
......@@ -89,7 +90,7 @@ towire_cname(ARGS_TOWIRE) {
dns_compress_setmethods(cctx, DNS_COMPRESS_GLOBAL14);
dns_name_init(&name, NULL);
dns_name_init(&name, offsets);
dns_rdata_toregion(rdata, &region);
dns_name_fromregion(&name, &region);
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: dname_39.c,v 1.29 2001/01/09 21:53:57 bwelling Exp $ */
/* $Id: dname_39.c,v 1.30 2001/02/12 03:04:40 bwelling Exp $ */
/* Reviewed: Wed Mar 15 16:52:38 PST 2000 by explorer */
......@@ -83,13 +83,14 @@ fromwire_dname(ARGS_FROMWIRE) {
static inline isc_result_t
towire_dname(ARGS_TOWIRE) {
dns_name_t name;
dns_offsets_t offsets;
isc_region_t region;
REQUIRE(rdata->type == 39);
REQUIRE(rdata->length != 0);
dns_compress_setmethods(cctx, DNS_COMPRESS_NONE);
dns_name_init(&name, NULL);
dns_name_init(&name, offsets);
dns_rdata_toregion(rdata, &region);
dns_name_fromregion(&name, &region);
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: mb_7.c,v 1.37 2001/01/09 21:54:10 bwelling Exp $ */
/* $Id: mb_7.c,v 1.38 2001/02/12 03:04:41 bwelling Exp $ */
/* Reviewed: Wed Mar 15 17:31:26 PST 2000 by bwelling */
......@@ -81,6 +81,7 @@ fromwire_mb(ARGS_FROMWIRE) {
static inline isc_result_t
towire_mb(ARGS_TOWIRE) {
dns_name_t name;
dns_offsets_t offsets;
isc_region_t region;
REQUIRE(rdata->type == 7);
......@@ -88,7 +89,7 @@ towire_mb(ARGS_TOWIRE) {
dns_compress_setmethods(cctx, DNS_COMPRESS_GLOBAL14);
dns_name_init(&name, NULL);
dns_name_init(&name, offsets);
dns_rdata_toregion(rdata, &region);
dns_name_fromregion(&name, &region);
......@@ -175,11 +176,12 @@ freestruct_mb(ARGS_FREESTRUCT) {
static inline isc_result_t
additionaldata_mb(ARGS_ADDLDATA) {
dns_name_t name;
dns_offsets_t offsets;
isc_region_t region;
REQUIRE(rdata->type == 7);
dns_name_init(&name, NULL);
dns_name_init(&name, offsets);
dns_rdata_toregion(rdata, &region);
dns_name_fromregion(&name, &region);
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: md_3.c,v 1.39 2001/01/09 21:54:13 bwelling Exp $ */
/* $Id: md_3.c,v 1.40 2001/02/12 03:04:43 bwelling Exp $ */
/* Reviewed: Wed Mar 15 17:48:20 PST 2000 by bwelling */
......@@ -81,6 +81,7 @@ fromwire_md(ARGS_FROMWIRE) {
static inline isc_result_t
towire_md(ARGS_TOWIRE) {
dns_name_t name;
dns_offsets_t offsets;
isc_region_t region;
REQUIRE(rdata->type == 3);
......@@ -88,7 +89,7 @@ towire_md(ARGS_TOWIRE) {
dns_compress_setmethods(cctx, DNS_COMPRESS_GLOBAL14);
dns_name_init(&name, NULL);
dns_name_init(&name, offsets);
dns_rdata_toregion(rdata, &region);
dns_name_fromregion(&name, &region);
......@@ -176,11 +177,12 @@ freestruct_md(ARGS_FREESTRUCT) {
static inline isc_result_t
additionaldata_md(ARGS_ADDLDATA) {
dns_name_t name;
dns_offsets_t offsets;
isc_region_t region;
REQUIRE(rdata->type == 3);
dns_name_init(&name, NULL);
dns_name_init(&name, offsets);
dns_rdata_toregion(rdata, &region);
dns_name_fromregion(&name, &region);
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: mf_4.c,v 1.37 2001/01/09 21:54:15 bwelling Exp $ */
/* $Id: mf_4.c,v 1.38 2001/02/12 03:04:44 bwelling Exp $ */
/* reviewed: Wed Mar 15 17:47:33 PST 2000 by brister */
......@@ -81,6 +81,7 @@ fromwire_mf(ARGS_FROMWIRE) {
static inline isc_result_t
towire_mf(ARGS_TOWIRE) {
dns_name_t name;
dns_offsets_t offsets;
isc_region_t region;
REQUIRE(rdata->type == 4);
......@@ -88,7 +89,7 @@ towire_mf(ARGS_TOWIRE) {
dns_compress_setmethods(cctx, DNS_COMPRESS_GLOBAL14);
dns_name_init(&name, NULL);
dns_name_init(&name, offsets);
dns_rdata_toregion(rdata, &region);
dns_name_fromregion(&name, &region);
......@@ -175,11 +176,12 @@ freestruct_mf(ARGS_FREESTRUCT) {
static inline isc_result_t
additionaldata_mf(ARGS_ADDLDATA) {
dns_name_t name;
dns_offsets_t offsets;
isc_region_t region;
REQUIRE(rdata->type == 4);
dns_name_init(&name, NULL);
dns_name_init(&name, offsets);
dns_rdata_toregion(rdata, &region);
dns_name_fromregion(&name, &region);
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: mg_8.c,v 1.35 2001/01/09 21:54:17 bwelling Exp $ */
/* $Id: mg_8.c,v 1.36 2001/02/12 03:04:45 bwelling Exp $ */
/* reviewed: Wed Mar 15 17:49:21 PST 2000 by brister */
......@@ -81,6 +81,7 @@ fromwire_mg(ARGS_FROMWIRE) {
static inline isc_result_t
towire_mg(ARGS_TOWIRE) {
dns_name_t name;
dns_offsets_t offsets;
isc_region_t region;
REQUIRE(rdata->type == 8);
......@@ -88,7 +89,7 @@ towire_mg(ARGS_TOWIRE) {
dns_compress_setmethods(cctx, DNS_COMPRESS_GLOBAL14);
dns_name_init(&name, NULL);
dns_name_init(&name, offsets);
dns_rdata_toregion(rdata, &region);
dns_name_fromregion(&name, &region);
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: minfo_14.c,v 1.36 2001/01/09 21:54:20 bwelling Exp $ */
/* $Id: minfo_14.c,v 1.37 2001/02/12 03:04:46 bwelling Exp $ */
/* reviewed: Wed Mar 15 17:45:32 PST 2000 by brister */
......@@ -104,14 +104,16 @@ towire_minfo(ARGS_TOWIRE) {
isc_region_t region;
dns_name_t rmail;
dns_name_t email;
dns_offsets_t roffsets;
dns_offsets_t eoffsets;
REQUIRE(rdata->type == 14);
REQUIRE(rdata->length != 0);
dns_compress_setmethods(cctx, DNS_COMPRESS_GLOBAL14);
dns_name_init(&rmail, NULL);
dns_name_init(&email, NULL);
dns_name_init(&rmail, roffsets);
dns_name_init(&email, eoffsets);
dns_rdata_toregion(rdata, &region);
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: mr_9.c,v 1.34 2001/01/09 21:54:22 bwelling Exp $ */
/* $Id: mr_9.c,v 1.35 2001/02/12 03:04:47 bwelling Exp $ */
/* Reviewed: Wed Mar 15 21:30:35 EST 2000 by tale */
......@@ -81,6 +81,7 @@ fromwire_mr(ARGS_FROMWIRE) {
static inline isc_result_t
towire_mr(ARGS_TOWIRE) {
dns_name_t name;
dns_offsets_t offsets;
isc_region_t region;
REQUIRE(rdata->type == 9);
......@@ -88,7 +89,7 @@ towire_mr(ARGS_TOWIRE) {
dns_compress_setmethods(cctx, DNS_COMPRESS_GLOBAL14);
dns_name_init(&name, NULL);
dns_name_init(&name, offsets);
dns_rdata_toregion(rdata, &region);
dns_name_fromregion(&name, &region);
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: mx_15.c,v 1.44 2001/01/09 21:54:24 bwelling Exp $ */
/* $Id: mx_15.c,v 1.45 2001/02/12 03:04:48 bwelling Exp $ */
/* reviewed: Wed Mar 15 18:05:46 PST 2000 by brister */
......@@ -100,6 +100,7 @@ fromwire_mx(ARGS_FROMWIRE) {
static inline isc_result_t
towire_mx(ARGS_TOWIRE) {
dns_name_t name;
dns_offsets_t offsets;
isc_region_t region;
REQUIRE(rdata->type == 15);
......@@ -111,7 +112,7 @@ towire_mx(ARGS_TOWIRE) {
RETERR(mem_tobuffer(target, region.base, 2));
isc_region_consume(&region, 2);
dns_name_init(&name, NULL);
dns_name_init(&name, offsets);
dns_name_fromregion(&name, &region);
return (dns_name_towire(&name, cctx, target));
......@@ -209,11 +210,12 @@ freestruct_mx(ARGS_FREESTRUCT) {
static inline isc_result_t
additionaldata_mx(ARGS_ADDLDATA) {
dns_name_t name;
dns_offsets_t offsets;
isc_region_t region;
REQUIRE(rdata->type == 15);
dns_name_init(&name, NULL);
dns_name_init(&name, offsets);
dns_rdata_toregion(rdata, &region);
isc_region_consume(&region, 2);
dns_name_fromregion(&name, &region);
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: ns_2.c,v 1.38 2001/01/09 21:54:26 bwelling Exp $ */
/* $Id: ns_2.c,v 1.39 2001/02/12 03:04:49 bwelling Exp $ */
/* Reviewed: Wed Mar 15 18:15:00 PST 2000 by bwelling */
......@@ -81,6 +81,7 @@ fromwire_ns(ARGS_FROMWIRE) {
static inline isc_result_t
towire_ns(ARGS_TOWIRE) {
dns_name_t name;
dns_offsets_t offsets;
isc_region_t region;
REQUIRE(rdata->type == 2);
......@@ -88,7 +89,7 @@ towire_ns(ARGS_TOWIRE) {
dns_compress_setmethods(cctx, DNS_COMPRESS_GLOBAL14);
dns_name_init(&name, NULL);
dns_name_init(&name, offsets);
dns_rdata_toregion(rdata, &region);
dns_name_fromregion(&name, &region);
......@@ -175,11 +176,12 @@ freestruct_ns(ARGS_FREESTRUCT) {
static inline isc_result_t
additionaldata_ns(ARGS_ADDLDATA) {
dns_name_t name;
dns_offsets_t offsets;
isc_region_t region;
REQUIRE(rdata->type == 2);
dns_name_init(&name, NULL);
dns_name_init(&name, offsets);
dns_rdata_toregion(rdata, &region);
dns_name_fromregion(&name, &region);
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: nxt_30.c,v 1.45 2001/01/09 21:54:31 bwelling Exp $ */
/* $Id: nxt_30.c,v 1.46 2001/02/12 03:04:51 bwelling Exp $ */
/* reviewed: Wed Mar 15 18:21:15 PST 2000 by brister */
......@@ -151,12 +151,13 @@ static inline isc_result_t
towire_nxt(ARGS_TOWIRE) {
isc_region_t sr;
dns_name_t name;
dns_offsets_t offsets;
REQUIRE(rdata->type == 30);
REQUIRE(rdata->length != 0);
dns_compress_setmethods(cctx, DNS_COMPRESS_NONE);
dns_name_init(&name, NULL);
dns_name_init(&name, offsets);
dns_rdata_toregion(rdata, &sr);
dns_name_fromregion(&name, &sr);
isc_region_consume(&sr, name_length(&name));
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: ptr_12.c,v 1.35 2001/01/09 21:54:38 bwelling Exp $ */
/* $Id: ptr_12.c,v 1.36 2001/02/12 03:04:52 bwelling Exp $ */
/* Reviewed: Thu Mar 16 14:05:12 PST 2000 by explorer */
......@@ -81,6 +81,7 @@ fromwire_ptr(ARGS_FROMWIRE) {
static inline isc_result_t
towire_ptr(ARGS_TOWIRE) {
dns_name_t name;
dns_offsets_t offsets;
isc_region_t region;
REQUIRE(rdata->type == 12);
......@@ -88,7 +89,7 @@ towire_ptr(ARGS_TOWIRE) {
dns_compress_setmethods(cctx, DNS_COMPRESS_GLOBAL14);
dns_name_init(&name, NULL);
dns_name_init(&name, offsets);
dns_rdata_toregion(rdata, &region);
dns_name_fromregion(&name, &region);
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: rp_17.c,v 1.31 2001/01/09 21:54:40 bwelling Exp $ */
/* $Id: rp_17.c,v 1.32 2001/02/12 03:04:53 bwelling Exp $ */
/* RFC 1183 */
......@@ -104,13 +104,15 @@ towire_rp(ARGS_TOWIRE) {
isc_region_t region;
dns_name_t rmail;
dns_name_t email;
dns_offsets_t roffsets;
dns_offsets_t eoffsets;
REQUIRE(rdata->type == 17);
REQUIRE(rdata->length != 0);
dns_compress_setmethods(cctx, DNS_COMPRESS_NONE);
dns_name_init(&rmail, NULL);
dns_name_init(&email, NULL);
dns_name_init(&rmail, roffsets);
dns_name_init(&email, eoffsets);
dns_rdata_toregion(rdata, &region);
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: rt_21.c,v 1.33 2001/01/09 21:54:42 bwelling Exp $ */
/* $Id: rt_21.c,v 1.34 2001/02/12 03:04:54 bwelling Exp $ */
/* reviewed: Thu Mar 16 15:02:31 PST 2000 by brister */
......@@ -105,6 +105,7 @@ fromwire_rt(ARGS_FROMWIRE) {
static inline isc_result_t
towire_rt(ARGS_TOWIRE) {
dns_name_t name;
dns_offsets_t offsets;
isc_region_t region;
isc_region_t tr;
......@@ -120,7 +121,7 @@ towire_rt(ARGS_TOWIRE) {
isc_region_consume(&region, 2);
isc_buffer_add(target, 2);
dns_name_init(&name, NULL);
dns_name_init(&name, offsets);
dns_name_fromregion(&name, &region);
return (dns_name_towire(&name, cctx, target));
......@@ -219,12 +220,13 @@ freestruct_rt(ARGS_FREESTRUCT) {
static inline isc_result_t
additionaldata_rt(ARGS_ADDLDATA) {
dns_name_t name;
dns_offsets_t offsets;
isc_region_t region;
isc_result_t result;
REQUIRE(rdata->type == 21);
dns_name_init(&name, NULL);
dns_name_init(&name, offsets);
dns_rdata_toregion(rdata, &region);
isc_region_consume(&region, 2);
dns_name_fromregion(&name, &region);
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: sig_24.c,v 1.49 2001/01/09 21:54:44 bwelling Exp $ */
/* $Id: sig_24.c,v 1.50 2001/02/12 03:04:55 bwelling Exp $ */
/* Reviewed: Fri Mar 17 09:05:02 PST 2000 by gson */
......@@ -278,6 +278,7 @@ static inline isc_result_t
towire_sig(ARGS_TOWIRE) {
isc_region_t sr;
dns_name_t name;
dns_offsets_t offsets;
REQUIRE(rdata->type == 24);
REQUIRE(rdata->length != 0);
......@@ -299,7 +300,7 @@ towire_sig(ARGS_TOWIRE) {
/*
* Signer.
*/
dns_name_init(&name, NULL);
dns_name_init(&name, offsets);
dns_name_fromregion(&name, &sr);
isc_region_consume(&sr, name_length(&name));
RETERR(dns_name_towire(&name, cctx, target));
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: soa_6.c,v 1.48 2001/01/09 21:54:47 bwelling Exp $ */
/* $Id: soa_6.c,v 1.49 2001/02/12 03:04:56 bwelling Exp $ */
/* Reviewed: Thu Mar 16 15:18:32 PST 2000 by explorer */
......@@ -179,14 +179,16 @@ towire_soa(ARGS_TOWIRE) {
isc_region_t tregion;
dns_name_t mname;
dns_name_t rname;
dns_offsets_t moffsets;
dns_offsets_t roffsets;
REQUIRE(rdata->type == 6);
REQUIRE(rdata->length != 0);
dns_compress_setmethods(cctx, DNS_COMPRESS_GLOBAL14);
dns_name_init(&mname, NULL);
dns_name_init(&rname, NULL);
dns_name_init(&mname, moffsets);
dns_name_init(&rname, roffsets);
dns_rdata_toregion(rdata, &sregion);
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: tkey_249.c,v 1.43 2001/01/11 03:11:30 bwelling Exp $ */
/* $Id: tkey_249.c,v 1.44 2001/02/12 03:04:58 bwelling Exp $ */
/*
* Reviewed: Thu Mar 16 17:35:30 PST 2000 by halley.
......@@ -292,6 +292,7 @@ static inline isc_result_t
towire_tkey(ARGS_TOWIRE) {
isc_region_t sr;
dns_name_t name;
dns_offsets_t offsets;
REQUIRE(rdata->type == 249);
REQUIRE(rdata->length != 0);
......@@ -301,7 +302,7 @@ towire_tkey(ARGS_TOWIRE) {
* Algorithm.
*/
dns_rdata_toregion(rdata, &sr);
dns_name_init(&name, NULL);
dns_name_init(&name, offsets);
dns_name_fromregion(&name, &sr);
RETERR(dns_name_towire(&name, cctx, target));
isc_region_consume(&sr, name_length(&name));
......
......@@ -15,7 +15,7 @@
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: a6_38.c,v 1.41 2001/01/25 20:14:39 bwelling Exp $ */
/* $Id: a6_38.c,v 1.42 2001/02/12 03:04:59 bwelling Exp $ */
/* draft-ietf-ipngwg-dns-lookups-03.txt */
......@@ -183,6 +183,7 @@ static inline isc_result_t
towire_in_a6(ARGS_TOWIRE) {
isc_region_t sr;
dns_name_t name;
dns_offsets_t offsets;
unsigned char prefixlen;
unsigned char octets;
......@@ -202,7 +203,7 @@ towire_in_a6(ARGS_TOWIRE) {
if (prefixlen == 0)
return (ISC_R_SUCCESS);
dns_name_init(&name, NULL);
dns_name_init(&name, offsets);
dns_name_fromregion(&name, &sr);
return (dns_name_towire(&name, cctx, target));
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment