[ldns-users] Accessing RR rdata

John Kristoff jtk at cymru.com
Tue Jul 21 15:12:35 UTC 2009


I've used the Perl Net::DNS library quite a bit, but am trying to
incorporate ldns into my projects where appropriate.  Thanks for making
this available.  I'm a poor C coder, but this certainly does make some
things easier.

I'm trying to still wrap my head around some parts of ldns (and brush
up on my poor C skills generally :-) and am finding at least one part a
bit confusing I was hoping to get clued in on.  In Net::DNS I would
create a Net::DNS::Packet object and then could roll through the
$obj->answer (or authority/additional section RRs) in a loop like this:

  for my $rr (@section) {
      my $qname = lc( $rr->name || '.' );
      my $class = $rr->class;
      my $type  = $rr->type;
      my $ttl   = $rr->ttl;
      my $rdata = $rr->rdatastr;
      ... work goes here ...

With ldns, the qname, class, type and ttl I can grab in a similar
fashion by unrolling an RRset using ldns_rr_list_pop_rr, but am I
correct in thinking that to get the equivalent of the rdatastr in
Net::DNS I have to reconstruct it manually by rolling through and rdf
rdata array or is there an equivalent function that can accomplish
essentially what is shown with Net::DNS above?

Maybe I'm getting a little confused by the rdf/rdata terminology
sprinkled throughout the doxygen pages?

John



More information about the ldns-users mailing list