[bind10-dev] RRset API is hard to use

JINMEI Tatuya / 神明達哉 jinmei at isc.org
Mon Feb 8 23:48:08 UTC 2010


At Mon, 08 Feb 2010 17:16:51 -0600,
Michael Graff <mgraff at isc.org> wrote:

> > Could you be more specific about the "record" returned from the SQL
> > query?  I suspect the answer to your question highly depends on its
> > detail.
> 
> It's a master-file format RDATA string:
> 
>   rdtype, rdata
>   TXT     This is a test "This is one item"
>   TXT     This is another record for the same name
>   SOA     dns01.flame.org. explorer.flame.org. 103112384 3600 1800
> 2419200 7200

Okay, so what you need to create an RdataPtr from each of these
records, correct?  If so, you wouldn't have to have a giant switch.
For example, assuming you have

std::string rrtype_txt (= "TXT", "SOA", etc)
std::string rdata_txt (= "This is a test...", "dns01.flame.org....7200" etc)

you write:

RdataPtr rdata = createRdata(RRType(rrtype_txt), RRClass("IN"), rdata_txt);
(createRdata() is a public function defined in the isc::dns::rdata
namespace.  See rdata.h)

Here I assume the RRClass is "IN", but you can easily make it dynamic.

I'm not sure how this matches the other part of your original problem
statement though...

At Mon, 08 Feb 2010 09:48:53 -0600,
Michael Graff <mgraff at isc.org> wrote:

> What I want is to say "make an RRset from this list of string" or at
> least "here is a complete rdataset line.  If it is incompatible with
> what is already there, throw an exception, otherwise just do what I want"
> 
> Where "what I want" means "if the TTL is not the same, make it the
> smaller of (current, newttl).  If the name does not match, throw.  If
> the type does not match, throw.  If the class does not match, throw.  If
> the rdata is not parsable, throw.  Otherwise add it."

...as your record examples don't include TTL.  But in any case, the
current API doesn't (yet) provide a way to construct a full RRset
including a list of RDATA from a single/multiple line of text.  We'll
probably eventually need to have something like this (e.g. for master
file parser), but if I understand your current need I guess you
wouldn't need that feature for now.

---
JINMEI, Tatuya



More information about the bind10-dev mailing list