From 1c3191528684f3dd93ebb122298c2f8ebfc6d397 Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Fri, 22 Jan 1999 05:02:49 +0000 Subject: [PATCH] Add RR from RFC 1183 Update Copyright dates. --- lib/dns/rdata.c | 4 +- lib/dns/rdata/generic/afsdb_18.c | 177 +++++++++++++++++++++++++++++ lib/dns/rdata/generic/afsdb_18.h | 177 +++++++++++++++++++++++++++++ lib/dns/rdata/generic/cname_5.c | 4 +- lib/dns/rdata/generic/cname_5.h | 4 +- lib/dns/rdata/generic/hinfo_13.c | 32 ++---- lib/dns/rdata/generic/hinfo_13.h | 32 ++---- lib/dns/rdata/generic/isdn_20.c | 130 +++++++++++++++++++++ lib/dns/rdata/generic/isdn_20.h | 130 +++++++++++++++++++++ lib/dns/rdata/generic/mb_7.c | 4 +- lib/dns/rdata/generic/mb_7.h | 4 +- lib/dns/rdata/generic/md_3.c | 4 +- lib/dns/rdata/generic/md_3.h | 4 +- lib/dns/rdata/generic/mf_4.c | 4 +- lib/dns/rdata/generic/mf_4.h | 4 +- lib/dns/rdata/generic/mg_8.c | 4 +- lib/dns/rdata/generic/mg_8.h | 4 +- lib/dns/rdata/generic/minfo_14.c | 4 +- lib/dns/rdata/generic/minfo_14.h | 4 +- lib/dns/rdata/generic/mr_9.c | 4 +- lib/dns/rdata/generic/mr_9.h | 4 +- lib/dns/rdata/generic/mx_15.c | 4 +- lib/dns/rdata/generic/mx_15.h | 4 +- lib/dns/rdata/generic/ns_2.c | 4 +- lib/dns/rdata/generic/ns_2.h | 4 +- lib/dns/rdata/generic/null_10.c | 4 +- lib/dns/rdata/generic/null_10.h | 4 +- lib/dns/rdata/generic/proforma.c | 14 ++- lib/dns/rdata/generic/proforma.h | 14 ++- lib/dns/rdata/generic/ptr_12.c | 4 +- lib/dns/rdata/generic/ptr_12.h | 4 +- lib/dns/rdata/generic/rp_17.c | 186 +++++++++++++++++++++++++++++++ lib/dns/rdata/generic/rp_17.h | 186 +++++++++++++++++++++++++++++++ lib/dns/rdata/generic/rt_21.c | 176 +++++++++++++++++++++++++++++ lib/dns/rdata/generic/rt_21.h | 176 +++++++++++++++++++++++++++++ lib/dns/rdata/generic/soa_6.c | 4 +- lib/dns/rdata/generic/soa_6.h | 4 +- lib/dns/rdata/generic/txt_16.c | 4 +- lib/dns/rdata/generic/txt_16.h | 4 +- lib/dns/rdata/generic/x25_19.c | 127 +++++++++++++++++++++ lib/dns/rdata/generic/x25_19.h | 127 +++++++++++++++++++++ lib/dns/rdata/in_1/a_1.c | 4 +- lib/dns/rdata/in_1/a_1.h | 4 +- lib/dns/rdata/in_1/wks_11.c | 4 +- lib/dns/rdata/in_1/wks_11.h | 4 +- 45 files changed, 1693 insertions(+), 115 deletions(-) create mode 100644 lib/dns/rdata/generic/afsdb_18.c create mode 100644 lib/dns/rdata/generic/afsdb_18.h create mode 100644 lib/dns/rdata/generic/isdn_20.c create mode 100644 lib/dns/rdata/generic/isdn_20.h create mode 100644 lib/dns/rdata/generic/rp_17.c create mode 100644 lib/dns/rdata/generic/rp_17.h create mode 100644 lib/dns/rdata/generic/rt_21.c create mode 100644 lib/dns/rdata/generic/rt_21.h create mode 100644 lib/dns/rdata/generic/x25_19.c create mode 100644 lib/dns/rdata/generic/x25_19.h diff --git a/lib/dns/rdata.c b/lib/dns/rdata.c index ef9744cc3c..208dae9b00 100644 --- a/lib/dns/rdata.c +++ b/lib/dns/rdata.c @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: rdata.c,v 1.12 1999/01/22 01:27:29 marka Exp $ */ + /* $Id: rdata.c,v 1.13 1999/01/22 05:02:43 marka Exp $ */ #include @@ -573,6 +573,8 @@ static isc_result_t uint16_tobuffer(unsigned long value, isc_buffer_t *target) { isc_region_t region; + if (value > 0xffff) + return (DNS_R_RANGE); isc_buffer_available(target, ®ion); if (region.length < 2) return (DNS_R_NOSPACE); diff --git a/lib/dns/rdata/generic/afsdb_18.c b/lib/dns/rdata/generic/afsdb_18.c new file mode 100644 index 0000000000..310820c49d --- /dev/null +++ b/lib/dns/rdata/generic/afsdb_18.c @@ -0,0 +1,177 @@ +/* + * Copyright (C) 1999 Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE + * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + + /* $Id: afsdb_18.c,v 1.1 1999/01/22 05:02:44 marka Exp $ */ + + /* RFC 1183 */ + +#ifndef RDATA_GENERIC_AFSDB_18_H +#define RDATA_GENERIC_AFSDB_18_H + +static dns_result_t +fromtext_afsdb(dns_rdataclass_t class, dns_rdatatype_t type, + isc_lex_t *lexer, dns_name_t *origin, + isc_boolean_t downcase, isc_buffer_t *target) { + isc_token_t token; + isc_buffer_t buffer; + dns_name_t name; + + REQUIRE(type == 18); + + class = class; /*unused*/ + + /* subtype */ + RETERR(gettoken(lexer, &token, isc_tokentype_number, ISC_FALSE)); + RETERR(uint16_tobuffer(token.value.as_ulong, target)); + + /* hostname */ + RETERR(gettoken(lexer, &token, isc_tokentype_string, ISC_FALSE)); + dns_name_init(&name, NULL); + buffer_fromregion(&buffer, &token.value.as_region, + ISC_BUFFERTYPE_TEXT); + origin = (origin != NULL) ? origin : dns_rootname; + return (dns_name_fromtext(&name, &buffer, origin, downcase, target)); +} + +static dns_result_t +totext_afsdb(dns_rdata_t *rdata, dns_name_t *origin, isc_buffer_t *target) { + dns_name_t name; + dns_name_t prefix; + isc_region_t region; + char buf[sizeof "64000"]; + isc_boolean_t sub; + unsigned int num; + + + REQUIRE(rdata->type == 18); + dns_name_init(&name, NULL); + dns_name_init(&prefix, NULL); + + dns_rdata_toregion(rdata, ®ion); + num = uint16_fromregion(®ion); + isc_region_consume(®ion, 2); + sprintf(buf, "%u", num); + RETERR(str_totext(buf, target)); + RETERR(str_totext(" ", target)); + dns_name_fromregion(&name, ®ion); + sub = name_prefix(&name, origin, &prefix); + return(dns_name_totext(&prefix, sub, target)); +} + +static dns_result_t +fromwire_afsdb(dns_rdataclass_t class, dns_rdatatype_t type, + isc_buffer_t *source, dns_decompress_t *dctx, + isc_boolean_t downcase, isc_buffer_t *target) { + dns_name_t name; + isc_region_t sr; + isc_region_t tr; + + REQUIRE(type == 18); + + class = class; /*unused*/ + + dns_name_init(&name, NULL); + + isc_buffer_active(source, &sr); + isc_buffer_available(target, &tr); + if (tr.length < 2) + return (DNS_R_NOSPACE); + if (sr.length < 2) + return (DNS_R_UNEXPECTEDEND); + memcpy(tr.base, sr.base, 2); + isc_buffer_forward(source, 2); + isc_buffer_add(target, 2); + return (dns_name_fromwire(&name, source, dctx, downcase, target)); +} + +static dns_result_t +towire_afsdb(dns_rdata_t *rdata, dns_compress_t *cctx, isc_buffer_t *target) { + isc_region_t tr; + isc_region_t sr; + dns_name_t name; + + REQUIRE(rdata->type == 18); + + isc_buffer_available(target, &tr); + dns_rdata_toregion(rdata, &sr); + if (tr.length < 2) + return (DNS_R_NOSPACE); + memcpy(tr.base, sr.base, 2); + isc_region_consume(&sr, 2); + isc_buffer_add(target, 2); + + dns_name_init(&name, NULL); + dns_name_fromregion(&name, &sr); + + return (dns_name_towire(&name, cctx, target)); +} + +static int +compare_afsdb(dns_rdata_t *rdata1, dns_rdata_t *rdata2) { + int result; + dns_name_t name1; + dns_name_t name2; + isc_region_t region1; + isc_region_t region2; + + REQUIRE(rdata1->type == rdata2->type); + REQUIRE(rdata1->class == rdata2->class); + REQUIRE(rdata1->type == 18); + + result = memcmp(rdata1->data, rdata2->data, 2); + if (result != 0) + return (result < 0 ? -1 : 1); + + dns_name_init(&name1, NULL); + dns_name_init(&name2, NULL); + + dns_rdata_toregion(rdata1, ®ion1); + dns_rdata_toregion(rdata2, ®ion2); + + isc_region_consume(®ion1, 2); + isc_region_consume(®ion2, 2); + + dns_name_fromregion(&name1, ®ion1); + dns_name_fromregion(&name2, ®ion2); + + return (dns_name_compare(&name1, &name2)); +} + +static dns_result_t +fromstruct_afsdb(dns_rdataclass_t class, dns_rdatatype_t type, void *source, + isc_buffer_t *target) { + + REQUIRE(type == 18); + + class = class; /*unused*/ + + source = source; + target = target; + + return (DNS_R_NOTIMPLEMENTED); +} + +static dns_result_t +tostruct_afsdb(dns_rdata_t *rdata, void *target) { + + REQUIRE(rdata->type == 18); + + target = target; + + return (DNS_R_NOTIMPLEMENTED); +} +#endif /* RDATA_GENERIC_AFSDB_18_H */ diff --git a/lib/dns/rdata/generic/afsdb_18.h b/lib/dns/rdata/generic/afsdb_18.h new file mode 100644 index 0000000000..479615d940 --- /dev/null +++ b/lib/dns/rdata/generic/afsdb_18.h @@ -0,0 +1,177 @@ +/* + * Copyright (C) 1999 Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE + * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + + /* $Id: afsdb_18.h,v 1.1 1999/01/22 05:02:44 marka Exp $ */ + + /* RFC 1183 */ + +#ifndef RDATA_GENERIC_AFSDB_18_H +#define RDATA_GENERIC_AFSDB_18_H + +static dns_result_t +fromtext_afsdb(dns_rdataclass_t class, dns_rdatatype_t type, + isc_lex_t *lexer, dns_name_t *origin, + isc_boolean_t downcase, isc_buffer_t *target) { + isc_token_t token; + isc_buffer_t buffer; + dns_name_t name; + + REQUIRE(type == 18); + + class = class; /*unused*/ + + /* subtype */ + RETERR(gettoken(lexer, &token, isc_tokentype_number, ISC_FALSE)); + RETERR(uint16_tobuffer(token.value.as_ulong, target)); + + /* hostname */ + RETERR(gettoken(lexer, &token, isc_tokentype_string, ISC_FALSE)); + dns_name_init(&name, NULL); + buffer_fromregion(&buffer, &token.value.as_region, + ISC_BUFFERTYPE_TEXT); + origin = (origin != NULL) ? origin : dns_rootname; + return (dns_name_fromtext(&name, &buffer, origin, downcase, target)); +} + +static dns_result_t +totext_afsdb(dns_rdata_t *rdata, dns_name_t *origin, isc_buffer_t *target) { + dns_name_t name; + dns_name_t prefix; + isc_region_t region; + char buf[sizeof "64000"]; + isc_boolean_t sub; + unsigned int num; + + + REQUIRE(rdata->type == 18); + dns_name_init(&name, NULL); + dns_name_init(&prefix, NULL); + + dns_rdata_toregion(rdata, ®ion); + num = uint16_fromregion(®ion); + isc_region_consume(®ion, 2); + sprintf(buf, "%u", num); + RETERR(str_totext(buf, target)); + RETERR(str_totext(" ", target)); + dns_name_fromregion(&name, ®ion); + sub = name_prefix(&name, origin, &prefix); + return(dns_name_totext(&prefix, sub, target)); +} + +static dns_result_t +fromwire_afsdb(dns_rdataclass_t class, dns_rdatatype_t type, + isc_buffer_t *source, dns_decompress_t *dctx, + isc_boolean_t downcase, isc_buffer_t *target) { + dns_name_t name; + isc_region_t sr; + isc_region_t tr; + + REQUIRE(type == 18); + + class = class; /*unused*/ + + dns_name_init(&name, NULL); + + isc_buffer_active(source, &sr); + isc_buffer_available(target, &tr); + if (tr.length < 2) + return (DNS_R_NOSPACE); + if (sr.length < 2) + return (DNS_R_UNEXPECTEDEND); + memcpy(tr.base, sr.base, 2); + isc_buffer_forward(source, 2); + isc_buffer_add(target, 2); + return (dns_name_fromwire(&name, source, dctx, downcase, target)); +} + +static dns_result_t +towire_afsdb(dns_rdata_t *rdata, dns_compress_t *cctx, isc_buffer_t *target) { + isc_region_t tr; + isc_region_t sr; + dns_name_t name; + + REQUIRE(rdata->type == 18); + + isc_buffer_available(target, &tr); + dns_rdata_toregion(rdata, &sr); + if (tr.length < 2) + return (DNS_R_NOSPACE); + memcpy(tr.base, sr.base, 2); + isc_region_consume(&sr, 2); + isc_buffer_add(target, 2); + + dns_name_init(&name, NULL); + dns_name_fromregion(&name, &sr); + + return (dns_name_towire(&name, cctx, target)); +} + +static int +compare_afsdb(dns_rdata_t *rdata1, dns_rdata_t *rdata2) { + int result; + dns_name_t name1; + dns_name_t name2; + isc_region_t region1; + isc_region_t region2; + + REQUIRE(rdata1->type == rdata2->type); + REQUIRE(rdata1->class == rdata2->class); + REQUIRE(rdata1->type == 18); + + result = memcmp(rdata1->data, rdata2->data, 2); + if (result != 0) + return (result < 0 ? -1 : 1); + + dns_name_init(&name1, NULL); + dns_name_init(&name2, NULL); + + dns_rdata_toregion(rdata1, ®ion1); + dns_rdata_toregion(rdata2, ®ion2); + + isc_region_consume(®ion1, 2); + isc_region_consume(®ion2, 2); + + dns_name_fromregion(&name1, ®ion1); + dns_name_fromregion(&name2, ®ion2); + + return (dns_name_compare(&name1, &name2)); +} + +static dns_result_t +fromstruct_afsdb(dns_rdataclass_t class, dns_rdatatype_t type, void *source, + isc_buffer_t *target) { + + REQUIRE(type == 18); + + class = class; /*unused*/ + + source = source; + target = target; + + return (DNS_R_NOTIMPLEMENTED); +} + +static dns_result_t +tostruct_afsdb(dns_rdata_t *rdata, void *target) { + + REQUIRE(rdata->type == 18); + + target = target; + + return (DNS_R_NOTIMPLEMENTED); +} +#endif /* RDATA_GENERIC_AFSDB_18_H */ diff --git a/lib/dns/rdata/generic/cname_5.c b/lib/dns/rdata/generic/cname_5.c index 478284ae6f..cf204c8428 100644 --- a/lib/dns/rdata/generic/cname_5.c +++ b/lib/dns/rdata/generic/cname_5.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1998 Internet Software Consortium. + * Copyright (C) 1998-1999 Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: cname_5.c,v 1.5 1999/01/22 00:36:55 marka Exp $ */ + /* $Id: cname_5.c,v 1.6 1999/01/22 05:02:44 marka Exp $ */ #ifndef RDATA_GENERIC_CNAME_5_H #define RDATA_GENERIC_CNAME_5_H diff --git a/lib/dns/rdata/generic/cname_5.h b/lib/dns/rdata/generic/cname_5.h index cc075175f8..76cd5e4fc2 100644 --- a/lib/dns/rdata/generic/cname_5.h +++ b/lib/dns/rdata/generic/cname_5.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1998 Internet Software Consortium. + * Copyright (C) 1998-1999 Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: cname_5.h,v 1.5 1999/01/22 00:36:55 marka Exp $ */ + /* $Id: cname_5.h,v 1.6 1999/01/22 05:02:44 marka Exp $ */ #ifndef RDATA_GENERIC_CNAME_5_H #define RDATA_GENERIC_CNAME_5_H diff --git a/lib/dns/rdata/generic/hinfo_13.c b/lib/dns/rdata/generic/hinfo_13.c index ba79ee0cb3..b2910bffc4 100644 --- a/lib/dns/rdata/generic/hinfo_13.c +++ b/lib/dns/rdata/generic/hinfo_13.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1998 Internet Software Consortium. + * Copyright (C) 1998-1999 Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: hinfo_13.c,v 1.7 1999/01/22 01:27:30 marka Exp $ */ + /* $Id: hinfo_13.c,v 1.8 1999/01/22 05:02:44 marka Exp $ */ #ifndef RDATA_GENERIC_HINFO_13_H #define RDATA_GENERIC_HINFO_13_H @@ -72,40 +72,26 @@ fromwire_hinfo(dns_rdataclass_t class, dns_rdatatype_t type, static dns_result_t towire_hinfo(dns_rdata_t *rdata, dns_compress_t *cctx, isc_buffer_t *target) { - isc_region_t region; REQUIRE(rdata->type == 13); - cctx = cctx; + cctx = cctx; /*unused*/ - isc_buffer_available(target, ®ion); - if (region.length < rdata->length) - return (DNS_R_NOSPACE); - - memcpy(region.base, rdata->data, rdata->length); - isc_buffer_add(target, rdata->length); - - return (DNS_R_SUCCESS); + return (mem_tobuffer(target, rdata->data, rdata->length)); } static int compare_hinfo(dns_rdata_t *rdata1, dns_rdata_t *rdata2) { - int l; - int result; + isc_region_t r1; + isc_region_t r2; REQUIRE(rdata1->type == rdata2->type); REQUIRE(rdata1->class == rdata2->class); REQUIRE(rdata1->type == 13); - l = (rdata1->length < rdata2->length) ? rdata1->length : rdata2->length; - result = memcmp(rdata1->data, rdata2->data, l); - - if (result != 0) - result = (result < 0) ? -1 : 1; - else if (rdata1->length != rdata2->length) - result = (rdata1->length < rdata2->length) ? -1 : 1; - - return (result); + dns_rdata_toregion(rdata1, &r1); + dns_rdata_toregion(rdata2, &r2); + return (compare_region(&r1, &r2)); } static dns_result_t diff --git a/lib/dns/rdata/generic/hinfo_13.h b/lib/dns/rdata/generic/hinfo_13.h index 84fed057c3..8b3fddd3f6 100644 --- a/lib/dns/rdata/generic/hinfo_13.h +++ b/lib/dns/rdata/generic/hinfo_13.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1998 Internet Software Consortium. + * Copyright (C) 1998-1999 Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: hinfo_13.h,v 1.7 1999/01/22 01:27:30 marka Exp $ */ + /* $Id: hinfo_13.h,v 1.8 1999/01/22 05:02:44 marka Exp $ */ #ifndef RDATA_GENERIC_HINFO_13_H #define RDATA_GENERIC_HINFO_13_H @@ -72,40 +72,26 @@ fromwire_hinfo(dns_rdataclass_t class, dns_rdatatype_t type, static dns_result_t towire_hinfo(dns_rdata_t *rdata, dns_compress_t *cctx, isc_buffer_t *target) { - isc_region_t region; REQUIRE(rdata->type == 13); - cctx = cctx; + cctx = cctx; /*unused*/ - isc_buffer_available(target, ®ion); - if (region.length < rdata->length) - return (DNS_R_NOSPACE); - - memcpy(region.base, rdata->data, rdata->length); - isc_buffer_add(target, rdata->length); - - return (DNS_R_SUCCESS); + return (mem_tobuffer(target, rdata->data, rdata->length)); } static int compare_hinfo(dns_rdata_t *rdata1, dns_rdata_t *rdata2) { - int l; - int result; + isc_region_t r1; + isc_region_t r2; REQUIRE(rdata1->type == rdata2->type); REQUIRE(rdata1->class == rdata2->class); REQUIRE(rdata1->type == 13); - l = (rdata1->length < rdata2->length) ? rdata1->length : rdata2->length; - result = memcmp(rdata1->data, rdata2->data, l); - - if (result != 0) - result = (result < 0) ? -1 : 1; - else if (rdata1->length != rdata2->length) - result = (rdata1->length < rdata2->length) ? -1 : 1; - - return (result); + dns_rdata_toregion(rdata1, &r1); + dns_rdata_toregion(rdata2, &r2); + return (compare_region(&r1, &r2)); } static dns_result_t diff --git a/lib/dns/rdata/generic/isdn_20.c b/lib/dns/rdata/generic/isdn_20.c new file mode 100644 index 0000000000..b1d96bd8cd --- /dev/null +++ b/lib/dns/rdata/generic/isdn_20.c @@ -0,0 +1,130 @@ +/* + * Copyright (C) 1999 Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE + * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + + /* $Id*/ + + /* RFC 1183 */ + +#ifndef RDATA_GENERIC_ISDN_20_H +#define RDATA_GENERIC_ISDN_20_H + +static dns_result_t +fromtext_isdn(dns_rdataclass_t class, dns_rdatatype_t type, + isc_lex_t *lexer, dns_name_t *origin, + isc_boolean_t downcase, isc_buffer_t *target) { + isc_token_t token; + + REQUIRE(type == 20); + + class = class; /*unused*/ + origin = origin; /*unused*/ + downcase = downcase; /*unused*/ + + /* ISDN-address */ + RETERR(gettoken(lexer, &token, isc_tokentype_string, ISC_FALSE)); + RETERR(txt_fromtext(&token.value.as_textregion, target)); + + /* sa: optional */ + RETERR(gettoken(lexer, &token, isc_tokentype_qstring, ISC_TRUE)); + if (token.type != isc_tokentype_string) { + isc_lex_ungettoken(lexer, &token); + return (DNS_R_SUCCESS); + } + return (txt_fromtext(&token.value.as_textregion, target)); +} + +static dns_result_t +totext_isdn(dns_rdata_t *rdata, dns_name_t *origin, isc_buffer_t *target) { + isc_region_t region; + + REQUIRE(rdata->type == 20); + + origin = origin; /*unused*/ + + dns_rdata_toregion(rdata, ®ion); + RETERR(txt_totext(®ion, target)); + if (region.length == 0) + return (DNS_R_SUCCESS); + RETERR(str_totext(" ", target)); + return (txt_totext(®ion, target)); +} + +static dns_result_t +fromwire_isdn(dns_rdataclass_t class, dns_rdatatype_t type, + isc_buffer_t *source, dns_decompress_t *dctx, + isc_boolean_t downcase, isc_buffer_t *target) { + + REQUIRE(type == 20); + + dctx = dctx; /* unused */ + class = class; /* unused */ + downcase = downcase; /* unused */ + + RETERR(txt_fromwire(source, target)); + if (buffer_empty(source)) + return (DNS_R_SUCCESS); + return (txt_fromwire(source, target)); +} + +static dns_result_t +towire_isdn(dns_rdata_t *rdata, dns_compress_t *cctx, isc_buffer_t *target) { + + REQUIRE(rdata->type == 20); + + cctx = cctx; /*unused*/ + + return (mem_tobuffer(target, rdata->data, rdata->length)); +} + +static int +compare_isdn(dns_rdata_t *rdata1, dns_rdata_t *rdata2) { + isc_region_t r1; + isc_region_t r2; + + REQUIRE(rdata1->type == rdata2->type); + REQUIRE(rdata1->class == rdata2->class); + REQUIRE(rdata1->type == 20); + + dns_rdata_toregion(rdata1, &r1); + dns_rdata_toregion(rdata2, &r2); + return (compare_region(&r1, &r2)); +} + +static dns_result_t +fromstruct_isdn(dns_rdataclass_t class, dns_rdatatype_t type, void *source, + isc_buffer_t *target) { + + REQUIRE(type == 20); + + class = class; /*unused*/ + + source = source; + target = target; + + return (DNS_R_NOTIMPLEMENTED); +} + +static dns_result_t +tostruct_isdn(dns_rdata_t *rdata, void *target) { + + REQUIRE(rdata->type == 20); + + target = target; + + return (DNS_R_NOTIMPLEMENTED); +} +#endif /* RDATA_GENERIC_ISDN_20_H */ diff --git a/lib/dns/rdata/generic/isdn_20.h b/lib/dns/rdata/generic/isdn_20.h new file mode 100644 index 0000000000..b1d96bd8cd --- /dev/null +++ b/lib/dns/rdata/generic/isdn_20.h @@ -0,0 +1,130 @@ +/* + * Copyright (C) 1999 Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE + * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + + /* $Id*/ + + /* RFC 1183 */ + +#ifndef RDATA_GENERIC_ISDN_20_H +#define RDATA_GENERIC_ISDN_20_H + +static dns_result_t +fromtext_isdn(dns_rdataclass_t class, dns_rdatatype_t type, + isc_lex_t *lexer, dns_name_t *origin, + isc_boolean_t downcase, isc_buffer_t *target) { + isc_token_t token; + + REQUIRE(type == 20); + + class = class; /*unused*/ + origin = origin; /*unused*/ + downcase = downcase; /*unused*/ + + /* ISDN-address */ + RETERR(gettoken(lexer, &token, isc_tokentype_string, ISC_FALSE)); + RETERR(txt_fromtext(&token.value.as_textregion, target)); + + /* sa: optional */ + RETERR(gettoken(lexer, &token, isc_tokentype_qstring, ISC_TRUE)); + if (token.type != isc_tokentype_string) { + isc_lex_ungettoken(lexer, &token); + return (DNS_R_SUCCESS); + } + return (txt_fromtext(&token.value.as_textregion, target)); +} + +static dns_result_t +totext_isdn(dns_rdata_t *rdata, dns_name_t *origin, isc_buffer_t *target) { + isc_region_t region; + + REQUIRE(rdata->type == 20); + + origin = origin; /*unused*/ + + dns_rdata_toregion(rdata, ®ion); + RETERR(txt_totext(®ion, target)); + if (region.length == 0) + return (DNS_R_SUCCESS); + RETERR(str_totext(" ", target)); + return (txt_totext(®ion, target)); +} + +static dns_result_t +fromwire_isdn(dns_rdataclass_t class, dns_rdatatype_t type, + isc_buffer_t *source, dns_decompress_t *dctx, + isc_boolean_t downcase, isc_buffer_t *target) { + + REQUIRE(type == 20); + + dctx = dctx; /* unused */ + class = class; /* unused */ + downcase = downcase; /* unused */ + + RETERR(txt_fromwire(source, target)); + if (buffer_empty(source)) + return (DNS_R_SUCCESS); + return (txt_fromwire(source, target)); +} + +static dns_result_t +towire_isdn(dns_rdata_t *rdata, dns_compress_t *cctx, isc_buffer_t *target) { + + REQUIRE(rdata->type == 20); + + cctx = cctx; /*unused*/ + + return (mem_tobuffer(target, rdata->data, rdata->length)); +} + +static int +compare_isdn(dns_rdata_t *rdata1, dns_rdata_t *rdata2) { + isc_region_t r1; + isc_region_t r2; + + REQUIRE(rdata1->type == rdata2->type); + REQUIRE(rdata1->class == rdata2->class); + REQUIRE(rdata1->type == 20); + + dns_rdata_toregion(rdata1, &r1); + dns_rdata_toregion(rdata2, &r2); + return (compare_region(&r1, &r2)); +} + +static dns_result_t +fromstruct_isdn(dns_rdataclass_t class, dns_rdatatype_t type, void *source, + isc_buffer_t *target) { + + REQUIRE(type == 20); + + class = class; /*unused*/ + + source = source; + target = target; + + return (DNS_R_NOTIMPLEMENTED); +} + +static dns_result_t +tostruct_isdn(dns_rdata_t *rdata, void *target) { + + REQUIRE(rdata->type == 20); + + target = target; + + return (DNS_R_NOTIMPLEMENTED); +} +#endif /* RDATA_GENERIC_ISDN_20_H */ diff --git a/lib/dns/rdata/generic/mb_7.c b/lib/dns/rdata/generic/mb_7.c index 7d907ebb36..a74f0cbd9f 100644 --- a/lib/dns/rdata/generic/mb_7.c +++ b/lib/dns/rdata/generic/mb_7.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1998 Internet Software Consortium. + * Copyright (C) 1998-1999 Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: mb_7.c,v 1.5 1999/01/22 00:36:55 marka Exp $ */ + /* $Id: mb_7.c,v 1.6 1999/01/22 05:02:45 marka Exp $ */ #ifndef RDATA_GENERIC_MB_7_H #define RDATA_GENERIC_MB_7_H diff --git a/lib/dns/rdata/generic/mb_7.h b/lib/dns/rdata/generic/mb_7.h index 4c23583e17..05ee992f2c 100644 --- a/lib/dns/rdata/generic/mb_7.h +++ b/lib/dns/rdata/generic/mb_7.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1998 Internet Software Consortium. + * Copyright (C) 1998-1999 Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: mb_7.h,v 1.5 1999/01/22 00:36:55 marka Exp $ */ + /* $Id: mb_7.h,v 1.6 1999/01/22 05:02:45 marka Exp $ */ #ifndef RDATA_GENERIC_MB_7_H #define RDATA_GENERIC_MB_7_H diff --git a/lib/dns/rdata/generic/md_3.c b/lib/dns/rdata/generic/md_3.c index ab5d936ce0..2b3064fc1e 100644 --- a/lib/dns/rdata/generic/md_3.c +++ b/lib/dns/rdata/generic/md_3.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1998 Internet Software Consortium. + * Copyright (C) 1998-1999 Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: md_3.c,v 1.5 1999/01/22 00:36:55 marka Exp $ */ + /* $Id: md_3.c,v 1.6 1999/01/22 05:02:45 marka Exp $ */ #ifndef RDATA_GENERIC_MD_3_H #define RDATA_GENERIC_MD_3_H diff --git a/lib/dns/rdata/generic/md_3.h b/lib/dns/rdata/generic/md_3.h index 9307bc3e71..6b95dafa15 100644 --- a/lib/dns/rdata/generic/md_3.h +++ b/lib/dns/rdata/generic/md_3.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1998 Internet Software Consortium. + * Copyright (C) 1998-1999 Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: md_3.h,v 1.5 1999/01/22 00:36:55 marka Exp $ */ + /* $Id: md_3.h,v 1.6 1999/01/22 05:02:45 marka Exp $ */ #ifndef RDATA_GENERIC_MD_3_H #define RDATA_GENERIC_MD_3_H diff --git a/lib/dns/rdata/generic/mf_4.c b/lib/dns/rdata/generic/mf_4.c index 86a69deea0..a7e4a8f737 100644 --- a/lib/dns/rdata/generic/mf_4.c +++ b/lib/dns/rdata/generic/mf_4.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1998 Internet Software Consortium. + * Copyright (C) 1998-1999 Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: mf_4.c,v 1.5 1999/01/22 00:36:56 marka Exp $ */ + /* $Id: mf_4.c,v 1.6 1999/01/22 05:02:45 marka Exp $ */ #ifndef RDATA_GENERIC_MF_4_H #define RDATA_GENERIC_MF_4_H diff --git a/lib/dns/rdata/generic/mf_4.h b/lib/dns/rdata/generic/mf_4.h index 01fd69f196..66817c0b2b 100644 --- a/lib/dns/rdata/generic/mf_4.h +++ b/lib/dns/rdata/generic/mf_4.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1998 Internet Software Consortium. + * Copyright (C) 1998-1999 Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: mf_4.h,v 1.5 1999/01/22 00:36:56 marka Exp $ */ + /* $Id: mf_4.h,v 1.6 1999/01/22 05:02:45 marka Exp $ */ #ifndef RDATA_GENERIC_MF_4_H #define RDATA_GENERIC_MF_4_H diff --git a/lib/dns/rdata/generic/mg_8.c b/lib/dns/rdata/generic/mg_8.c index 5655045063..e905aa0118 100644 --- a/lib/dns/rdata/generic/mg_8.c +++ b/lib/dns/rdata/generic/mg_8.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1998 Internet Software Consortium. + * Copyright (C) 1998-1999 Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: mg_8.c,v 1.5 1999/01/22 00:36:56 marka Exp $ */ + /* $Id: mg_8.c,v 1.6 1999/01/22 05:02:45 marka Exp $ */ #ifndef RDATA_GENERIC_MG_8_H #define RDATA_GENERIC_MG_8_H diff --git a/lib/dns/rdata/generic/mg_8.h b/lib/dns/rdata/generic/mg_8.h index de09bcc626..fdfd302154 100644 --- a/lib/dns/rdata/generic/mg_8.h +++ b/lib/dns/rdata/generic/mg_8.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1998 Internet Software Consortium. + * Copyright (C) 1998-1999 Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: mg_8.h,v 1.5 1999/01/22 00:36:56 marka Exp $ */ + /* $Id: mg_8.h,v 1.6 1999/01/22 05:02:45 marka Exp $ */ #ifndef RDATA_GENERIC_MG_8_H #define RDATA_GENERIC_MG_8_H diff --git a/lib/dns/rdata/generic/minfo_14.c b/lib/dns/rdata/generic/minfo_14.c index f569ab595c..1db1801167 100644 --- a/lib/dns/rdata/generic/minfo_14.c +++ b/lib/dns/rdata/generic/minfo_14.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1998 Internet Software Consortium. + * Copyright (C) 1998-1999 Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: minfo_14.c,v 1.5 1999/01/22 00:36:56 marka Exp $ */ + /* $Id: minfo_14.c,v 1.6 1999/01/22 05:02:46 marka Exp $ */ #ifndef RDATA_GENERIC_MINFO_14_H #define RDATA_GENERIC_MINFO_14_H diff --git a/lib/dns/rdata/generic/minfo_14.h b/lib/dns/rdata/generic/minfo_14.h index 6914c920e3..b2116a6478 100644 --- a/lib/dns/rdata/generic/minfo_14.h +++ b/lib/dns/rdata/generic/minfo_14.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1998 Internet Software Consortium. + * Copyright (C) 1998-1999 Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: minfo_14.h,v 1.5 1999/01/22 00:36:56 marka Exp $ */ + /* $Id: minfo_14.h,v 1.6 1999/01/22 05:02:46 marka Exp $ */ #ifndef RDATA_GENERIC_MINFO_14_H #define RDATA_GENERIC_MINFO_14_H diff --git a/lib/dns/rdata/generic/mr_9.c b/lib/dns/rdata/generic/mr_9.c index 801ea62b44..4e5b1dbc7d 100644 --- a/lib/dns/rdata/generic/mr_9.c +++ b/lib/dns/rdata/generic/mr_9.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1998 Internet Software Consortium. + * Copyright (C) 1998-1999 Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: mr_9.c,v 1.5 1999/01/22 00:36:57 marka Exp $ */ + /* $Id: mr_9.c,v 1.6 1999/01/22 05:02:46 marka Exp $ */ #ifndef RDATA_GENERIC_MR_9_H #define RDATA_GENERIC_MR_9_H diff --git a/lib/dns/rdata/generic/mr_9.h b/lib/dns/rdata/generic/mr_9.h index ca9a6df985..790760a870 100644 --- a/lib/dns/rdata/generic/mr_9.h +++ b/lib/dns/rdata/generic/mr_9.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1998 Internet Software Consortium. + * Copyright (C) 1998-1999 Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: mr_9.h,v 1.5 1999/01/22 00:36:57 marka Exp $ */ + /* $Id: mr_9.h,v 1.6 1999/01/22 05:02:46 marka Exp $ */ #ifndef RDATA_GENERIC_MR_9_H #define RDATA_GENERIC_MR_9_H diff --git a/lib/dns/rdata/generic/mx_15.c b/lib/dns/rdata/generic/mx_15.c index 63bb74edd0..be9169f9fd 100644 --- a/lib/dns/rdata/generic/mx_15.c +++ b/lib/dns/rdata/generic/mx_15.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1998 Internet Software Consortium. + * Copyright (C) 1998-1999 Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: mx_15.c,v 1.8 1999/01/22 00:36:57 marka Exp $ */ + /* $Id: mx_15.c,v 1.9 1999/01/22 05:02:46 marka Exp $ */ #ifndef RDATA_GENERIC_MX_15_H #define RDATA_GENERIC_MX_15_H diff --git a/lib/dns/rdata/generic/mx_15.h b/lib/dns/rdata/generic/mx_15.h index d1cfdd8f42..0fe5bf78c3 100644 --- a/lib/dns/rdata/generic/mx_15.h +++ b/lib/dns/rdata/generic/mx_15.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1998 Internet Software Consortium. + * Copyright (C) 1998-1999 Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: mx_15.h,v 1.8 1999/01/22 00:36:57 marka Exp $ */ + /* $Id: mx_15.h,v 1.9 1999/01/22 05:02:46 marka Exp $ */ #ifndef RDATA_GENERIC_MX_15_H #define RDATA_GENERIC_MX_15_H diff --git a/lib/dns/rdata/generic/ns_2.c b/lib/dns/rdata/generic/ns_2.c index 7b969aa9f0..78ce27373c 100644 --- a/lib/dns/rdata/generic/ns_2.c +++ b/lib/dns/rdata/generic/ns_2.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1998 Internet Software Consortium. + * Copyright (C) 1998-1999 Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: ns_2.c,v 1.5 1999/01/22 00:36:57 marka Exp $ */ + /* $Id: ns_2.c,v 1.6 1999/01/22 05:02:46 marka Exp $ */ #ifndef RDATA_GENERIC_NS_2_H #define RDATA_GENERIC_NS_2_H diff --git a/lib/dns/rdata/generic/ns_2.h b/lib/dns/rdata/generic/ns_2.h index e1afb269ed..950fd8de04 100644 --- a/lib/dns/rdata/generic/ns_2.h +++ b/lib/dns/rdata/generic/ns_2.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1998 Internet Software Consortium. + * Copyright (C) 1998-1999 Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: ns_2.h,v 1.5 1999/01/22 00:36:57 marka Exp $ */ + /* $Id: ns_2.h,v 1.6 1999/01/22 05:02:46 marka Exp $ */ #ifndef RDATA_GENERIC_NS_2_H #define RDATA_GENERIC_NS_2_H diff --git a/lib/dns/rdata/generic/null_10.c b/lib/dns/rdata/generic/null_10.c index 6bd5b1101e..583e16dd6a 100644 --- a/lib/dns/rdata/generic/null_10.c +++ b/lib/dns/rdata/generic/null_10.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1998 Internet Software Consortium. + * Copyright (C) 1998-1999 Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: null_10.c,v 1.4 1999/01/20 05:20:22 marka Exp $ */ + /* $Id: null_10.c,v 1.5 1999/01/22 05:02:47 marka Exp $ */ #ifndef RDATA_GENERIC_NULL_10_H #define RDATA_GENERIC_NULL_10_H diff --git a/lib/dns/rdata/generic/null_10.h b/lib/dns/rdata/generic/null_10.h index 87eb3394f6..54b2a258d0 100644 --- a/lib/dns/rdata/generic/null_10.h +++ b/lib/dns/rdata/generic/null_10.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1998 Internet Software Consortium. + * Copyright (C) 1998-1999 Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: null_10.h,v 1.4 1999/01/20 05:20:22 marka Exp $ */ + /* $Id: null_10.h,v 1.5 1999/01/22 05:02:47 marka Exp $ */ #ifndef RDATA_GENERIC_NULL_10_H #define RDATA_GENERIC_NULL_10_H diff --git a/lib/dns/rdata/generic/proforma.c b/lib/dns/rdata/generic/proforma.c index 19c6e6f3fa..95a36baf06 100644 --- a/lib/dns/rdata/generic/proforma.c +++ b/lib/dns/rdata/generic/proforma.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1998 Internet Software Consortium. + * Copyright (C) 1998-1999 Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: proforma.c,v 1.4 1999/01/20 05:20:23 marka Exp $ */ + /* $Id: proforma.c,v 1.5 1999/01/22 05:02:47 marka Exp $ */ #ifndef RDATA_GENERIC_#_#_H #define RDATA_GENERIC_#_#_H @@ -24,11 +24,13 @@ static dns_result_t fromtext_#(dns_rdataclass_t class, dns_rdatatype_t type, isc_lex_t *lexer, dns_name_t *origin, isc_boolean_t downcase, isc_buffer_t *target) { - unsigned int options = ISC_LEXOPT_EOL | ISC_LEXOPT_EOF; + isc_token_t token; REQUIRE(type == #); REQUIRE(class == #); + RETERR(gettoken(lexer, &token, isc_tokentype_string, ISC_FALSE)); + return (DNS_R_NOTIMPLEMENTED); } @@ -63,13 +65,17 @@ towire_#(dns_rdata_t *rdata, dns_compress_t *cctx, isc_buffer_t *target) { static int compare_#(dns_rdata_t *rdata1, dns_rdata_t *rdata2) { + isc_region_t r1; + isc_region_t r2; REQUIRE(rdata1->type == rdata2->type); REQUIRE(rdata1->class == rdata2->class); REQUIRE(rdata1->type == #); REQUIRE(rdata1->class == #); - return (-2); + dns_rdata_toregion(rdata1, &r1); + dns_rdata_toregion(rdata2, &r2); + return (compare_region(&r1, &r2)); } static dns_result_t diff --git a/lib/dns/rdata/generic/proforma.h b/lib/dns/rdata/generic/proforma.h index e3e6e9df13..a2e991be2b 100644 --- a/lib/dns/rdata/generic/proforma.h +++ b/lib/dns/rdata/generic/proforma.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1998 Internet Software Consortium. + * Copyright (C) 1998-1999 Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: proforma.h,v 1.4 1999/01/20 05:20:23 marka Exp $ */ + /* $Id: proforma.h,v 1.5 1999/01/22 05:02:47 marka Exp $ */ #ifndef RDATA_GENERIC_#_#_H #define RDATA_GENERIC_#_#_H @@ -24,11 +24,13 @@ static dns_result_t fromtext_#(dns_rdataclass_t class, dns_rdatatype_t type, isc_lex_t *lexer, dns_name_t *origin, isc_boolean_t downcase, isc_buffer_t *target) { - unsigned int options = ISC_LEXOPT_EOL | ISC_LEXOPT_EOF; + isc_token_t token; REQUIRE(type == #); REQUIRE(class == #); + RETERR(gettoken(lexer, &token, isc_tokentype_string, ISC_FALSE)); + return (DNS_R_NOTIMPLEMENTED); } @@ -63,13 +65,17 @@ towire_#(dns_rdata_t *rdata, dns_compress_t *cctx, isc_buffer_t *target) { static int compare_#(dns_rdata_t *rdata1, dns_rdata_t *rdata2) { + isc_region_t r1; + isc_region_t r2; REQUIRE(rdata1->type == rdata2->type); REQUIRE(rdata1->class == rdata2->class); REQUIRE(rdata1->type == #); REQUIRE(rdata1->class == #); - return (-2); + dns_rdata_toregion(rdata1, &r1); + dns_rdata_toregion(rdata2, &r2); + return (compare_region(&r1, &r2)); } static dns_result_t diff --git a/lib/dns/rdata/generic/ptr_12.c b/lib/dns/rdata/generic/ptr_12.c index 97ba5296ec..9eda56cdf1 100644 --- a/lib/dns/rdata/generic/ptr_12.c +++ b/lib/dns/rdata/generic/ptr_12.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1998 Internet Software Consortium. + * Copyright (C) 1998-1999 Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: ptr_12.c,v 1.5 1999/01/22 00:36:58 marka Exp $ */ + /* $Id: ptr_12.c,v 1.6 1999/01/22 05:02:47 marka Exp $ */ #ifndef RDATA_GENERIC_PTR_12_H #define RDATA_GENERIC_PTR_12_H diff --git a/lib/dns/rdata/generic/ptr_12.h b/lib/dns/rdata/generic/ptr_12.h index 27cf29752a..32d06e17bc 100644 --- a/lib/dns/rdata/generic/ptr_12.h +++ b/lib/dns/rdata/generic/ptr_12.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1998 Internet Software Consortium. + * Copyright (C) 1998-1999 Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: ptr_12.h,v 1.5 1999/01/22 00:36:58 marka Exp $ */ + /* $Id: ptr_12.h,v 1.6 1999/01/22 05:02:47 marka Exp $ */ #ifndef RDATA_GENERIC_PTR_12_H #define RDATA_GENERIC_PTR_12_H diff --git a/lib/dns/rdata/generic/rp_17.c b/lib/dns/rdata/generic/rp_17.c new file mode 100644 index 0000000000..bc6a201266 --- /dev/null +++ b/lib/dns/rdata/generic/rp_17.c @@ -0,0 +1,186 @@ +/* + * Copyright (C) 1999 Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE + * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + + /* $Id: rp_17.c,v 1.1 1999/01/22 05:02:47 marka Exp $ */ + + /* RFC 1183 */ + +#ifndef RDATA_GENERIC_RP_17_H +#define RDATA_GENERIC_RP_17_H + +static dns_result_t +fromtext_rp(dns_rdataclass_t class, dns_rdatatype_t type, + isc_lex_t *lexer, dns_name_t *origin, + isc_boolean_t downcase, isc_buffer_t *target) { + isc_token_t token; + dns_name_t name; + isc_buffer_t buffer; + int i; + + REQUIRE(type == 17); + + class = class; /*unused*/ + + for (i = 0; i < 2 ; i++) { + RETERR(gettoken(lexer, &token, isc_tokentype_string, + ISC_FALSE)); + dns_name_init(&name, NULL); + buffer_fromregion(&buffer, &token.value.as_region, + ISC_BUFFERTYPE_TEXT); + origin = (origin != NULL) ? origin : dns_rootname; + RETERR(dns_name_fromtext(&name, &buffer, origin, + downcase, target)); + } + return (DNS_R_SUCCESS); +} + +static dns_result_t +totext_rp(dns_rdata_t *rdata, dns_name_t *origin, isc_buffer_t *target) { + isc_region_t region; + dns_name_t rmail; + dns_name_t email; + dns_name_t prefix; + isc_boolean_t sub; + + REQUIRE(rdata->type == 17); + + dns_name_init(&rmail, NULL); + dns_name_init(&email, NULL); + dns_name_init(&prefix, NULL); + + dns_rdata_toregion(rdata, ®ion); + + dns_name_fromregion(&rmail, ®ion); + isc_region_consume(®ion, rmail.length); + + dns_name_fromregion(&email, ®ion); + isc_region_consume(®ion, email.length); + + sub = name_prefix(&rmail, origin, &prefix); + + RETERR(dns_name_totext(&prefix, sub, target)); + + RETERR(str_totext(" ", target)); + + sub = name_prefix(&email, origin, &prefix); + return (dns_name_totext(&prefix, sub, target)); +} + +static dns_result_t +fromwire_rp(dns_rdataclass_t class, dns_rdatatype_t type, + isc_buffer_t *source, dns_decompress_t *dctx, + isc_boolean_t downcase, isc_buffer_t *target) { + dns_name_t rmail; + dns_name_t email; + + REQUIRE(type == 17); + + class = class; /*unused*/ + + dns_name_init(&rmail, NULL); + dns_name_init(&email, NULL); + + RETERR(dns_name_fromwire(&rmail, source, dctx, downcase, target)); + return (dns_name_fromwire(&email, source, dctx, downcase, target)); +} + +static dns_result_t +towire_rp(dns_rdata_t *rdata, dns_compress_t *cctx, isc_buffer_t *target) { + isc_region_t region; + dns_name_t rmail; + dns_name_t email; + + REQUIRE(rdata->type == 17); + + dns_name_init(&rmail, NULL); + dns_name_init(&email, NULL); + + dns_rdata_toregion(rdata, ®ion); + + dns_name_fromregion(&rmail, ®ion); + isc_region_consume(®ion, rmail.length); + + RETERR(dns_name_towire(&rmail, cctx, target)); + + dns_name_fromregion(&rmail, ®ion); + isc_region_consume(®ion, rmail.length); + + return (dns_name_towire(&rmail, cctx, target)); +} + +static int +compare_rp(dns_rdata_t *rdata1, dns_rdata_t *rdata2) { + isc_region_t region1; + isc_region_t region2; + dns_name_t name1; + dns_name_t name2; + int result; + + REQUIRE(rdata1->type == rdata2->type); + REQUIRE(rdata1->class == rdata2->class); + REQUIRE(rdata1->type == 17); + + dns_name_init(&name1, NULL); + dns_name_init(&name2, NULL); + + dns_rdata_toregion(rdata1, ®ion1); + dns_rdata_toregion(rdata2, ®ion2); + + dns_name_fromregion(&name1, ®ion1); + dns_name_fromregion(&name2, ®ion2); + + result = dns_name_compare(&name1, &name2); + if (result != 0) + return (result); + + isc_region_consume(®ion1, name_length(&name1)); + isc_region_consume(®ion2, name_length(&name2)); + + dns_name_init(&name1, NULL); + dns_name_init(&name2, NULL); + + dns_name_fromregion(&name1, ®ion1); + dns_name_fromregion(&name2, ®ion2); + + result = dns_name_compare(&name1, &name2); + return (result); +} + +static dns_result_t +fromstruct_rp(dns_rdataclass_t class, dns_rdatatype_t type, void *source, + isc_buffer_t *target) { + + REQUIRE(type == 17); + + class = class; /*unused*/ + + source = source; + target = target; + + return (DNS_R_NOTIMPLEMENTED); +} + +static dns_result_t +tostruct_rp(dns_rdata_t *rdata, void *target) { + + REQUIRE(rdata->type == 17); + + target = target; + + return (DNS_R_NOTIMPLEMENTED); +} +#endif /* RDATA_GENERIC_RP_17_H */ diff --git a/lib/dns/rdata/generic/rp_17.h b/lib/dns/rdata/generic/rp_17.h new file mode 100644 index 0000000000..2d62fffb4d --- /dev/null +++ b/lib/dns/rdata/generic/rp_17.h @@ -0,0 +1,186 @@ +/* + * Copyright (C) 1999 Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE + * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + + /* $Id: rp_17.h,v 1.1 1999/01/22 05:02:47 marka Exp $ */ + + /* RFC 1183 */ + +#ifndef RDATA_GENERIC_RP_17_H +#define RDATA_GENERIC_RP_17_H + +static dns_result_t +fromtext_rp(dns_rdataclass_t class, dns_rdatatype_t type, + isc_lex_t *lexer, dns_name_t *origin, + isc_boolean_t downcase, isc_buffer_t *target) { + isc_token_t token; + dns_name_t name; + isc_buffer_t buffer; + int i; + + REQUIRE(type == 17); + + class = class; /*unused*/ + + for (i = 0; i < 2 ; i++) { + RETERR(gettoken(lexer, &token, isc_tokentype_string, + ISC_FALSE)); + dns_name_init(&name, NULL); + buffer_fromregion(&buffer, &token.value.as_region, + ISC_BUFFERTYPE_TEXT); + origin = (origin != NULL) ? origin : dns_rootname; + RETERR(dns_name_fromtext(&name, &buffer, origin, + downcase, target)); + } + return (DNS_R_SUCCESS); +} + +static dns_result_t +totext_rp(dns_rdata_t *rdata, dns_name_t *origin, isc_buffer_t *target) { + isc_region_t region; + dns_name_t rmail; + dns_name_t email; + dns_name_t prefix; + isc_boolean_t sub; + + REQUIRE(rdata->type == 17); + + dns_name_init(&rmail, NULL); + dns_name_init(&email, NULL); + dns_name_init(&prefix, NULL); + + dns_rdata_toregion(rdata, ®ion); + + dns_name_fromregion(&rmail, ®ion); + isc_region_consume(®ion, rmail.length); + + dns_name_fromregion(&email, ®ion); + isc_region_consume(®ion, email.length); + + sub = name_prefix(&rmail, origin, &prefix); + + RETERR(dns_name_totext(&prefix, sub, target)); + + RETERR(str_totext(" ", target)); + + sub = name_prefix(&email, origin, &prefix); + return (dns_name_totext(&prefix, sub, target)); +} + +static dns_result_t +fromwire_rp(dns_rdataclass_t class, dns_rdatatype_t type, + isc_buffer_t *source, dns_decompress_t *dctx, + isc_boolean_t downcase, isc_buffer_t *target) { + dns_name_t rmail; + dns_name_t email; + + REQUIRE(type == 17); + + class = class; /*unused*/ + + dns_name_init(&rmail, NULL); + dns_name_init(&email, NULL); + + RETERR(dns_name_fromwire(&rmail, source, dctx, downcase, target)); + return (dns_name_fromwire(&email, source, dctx, downcase, target)); +} + +static dns_result_t +towire_rp(dns_rdata_t *rdata, dns_compress_t *cctx, isc_buffer_t *target) { + isc_region_t region; + dns_name_t rmail; + dns_name_t email; + + REQUIRE(rdata->type == 17); + + dns_name_init(&rmail, NULL); + dns_name_init(&email, NULL); + + dns_rdata_toregion(rdata, ®ion); + + dns_name_fromregion(&rmail, ®ion); + isc_region_consume(®ion, rmail.length); + + RETERR(dns_name_towire(&rmail, cctx, target)); + + dns_name_fromregion(&rmail, ®ion); + isc_region_consume(®ion, rmail.length); + + return (dns_name_towire(&rmail, cctx, target)); +} + +static int +compare_rp(dns_rdata_t *rdata1, dns_rdata_t *rdata2) { + isc_region_t region1; + isc_region_t region2; + dns_name_t name1; + dns_name_t name2; + int result; + + REQUIRE(rdata1->type == rdata2->type); + REQUIRE(rdata1->class == rdata2->class); + REQUIRE(rdata1->type == 17); + + dns_name_init(&name1, NULL); + dns_name_init(&name2, NULL); + + dns_rdata_toregion(rdata1, ®ion1); + dns_rdata_toregion(rdata2, ®ion2); + + dns_name_fromregion(&name1, ®ion1); + dns_name_fromregion(&name2, ®ion2); + + result = dns_name_compare(&name1, &name2); + if (result != 0) + return (result); + + isc_region_consume(®ion1, name_length(&name1)); + isc_region_consume(®ion2, name_length(&name2)); + + dns_name_init(&name1, NULL); + dns_name_init(&name2, NULL); + + dns_name_fromregion(&name1, ®ion1); + dns_name_fromregion(&name2, ®ion2); + + result = dns_name_compare(&name1, &name2); + return (result); +} + +static dns_result_t +fromstruct_rp(dns_rdataclass_t class, dns_rdatatype_t type, void *source, + isc_buffer_t *target) { + + REQUIRE(type == 17); + + class = class; /*unused*/ + + source = source; + target = target; + + return (DNS_R_NOTIMPLEMENTED); +} + +static dns_result_t +tostruct_rp(dns_rdata_t *rdata, void *target) { + + REQUIRE(rdata->type == 17); + + target = target; + + return (DNS_R_NOTIMPLEMENTED); +} +#endif /* RDATA_GENERIC_RP_17_H */ diff --git a/lib/dns/rdata/generic/rt_21.c b/lib/dns/rdata/generic/rt_21.c new file mode 100644 index 0000000000..21316a6f83 --- /dev/null +++ b/lib/dns/rdata/generic/rt_21.c @@ -0,0 +1,176 @@ +/* + * Copyright (C) 1999 Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE + * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + + /* $Id: rt_21.c,v 1.1 1999/01/22 05:02:48 marka Exp $ */ + + /* RFC 1183 */ + +#ifndef RDATA_GENERIC_RT_21_H +#define RDATA_GENERIC_RT_21_H + +static dns_result_t +fromtext_rt(dns_rdataclass_t class, dns_rdatatype_t type, + isc_lex_t *lexer, dns_name_t *origin, + isc_boolean_t downcase, isc_buffer_t *target) { + isc_token_t token; + dns_name_t name; + isc_buffer_t buffer; + + REQUIRE(type == 21); + + class = class; /*unused*/ + + RETERR(gettoken(lexer, &token, isc_tokentype_number, ISC_FALSE)); + + RETERR(uint16_tobuffer(token.value.as_ulong, target)); + + RETERR(gettoken(lexer, &token, isc_tokentype_string, ISC_FALSE)); + + dns_name_init(&name, NULL); + buffer_fromregion(&buffer, &token.value.as_region, + ISC_BUFFERTYPE_TEXT); + origin = (origin != NULL) ? origin : dns_rootname; + return (dns_name_fromtext(&name, &buffer, origin, downcase, target)); +} + +static dns_result_t +totext_rt(dns_rdata_t *rdata, dns_name_t *origin, isc_buffer_t *target) { + isc_region_t region; + dns_name_t name; + dns_name_t prefix; + isc_boolean_t sub; + char buf[sizeof "64000"]; + unsigned short num; + + REQUIRE(rdata->type == 21); + + dns_name_init(&name, NULL); + dns_name_init(&prefix, NULL); + + dns_rdata_toregion(rdata, ®ion); + num = uint16_fromregion(®ion); + isc_region_consume(®ion, 2); + sprintf(buf, "%u", num); + RETERR(str_totext(buf, target)); + RETERR(str_totext(" ", target)); + dns_name_fromregion(&name, ®ion); + sub = name_prefix(&name, origin, &prefix); + return(dns_name_totext(&prefix, sub, target)); +} + +static dns_result_t +fromwire_rt(dns_rdataclass_t class, dns_rdatatype_t type, + isc_buffer_t *source, dns_decompress_t *dctx, + isc_boolean_t downcase, isc_buffer_t *target) { + dns_name_t name; + isc_region_t sregion; + isc_region_t tregion; + + REQUIRE(type == 21); + class = class; /* unused */ + + dns_name_init(&name, NULL); + + isc_buffer_active(source, &sregion); + isc_buffer_available(target, &tregion); + if (tregion.length < 2) + return (DNS_R_NOSPACE); + if (sregion.length < 2) + return (DNS_R_UNEXPECTEDEND); + memcpy(tregion.base, sregion.base, 2); + isc_buffer_forward(source, 2); + isc_buffer_add(target, 2); + return (dns_name_fromwire(&name, source, dctx, downcase, target)); +} + +static dns_result_t +towire_rt(dns_rdata_t *rdata, dns_compress_t *cctx, isc_buffer_t *target) { + dns_name_t name; + isc_region_t region; + isc_region_t tr; + + REQUIRE(rdata->type == 21); + + isc_buffer_available(target, &tr); + dns_rdata_toregion(rdata, ®ion); + if (tr.length < 2) + return (DNS_R_NOSPACE); + memcpy(tr.base, region.base, 2); + isc_region_consume(®ion, 2); + isc_buffer_add(target, 2); + + dns_name_init(&name, NULL); + dns_name_fromregion(&name, ®ion); + + return (dns_name_towire(&name, cctx, target)); +} + +static int +compare_rt(dns_rdata_t *rdata1, dns_rdata_t *rdata2) { + dns_name_t name1; + dns_name_t name2; + isc_region_t region1; + isc_region_t region2; + int result; + + REQUIRE(rdata1->type == rdata2->type); + REQUIRE(rdata1->class == rdata2->class); + REQUIRE(rdata1->type == 21); + + result = memcmp(rdata1->data, rdata2->data, 2); + if (result != 0) + return (result < 0 ? -1 : 1); + + dns_name_init(&name1, NULL); + dns_name_init(&name2, NULL); + + dns_rdata_toregion(rdata1, ®ion1); + dns_rdata_toregion(rdata2, ®ion2); + + isc_region_consume(®ion1, 2); + isc_region_consume(®ion2, 2); + + dns_name_fromregion(&name1, ®ion1); + dns_name_fromregion(&name2, ®ion2); + + return (dns_name_compare(&name1, &name2)); +} + +static dns_result_t +fromstruct_rt(dns_rdataclass_t class, dns_rdatatype_t type, void *source, + isc_buffer_t *target) { + + REQUIRE(type == 21); + + class = class; /*unused*/ + + source = source; + target = target; + + return (DNS_R_NOTIMPLEMENTED); +} + +static dns_result_t +tostruct_rt(dns_rdata_t *rdata, void *target) { + + REQUIRE(rdata->type == 21); + + target = target; + + return (DNS_R_NOTIMPLEMENTED); +} +#endif /* RDATA_GENERIC_RT_21_H */ diff --git a/lib/dns/rdata/generic/rt_21.h b/lib/dns/rdata/generic/rt_21.h new file mode 100644 index 0000000000..33f8a9f571 --- /dev/null +++ b/lib/dns/rdata/generic/rt_21.h @@ -0,0 +1,176 @@ +/* + * Copyright (C) 1999 Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE + * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + + /* $Id: rt_21.h,v 1.1 1999/01/22 05:02:48 marka Exp $ */ + + /* RFC 1183 */ + +#ifndef RDATA_GENERIC_RT_21_H +#define RDATA_GENERIC_RT_21_H + +static dns_result_t +fromtext_rt(dns_rdataclass_t class, dns_rdatatype_t type, + isc_lex_t *lexer, dns_name_t *origin, + isc_boolean_t downcase, isc_buffer_t *target) { + isc_token_t token; + dns_name_t name; + isc_buffer_t buffer; + + REQUIRE(type == 21); + + class = class; /*unused*/ + + RETERR(gettoken(lexer, &token, isc_tokentype_number, ISC_FALSE)); + + RETERR(uint16_tobuffer(token.value.as_ulong, target)); + + RETERR(gettoken(lexer, &token, isc_tokentype_string, ISC_FALSE)); + + dns_name_init(&name, NULL); + buffer_fromregion(&buffer, &token.value.as_region, + ISC_BUFFERTYPE_TEXT); + origin = (origin != NULL) ? origin : dns_rootname; + return (dns_name_fromtext(&name, &buffer, origin, downcase, target)); +} + +static dns_result_t +totext_rt(dns_rdata_t *rdata, dns_name_t *origin, isc_buffer_t *target) { + isc_region_t region; + dns_name_t name; + dns_name_t prefix; + isc_boolean_t sub; + char buf[sizeof "64000"]; + unsigned short num; + + REQUIRE(rdata->type == 21); + + dns_name_init(&name, NULL); + dns_name_init(&prefix, NULL); + + dns_rdata_toregion(rdata, ®ion); + num = uint16_fromregion(®ion); + isc_region_consume(®ion, 2); + sprintf(buf, "%u", num); + RETERR(str_totext(buf, target)); + RETERR(str_totext(" ", target)); + dns_name_fromregion(&name, ®ion); + sub = name_prefix(&name, origin, &prefix); + return(dns_name_totext(&prefix, sub, target)); +} + +static dns_result_t +fromwire_rt(dns_rdataclass_t class, dns_rdatatype_t type, + isc_buffer_t *source, dns_decompress_t *dctx, + isc_boolean_t downcase, isc_buffer_t *target) { + dns_name_t name; + isc_region_t sregion; + isc_region_t tregion; + + REQUIRE(type == 21); + class = class; /* unused */ + + dns_name_init(&name, NULL); + + isc_buffer_active(source, &sregion); + isc_buffer_available(target, &tregion); + if (tregion.length < 2) + return (DNS_R_NOSPACE); + if (sregion.length < 2) + return (DNS_R_UNEXPECTEDEND); + memcpy(tregion.base, sregion.base, 2); + isc_buffer_forward(source, 2); + isc_buffer_add(target, 2); + return (dns_name_fromwire(&name, source, dctx, downcase, target)); +} + +static dns_result_t +towire_rt(dns_rdata_t *rdata, dns_compress_t *cctx, isc_buffer_t *target) { + dns_name_t name; + isc_region_t region; + isc_region_t tr; + + REQUIRE(rdata->type == 21); + + isc_buffer_available(target, &tr); + dns_rdata_toregion(rdata, ®ion); + if (tr.length < 2) + return (DNS_R_NOSPACE); + memcpy(tr.base, region.base, 2); + isc_region_consume(®ion, 2); + isc_buffer_add(target, 2); + + dns_name_init(&name, NULL); + dns_name_fromregion(&name, ®ion); + + return (dns_name_towire(&name, cctx, target)); +} + +static int +compare_rt(dns_rdata_t *rdata1, dns_rdata_t *rdata2) { + dns_name_t name1; + dns_name_t name2; + isc_region_t region1; + isc_region_t region2; + int result; + + REQUIRE(rdata1->type == rdata2->type); + REQUIRE(rdata1->class == rdata2->class); + REQUIRE(rdata1->type == 21); + + result = memcmp(rdata1->data, rdata2->data, 2); + if (result != 0) + return (result < 0 ? -1 : 1); + + dns_name_init(&name1, NULL); + dns_name_init(&name2, NULL); + + dns_rdata_toregion(rdata1, ®ion1); + dns_rdata_toregion(rdata2, ®ion2); + + isc_region_consume(®ion1, 2); + isc_region_consume(®ion2, 2); + + dns_name_fromregion(&name1, ®ion1); + dns_name_fromregion(&name2, ®ion2); + + return (dns_name_compare(&name1, &name2)); +} + +static dns_result_t +fromstruct_rt(dns_rdataclass_t class, dns_rdatatype_t type, void *source, + isc_buffer_t *target) { + + REQUIRE(type == 21); + + class = class; /*unused*/ + + source = source; + target = target; + + return (DNS_R_NOTIMPLEMENTED); +} + +static dns_result_t +tostruct_rt(dns_rdata_t *rdata, void *target) { + + REQUIRE(rdata->type == 21); + + target = target; + + return (DNS_R_NOTIMPLEMENTED); +} +#endif /* RDATA_GENERIC_RT_21_H */ diff --git a/lib/dns/rdata/generic/soa_6.c b/lib/dns/rdata/generic/soa_6.c index 9085f2c487..15f4068d7d 100644 --- a/lib/dns/rdata/generic/soa_6.c +++ b/lib/dns/rdata/generic/soa_6.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1998 Internet Software Consortium. + * Copyright (C) 1998-1999 Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: soa_6.c,v 1.8 1999/01/22 00:36:58 marka Exp $ */ + /* $Id: soa_6.c,v 1.9 1999/01/22 05:02:48 marka Exp $ */ #ifndef RDATA_GENERIC_SOA_6_H #define RDATA_GENERIC_SOA_6_H diff --git a/lib/dns/rdata/generic/soa_6.h b/lib/dns/rdata/generic/soa_6.h index 1bcbc249e1..1e62015ede 100644 --- a/lib/dns/rdata/generic/soa_6.h +++ b/lib/dns/rdata/generic/soa_6.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1998 Internet Software Consortium. + * Copyright (C) 1998-1999 Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: soa_6.h,v 1.8 1999/01/22 00:36:58 marka Exp $ */ + /* $Id: soa_6.h,v 1.9 1999/01/22 05:02:48 marka Exp $ */ #ifndef RDATA_GENERIC_SOA_6_H #define RDATA_GENERIC_SOA_6_H diff --git a/lib/dns/rdata/generic/txt_16.c b/lib/dns/rdata/generic/txt_16.c index 782b8964bd..b25ad2243a 100644 --- a/lib/dns/rdata/generic/txt_16.c +++ b/lib/dns/rdata/generic/txt_16.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1998 Internet Software Consortium. + * Copyright (C) 1998-1999 Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: txt_16.c,v 1.7 1999/01/22 01:27:30 marka Exp $ */ + /* $Id: txt_16.c,v 1.8 1999/01/22 05:02:48 marka Exp $ */ #ifndef RDATA_GENERIC_TXT_16_H #define RDATA_GENERIC_TXT_16_H diff --git a/lib/dns/rdata/generic/txt_16.h b/lib/dns/rdata/generic/txt_16.h index 352c0beb03..47bae3634c 100644 --- a/lib/dns/rdata/generic/txt_16.h +++ b/lib/dns/rdata/generic/txt_16.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1998 Internet Software Consortium. + * Copyright (C) 1998-1999 Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: txt_16.h,v 1.7 1999/01/22 01:27:30 marka Exp $ */ + /* $Id: txt_16.h,v 1.8 1999/01/22 05:02:48 marka Exp $ */ #ifndef RDATA_GENERIC_TXT_16_H #define RDATA_GENERIC_TXT_16_H diff --git a/lib/dns/rdata/generic/x25_19.c b/lib/dns/rdata/generic/x25_19.c new file mode 100644 index 0000000000..ded64edde0 --- /dev/null +++ b/lib/dns/rdata/generic/x25_19.c @@ -0,0 +1,127 @@ +/* + * Copyright (C) 1999 Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE + * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + + /* $Id: x25_19.c,v 1.1 1999/01/22 05:02:49 marka Exp $ */ + + /* RFC 1183 */ + +#ifndef RDATA_GENERIC_X25_19_H +#define RDATA_GENERIC_X25_19_H + +#include + +static dns_result_t +fromtext_x25(dns_rdataclass_t class, dns_rdatatype_t type, + isc_lex_t *lexer, dns_name_t *origin, + isc_boolean_t downcase, isc_buffer_t *target) { + isc_token_t token; + unsigned int i; + + REQUIRE(type == 19); + + class = class; /*unused*/ + origin = origin; /*unused*/ + downcase = downcase; /*unused*/ + + RETERR(gettoken(lexer, &token, isc_tokentype_string, ISC_FALSE)); + for (i = 0; i < token.value.as_textregion.length; i++) + if (!isascii(token.value.as_textregion.base[i]&0xff) || + !isdigit(token.value.as_textregion.base[i]&0xff)) + return (DNS_R_RANGE); + return (txt_fromtext(&token.value.as_textregion, target)); +} + +static dns_result_t +totext_x25(dns_rdata_t *rdata, dns_name_t *origin, isc_buffer_t *target) { + isc_region_t region; + + REQUIRE(rdata->type == 19); + + origin = origin; /*unused*/ + + dns_rdata_toregion(rdata, ®ion); + return (txt_totext(®ion, target)); +} + +static dns_result_t +fromwire_x25(dns_rdataclass_t class, dns_rdatatype_t type, + isc_buffer_t *source, dns_decompress_t *dctx, + isc_boolean_t downcase, isc_buffer_t *target) { + + REQUIRE(type == 19); + + dctx = dctx; /* unused */ + class = class; /* unused */ + downcase = downcase; /* unused */ + + return (txt_fromwire(source, target)); +} + +static dns_result_t +towire_x25(dns_rdata_t *rdata, dns_compress_t *cctx, isc_buffer_t *target) { + + REQUIRE(rdata->type == 19); + + cctx = cctx; + + return (mem_tobuffer(target, rdata->data, rdata->length)); +} + +static int +compare_x25(dns_rdata_t *rdata1, dns_rdata_t *rdata2) { + int l; + int result; + + REQUIRE(rdata1->type == rdata2->type); + REQUIRE(rdata1->class == rdata2->class); + REQUIRE(rdata1->type == 19); + + l = (rdata1->length < rdata2->length) ? rdata1->length : rdata2->length; + result = memcmp(rdata1->data, rdata2->data, l); + + if (result != 0) + result = (result < 0) ? -1 : 1; + else if (rdata1->length != rdata2->length) + result = (rdata1->length < rdata2->length) ? -1 : 1; + + return (result); +} + +static dns_result_t +fromstruct_x25(dns_rdataclass_t class, dns_rdatatype_t type, void *source, + isc_buffer_t *target) { + + REQUIRE(type == 19); + + class = class; /*unused*/ + + source = source; + target = target; + + return (DNS_R_NOTIMPLEMENTED); +} + +static dns_result_t +tostruct_x25(dns_rdata_t *rdata, void *target) { + + REQUIRE(rdata->type == 19); + + target = target; + + return (DNS_R_NOTIMPLEMENTED); +} +#endif /* RDATA_GENERIC_X25_19_H */ diff --git a/lib/dns/rdata/generic/x25_19.h b/lib/dns/rdata/generic/x25_19.h new file mode 100644 index 0000000000..daab5b5ab2 --- /dev/null +++ b/lib/dns/rdata/generic/x25_19.h @@ -0,0 +1,127 @@ +/* + * Copyright (C) 1999 Internet Software Consortium. + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS + * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE + * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. + */ + + /* $Id: x25_19.h,v 1.1 1999/01/22 05:02:49 marka Exp $ */ + + /* RFC 1183 */ + +#ifndef RDATA_GENERIC_X25_19_H +#define RDATA_GENERIC_X25_19_H + +#include + +static dns_result_t +fromtext_x25(dns_rdataclass_t class, dns_rdatatype_t type, + isc_lex_t *lexer, dns_name_t *origin, + isc_boolean_t downcase, isc_buffer_t *target) { + isc_token_t token; + unsigned int i; + + REQUIRE(type == 19); + + class = class; /*unused*/ + origin = origin; /*unused*/ + downcase = downcase; /*unused*/ + + RETERR(gettoken(lexer, &token, isc_tokentype_string, ISC_FALSE)); + for (i = 0; i < token.value.as_textregion.length; i++) + if (!isascii(token.value.as_textregion.base[i]&0xff) || + !isdigit(token.value.as_textregion.base[i]&0xff)) + return (DNS_R_RANGE); + return (txt_fromtext(&token.value.as_textregion, target)); +} + +static dns_result_t +totext_x25(dns_rdata_t *rdata, dns_name_t *origin, isc_buffer_t *target) { + isc_region_t region; + + REQUIRE(rdata->type == 19); + + origin = origin; /*unused*/ + + dns_rdata_toregion(rdata, ®ion); + return (txt_totext(®ion, target)); +} + +static dns_result_t +fromwire_x25(dns_rdataclass_t class, dns_rdatatype_t type, + isc_buffer_t *source, dns_decompress_t *dctx, + isc_boolean_t downcase, isc_buffer_t *target) { + + REQUIRE(type == 19); + + dctx = dctx; /* unused */ + class = class; /* unused */ + downcase = downcase; /* unused */ + + return (txt_fromwire(source, target)); +} + +static dns_result_t +towire_x25(dns_rdata_t *rdata, dns_compress_t *cctx, isc_buffer_t *target) { + + REQUIRE(rdata->type == 19); + + cctx = cctx; + + return (mem_tobuffer(target, rdata->data, rdata->length)); +} + +static int +compare_x25(dns_rdata_t *rdata1, dns_rdata_t *rdata2) { + int l; + int result; + + REQUIRE(rdata1->type == rdata2->type); + REQUIRE(rdata1->class == rdata2->class); + REQUIRE(rdata1->type == 19); + + l = (rdata1->length < rdata2->length) ? rdata1->length : rdata2->length; + result = memcmp(rdata1->data, rdata2->data, l); + + if (result != 0) + result = (result < 0) ? -1 : 1; + else if (rdata1->length != rdata2->length) + result = (rdata1->length < rdata2->length) ? -1 : 1; + + return (result); +} + +static dns_result_t +fromstruct_x25(dns_rdataclass_t class, dns_rdatatype_t type, void *source, + isc_buffer_t *target) { + + REQUIRE(type == 19); + + class = class; /*unused*/ + + source = source; + target = target; + + return (DNS_R_NOTIMPLEMENTED); +} + +static dns_result_t +tostruct_x25(dns_rdata_t *rdata, void *target) { + + REQUIRE(rdata->type == 19); + + target = target; + + return (DNS_R_NOTIMPLEMENTED); +} +#endif /* RDATA_GENERIC_X25_19_H */ diff --git a/lib/dns/rdata/in_1/a_1.c b/lib/dns/rdata/in_1/a_1.c index 81d0b4160b..40fcdb380c 100644 --- a/lib/dns/rdata/in_1/a_1.c +++ b/lib/dns/rdata/in_1/a_1.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1998 Internet Software Consortium. + * Copyright (C) 1998-1999 Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: a_1.c,v 1.7 1999/01/22 04:35:10 explorer Exp $ */ + /* $Id: a_1.c,v 1.8 1999/01/22 05:02:49 marka Exp $ */ #ifndef RDATA_IN_1_A_1_H #define RDATA_IN_1_A_1_H diff --git a/lib/dns/rdata/in_1/a_1.h b/lib/dns/rdata/in_1/a_1.h index f3130e5196..2d4817f1ba 100644 --- a/lib/dns/rdata/in_1/a_1.h +++ b/lib/dns/rdata/in_1/a_1.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1998 Internet Software Consortium. + * Copyright (C) 1998-1999 Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: a_1.h,v 1.7 1999/01/22 04:35:10 explorer Exp $ */ + /* $Id: a_1.h,v 1.8 1999/01/22 05:02:49 marka Exp $ */ #ifndef RDATA_IN_1_A_1_H #define RDATA_IN_1_A_1_H diff --git a/lib/dns/rdata/in_1/wks_11.c b/lib/dns/rdata/in_1/wks_11.c index 7ac4bd08ff..785aa6e0c7 100644 --- a/lib/dns/rdata/in_1/wks_11.c +++ b/lib/dns/rdata/in_1/wks_11.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1998 Internet Software Consortium. + * Copyright (C) 1999 Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: wks_11.c,v 1.3 1999/01/22 04:35:10 explorer Exp $ */ + /* $Id: wks_11.c,v 1.4 1999/01/22 05:02:49 marka Exp $ */ #ifndef RDATA_IN_1_WKS_11_H #define RDATA_IN_1_WKS_11_H diff --git a/lib/dns/rdata/in_1/wks_11.h b/lib/dns/rdata/in_1/wks_11.h index 493297975a..ca2fa4ddcb 100644 --- a/lib/dns/rdata/in_1/wks_11.h +++ b/lib/dns/rdata/in_1/wks_11.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 1998 Internet Software Consortium. + * Copyright (C) 1999 Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -15,7 +15,7 @@ * SOFTWARE. */ - /* $Id: wks_11.h,v 1.3 1999/01/22 04:35:10 explorer Exp $ */ + /* $Id: wks_11.h,v 1.4 1999/01/22 05:02:49 marka Exp $ */ #ifndef RDATA_IN_1_WKS_11_H #define RDATA_IN_1_WKS_11_H