3457. [protocol] Add ILNP records (NID, LP, L32, L64). [RT #31836]

This commit is contained in:
Mark Andrews 2013-01-10 08:26:31 +11:00
parent ad64ed1829
commit 1c24d761e6
27 changed files with 2629 additions and 9 deletions

View file

@ -1,3 +1,5 @@
3457. [protocol] Add ILNP records (NID, LP, L32, L64). [RT #31836]
3456. [port] g++47: aft fails to compile. [RT #32012]
3455. [contrib] queryperf: fix getopt option list. [RT #32338]

View file

@ -0,0 +1,26 @@
#!/bin/sh
#
# Copyright (C) 2005-2007, 2012 Internet Systems Consortium, Inc. ("ISC")
#
# Permission to use, copy, modify, and/or 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 ISC DISCLAIMS ALL WARRANTIES WITH
# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
# AND FITNESS. IN NO EVENT SHALL ISC 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: clean.sh,v 1.6 2007/09/26 03:22:44 marka Exp $
#
# Clean up after tests.
#
rm -f dig.out.*
rm -f */named.memstats
rm -f */named.conf
rm -f */named.run

View file

@ -0,0 +1,2 @@
# this server runs named with only one worker thread
-m record,size,mctx -c named.conf -d 99 -g -T clienttest -n 1

View file

@ -0,0 +1,62 @@
/*
* Copyright (C) 2005-2007 Internet Systems Consortium, Inc. ("ISC")
*
* Permission to use, copy, modify, and/or 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 ISC DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS. IN NO EVENT SHALL ISC 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: named.conf,v 1.5 2007/06/19 23:47:06 tbox Exp $ */
options {
query-source address 10.53.0.1;
notify-source 10.53.0.1;
transfer-source 10.53.0.1;
recursion no;
additional-from-auth no;
port 5300;
pid-file "named.pid";
listen-on { 10.53.0.1; };
listen-on-v6 { none; };
notify no;
minimal-responses yes;
};
include "../../common/rndc.key";
controls {
inet 10.53.0.1 port 9953 allow { any; } keys { rndc_key; };
};
zone "rt.example" {
type master;
file "rt.db";
};
zone "naptr.example" {
type master;
file "naptr.db";
};
zone "rt2.example" {
type master;
file "rt2.db";
};
zone "naptr2.example" {
type master;
file "naptr2.db";
};
zone "nid.example" {
type master;
file "nid.db";
};

View file

@ -0,0 +1,62 @@
/*
* Copyright (C) 2005-2007 Internet Systems Consortium, Inc. ("ISC")
*
* Permission to use, copy, modify, and/or 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 ISC DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS. IN NO EVENT SHALL ISC 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: named.conf,v 1.5 2007/06/19 23:47:06 tbox Exp $ */
options {
query-source address 10.53.0.1;
notify-source 10.53.0.1;
transfer-source 10.53.0.1;
recursion no;
additional-from-auth no;
port 5300;
pid-file "named.pid";
listen-on { 10.53.0.1; };
listen-on-v6 { none; };
notify no;
minimal-responses no;
};
include "../../common/rndc.key";
controls {
inet 10.53.0.1 port 9953 allow { any; } keys { rndc_key; };
};
zone "rt.example" {
type master;
file "rt.db";
};
zone "naptr.example" {
type master;
file "naptr.db";
};
zone "rt2.example" {
type master;
file "rt2.db";
};
zone "naptr2.example" {
type master;
file "naptr2.db";
};
zone "nid.example" {
type master;
file "nid.db";
};

View file

@ -0,0 +1,9 @@
$TTL 86400
@ IN SOA ns1 hostmaster ( 2 8H 2H 4W 1D );
NS ns1
ns1 A 127.0.0.0
nap IN NAPTR 50 50 "S" "SIPS+D2T" "" server
server SRV 0 0 5061 server
server A 192.168.2.9
server AAAA 192::9

View file

@ -0,0 +1,9 @@
$TTL 86400
@ IN SOA ns1 hostmaster ( 2 8H 2H 4W 1D );
NS ns1
ns1 A 127.0.0.0
nap IN NAPTR 50 50 "S" "SIPS+D2T" "" server.hang3a.zone.
www AAAA 192::99
www A 192.168.2.99
www X25 100099

View file

@ -0,0 +1,10 @@
$TTL 86400
@ IN SOA ns1 hostmaster ( 2 8H 2H 4W 1D );
NS ns1
ns1 A 127.0.0.0
ns1 NID 2 0:0:0:0
ns1 L64 2 0:0:0:0
ns1 L32 2 0.0.0.0
nid2 NID 2 0:0:0:1
nid2 LP 2 ns1

View file

@ -0,0 +1,9 @@
$TTL 86400
@ IN SOA ns1 hostmaster ( 2 8H 2H 4W 1D );
NS ns1
ns1 A 127.0.0.0
rt RT 2 www
www AAAA 192::99
www A 192.168.2.99
www X25 100099

View file

@ -0,0 +1,9 @@
$TTL 86400
@ IN SOA ns1 hostmaster ( 2 8H 2H 4W 1D );
NS ns1
ns1 A 127.0.0.0
rt RT 2 www.hang3b.zone.
server SRV 0 0 5061 server
server A 192.168.2.9
server AAAA 192::9

View file

@ -0,0 +1,17 @@
#!/bin/sh
#
# Copyright (C) 2012 Internet Systems Consortium, Inc. ("ISC")
#
# Permission to use, copy, modify, and/or 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 ISC DISCLAIMS ALL WARRANTIES WITH
# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
# AND FITNESS. IN NO EVENT SHALL ISC 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.
cp -f ns1/named1.conf ns1/named.conf

View file

@ -0,0 +1,121 @@
#!/bin/sh
#
# Copyright (C) 2005-2007, 2011, 2012 Internet Systems Consortium, Inc. ("ISC")
#
# Permission to use, copy, modify, and/or 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 ISC DISCLAIMS ALL WARRANTIES WITH
# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
# AND FITNESS. IN NO EVENT SHALL ISC 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: tests.sh,v 1.7 2011/11/06 23:46:40 tbox Exp $
SYSTEMTESTTOP=..
. $SYSTEMTESTTOP/conf.sh
status=0
n=0
dotests() {
n=`expr $n + 1`
echo "I:test with RT, single zone ($n)"
ret=0
$DIG -t RT rt.rt.example @10.53.0.1 -p 5300 > dig.out.$n || ret=1
if [ $ret -eq 1 ] ; then
echo "I: failed"; status=1
fi
n=`expr $n + 1`
echo "I:test with RT, two zones ($n)"
ret=0
$DIG -t RT rt.rt2.example @10.53.0.1 -p 5300 > dig.out.$n || ret=1
if [ $ret -eq 1 ] ; then
echo "I: failed"; status=1
fi
n=`expr $n + 1`
echo "I:test with NAPTR, single zone ($n)"
ret=0
$DIG -t NAPTR nap.naptr.example @10.53.0.1 -p 5300 > dig.out.$n || ret=1
if [ $ret -eq 1 ] ; then
echo "I: failed"; status=1
fi
n=`expr $n + 1`
echo "I:test with NAPTR, two zones ($n)"
ret=0
$DIG -t NAPTR nap.hang3b.example @10.53.0.1 -p 5300 > dig.out.$n || ret=1
if [ $ret -eq 1 ] ; then
echo "I: failed"; status=1
fi
n=`expr $n + 1`
echo "I:test with LP ($n)"
ret=0
$DIG -t LP nid2.nid.example @10.53.0.1 -p 5300 > dig.out.$n || ret=1
if [ $minimal = no ] ; then
grep "L64" dig.out.$n > /dev/null || ret=1
grep "L32" dig.out.$n > /dev/null || ret=1
else
grep "L64" dig.out.$n > /dev/null && ret=1
grep "L32" dig.out.$n > /dev/null && ret=1
fi
if [ $ret -eq 1 ] ; then
echo "I: failed"; status=1
fi
n=`expr $n + 1`
echo "I:test with NID ($n)"
ret=0
$DIG -t NID ns1.nid.example @10.53.0.1 -p 5300 > dig.out.$n || ret=1
if [ $minimal = no ] ; then
# change && to || when we support NID additional processing
grep "L64" dig.out.$n > /dev/null && ret=1
grep "L32" dig.out.$n > /dev/null && ret=1
else
grep "L64" dig.out.$n > /dev/null && ret=1
grep "L32" dig.out.$n > /dev/null && ret=1
fi
if [ $ret -eq 1 ] ; then
echo "I: failed"; status=1
fi
n=`expr $n + 1`
echo "I:test with NID + LP ($n)"
ret=0
$DIG -t NID nid2.nid.example @10.53.0.1 -p 5300 > dig.out.$n || ret=1
if [ $minimal = no ] ; then
# change && to || when we support NID additional processing
grep "LP" dig.out.$n > /dev/null && ret=1
grep "L64" dig.out.$n > /dev/null && ret=1
grep "L32" dig.out.$n > /dev/null && ret=1
else
grep "LP" dig.out.$n > /dev/null && ret=1
grep "L64" dig.out.$n > /dev/null && ret=1
grep "L32" dig.out.$n > /dev/null && ret=1
fi
if [ $ret -eq 1 ] ; then
echo "I: failed"; status=1
fi
}
echo "I:testing with 'minimal-responses yes;'"
minimal=yes
dotests
echo "I:reconfiguring server"
cp ns1/named2.conf ns1/named.conf
$RNDC -c ../common/rndc.conf -s 10.53.0.1 -p 9953 reconfig 2>&1 | sed 's/^/I:ns1 /'
sleep 2
echo "I:testing with 'minimal-responses no;'"
minimal=no
dotests
exit $status

View file

@ -55,14 +55,14 @@ ARPANAME=$TOP/bin/tools/arpaname
# The "stress" test is not run by default since it creates enough
# load on the machine to make it unusable to other users.
# v6synth
SUBDIRS="acl allow_query addzone autosign builtin cacheclean checkconf
@CHECKDS@ checknames checkzone database dlv dlvauto dlz dlzexternal
dname dns64 dnssec ecdsa forward glue gost ixfr inline limits
logfileconfig lwresd masterfile masterformat metadata notify
nsupdate pending pkcs11 redirect resolver rndc rpz rrsetorder
rsabigexponent sortlist smartsign staticstub stub tkey tsig
tsiggss unknown upforwd verify views wildcard xfer xferquota
zonechecks"
SUBDIRS="acl additional allow_query addzone autosign builtin
cacheclean checkconf @CHECKDS@ checknames checkzone database
dlv dlvauto dlz dlzexternal dname dns64 dnssec ecdsa forward
glue gost ixfr inline limits logfileconfig lwresd masterfile
masterformat metadata notify nsupdate pending pkcs11
redirect resolver rndc rpz rrsetorder rsabigexponent
sortlist smartsign staticstub stub tkey tsig tsiggss unknown
upforwd verify views wildcard xfer xferquota zonechecks"
# PERL will be an empty string if no perl interpreter was found.
PERL=@PERL@

View file

@ -275,6 +275,14 @@ tlsa TLSA ( 1 1 2 92003ba34942dc74152e2f2c408d29ec
1b177615d466f6c4b71c216a50292bd5
8c9ebdd2f74e38fe51ffd48c43326cbc )
nid NID 10 0014:4fff:ff20:ee64
l32 L32 10 1.2.3.4
l64 L64 10 0014:4fff:ff20:ee64
lp LP 10 example.net.
; type 255
; TSIG is a meta-type and should never occur in master files.

View file

@ -20,7 +20,7 @@ gpos01.example. 3600 IN GPOS "-22.6882" "116.8652" "250.0"
gpos02.example. 3600 IN GPOS "" "" ""
hinfo01.example. 3600 IN HINFO "Generic PC clone" "NetBSD-1.4"
hinfo02.example. 3600 IN HINFO "PC" "NetBSD"
hip1.example. 3600 IN HIP 2 200100107B1A74DF365639CC39F1D578 AwEAAbdxyhNuSutc5EMzxTs9LBPCIkOFH8cIvM4p9+LrV4e19WzK00+CI6zBCQTdtWsuxKbWIy87UOoJTwkUs7lBu+Upr1gsNrut79ryra+bSRGQb1slImA8YVJyuIDsj7kwzG7jnERNqnWxZ48AWkskmdHaVDP4BcelrTI3rMXdXF5D
hip1.example. 3600 IN HIP 2 200100107B1A74DF365639CC39F1D578 AwEAAbdxyhNuSutc5EMzxTs9LBPCIkOFH8cIvM4p9+LrV4e19WzK00+CI6zBCQTdtWsuxKbWIy87UOoJTwkUs7lBu+Upr1gsNrut79ryra+bSRGQb1slImA8YVJyuIDsj7kwzG7jnERNqnWxZ48AWkskmdHaVDP4BcelrTI3rMXdXF5D
hip2.example. 3600 IN HIP 2 200100107B1A74DF365639CC39F1D578 AwEAAbdxyhNuSutc5EMzxTs9LBPCIkOFH8cIvM4p9+LrV4e19WzK00+CI6zBCQTdtWsuxKbWIy87UOoJTwkUs7lBu+Upr1gsNrut79ryra+bSRGQb1slImA8YVJyuIDsj7kwzG7jnERNqnWxZ48AWkskmdHaVDP4BcelrTI3rMXdXF5D rvs.example.com.
isdn01.example. 3600 IN ISDN "isdn-address"
isdn02.example. 3600 IN ISDN "isdn-address" "subaddress"
@ -31,6 +31,10 @@ kx01.example. 3600 IN KX 10 kdc.example.
kx02.example. 3600 IN KX 10 .
loc01.example. 3600 IN LOC 60 9 0.000 N 24 39 0.000 E 10.00m 20m 2000m 20m
loc02.example. 3600 IN LOC 60 9 0.000 N 24 39 0.000 E 10.00m 20m 2000m 20m
l32.example. 3600 IN L32 10 1.2.3.4
l64.example. 3600 IN L64 10 14:4fff:ff20:ee64
lp.example. 3600 IN LP 10 example.net.
nid.example. 3600 IN NID 10 14:4fff:ff20:ee64
mb01.example. 3600 IN MG madname.example.
mb02.example. 3600 IN MG .
mg01.example. 3600 IN MG mgmname.example.

View file

@ -31,6 +31,10 @@ kx01.example. 3600 IN KX 10 kdc.example.
kx02.example. 3600 IN KX 10 .
loc01.example. 3600 IN LOC 60 9 0.000 N 24 39 0.000 E 10.00m 20m 2000m 20m
loc02.example. 3600 IN LOC 60 9 0.000 N 24 39 0.000 E 10.00m 20m 2000m 20m
l32.example. 3600 IN L32 10 1.2.3.4
l64.example. 3600 IN L64 10 14:4fff:ff20:ee64
lp.example. 3600 IN LP 10 example.net.
nid.example. 3600 IN NID 10 14:4fff:ff20:ee64
mb01.example. 3600 IN MG madname.example.
mb02.example. 3600 IN MG .
mg01.example. 3600 IN MG mgmname.example.

View file

@ -141,3 +141,6 @@
5933: Use of GOST Signature Algorithms in DNSKEY
and RRSIG Resource Records for DNSSEC
6303: Locally Served DNS Zones
6742: DNS Resource Records for the
Identifier-Locator Network Protocol (ILNP)

1123
doc/rfc/rfc6742.txt Normal file

File diff suppressed because it is too large Load diff

View file

@ -221,6 +221,72 @@ static isc_result_t
unknown_totext(dns_rdata_t *rdata, dns_rdata_textctx_t *tctx,
isc_buffer_t *target);
/*% INT16 Size */
#define NS_INT16SZ 2
/*% IPv6 Address Size */
#define NS_LOCATORSZ 8
/*%
* convert presentation level address to network order binary form.
* \return
* 1 if `src' is a valid [RFC1884 2.2] address, else 0.
* \note
* (1) does not touch `dst' unless it's returning 1.
*/
static inline int
locator_pton(const char *src, unsigned char *dst) {
static const char xdigits_l[] = "0123456789abcdef",
xdigits_u[] = "0123456789ABCDEF";
unsigned char tmp[NS_LOCATORSZ];
unsigned char *tp = tmp, *endp;
const char *xdigits, *curtok;
int ch, seen_xdigits;
unsigned int val;
memset(tp, '\0', NS_LOCATORSZ);
endp = tp + NS_LOCATORSZ;
curtok = src;
seen_xdigits = 0;
val = 0;
while ((ch = *src++) != '\0') {
const char *pch;
pch = strchr((xdigits = xdigits_l), ch);
if (pch == NULL)
pch = strchr((xdigits = xdigits_u), ch);
if (pch != NULL) {
val <<= 4;
val |= (pch - xdigits);
if (++seen_xdigits > 4)
return (0);
continue;
}
if (ch == ':') {
curtok = src;
if (!seen_xdigits)
return (0);
if (tp + NS_INT16SZ > endp)
return (0);
*tp++ = (unsigned char) (val >> 8) & 0xff;
*tp++ = (unsigned char) val & 0xff;
seen_xdigits = 0;
val = 0;
continue;
}
return (0);
}
if (seen_xdigits) {
if (tp + NS_INT16SZ > endp)
return (0);
*tp++ = (unsigned char) (val >> 8) & 0xff;
*tp++ = (unsigned char) val & 0xff;
}
if (tp != endp)
return (0);
memcpy(dst, tmp, NS_LOCATORSZ);
return (1);
}
static inline int
getquad(const void *src, struct in_addr *dst,
isc_lex_t *lexer, dns_rdatacallbacks_t *callbacks)

View file

@ -0,0 +1,233 @@
/*
* Copyright (C) 2012 Internet Systems Consortium, Inc. ("ISC")
*
* Permission to use, copy, modify, and/or 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 ISC DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS. IN NO EVENT SHALL ISC 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.
*/
#ifndef RDATA_GENERIC_L32_105_C
#define RDATA_GENERIC_L32_105_C
#include <string.h>
#include <isc/net.h>
#define RRTYPE_L32_ATTRIBUTES (0)
static inline isc_result_t
fromtext_l32(ARGS_FROMTEXT) {
isc_token_t token;
struct in_addr addr;
isc_region_t region;
REQUIRE(type == 105);
UNUSED(type);
UNUSED(rdclass);
UNUSED(origin);
UNUSED(options);
UNUSED(callbacks);
RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number,
ISC_FALSE));
if (token.value.as_ulong > 0xffffU)
RETTOK(ISC_R_RANGE);
RETERR(uint16_tobuffer(token.value.as_ulong, target));
RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string,
ISC_FALSE));
if (getquad(DNS_AS_STR(token), &addr, lexer, callbacks) != 1)
RETTOK(DNS_R_BADDOTTEDQUAD);
isc_buffer_availableregion(target, &region);
if (region.length < 4)
return (ISC_R_NOSPACE);
memcpy(region.base, &addr, 4);
isc_buffer_add(target, 4);
return (ISC_R_SUCCESS);
}
static inline isc_result_t
totext_l32(ARGS_TOTEXT) {
isc_region_t region;
char buf[sizeof("65000")];
unsigned short num;
REQUIRE(rdata->type == 105);
REQUIRE(rdata->length == 6);
UNUSED(tctx);
dns_rdata_toregion(rdata, &region);
num = uint16_fromregion(&region);
isc_region_consume(&region, 2);
sprintf(buf, "%u", num);
RETERR(str_totext(buf, target));
RETERR(str_totext(" ", target));
return (inet_totext(AF_INET, &region, target));
}
static inline isc_result_t
fromwire_l32(ARGS_FROMWIRE) {
isc_region_t sregion;
REQUIRE(type == 105);
UNUSED(type);
UNUSED(options);
UNUSED(rdclass);
UNUSED(dctx);
isc_buffer_activeregion(source, &sregion);
if (sregion.length != 6)
return (DNS_R_FORMERR);
isc_buffer_forward(source, sregion.length);
return (mem_tobuffer(target, sregion.base, sregion.length));
}
static inline isc_result_t
towire_l32(ARGS_TOWIRE) {
REQUIRE(rdata->type == 105);
REQUIRE(rdata->length == 6);
UNUSED(cctx);
return (mem_tobuffer(target, rdata->data, rdata->length));
}
static inline int
compare_l32(ARGS_COMPARE) {
isc_region_t region1;
isc_region_t region2;
REQUIRE(rdata1->type == rdata2->type);
REQUIRE(rdata1->rdclass == rdata2->rdclass);
REQUIRE(rdata1->type == 105);
REQUIRE(rdata1->length == 6);
REQUIRE(rdata2->length == 6);
dns_rdata_toregion(rdata1, &region1);
dns_rdata_toregion(rdata2, &region2);
return (isc_region_compare(&region1, &region2));
}
static inline isc_result_t
fromstruct_l32(ARGS_FROMSTRUCT) {
dns_rdata_l32_t *l32 = source;
isc_uint32_t n;
REQUIRE(type == 105);
REQUIRE(source != NULL);
REQUIRE(l32->common.rdtype == type);
REQUIRE(l32->common.rdclass == rdclass);
UNUSED(type);
UNUSED(rdclass);
RETERR(uint16_tobuffer(l32->pref, target));
n = ntohl(l32->l32.s_addr);
return (uint32_tobuffer(n, target));
}
static inline isc_result_t
tostruct_l32(ARGS_TOSTRUCT) {
isc_region_t region;
dns_rdata_l32_t *l32 = target;
isc_uint32_t n;
REQUIRE(rdata->type == 105);
REQUIRE(target != NULL);
REQUIRE(rdata->length == 6);
UNUSED(mctx);
l32->common.rdclass = rdata->rdclass;
l32->common.rdtype = rdata->type;
ISC_LINK_INIT(&l32->common, link);
dns_rdata_toregion(rdata, &region);
l32->pref = uint16_fromregion(&region);
n = uint32_fromregion(&region);
l32->l32.s_addr = htonl(n);
return (ISC_R_SUCCESS);
}
static inline void
freestruct_l32(ARGS_FREESTRUCT) {
dns_rdata_l32_t *l32 = source;
REQUIRE(source != NULL);
REQUIRE(l32->common.rdtype == 105);
return;
}
static inline isc_result_t
additionaldata_l32(ARGS_ADDLDATA) {
REQUIRE(rdata->type == 105);
REQUIRE(rdata->length == 6);
UNUSED(rdata);
UNUSED(add);
UNUSED(arg);
return (ISC_R_SUCCESS);
}
static inline isc_result_t
digest_l32(ARGS_DIGEST) {
isc_region_t r;
REQUIRE(rdata->type == 105);
REQUIRE(rdata->length == 6);
dns_rdata_toregion(rdata, &r);
return ((digest)(arg, &r));
}
static inline isc_boolean_t
checkowner_l32(ARGS_CHECKOWNER) {
REQUIRE(type == 105);
UNUSED(name);
UNUSED(type);
UNUSED(rdclass);
UNUSED(wildcard);
return (ISC_TRUE);
}
static inline isc_boolean_t
checknames_l32(ARGS_CHECKNAMES) {
REQUIRE(rdata->type == 105);
REQUIRE(rdata->length == 6);
UNUSED(rdata);
UNUSED(owner);
UNUSED(bad);
return (ISC_TRUE);
}
static inline int
casecompare_l32(ARGS_COMPARE) {
return (compare_l32(rdata1, rdata2));
}
#endif /* RDATA_GENERIC_L32_105_C */

