]> granicus.if.org Git - pdns/commitdiff
turn blogpost about adding RR types into pdns internals doc section
authorPeter van Dijk <peter.van.dijk@netherlabs.nl>
Thu, 6 Dec 2012 08:11:05 +0000 (08:11 +0000)
committerPeter van Dijk <peter.van.dijk@netherlabs.nl>
Thu, 6 Dec 2012 08:11:05 +0000 (08:11 +0000)
git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@2970 d19b8d6e-7fed-0310-83ef-9ca221ded41b

pdns/docs/pdns.xml

index 6557ccee8c6ee6d2df53a10e72a8ac68697b2947..e168f173c3c6328cfb44bb3e81184cf61ea87e73 100644 (file)
@@ -19246,6 +19246,76 @@ Reply:
        problems though.
       </para>
   </sect1>
+  <sect1 id="adding-rr-types"><title>Adding new DNS record types</title>
+  <para>
+       Here are the full descriptions on how we added the TLSA record type to all PowerDNS products, with links to the actual source code.
+  </para>
+  <para>
+       First, define the TLSARecordContent class in <ulink url="http://wiki.powerdns.com/trac/browser/trunk/pdns/pdns/dnsrecords.hh?rev=2338#L307">dnsrecords.hh</ulink>:
+  </para>
+
+<screen>
+class TLSARecordContent : public DNSRecordContent
+{
+public:
+  includeboilerplate(TLSA) 
+  uint8_t d_certusage, d_selector, d_matchtype;
+  string d_cert;
+};
+</screen>
+
+<para>
+The 'includeboilerplate(TLSA)' generates the four methods that do everything PowerDNS would ever want to do with a record:
+<itemizedlist>
+       <listitem>
+               <para>
+                       read TLSA records from zonefile format
+               </para>
+       </listitem>
+       <listitem>
+               <para>
+write out a TLSA record in zonefile format
+               </para>
+       </listitem>
+       <listitem>
+               <para>
+read a TLSA record from a packet
+               </para>
+       </listitem>
+       <listitem>
+               <para>
+write a TLSA record to a packet
+               </para>
+       </listitem>
+</itemizedlist>
+</para>
+<para>
+The <ulink url="http://wiki.powerdns.com/trac/browser/trunk/pdns/pdns/dnsrecords.cc?rev=2638#L226">actual parsing code</ulink>:
+</para>
+<screen>
+boilerplate_conv(TLSA, 52,
+                 conv.xfr8BitInt(d_certusage);
+                 conv.xfr8BitInt(d_selector);
+                 conv.xfr8BitInt(d_matchtype);
+                 conv.xfrHexBlob(d_cert, true);
+                 )
+</screen>
+
+<para>
+       This code defines the TLSA rrtype number as 52. Secondly, it says there are 3 eight bit fields for Certificate Usage, Selector and Match type. Next, it defines that the rest of the record is the actual certificate (hash). <ulink url="http://wiki.powerdns.com/trac/browser/trunk/pdns/pdns/dnsparser.hh?rev=2338#L70">'conv'</ulink> methods are supplied for all DNS data types in use.
+</para>
+
+<para>
+Now add TLSRecordContent::report() to <ulink url="http://wiki.powerdns.com/trac/browser/trunk/pdns/pdns/dnsrecords.cc?rev=2338#L364">reportOtherTypes()</ulink>.
+</para>
+
+<para>
+       And that's it. For completeness, add TLSA and 52 to the QType enum in qtype.hh, which makes it easier to refer to the TLSA record in code if so required.
+</para>
+  </sect1>
+
+
+
   </appendix>
   <appendix id="backend-writers-guide"><title>Backend writers' guide</title>
     <para>