[ldns-users] python wrapper for ldns_rr_new_frm_fp_l

Willem Toorop willem at NLnetLabs.nl
Tue May 17 20:58:12 UTC 2011


Hi Bedrich,

I love the generator function. Looks like the pytonicly correct way to
access ldns_rr_new_frm_fp_l from python to me! The patch is applied in
trunk, and the demo scripts added to the example directory.

Thanks again! Willem

Op 05-05-11 10:33, Bedrich Kosata schreef:
> Hi everybody,
>
> after working with the python wrapper around ldns_rr_new_frm_fp_l, I
> would like to propose a few changes.
>
> The C version of the ldns_rr_new_frm_fp_l function stores the state of
> zone file parsing in 3 different variables - origin, prev(ious owner)
> and (default) ttl. Due to pointer and pointer to pointer usage, these
> are automatically updated by calls to ldns_rr_new_frm_fp_l and the
> only thing the programmer has to take care of it not to touch these.
>
> However, in Python this is not possible and the wrapper goes around
> this problem by returning the new values of origin, prev and ttl as
> part of the result of the function. It is then left to the programmer
> to send these updated values back to the subsequent calls of
> ldns.ldns_rr_new_frm_fp_l_. I attach a script that shows how to do
> this and I would suggest putting it into the examples directory as
> reference.
>
> I also added a convenience function (a generator) into the python
> interface, so that the context is managed automatically and the
> programmer does not have to take care of it. It is part of the patch I
> attach. There is also a demo script for this function attached.
>
> Another change that I made in the patch is that I removed the 5th
> argument, which indicated whether the result should contain line
> number. As the value of this argument influenced the number and order
> of items in the returned tuple, which I do not consider a good design,
> I removed it and changed the result, so that it always contains the
> number of lines parsed in this step and the format of the result is
> always the same.
>
> Please let me know if these changes are acceptable or if there is
> something else needed.
>
> With best regards
>
> Beda
>
>
>
> _______________________________________________
> ldns-users mailing list
> ldns-users at open.nlnetlabs.nl
> http://open.nlnetlabs.nl/mailman/listinfo/ldns-users

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nlnetlabs.nl/pipermail/ldns-users/attachments/20110517/24a16fa1/attachment.htm>


More information about the ldns-users mailing list