cctools
Macros | Functions
domain_name.h File Reference

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

Go to the source code of this file.

Macros

#define DOMAIN_NAME_MAX   256
 Maximum number of characters in a domain name or address. More...
 

Functions

int domain_name_lookup (const char *name, char *addr)
 Resolve a domain name to an IP address. More...
 
int domain_name_lookup_reverse (const char *addr, char *name)
 Resolve an IP address to a domain name with caching. More...
 

Detailed Description

Look up domain names and addresses directly.

Most applications should use domain_name_cache.h, which uses an internal cache to perform lookups quickly.

Macro Definition Documentation

#define DOMAIN_NAME_MAX   256

Maximum number of characters in a domain name or address.

Function Documentation

int domain_name_lookup ( const char *  name,
char *  addr 
)

Resolve a domain name to an IP address.

Parameters
nameA string containing a domain name like "www.google.com".
addrA string where the IP address will be written.
Returns
One on success, zero on failure.
int domain_name_lookup_reverse ( const char *  addr,
char *  name 
)

Resolve an IP address to a domain name with caching.

Parameters
addrA string containing an IP address like "202.5.129.1"
nameA string where the domain name will be written.
Returns
One on success, zero on failure.