[bind10-dev] DNS packet API: the name object

JINMEI Tatuya / 神明達哉 jinmei at isc.org
Thu Sep 3 08:22:54 UTC 2009


At Tue, 25 Aug 2009 15:46:57 -0500,
Michael Graff <mgraff at isc.org> wrote:

> I thought a little about that in fact.
> 
> Knowing where the names are is good, and the resource record itself is
> best suited for that goal.  I would not want to see an API that did this:
> 
>   if (record->canCompress())
>     record->renderCompressedWire(message)
>   else
>     record->renderUncompressedWire(message)
>   end
> 
> but just a simple record->renderWire(message) or something.  The smarts
> are under the hood.
> 
> Passing in the message (which might have things like a list of names
> currently in the message, for compression purposes) allows the smartness
> to be hidden.
> 
> Note that many APIs reverse this, and use message->addRecord().  This is
> fine to build up a list of records, but I think the actual rendering
> should be as I describe above.

FWIW, pdns recursor seems to render RRs as you suggested.  The
DNSRecordContent class has a "toPacket" member function:

  virtual void toPacket(DNSPacketWriter& pw)=0;

---
JINMEI, Tatuya



More information about the bind10-dev mailing list