a134177ed9f82189504191d90f3ed9e97c2b47cbTinderbox User * Copyright (C) 1999-2004, 2007, 2009, 2011, 2012, 2014-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/.
d10099d8663f4a4b21219f0c4bcc4f2b1ca1d877Bob Halley * Reviewed: Thu Mar 16 17:35:30 PST 2000 by halley.
6324997211a5e2d82528dcde98e8981190a35faeMichael Graff#define RRTYPE_TKEY_ATTRIBUTES (DNS_RDATATYPEATTR_META)
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, isc_tokentype_number,
f427e7850928d15ffc37b1f68c60588995c9b318Mark Andrews RETERR(uint32_tobuffer(token.value.as_ulong, target));
652c80435a97ca558a47e2f320047b73b3626cd1David Lawrence * Expiration.
add4043305ca411202ed9cf1929a4179016515ceBrian Wellington RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number,
f427e7850928d15ffc37b1f68c60588995c9b318Mark Andrews RETERR(uint32_tobuffer(token.value.as_ulong, target));
add4043305ca411202ed9cf1929a4179016515ceBrian Wellington RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number,
f427e7850928d15ffc37b1f68c60588995c9b318Mark Andrews RETERR(uint16_tobuffer(token.value.as_ulong, target));
add4043305ca411202ed9cf1929a4179016515ceBrian Wellington RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_string,
5d83b561ad7eb84885a8ec63dee4c51b335f067aBrian Wellington if (dns_tsigrcode_fromtext(&rcode, &token.value.as_textregion)
8d3e74b1683f714a484bbcf73249e8ee470e36d7Mark Andrews if (*e != 0)
63430de3450a99b7ae0cb05a95a26cff8cc66358David Lawrence if (i < 0 || i > 0xffff)
add4043305ca411202ed9cf1929a4179016515ceBrian Wellington RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number,
f427e7850928d15ffc37b1f68c60588995c9b318Mark Andrews RETERR(uint16_tobuffer(token.value.as_ulong, target));
652c80435a97ca558a47e2f320047b73b3626cd1David Lawrence RETERR(isc_base64_tobuffer(lexer, target, (int)token.value.as_ulong));
652c80435a97ca558a47e2f320047b73b3626cd1David Lawrence * Other Size.
add4043305ca411202ed9cf1929a4179016515ceBrian Wellington RETERR(isc_lex_getmastertoken(lexer, &token, isc_tokentype_number,
f427e7850928d15ffc37b1f68c60588995c9b318Mark Andrews RETERR(uint16_tobuffer(token.value.as_ulong, target));
652c80435a97ca558a47e2f320047b73b3626cd1David Lawrence * Other Data.
652c80435a97ca558a47e2f320047b73b3626cd1David Lawrence return (isc_base64_tobuffer(lexer, target, (int)token.value.as_ulong));
f427e7850928d15ffc37b1f68c60588995c9b318Mark Andrews unsigned long n;
b0ba1a6059b6d6c4b3aa77d8bc84cc443b981e01Mukund Sivaraman REQUIRE(rdata->type == dns_rdatatype_tkey);
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafsson sub = name_prefix(&name, tctx->origin, &prefix);
652c80435a97ca558a47e2f320047b73b3626cd1David Lawrence * Expiration.
5d83b561ad7eb84885a8ec63dee4c51b335f067aBrian Wellington if (dns_tsigrcode_totext((dns_rcode_t)n, target) == ISC_R_SUCCESS)
fad44a20eede1bbc66716241dede225500c91caaAndreas Gustafsson if ((tctx->flags & DNS_STYLEFLAG_MULTILINE) != 0)
5fc7ba3e1ac5d72239e9971e0f469dd5796738f9Andreas Gustafsson RETERR(str_totext(tctx->linebreak, target));
fad44a20eede1bbc66716241dede225500c91caaAndreas Gustafsson if ((tctx->flags & DNS_STYLEFLAG_MULTILINE) != 0)
652c80435a97ca558a47e2f320047b73b3626cd1David Lawrence * Other Size.
652c80435a97ca558a47e2f320047b73b3626cd1David Lawrence * Other Data.
5eb91bd90e3ad3426e5e3213031556a737cf3809Mark Andrews if (n != 0U) {
a3c9e34301218c7092cd8b6add6eec0957ab5483Andreas Gustafsson if ((tctx->flags & DNS_STYLEFLAG_MULTILINE) != 0)
a3c9e34301218c7092cd8b6add6eec0957ab5483Andreas Gustafsson RETERR(str_totext(tctx->linebreak, target));
a3c9e34301218c7092cd8b6add6eec0957ab5483Andreas Gustafsson if ((tctx->flags & DNS_STYLEFLAG_MULTILINE) != 0)
f427e7850928d15ffc37b1f68c60588995c9b318Mark Andrews unsigned long n;
94a08e09db3dc844b6ee4841c368a2d7074a9c3fAndreas Gustafsson dns_decompress_setmethods(dctx, DNS_COMPRESS_NONE);
2047977ce2dfcfe3a0fa2d638c3242841310fad3Mark Andrews RETERR(dns_name_fromwire(&name, source, dctx, options, target));
f427e7850928d15ffc37b1f68c60588995c9b318Mark Andrews * Inception: 4
f427e7850928d15ffc37b1f68c60588995c9b318Mark Andrews * Expiration: 4
652c80435a97ca558a47e2f320047b73b3626cd1David Lawrence * Key Length + Key Data.
652c80435a97ca558a47e2f320047b73b3626cd1David Lawrence * Other Length + Other Data.
b0ba1a6059b6d6c4b3aa77d8bc84cc443b981e01Mukund Sivaraman REQUIRE(rdata->type == dns_rdatatype_tkey);
94a08e09db3dc844b6ee4841c368a2d7074a9c3fAndreas Gustafsson dns_compress_setmethods(cctx, DNS_COMPRESS_NONE);
f427e7850928d15ffc37b1f68c60588995c9b318Mark Andrews return (mem_tobuffer(target, sr.base, sr.length));
4529cdaedaf1a0a5f8ff89aeca510b7a4475446cBob Halleystatic inline int
b0ba1a6059b6d6c4b3aa77d8bc84cc443b981e01Mukund Sivaraman REQUIRE(rdata1->type == dns_rdatatype_tkey);
41aad56b6cc458cbf7b8483576d990a77ae9bac2Andreas Gustafsson if ((order = dns_name_rdatacompare(&name1, &name2)) != 0)
652c80435a97ca558a47e2f320047b73b3626cd1David Lawrence * Algorithm Name.
5466ce3f279d9fa83ce826bcdc9482bc591152aeAndreas Gustafsson RETERR(name_tobuffer(&tkey->algorithm, target));
652c80435a97ca558a47e2f320047b73b3626cd1David Lawrence * Inception: 32 bits.
cf3f14106d082e4676431c10c54b60b9a0e9b127Brian Wellington RETERR(uint32_tobuffer(tkey->inception, target));
652c80435a97ca558a47e2f320047b73b3626cd1David Lawrence * Expire: 32 bits.
cf3f14106d082e4676431c10c54b60b9a0e9b127Brian Wellington RETERR(uint32_tobuffer(tkey->expire, target));
652c80435a97ca558a47e2f320047b73b3626cd1David Lawrence * Mode: 16 bits.
cf3f14106d082e4676431c10c54b60b9a0e9b127Brian Wellington RETERR(uint16_tobuffer(tkey->mode, target));
652c80435a97ca558a47e2f320047b73b3626cd1David Lawrence * Error: 16 bits.
cf3f14106d082e4676431c10c54b60b9a0e9b127Brian Wellington RETERR(uint16_tobuffer(tkey->error, target));
652c80435a97ca558a47e2f320047b73b3626cd1David Lawrence * Key size: 16 bits.
cf3f14106d082e4676431c10c54b60b9a0e9b127Brian Wellington RETERR(uint16_tobuffer(tkey->keylen, target));
373ce67419680a398ba3dc51a14a486caaf0afb0Mark Andrews RETERR(mem_tobuffer(target, tkey->key, tkey->keylen));
652c80435a97ca558a47e2f320047b73b3626cd1David Lawrence * Other size: 16 bits.
cf3f14106d082e4676431c10c54b60b9a0e9b127Brian Wellington RETERR(uint16_tobuffer(tkey->otherlen, target));
652c80435a97ca558a47e2f320047b73b3626cd1David Lawrence * Other data.
373ce67419680a398ba3dc51a14a486caaf0afb0Mark Andrews return (mem_tobuffer(target, tkey->other, tkey->otherlen));
b0ba1a6059b6d6c4b3aa77d8bc84cc443b981e01Mukund Sivaraman REQUIRE(rdata->type == dns_rdatatype_tkey);
652c80435a97ca558a47e2f320047b73b3626cd1David Lawrence * Algorithm Name.
9281e7aa775026dc47c01745fdcc438645146877Mark Andrews RETERR(name_duporclone(&alg, mctx, &tkey->algorithm));
cf3f14106d082e4676431c10c54b60b9a0e9b127Brian Wellington isc_region_consume(&sr, name_length(&tkey->algorithm));
85bdc128fcda11c89ec1d76ea4221f4fa8e4fc24Mark Andrews tkey->key = mem_maybedup(mctx, sr.base, tkey->keylen);
652c80435a97ca558a47e2f320047b73b3626cd1David Lawrence * Other size.
85bdc128fcda11c89ec1d76ea4221f4fa8e4fc24Mark Andrews tkey->other = mem_maybedup(mctx, sr.base, tkey->otherlen);
4529cdaedaf1a0a5f8ff89aeca510b7a4475446cBob Halleystatic inline void
b8dd48ecf83142f6ee7238cbd68fec455e527fc8Mark Andrews dns_rdata_tkey_t *tkey = (dns_rdata_tkey_t *) source;
cf3f14106d082e4676431c10c54b60b9a0e9b127Brian Wellington dns_name_free(&tkey->algorithm, tkey->mctx);
b0ba1a6059b6d6c4b3aa77d8bc84cc443b981e01Mukund Sivaraman REQUIRE(rdata->type == dns_rdatatype_tkey);
b0ba1a6059b6d6c4b3aa77d8bc84cc443b981e01Mukund Sivaraman REQUIRE(rdata->type == dns_rdatatype_tkey);
b0ba1a6059b6d6c4b3aa77d8bc84cc443b981e01Mukund Sivaraman REQUIRE(rdata->type == dns_rdatatype_tkey);
854d0238dbc2908490197984b3b9d558008a53dfMark Andrews#endif /* RDATA_GENERIC_TKEY_249_C */