View file

@ -0,0 +1,27 @@
/*
* Copyright (C) 2012 Internet Systems Consortium, Inc. ("ISC")
*
* Permission to use, copy, modify, and/or 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 ISC DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS. IN NO EVENT SHALL ISC 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.
*/
/* */
#ifndef GENERIC_L32_105_H
#define GENERIC_L32_105_H 1
typedef struct dns_rdata_l32 {
dns_rdatacommon_t common;
isc_uint16_t pref;
struct in_addr l32;
} dns_rdata_l32_t;
#endif /* GENERIC_L32_105_H */

View file

@ -0,0 +1,228 @@
/*
* Copyright (C) 2012 Internet Systems Consortium, Inc. ("ISC")
*
* Permission to use, copy, modify, and/or 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 ISC DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS. IN NO EVENT SHALL ISC 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.
*/
#ifndef RDATA_GENERIC_L64_106_C
#define RDATA_GENERIC_L64_106_C
#include <string.h>
#include <isc/net.h>
#define RRTYPE_L64_ATTRIBUTES (0)
static inline isc_result_t
fromtext_l64(ARGS_FROMTEXT) {
isc_token_t token;
unsigned char locator[NS_LOCATORSZ];
REQUIRE(type == 106);
UNUSED(type);
UNUSED(rdclass);
UNUSED(origin);
UNUSED(options);
UNUSED(callbacks);
RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number,
ISC_FALSE));
if (token.value.as_ulong > 0xffffU)
RETTOK(ISC_R_RANGE);
RETERR(uint16_tobuffer(token.value.as_ulong, target));
RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string,
ISC_FALSE));
if (locator_pton(DNS_AS_STR(token), locator) != 1)
RETTOK(DNS_R_SYNTAX);
return (mem_tobuffer(target, locator, NS_LOCATORSZ));
}
static inline isc_result_t
totext_l64(ARGS_TOTEXT) {
isc_region_t region;
char buf[sizeof("xxxx:xxxx:xxxx:xxxx")];
unsigned short num;
REQUIRE(rdata->type == 106);
REQUIRE(rdata->length == 10);
UNUSED(tctx);
dns_rdata_toregion(rdata, &region);
num = uint16_fromregion(&region);
isc_region_consume(&region, 2);
sprintf(buf, "%u", num);
RETERR(str_totext(buf, target));
RETERR(str_totext(" ", target));
sprintf(buf, "%x:%x:%x:%x",
region.base[0]<<8 | region.base[1],
region.base[2]<<8 | region.base[3],
region.base[4]<<8 | region.base[5],
region.base[6]<<8 | region.base[7]);
return (str_totext(buf, target));
}
static inline isc_result_t
fromwire_l64(ARGS_FROMWIRE) {
isc_region_t sregion;
REQUIRE(type == 106);
UNUSED(type);
UNUSED(options);
UNUSED(rdclass);
UNUSED(dctx);
isc_buffer_activeregion(source, &sregion);
if (sregion.length != 10)
return (DNS_R_FORMERR);
isc_buffer_forward(source, sregion.length);
return (mem_tobuffer(target, sregion.base, sregion.length));
}
static inline isc_result_t
towire_l64(ARGS_TOWIRE) {
REQUIRE(rdata->type == 106);
REQUIRE(rdata->length == 10);
UNUSED(cctx);
return (mem_tobuffer(target, rdata->data, rdata->length));
}
static inline int
compare_l64(ARGS_COMPARE) {
isc_region_t region1;
isc_region_t region2;
REQUIRE(rdata1->type == rdata2->type);
REQUIRE(rdata1->rdclass == rdata2->rdclass);
REQUIRE(rdata1->type == 106);
REQUIRE(rdata1->length == 10);
REQUIRE(rdata2->length == 10);
dns_rdata_toregion(rdata1, &region1);
dns_rdata_toregion(rdata2, &region2);
return (isc_region_compare(&region1, &region2));
}
static inline isc_result_t
fromstruct_l64(ARGS_FROMSTRUCT) {
dns_rdata_l64_t *l64 = source;
REQUIRE(type == 106);
REQUIRE(source != NULL);
REQUIRE(l64->common.rdtype == type);
REQUIRE(l64->common.rdclass == rdclass);
UNUSED(type);
UNUSED(rdclass);
RETERR(uint16_tobuffer(l64->pref, target));
return (mem_tobuffer(target, l64->l64, sizeof(l64->l64)));
}
static inline isc_result_t
tostruct_l64(ARGS_TOSTRUCT) {
isc_region_t region;
dns_rdata_l64_t *l64 = target;
REQUIRE(rdata->type == 106);
REQUIRE(target != NULL);
REQUIRE(rdata->length == 10);
UNUSED(mctx);
l64->common.rdclass = rdata->rdclass;
l64->common.rdtype = rdata->type;
ISC_LINK_INIT(&l64->common, link);
dns_rdata_toregion(rdata, &region);
l64->pref = uint16_fromregion(&region);
memcpy(l64->l64, region.base, region.length);
return (ISC_R_SUCCESS);
}
static inline void
freestruct_l64(ARGS_FREESTRUCT) {
dns_rdata_l64_t *l64 = source;
REQUIRE(source != NULL);
REQUIRE(l64->common.rdtype == 106);
return;
}
static inline isc_result_t
additionaldata_l64(ARGS_ADDLDATA) {
REQUIRE(rdata->type == 106);
REQUIRE(rdata->length == 10);
UNUSED(rdata);
UNUSED(add);
UNUSED(arg);
return (ISC_R_SUCCESS);
}
static inline isc_result_t
digest_l64(ARGS_DIGEST) {
isc_region_t r;
REQUIRE(rdata->type == 106);
REQUIRE(rdata->length == 10);
dns_rdata_toregion(rdata, &r);
return ((digest)(arg, &r));
}
static inline isc_boolean_t
checkowner_l64(ARGS_CHECKOWNER) {
REQUIRE(type == 106);
UNUSED(name);
UNUSED(type);
UNUSED(rdclass);
UNUSED(wildcard);
return (ISC_TRUE);
}
static inline isc_boolean_t
checknames_l64(ARGS_CHECKNAMES) {
REQUIRE(rdata->type == 106);
REQUIRE(rdata->length == 10);
UNUSED(rdata);
UNUSED(owner);
UNUSED(bad);
return (ISC_TRUE);
}
static inline int
casecompare_l64(ARGS_COMPARE) {
return (compare_l64(rdata1, rdata2));
}
#endif /* RDATA_GENERIC_L64_106_C */

