>gnome-dns

gnome-dns

Name

gnome-dns -- Non-blocking name resolver interface.

Synopsis


#include <gnome.h>


void        gnome_dns_init                  (gint server_count);
guint32     gnome_dns_lookup                (const char *hostname,
                                             void (*callback) (guint32 ip_addr, void *callback_data),
                                             void *callback_data);
void        gnome_dns_abort                 (guint32 tag);

Description

You can use this module to do name server lookups in a non-blocking fashion. You need to provide a callback function to be invoked when the name has been resolved.

Details

gnome_dns_init ()

void        gnome_dns_init                  (gint server_count);

Initialize the dns functions for use.

server_count specifies the number of servers to fork() at init, or <= 0 to do dynamic server forking. If you are concerned about virtual mem usage, fork your servers as one of the first things in your program.

Note that it will still do dynamic forking if you specify > 0. when it runs out of servers.. a good init value may be 1 or 2.

Results: gnome_dns_lookup() will be ready for use.

Side effects: The library is initialized.

server_count : server count to fork() at init.


gnome_dns_lookup ()

guint32     gnome_dns_lookup                (const char *hostname,
                                             void (*callback) (guint32 ip_addr, void *callback_data),
                                             void *callback_data);

Looks up an address and returns a tag for use with gnome_dns_abort() if desired. May not return -1 if hostname was in cache.

Callback function is called when dns_lookup is complete.

Side effects: A new dns server may be spawned if all the current servers are in use.

hostname : hostname to lookup
callback : function to call when dns lookup is complete.
callback_data : data to pass to the callback function
Returns : A tag identifying this lookup or 0 if lookup was in cache.


gnome_dns_abort ()

void        gnome_dns_abort                 (guint32 tag);

Aborts a previous call to gnome_dns_lookup(). DNS callback function is not called.

tag : the tag returned from previous call to gnome_dns_lookup().