nxt_30.c revision a134177ed9f82189504191d90f3ed9e97c2b47cb
a134177ed9f82189504191d90f3ed9e97c2b47cbTinderbox User * Copyright (C) 1999-2005, 2007, 2009, 2015-2017 Internet Systems Consortium, Inc. ("ISC")
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * This Source Code Form is subject to the terms of the Mozilla Public
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * License, v. 2.0. If a copy of the MPL was not distributed with this
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews * file, You can obtain one at http://mozilla.org/MPL/2.0/.
4b6dc226f78862286daa69fba761eac9fd5da16aAutomatic Updater/* $Id: nxt_30.c,v 1.65 2009/12/04 22:06:37 tbox Exp $ */
ecd3b66f8c4544a55dd44fddda7c7134b936cd3bJames Brister/* reviewed: Wed Mar 15 18:21:15 PST 2000 by brister */
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein/* RFC2535 */
59a6d9effd893036e39e14e775e1c98b0cd22388Andreas Gustafsson * The attributes do not include DNS_RDATATYPEATTR_SINGLETON
59a6d9effd893036e39e14e775e1c98b0cd22388Andreas Gustafsson * because we must be able to handle a parent/child NXT pair.
34b394b43e2207e8f8f3703f0402422121455638David Lawrence * Next domain.
add4043305ca411202ed9cf1929a4179016515ceBrian Wellington RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string,
6e49e91bd08778d7eae45a2229dcf41ed97cc636David Lawrence buffer_fromregion(&buffer, &token.value.as_region);
2047977ce2dfcfe3a0fa2d638c3242841310fad3Mark Andrews RETTOK(dns_name_fromtext(&name, &buffer, origin, options, target));
add4043305ca411202ed9cf1929a4179016515ceBrian Wellington RETERR(isc_lex_getmastertoken(lexer, &token,
19c5c23ef6e38965949c996592bd92478da0612cMark Andrews * NXT is only specified for types 1..127.
19c5c23ef6e38965949c996592bd92478da0612cMark Andrews } while (1);
2bc0da0cd874b15593d65338ba96e90ceed13072Mark Andrews unsigned int i, j;
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafsson sub = name_prefix(&name, tctx->origin, &prefix);
2bc0da0cd874b15593d65338ba96e90ceed13072Mark Andrews for (j = 0; j < 8; j++)
94a08e09db3dc844b6ee4841c368a2d7074a9c3fAndreas Gustafsson dns_decompress_setmethods(dctx, DNS_COMPRESS_NONE);
2047977ce2dfcfe3a0fa2d638c3242841310fad3Mark Andrews RETERR(dns_name_fromwire(&name, source, dctx, options, target));
182a34004c7c48e2c1626f3ce7e787f413955126Mark Andrews if (sr.length > 0 && (sr.base[0] & 0x80) == 0 &&
182a34004c7c48e2c1626f3ce7e787f413955126Mark Andrews ((sr.length > 16) || sr.base[sr.length - 1] == 0))
2bc0da0cd874b15593d65338ba96e90ceed13072Mark Andrews RETERR(mem_tobuffer(target, sr.base, sr.length));
94a08e09db3dc844b6ee4841c368a2d7074a9c3fAndreas Gustafsson dns_compress_setmethods(cctx, DNS_COMPRESS_NONE);
2bc0da0cd874b15593d65338ba96e90ceed13072Mark Andrews return (mem_tobuffer(target, sr.base, sr.length));
4529cdaedaf1a0a5f8ff89aeca510b7a4475446cBob Halleystatic inline int
b0ba1a6059b6d6c4b3aa77d8bc84cc443b981e01Mukund Sivaraman REQUIRE(rdata1->type == dns_rdatatype_nxt);
41aad56b6cc458cbf7b8483576d990a77ae9bac2Andreas Gustafsson order = dns_name_rdatacompare(&name1, &name2);
daf99720c90d7f527a12e76e437ae8c95fdf84caAndreas Gustafsson REQUIRE(nxt->typebits != NULL || nxt->len == 0);
182a34004c7c48e2c1626f3ce7e787f413955126Mark Andrews if (nxt->typebits != NULL && (nxt->typebits[0] & 0x80) == 0) {
e484f9de4f2cdab05d9db4f0bbcdd15d365f0b31Brian Wellington RETERR(isc_buffer_copyregion(target, ®ion));
e484f9de4f2cdab05d9db4f0bbcdd15d365f0b31Brian Wellington return (mem_tobuffer(target, nxt->typebits, nxt->len));
e484f9de4f2cdab05d9db4f0bbcdd15d365f0b31Brian Wellington isc_region_consume(®ion, name_length(&name));
e484f9de4f2cdab05d9db4f0bbcdd15d365f0b31Brian Wellington RETERR(name_duporclone(&name, mctx, &nxt->next));
daf99720c90d7f527a12e76e437ae8c95fdf84caAndreas Gustafsson nxt->typebits = mem_maybedup(mctx, region.base, region.length);
4529cdaedaf1a0a5f8ff89aeca510b7a4475446cBob Halleystatic inline void
b0ba1a6059b6d6c4b3aa77d8bc84cc443b981e01Mukund Sivaraman REQUIRE(nxt->common.rdtype == dns_rdatatype_nxt);
3d17a3ba61a303d5c4d9867068d0fbe9f24d2988Mark Andrewsstatic inline int
854d0238dbc2908490197984b3b9d558008a53dfMark Andrews#endif /* RDATA_GENERIC_NXT_30_C */