Gnome User Interface Library Reference Manual | |||
---|---|---|---|
<<< Previous Page | Home | Up | Next Page >>> |
#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); |
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.
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.
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.
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(). |