Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

adns.h File Reference


Detailed Description

Asynchronous DNS lookup.

Author:
Christian Biere
Date:
2003

#include <glib.h>
#include "host_addr.h"

Go to the source code of this file.

Typedefs

typedef void(* adns_callback_t )(const host_addr_t *, gpointer)
typedef void(* adns_reverse_callback_t )(const gchar *, gpointer)

Functions

void adns_init (void)
 Initializes the adns helper i.e., fork()s a child process which will be used to resolve hostnames asynchronously.

gboolean adns_resolve (const gchar *, adns_callback_t, gpointer)
 Creates a DNS resolve query for ``hostname''.

gboolean adns_reverse_lookup (const host_addr_t, adns_reverse_callback_t, gpointer)
 Creates a DNS reverse lookup query for ``addr''.

void adns_close (void)
 Removes the callback and frees the cache.


Typedef Documentation

typedef void(* adns_callback_t)(const host_addr_t *, gpointer)
 

typedef void(* adns_reverse_callback_t)(const gchar *, gpointer)
 


Function Documentation

void adns_close void   ) 
 

Removes the callback and frees the cache.

void adns_init void   ) 
 

Initializes the adns helper i.e., fork()s a child process which will be used to resolve hostnames asynchronously.

gboolean adns_resolve const gchar *  hostname,
adns_callback_t  user_callback,
gpointer  user_data
 

Creates a DNS resolve query for ``hostname''.

The given function ``user_callback'' (which MUST NOT be NULL) will be invoked with the resolved IP address and ``user_data'' as its parameters. The IP address 0.0.0.0 i.e., ``(guint32) 0'' is used to indicate a failure. In case the hostname is given as an IP string, it will be directly converted and the callback immediately invoked. If the adns helper process is ``out of service'' the query will be resolved synchronously.

Returns:
TRUE if the resolution is asynchronous i.e., the callback will be called AFTER adns_resolve() returned. If the resolution is synchronous i.e., the callback was called BEFORE adns_resolve() returned, adns_resolve() returns FALSE.

gboolean adns_reverse_lookup const host_addr_t  addr,
adns_reverse_callback_t  user_callback,
gpointer  user_data
 

Creates a DNS reverse lookup query for ``addr''.

The given function ``user_callback'' (which MUST NOT be NULL) will be invoked with the resolved hostname and ``user_data'' as its parameters. If the lookup failed, the callback will be invoked with ``hostname'' NULL. If the adns helper process is ``out of service'' the query will be processed synchronously.

Returns:
TRUE if the resolution is asynchronous i.e., the callback will be called AFTER adns_reverse_lookup() returned. If the resolution is synchronous i.e., the callback was called BEFORE adns_reverse_lookup() returned, adns_reverse_lookup() returns FALSE.


Generated on Sun Feb 12 10:49:58 2006 for Gtk-Gnutella by doxygen 1.3.6