domain_name_cache.h File Reference

Look up domain names and addresses quickly. More...

`#include "domain_name.h"`

Go to the source code of this file.

## Functions

int | domain_name_cache_guess (char *name)
| Determine the caller's primary domain name.
int | domain_name_cache_guess_short (char *name)
| Determine the caller's local machine name.
int | domain_name_cache_lookup (const char *name, char *addr)
| Resolve a domain name to an IP address with caching.
int | domain_name_cache_lookup_reverse (const char *addr, char *name)
| Resolve an IP address to a domain name with caching.
int | domain_name_cache_canonical (const char *name_or_addr, char *cname)
| Find the canonical name of a host.

## Detailed Description

Look up domain names and addresses quickly.

These routines resolve domain names using an internal cache, allowing for much faster response time than the plain domain_name.h routines.

## Function Documentation

## domain_name_cache_guess()

int domain_name_cache_guess | ( | char * | name | ) |

Determine the caller's primary domain name.

This function uses a variety of sources, including uname, the local hosts file, and the domain name system, to determine the caller's primary domain name. If this function returns an unexpected name, try running with the debug flags set to D_DNS to observe exactly who th ename was determined.

Parameters

  name | Pointer to buffer where name will be stored.

Returns
  One on success, zero on failure.

## domain_name_cache_guess_short()

int domain_name_cache_guess_short | ( | char * | name | ) |

Determine the caller's local machine name.

This function uses the built in facility to determine the local host name of the machine, without involving DNS. If the local name has been configured to look like a domain name, only the first segment of the name will be returned.

Parameters

  name | Pointer to buffer where name will be stored.

Returns
  One on success, zero on failure.

## domain_name_cache_lookup()

int domain_name_cache_lookup | ( | const char * | name,
|  | char * | addr )

Resolve a domain name to an IP address with caching.

Parameters

  name | A string containing a domain name like "www.google.com".
  addr | A string where the IP address will be written.

Returns
  One on success, zero on failure.

## domain_name_cache_lookup_reverse()

int domain_name_cache_lookup_reverse | ( | const char * | addr,
|  | char * | name )

Resolve an IP address to a domain name with caching.

Parameters

  addr | A string containing an IP address like "202.5.129.1"
  name | A string where the domain name will be written.

Returns
  One on success, zero on failure.

## domain_name_cache_canonical()

int domain_name_cache_canonical | ( | const char * | name_or_addr,
|  | char * | cname )

Find the canonical name of a host.

Parameters

  name_or_addr | A string containing a domain name or ip address.
  cname | A string where the canonical domain name will be written.

Returns
  One on success, zero on failure.