9a006fe9a05abc03c0e81977802194dab8737206Tinderbox User * Copyright (C) 2002, 2004, 2005, 2007-2009, 2014-2016 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/.
28a8f5b0de57d269cf2845c69cb6abe18cbd3b3aMark Andrews/* $Id: apl_42.c,v 1.16 2009/12/04 22:06:37 tbox Exp $ */
e08daafffce8fb74ffca8ecf5772e334299ccf76Bob Halley/* RFC3123 */
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉 RETTOK(isc_parse_uint8(&prefix, slash + 1, 10));
386d3a99c190bad55edf44d076e6bd087e230ab8Tatuya JINMEI 神明達哉 RETERR(uint8_tobuffer(len | ((neg) ? 0x80 : 0), target));
64ecc88345766e124e1fb053dbf4e36550471f83Evan Hunt } while (1);
7de2c6e6d51f38daeb2d346f3f21dc01ccece6daEvan Hunt * Let upper layer handle eol/eof.
9effea437d7973c9ed981ab2e14b219182d86ee7Curtis Blackburn REQUIRE(rdata->rdclass == dns_rdataclass_in);
9cd6d409b78a6f833b681c13a68fbdc7c024fe66David Lawrence n = snprintf(txt, sizeof(txt), "/%u", prefix);
64a84169d7eed05486b10be90afea58f4af146f9Brian Wellington /* Zero or more items */
e08daafffce8fb74ffca8ecf5772e334299ccf76Bob Halley return (mem_tobuffer(target, sr2.base, sr2.length));
f3f22040a8c4835227e1a3abc54454556d4c47abBrian Wellington REQUIRE(rdata->rdclass == dns_rdataclass_in);
4423c99613db1399dbb5c51e86ef0d351a1418c2Mark Andrews return (mem_tobuffer(target, rdata->data, rdata->length));
e08daafffce8fb74ffca8ecf5772e334299ccf76Bob Halleystatic inline int
602274b30f17281b8af0608016eadd0816d3eca6Mark Andrews REQUIRE(apl->apl != NULL || apl->apl_len == 0);
aa39170da817cae7b4c6c735cc832e05ec3d2351Mark Andrews return(fromwire_in_apl(rdclass, type, &b, NULL, ISC_FALSE, target));
aa39170da817cae7b4c6c735cc832e05ec3d2351Mark Andrews apl->apl = mem_maybedup(mctx, r.base, r.length);
aa39170da817cae7b4c6c735cc832e05ec3d2351Mark Andrewsstatic inline void
aa39170da817cae7b4c6c735cc832e05ec3d2351Mark Andrews REQUIRE(apl->common.rdtype == dns_rdatatype_apl);
aa39170da817cae7b4c6c735cc832e05ec3d2351Mark Andrews REQUIRE(apl->common.rdclass == dns_rdataclass_in);
aa39170da817cae7b4c6c735cc832e05ec3d2351Mark Andrews REQUIRE(apl->common.rdtype == dns_rdatatype_apl);
aa39170da817cae7b4c6c735cc832e05ec3d2351Mark Andrews REQUIRE(apl->common.rdclass == dns_rdataclass_in);
aa39170da817cae7b4c6c735cc832e05ec3d2351Mark Andrews REQUIRE(apl->apl != NULL || apl->apl_len == 0);
aa39170da817cae7b4c6c735cc832e05ec3d2351Mark Andrews * If no APL return ISC_R_NOMORE.
aa39170da817cae7b4c6c735cc832e05ec3d2351Mark Andrews * Sanity check data.
cc32d38366fa680fc29f9fb17bd3ebe515835445Mark Andrews REQUIRE(apl->common.rdtype == dns_rdatatype_apl);
4f082b58b17ce39087930d5affc2ada90ef386e6Mark Andrews REQUIRE(apl->common.rdclass == dns_rdataclass_in);
d8f2dd46cba3a16c2433e85657a5b15543013ca6Mark Andrews REQUIRE(apl->apl != NULL || apl->apl_len == 0);
cc32d38366fa680fc29f9fb17bd3ebe515835445Mark Andrews * No APL or have already reached the end return ISC_R_NOMORE.
cc32d38366fa680fc29f9fb17bd3ebe515835445Mark Andrews if (apl->apl == NULL || apl->offset == apl->apl_len)
cc32d38366fa680fc29f9fb17bd3ebe515835445Mark Andrews * Sanity check data.
cc32d38366fa680fc29f9fb17bd3ebe515835445Mark Andrews * 16 to 32 bits promotion as 'length' is 32 bits so there is
cc32d38366fa680fc29f9fb17bd3ebe515835445Mark Andrews * no overflow problems.
cc32d38366fa680fc29f9fb17bd3ebe515835445Mark Andrews INSIST(4 + length + apl->offset <= apl->apl_len);
cc32d38366fa680fc29f9fb17bd3ebe515835445Mark Andrews return ((apl->offset < apl->apl_len) ? ISC_R_SUCCESS : ISC_R_NOMORE);
cc32d38366fa680fc29f9fb17bd3ebe515835445Mark Andrewsdns_rdata_apl_current(dns_rdata_in_apl_t *apl, dns_rdata_apl_ent_t *ent) {
cc32d38366fa680fc29f9fb17bd3ebe515835445Mark Andrews REQUIRE(apl->common.rdtype == dns_rdatatype_apl);
cc32d38366fa680fc29f9fb17bd3ebe515835445Mark Andrews REQUIRE(apl->common.rdclass == dns_rdataclass_in);
aa39170da817cae7b4c6c735cc832e05ec3d2351Mark Andrews REQUIRE(apl->apl != NULL || apl->apl_len == 0);
cc32d38366fa680fc29f9fb17bd3ebe515835445Mark Andrews * Sanity check data.
cc32d38366fa680fc29f9fb17bd3ebe515835445Mark Andrews * 16 to 32 bits promotion as 'length' is 32 bits so there is
cc32d38366fa680fc29f9fb17bd3ebe515835445Mark Andrews * no overflow problems.
cc32d38366fa680fc29f9fb17bd3ebe515835445Mark Andrews INSIST(4 + length + apl->offset <= apl->apl_len);
cc32d38366fa680fc29f9fb17bd3ebe515835445Mark Andrews ent->family = (apl->apl[apl->offset] << 8) + apl->apl[apl->offset + 1];
7de2c6e6d51f38daeb2d346f3f21dc01ccece6daEvan Hunt ent->negative = ISC_TF((apl->apl[apl->offset + 3] & 0x80) != 0);
aa39170da817cae7b4c6c735cc832e05ec3d2351Mark Andrewsdns_rdata_apl_count(const dns_rdata_in_apl_t *apl) {
9effea437d7973c9ed981ab2e14b219182d86ee7Curtis Blackburn REQUIRE(rdata->rdclass == dns_rdataclass_in);
313b0ea9f258edd8530f4454c69e6ba194280162Tinderbox User REQUIRE(rdata->rdclass == dns_rdataclass_in);
313b0ea9f258edd8530f4454c69e6ba194280162Tinderbox Userstatic inline int
313b0ea9f258edd8530f4454c69e6ba194280162Tinderbox User#endif /* RDATA_IN_1_APL_42_C */