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

adns.h File Reference


Detailed Description

Asynchronous DNS lookup.

Author:
Christian Biere
Date:
2003

#include "common.h"
#include "host_addr.h"

Go to the source code of this file.

Typedefs

typedef void(* adns_callback_t )(const host_addr_t *, size_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 *, enum net_type net, adns_callback_t, gpointer)
 Creates a DNS resolve query for ``hostname''.
gboolean adns_reverse_lookup (const host_addr_t, adns_reverse_callback_t, gpointer)
void adns_close (void)
 Removes the callback and frees the cache.


Typedef Documentation

typedef void(* adns_callback_t)(const host_addr_t *, size_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.

Close all standard FILEs so that they don't keep a reference to the log files when they are reopened by the main process on SIGHUP. This means there will be no visible messages from ADNS at all.

gboolean adns_resolve const gchar *  hostname,
enum net_type  net,
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,
adns_reverse_callback_t  ,
gpointer 
 


Generated on Sat Jun 30 17:53:25 2007 for gtk-gnutella by  doxygen 1.3.9.1