View file

@ -0,0 +1,27 @@
/*
* Copyright (C) 2012 Internet Systems Consortium, Inc. ("ISC")
*
* Permission to use, copy, modify, and/or 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 ISC DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS. IN NO EVENT SHALL ISC 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.
*/
/* */
#ifndef GENERIC_L64_106_H
#define GENERIC_L64_106_H 1
typedef struct dns_rdata_l64 {
dns_rdatacommon_t common;
isc_uint16_t pref;
unsigned char l64[8];
} dns_rdata_l64_t;
#endif /* GENERIC_L64_106_H */

View file

@ -0,0 +1,276 @@
/*
* Copyright (C) 2004, 2005, 2007, 2009 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 1998-2001, 2003 Internet Software Consortium.
*
* Permission to use, copy, modify, and/or 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 ISC DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS. IN NO EVENT SHALL ISC 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.
*/
#ifndef RDATA_GENERIC_LP_107_C
#define RDATA_GENERIC_LP_107_C
#include <string.h>
#include <isc/net.h>
#define RRTYPE_LP_ATTRIBUTES (0)
static inline isc_result_t
fromtext_lp(ARGS_FROMTEXT) {
isc_token_t token;
dns_name_t name;
isc_buffer_t buffer;
REQUIRE(type == 107);
UNUSED(type);
UNUSED(rdclass);
UNUSED(callbacks);
RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number,
ISC_FALSE));
if (token.value.as_ulong > 0xffffU)
RETTOK(ISC_R_RANGE);
RETERR(uint16_tobuffer(token.value.as_ulong, target));
RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string,
ISC_FALSE));
dns_name_init(&name, NULL);
buffer_fromregion(&buffer, &token.value.as_region);
origin = (origin != NULL) ? origin : dns_rootname;
return (dns_name_fromtext(&name, &buffer, origin, options, target));
}
static inline isc_result_t
totext_lp(ARGS_TOTEXT) {
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 == 107);
REQUIRE(rdata->length != 0);
dns_name_init(&name, NULL);
dns_name_init(&prefix, NULL);
dns_rdata_toregion(rdata, &region);
num = uint16_fromregion(&region);
isc_region_consume(&region, 2);
sprintf(buf, "%u", num);
RETERR(str_totext(buf, target));
RETERR(str_totext(" ", target));
dns_name_fromregion(&name, &region);
sub = name_prefix(&name, tctx->origin, &prefix);
return (dns_name_totext(&prefix, sub, target));
}
static inline isc_result_t
fromwire_lp(ARGS_FROMWIRE) {
dns_name_t name;
isc_region_t sregion;
REQUIRE(type == 107);
UNUSED(type);
UNUSED(rdclass);
dns_decompress_setmethods(dctx, DNS_COMPRESS_GLOBAL14);
dns_name_init(&name, NULL);
isc_buffer_activeregion(source, &sregion);
if (sregion.length < 2)
return (ISC_R_UNEXPECTEDEND);
RETERR(mem_tobuffer(target, sregion.base, 2));
isc_buffer_forward(source, 2);
return (dns_name_fromwire(&name, source, dctx, options, target));
}
static inline isc_result_t
towire_lp(ARGS_TOWIRE) {
REQUIRE(rdata->type == 107);
REQUIRE(rdata->length != 0);
UNUSED(cctx);
return (mem_tobuffer(target, rdata->data, rdata->length));
}
static inline int
compare_lp(ARGS_COMPARE) {
isc_region_t region1;
isc_region_t region2;
REQUIRE(rdata1->type == rdata2->type);
REQUIRE(rdata1->rdclass == rdata2->rdclass);
REQUIRE(rdata1->type == 107);
REQUIRE(rdata1->length != 0);
REQUIRE(rdata2->length != 0);
dns_rdata_toregion(rdata1, &region1);
dns_rdata_toregion(rdata2, &region2);
return (isc_region_compare(&region1, &region2));
}
static inline isc_result_t
fromstruct_lp(ARGS_FROMSTRUCT) {
dns_rdata_lp_t *lp = source;
isc_region_t region;
REQUIRE(type == 107);
REQUIRE(source != NULL);
REQUIRE(lp->common.rdtype == type);
REQUIRE(lp->common.rdclass == rdclass);
UNUSED(type);
UNUSED(rdclass);
RETERR(uint16_tobuffer(lp->pref, target));
dns_name_toregion(&lp->lp, &region);
return (isc_buffer_copyregion(target, &region));
}
static inline isc_result_t
tostruct_lp(ARGS_TOSTRUCT) {
isc_region_t region;
dns_rdata_lp_t *lp = target;
dns_name_t name;
REQUIRE(rdata->type == 107);
REQUIRE(target != NULL);
REQUIRE(rdata->length != 0);
lp->common.rdclass = rdata->rdclass;
lp->common.rdtype = rdata->type;
ISC_LINK_INIT(&lp->common, link);
dns_name_init(&name, NULL);
dns_rdata_toregion(rdata, &region);
lp->pref = uint16_fromregion(&region);
isc_region_consume(&region, 2);
dns_name_fromregion(&name, &region);
dns_name_init(&lp->lp, NULL);
RETERR(name_duporclone(&name, mctx, &lp->lp));
lp->mctx = mctx;
return (ISC_R_SUCCESS);
}
static inline void
freestruct_lp(ARGS_FREESTRUCT) {
dns_rdata_lp_t *lp = source;
REQUIRE(source != NULL);
REQUIRE(lp->common.rdtype == 107);
if (lp->mctx == NULL)
return;
dns_name_free(&lp->lp, lp->mctx);
lp->mctx = NULL;
}
static inline isc_result_t
additionaldata_lp(ARGS_ADDLDATA) {
dns_name_t name;
dns_offsets_t offsets;
isc_region_t region;
isc_result_t result;
REQUIRE(rdata->type == 107);
dns_name_init(&name, offsets);
dns_rdata_toregion(rdata, &region);
isc_region_consume(&region, 2);
dns_name_fromregion(&name, &region);
result = (add)(arg, &name, dns_rdatatype_l32);
if (result != ISC_R_SUCCESS)
return (result);
return ((add)(arg, &name, dns_rdatatype_l64));
}
static inline isc_result_t
digest_lp(ARGS_DIGEST) {
isc_region_t region;
REQUIRE(rdata->type == 107);
dns_rdata_toregion(rdata, &region);
return ((digest)(arg, &region));
}
static inline isc_boolean_t
checkowner_lp(ARGS_CHECKOWNER) {
REQUIRE(type == 107);
UNUSED(type);
UNUSED(rdclass);
UNUSED(name);
UNUSED(wildcard);
return (ISC_TRUE);
}
static inline isc_boolean_t
checknames_lp(ARGS_CHECKNAMES) {
REQUIRE(rdata->type == 107);
UNUSED(bad);
UNUSED(owner);
return (ISC_TRUE);
}
static inline int
casecompare_lp(ARGS_COMPARE) {
dns_name_t name1;
dns_name_t name2;
isc_region_t region1;
isc_region_t region2;
int order;
REQUIRE(rdata1->type == rdata2->type);
REQUIRE(rdata1->rdclass == rdata2->rdclass);
REQUIRE(rdata1->type == 107);
REQUIRE(rdata1->length != 0);
REQUIRE(rdata2->length != 0);
order = memcmp(rdata1->data, rdata2->data, 2);
if (order != 0)
return (order < 0 ? -1 : 1);
dns_name_init(&name1, NULL);
dns_name_init(&name2, NULL);
dns_rdata_toregion(rdata1, &region1);
dns_rdata_toregion(rdata2, &region2);
isc_region_consume(&region1, 2);
isc_region_consume(&region2, 2);
dns_name_fromregion(&name1, &region1);
dns_name_fromregion(&name2, &region2);
return (dns_name_rdatacompare(&name1, &name2));
}
#endif /* RDATA_GENERIC_LP_107_C */

