## soup-dns

soup-dns — Low-level DNS routines

## Synopsis

    SoupDNSEntry* soup_dns_entry_from_name      (const char *name);
    SoupDNSEntry* soup_dns_entry_from_addr      (gconstpointer addr,
                                                 int family);
    gboolean    soup_dns_entry_check_lookup     (SoupDNSEntry *entry);
    void        soup_dns_entry_cancel_lookup    (SoupDNSEntry *entry);
    void        soup_dns_free_hostent           (struct hostent *h);
    char*       soup_dns_ntop                   (gconstpointer addr,
                                                 int family);

## Description

## Details

### soup_dns_entry_from_name ()

    SoupDNSEntry* soup_dns_entry_from_name      (const char *name);

Begins asynchronous resolution of `name`. The caller should periodically call `soup_dns_entry_check_lookup()` to see if it is done, and call `soup_dns_entry_get_hostent()` when `soup_dns_entry_check_lookup()` returns `TRUE`.

Currently, this routine forks and does the lookup, which can cause some problems. In general, this will work ok for most programs most of the time. It will be slow or even fail when using operating systems that copy the entire process when forking.

`name` : | a nice name (eg, mofo.eecs.umich.edu) or a dotted decimal name (eg, 141.213.8.59).
Returns : | a SoupDNSEntry, which will be freed when you call `soup_dns_entry_get_hostent()` or `soup_dns_entry_cancel_lookup()`.

### soup_dns_entry_from_addr ()

    SoupDNSEntry* soup_dns_entry_from_addr      (gconstpointer addr,
                                                 int family);

Begins asynchronous resolution of `addr`. The caller should periodically call `soup_dns_entry_check_lookup()` to see if it is done, and call `soup_dns_entry_get_hostent()` when `soup_dns_entry_check_lookup()` returns `TRUE`.

Currently, this routine forks and does the lookup, which can cause some problems. In general, this will work ok for most programs most of the time. It will be slow or even fail when using operating systems that copy the entire process when forking.

`addr` : | pointer to address data (eg, an in_addr_t)
`family` : | address family of `addr`
Returns : | a SoupDNSEntry, which will be freed when you call `soup_dns_entry_get_hostent()` or `soup_dns_entry_cancel_lookup()`.

### soup_dns_entry_check_lookup ()

    gboolean    soup_dns_entry_check_lookup     (SoupDNSEntry *entry);

Checks if `entry` has finished resolving

`entry` : | a SoupDNSEntry
Returns : | `TRUE` if `entry` has finished resolving (either successfully or not)

### soup_dns_entry_cancel_lookup ()

    void        soup_dns_entry_cancel_lookup    (SoupDNSEntry *entry);

Cancels the lookup for `entry`.

`entry` : | a SoupDNSEntry

### soup_dns_free_hostent ()

    void        soup_dns_free_hostent           (struct hostent *h);

Frees `h`. Use this to free the return value from `soup_dns_entry_get_hostent()`.

`h` : | a hostent

### soup_dns_ntop ()

    char*       soup_dns_ntop                   (gconstpointer addr,
                                                 int family);

Converts `addr` into textual form (eg, "141.213.8.59"), like the standard library function `inet_ntop()`, except that the returned string must be freed.

`addr` : | pointer to address data (eg, an in_addr_t)
`family` : | address family of `addr`
Returns : | the text form or `addr`, which must be freed.