Date: Fri, 15 Sep 2017 14:04:12 +0100 Message-ID: Delivered-To: bind9-confidential@bugs.isc.org Return-Path: Subject: [PATCH] A begginer's guide to rdatasets X-Cam-Scannerinfo: http://help.uis.cam.ac.uk/email-scanner-virus X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED autolearn=unavailable autolearn_force=no version=3.4.1 CC: "Tony Finch" X-Original-To: bind9-confidential@bugs.isc.org X-RT-Incoming-Encryption: Not encrypted X-Cam-Antivirus: no malware found User-Agent: Alpine 2.11 (DEB 23 2013-08-11) From: "Tony Finch" From dot@dotat.at Fri Sep 15 13:09:47 2017 Received: from mx.ams1.isc.org (mx.ams1.isc.org [199.6.1.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "mx.ams1.isc.org", Issuer "COMODO RSA Organization Validation Secure Server CA" (not verified)) by bugs.isc.org (Postfix) with ESMTPS id AA9C6D78B07 for ; Fri, 15 Sep 2017 13:09:47 +0000 (UTC) Received: from ppsw-32.csi.cam.ac.uk (ppsw-32.csi.cam.ac.uk [131.111.8.132]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx.ams1.isc.org (Postfix) with ESMTPS id B3ACA24B09D for ; Fri, 15 Sep 2017 13:09:07 +0000 (UTC) Received: from grey.csi.cam.ac.uk ([131.111.57.57]:53548) by ppsw-32.csi.cam.ac.uk (ppsw.cam.ac.uk [131.111.8.136]:25) with esmtps (TLSv1:ECDHE-RSA-AES256-SHA:256) id 1dsqI0-0011o4-0o (Exim 4.89) (return-path ); Fri, 15 Sep 2017 14:04:12 +0100 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on mx.ams1.isc.org content-type: TEXT/PLAIN; charset="utf-8" To: bind9-bugs@isc.org MIME-Version: 1.0 X-RT-Original-Encoding: ascii X-RT-Interface: Email Content-Length: 2705 I thought it might be helpful to write a quick overview/summary of some of the stuff I learned while writing dnssec-cds. --- doc/dev/rdatasets-for-beginners | 60 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 doc/dev/rdatasets-for-beginners diff --git a/doc/dev/rdatasets-for-beginners b/doc/dev/rdatasets-for-beginners new file mode 100644 index 0000000..30ea488 --- /dev/null +++ b/doc/dev/rdatasets-for-beginners @@ -0,0 +1,60 @@ +Copyright (C) 1999-2001, 2004, 2016 Internet Systems Consortium, Inc. ("ISC") + +This Source Code Form is subject to the terms of the Mozilla Public +License, v. 2.0. If a copy of the MPL was not distributed with this +file, You can obtain one at http://mozilla.org/MPL/2.0/. + +Written by Tony Finch +at Cambridge University Information Services + + +A beginner's guide to rdatasets +=============================== + +These notes aim to help you get started with the BIND9 libdns API, in +particular rdatasets and their multi-layer stack of abstractions. +We're going to work down from upper to lower abstraction layers. + + +rdataset +-------- + +An rdataset is BIND9's representation of a DNS RRset, excluding its +owner name. It does not actually hold the data itself: it is a view +that refers to data held elsewhere, for instance in a message, or in +an rbtdb (for cached or authoritative data). + +It is a vaguely OO-style polymorphic data structure, with different +implementations depending on the backing data structure that actually +holds the records. The rdataset is explicitly associated/disassociated +with the backing data structure so that it can maintain refcounts. + + +rdatalist +--------- + +One of the possible implementations of an rdataset is an rdatalist. +(The other important one is inside rbtdb, but we won't go into that +here.) An rdatalist is a linked list of rdata structures, using the +link field inside `sttuct dns_rdata`. It is used to record the +locations of records in a DNS message. An rdatalist doesn't maintain +refcounts. + + +rdata +----- + +BIND9's representation of the right hand side of a DNS record. Again, +it doesn't hold any data itself, but refers to data in wire format +stored elsewhere. It doesn't maintain refcounts - it is usually used +in the context of an rdataset which retains any necessary refcount. + + +type-specific structures +------------------------ + +The file doc/dev/rdata.html explains how the type-specific rdata +conversions work. In some cases the unpacked struct still refers to +the wire-format storage, e.g. when the rdata has variable-sized fields +such as DNSSEC crypto blobs. -- 2.10.1.445.g3cdd5d1