## gskdnsclient

gskdnsclient — This is a DNS client.

## Synopsis

                        GskDnsClient;
                        GskDnsClientClass;
    enum                GskDnsClientFlags;
    GskDnsClient *      gsk_dns_client_new                  (GskPacketQueue *packet_queue,
                                                             GskDnsRRCache *rr_cache,
                                                             GskDnsClientFlags flags);
    void                gsk_dns_client_add_searchpath       (GskDnsClient *client,
                                                             const char *searchpath);
    void                gsk_dns_client_add_ns               (GskDnsClient *client,
                                                             GskSocketAddressIpv4 *address);
    void                gsk_dns_client_set_cache            (GskDnsClient *client,
                                                             GskDnsRRCache *rr_cache);
    void                gsk_dns_client_set_flags            (GskDnsClient *client,
                                                             GskDnsClientFlags flags);
    GskDnsClientFlags   gsk_dns_client_get_flags            (GskDnsClient *client);
    gboolean            gsk_dns_client_parse_system_files   (GskDnsClient *client);

## Object Hierarchy

      GObject
       +----GskDnsClient

## Implemented Interfaces

GskDnsClient implements GskNameResolver and GskDnsResolver.

## Description

This is a flexible DNS client. It has (1) a transport for packets and (2) a cache of resource records.

This code is almost always used indirectly, from `gsk_name_resolve()`, since the default name resolver uses DNS.

## Details

### GskDnsClient

    typedef struct _GskDnsClient GskDnsClient;

An instance of the DNS client.

### GskDnsClientClass

    typedef struct _GskDnsClientClass GskDnsClientClass;

The class of the DNS client.

### enum GskDnsClientFlags

    typedef enum
    {
      GSK_DNS_CLIENT_STUB_RESOLVER = (1<<0)
    } GskDnsClientFlags;

Flags which affect how the DNS client operates.

`GSK_DNS_CLIENT_STUB_RESOLVER` | Whether this DNS client is a stub resolver. A stub resolver relies on its name-server to do all recursion and caching for it.

### gsk_dns_client_new ()

    GskDnsClient *      gsk_dns_client_new                  (GskPacketQueue *packet_queue,
                                                             GskDnsRRCache *rr_cache,
                                                             GskDnsClientFlags flags);

Create a new DNS client. This implements the GskDnsResolver interface.

`packet_queue` : | underlying transport layer to use. The client will keep a reference to this packet-queue.
`rr_cache` : | cache of resource-records. The client will keep a reference to this cache.
`flags` : | whether you want this client to be a recursive or stub resolver.
Returns : | the newly allocated DNS client.

### gsk_dns_client_add_searchpath ()

    void                gsk_dns_client_add_searchpath       (GskDnsClient *client,
                                                             const char *searchpath);

Add a new implicit domain to the list the client keeps.

A searchpath entry is simply a domain to try post-fixing to any request. For example, if you have "sourceforce.net" in your searchpath, then looking "cvs.gsk" should resolve "cvs.gsk.sourceforge.net".

Searchpath entries take priority, EXCEPT if the requested domain name ends in ".". If you have "sourceforce.net" in your searchpath, then looking "cvs.com" should resolve "cvs.com.sourceforge.net" then "cvs.com" if the former does not exist. However, looking up "cvs.com." will ONLY search the global namespace.

`client` : | the client to affect.
`searchpath` : | the new path to search.

### gsk_dns_client_add_ns ()

    void                gsk_dns_client_add_ns               (GskDnsClient *client,
                                                             GskSocketAddressIpv4 *address);

Add a new nameserver to query. All nameservers will be queried simultaneously.

`client` : | the client to affect.
`address` : | the numeric address of the nameserver.

### gsk_dns_client_set_cache ()

    void                gsk_dns_client_set_cache            (GskDnsClient *client,
                                                             GskDnsRRCache *rr_cache);

Switch the client to use a new resource-record cache.

`client` : | the client to affect.
`rr_cache` : | the new resource-record cache to use.

### gsk_dns_client_set_flags ()

    void                gsk_dns_client_set_flags            (GskDnsClient *client,
                                                             GskDnsClientFlags flags);

`client` : |
`flags` : |

### gsk_dns_client_get_flags ()

    GskDnsClientFlags   gsk_dns_client_get_flags            (GskDnsClient *client);

`client` : |
Returns : |

### gsk_dns_client_parse_system_files ()

    gboolean            gsk_dns_client_parse_system_files   (GskDnsClient *client);

Parse system DNS configuration.

Currently, this parses /etc/hosts and /etc/resolv.conf .

`client` : | the client which should add the system configuration information.
Returns : | whether the files were parsed successfully.