View file

@ -0,0 +1,28 @@
/*
* Copyright (C) 2012 Internet Systems Consortium, Inc. ("ISC")
*
* Permission to use, copy, modify, and/or 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 ISC DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS. IN NO EVENT SHALL ISC 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.
*/
/* */
#ifndef GENERIC_LP_107_H
#define GENERIC_LP_107_H 1
typedef struct dns_rdata_lp {
dns_rdatacommon_t common;
isc_mem_t *mctx;
isc_uint16_t pref;
dns_name_t lp;
} dns_rdata_lp_t;
#endif /* GENERIC_LP_107_H */

View file

@ -0,0 +1,228 @@
/*
* Copyright (C) 2012 Internet Systems Consortium, Inc. ("ISC")
*
* Permission to use, copy, modify, and/or 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 ISC DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS. IN NO EVENT SHALL ISC 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.
*/
#ifndef RDATA_GENERIC_NID_104_C
#define RDATA_GENERIC_NID_104_C
#include <string.h>
#include <isc/net.h>
#define RRTYPE_NID_ATTRIBUTES (0)
static inline isc_result_t
fromtext_nid(ARGS_FROMTEXT) {
isc_token_t token;
unsigned char locator[NS_LOCATORSZ];
REQUIRE(type == 104);
UNUSED(type);
UNUSED(rdclass);
UNUSED(origin);
UNUSED(options);
UNUSED(callbacks);
RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number,
ISC_FALSE));
if (token.value.as_ulong > 0xffffU)
RETTOK(ISC_R_RANGE);
RETERR(uint16_tobuffer(token.value.as_ulong, target));
RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string,
ISC_FALSE));
if (locator_pton(DNS_AS_STR(token), locator) != 1)
RETTOK(DNS_R_SYNTAX);
return (mem_tobuffer(target, locator, NS_LOCATORSZ));
}
static inline isc_result_t
totext_nid(ARGS_TOTEXT) {
isc_region_t region;
char buf[sizeof("xxxx:xxxx:xxxx:xxxx")];
unsigned short num;
REQUIRE(rdata->type == 104);
REQUIRE(rdata->length != 0);
UNUSED(tctx);
dns_rdata_toregion(rdata, &region);
num = uint16_fromregion(&region);
isc_region_consume(&region, 2);
sprintf(buf, "%u", num);
RETERR(str_totext(buf, target));
RETERR(str_totext(" ", target));
sprintf(buf, "%x:%x:%x:%x",
region.base[0]<<8 | region.base[1],
region.base[2]<<8 | region.base[3],
region.base[4]<<8 | region.base[5],
region.base[6]<<8 | region.base[7]);
return (str_totext(buf, target));
}
static inline isc_result_t
fromwire_nid(ARGS_FROMWIRE) {
isc_region_t sregion;
REQUIRE(type == 104);
UNUSED(type);
UNUSED(options);
UNUSED(rdclass);
UNUSED(dctx);
isc_buffer_activeregion(source, &sregion);
if (sregion.length != 10)
return (DNS_R_FORMERR);
isc_buffer_forward(source, sregion.length);
return (mem_tobuffer(target, sregion.base, sregion.length));
}
static inline isc_result_t
towire_nid(ARGS_TOWIRE) {
REQUIRE(rdata->type == 104);
REQUIRE(rdata->length == 10);
UNUSED(cctx);
return (mem_tobuffer(target, rdata->data, rdata->length));
}
static inline int
compare_nid(ARGS_COMPARE) {
isc_region_t region1;
isc_region_t region2;
REQUIRE(rdata1->type == rdata2->type);
REQUIRE(rdata1->rdclass == rdata2->rdclass);
REQUIRE(rdata1->type == 104);
REQUIRE(rdata1->length == 10);
REQUIRE(rdata2->length == 10);
dns_rdata_toregion(rdata1, &region1);
dns_rdata_toregion(rdata2, &region2);
return (isc_region_compare(&region1, &region2));
}
static inline isc_result_t
fromstruct_nid(ARGS_FROMSTRUCT) {
dns_rdata_nid_t *nid = source;
REQUIRE(type == 104);
REQUIRE(source != NULL);
REQUIRE(nid->common.rdtype == type);
REQUIRE(nid->common.rdclass == rdclass);
UNUSED(type);
UNUSED(rdclass);
RETERR(uint16_tobuffer(nid->pref, target));
return (mem_tobuffer(target, nid->nid, sizeof(nid->nid)));
}
static inline isc_result_t
tostruct_nid(ARGS_TOSTRUCT) {
isc_region_t region;
dns_rdata_nid_t *nid = target;
REQUIRE(rdata->type == 104);
REQUIRE(target != NULL);
REQUIRE(rdata->length == 10);
UNUSED(mctx);
nid->common.rdclass = rdata->rdclass;
nid->common.rdtype = rdata->type;
ISC_LINK_INIT(&nid->common, link);
dns_rdata_toregion(rdata, &region);
nid->pref = uint16_fromregion(&region);
memcpy(nid->nid, region.base, region.length);
return (ISC_R_SUCCESS);
}
static inline void
freestruct_nid(ARGS_FREESTRUCT) {
dns_rdata_nid_t *nid = source;
REQUIRE(source != NULL);
REQUIRE(nid->common.rdtype == 104);
return;
}
static inline isc_result_t
additionaldata_nid(ARGS_ADDLDATA) {
REQUIRE(rdata->type == 104);
REQUIRE(rdata->length == 10);
UNUSED(rdata);
UNUSED(add);
UNUSED(arg);
return (ISC_R_SUCCESS);
}
static inline isc_result_t
digest_nid(ARGS_DIGEST) {
isc_region_t r;
REQUIRE(rdata->type == 104);
REQUIRE(rdata->length == 10);
dns_rdata_toregion(rdata, &r);
return ((digest)(arg, &r));
}
static inline isc_boolean_t
checkowner_nid(ARGS_CHECKOWNER) {
REQUIRE(type == 104);
UNUSED(name);
UNUSED(type);
UNUSED(rdclass);
UNUSED(wildcard);
return (ISC_TRUE);
}
static inline isc_boolean_t
checknames_nid(ARGS_CHECKNAMES) {
REQUIRE(rdata->type == 104);
REQUIRE(rdata->length == 10);
UNUSED(rdata);
UNUSED(owner);
UNUSED(bad);
return (ISC_TRUE);
}
static inline int
casecompare_nid(ARGS_COMPARE) {
return (compare_nid(rdata1, rdata2));
}
#endif /* RDATA_GENERIC_NID_104_C */

View file

@ -0,0 +1,27 @@
/*
* Copyright (C) 2012 Internet Systems Consortium, Inc. ("ISC")
*
* Permission to use, copy, modify, and/or 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 ISC DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS. IN NO EVENT SHALL ISC 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.
*/
/* */
#ifndef GENERIC_NID_104_H
#define GENERIC_NID_104_H 1
typedef struct dns_rdata_nid {
dns_rdatacommon_t common;
isc_uint16_t pref;
unsigned char nid[8];
} dns_rdata_nid_t;
#endif /* GENERIC_NID_104_H */