[ldns-users] function call backs in ldns_resolver_send*?

W.C.A. Wijngaards wouter at NLnetLabs.nl
Tue Dec 14 15:52:05 CET 2010


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hoi Miek,

On 12/14/2010 02:10 PM, Miek Gieben wrote:
> Hello,
> 
> How hard would it be to extend the ldns library with 2 new functions
> that support callbacks? So to make asynchronous sending of queries
> possible?

Well, asynchronous means another thread or process is working on the
query.  And ldns does not do that.

> I was thinking about the following prototypes:
> 
> ldns_resolver_send_callback(cb_func, ldns_resolver *r, const 
>         ldns_rdf *name, ldns_rr_type t, ldns_rr_class c, uint16_t flags);
> ldns_resolver_send_pkt_callback(cb_func, ldns_resolver *r, ldns_pkt *query_pkt);
> 
> The cb_func prototype should be able to fill a ldns_pkt struct, so it
> might be:
> ldns_status cb_func(ldns_pkt *k)
> 
> I have never dealt with callback functions, so I don't know if this is
> a viable proposal and how it impacts the rest of the ldns design.

It is not viable (for ldns itself).  libunbound gives you a callback
that gives the packet wiredata from unbound, it handles the threads,
pipes, mutexes.  Or maybe this does what you need:
http://code.google.com/p/evldns/

Best regards,
   Wouter
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org/

iEYEARECAAYFAk0HhJUACgkQkDLqNwOhpPhYMwCeJY1e/p2M7AAKPvRN4x/omh/k
gEoAn0zO+ZpCb5hNczltGY3jcJLPt0WB
=J+YO
-----END PGP SIGNATURE-----


More information about the ldns-users mailing list