[ldns-users] Programmatically creating a zone

Bryan Duff bduff at ecessa.com
Thu Sep 2 19:21:17 UTC 2010


 On 09/02/10 14:01, Ray Bellis wrote:
> On 2 Sep 2010, at 19:14, Bryan Duff wrote:
>
>> As opposed to read it from a file, or from a packet.  The API doesn't
>> seem to be the best in this scenario.
>>
>> Is there something I'm missing?
> An LDNS zone structure (ldns_zone) is nothing more than an ldns_rr* for the SOA, and an ldns_rr_list* for the records therein, and there are functions to access and modify those - see <http://www.nlnetlabs.nl/projects/ldns/doc/zone_8c_source.html>
>
> e.g.
>
>   ldns_zone *z = ldns_zone_new();
>   ldns_zone_set_soa(z, soa);     // requires an SOA "ldns_rr*" object
>   ldns_zone_push_rr(z, rr);      // requires other "ldns_rr*" object
>
> Is the real issue figuring how to create an "ldns_rr"?

Yes, I think that is the main difficulty.

ldns_rr_new_frm_str_internal() is what I've been looking at as the
template for creating my own ldns_rr.  It looks like it has all the
init, and assignment code that I would need. 

It seems like this function is the most like what I want.

> Ray
>
>
>
-Bryan



More information about the ldns-users mailing list