Public Member Functions

base::DNS Class Reference

DNS resolver library. More...

#include <libppbase/base/DNS.h>

List of all members.

Public Member Functions

 DNS ()
 Constructor.
 ~DNS ()
 Destructor.
int errcode () const
 Returns error code of last query.
bool existsARecord (const String &host)
 Checks if an A record exists.
bool existsDomain (const String &domain)
 Checks if a domain exists (can send mail to user @ domain).
bool existsHost (const String &host)
 Checks if a host exists.
bool existsMX (const String &host)
 Checks if an mx record for a host exists.
bool existsRecord (const String &domain, int *types, int ntypes)
 Queries dns.
bool failed () const
 Checks if last query failed.
String fqdn ()
 Returns local host name, including domain (FQDN).
String hostname ()
 Returns local host name.
bool isValidEmailAddr (const String &email)
 Checks a email address for validity.
String lookup (const String &ipaddr)
 Looks up the host name for an ip address.
String resolve (const String &host)
 Resolves a host name to an ip address.

Detailed Description

DNS resolver library.

Author:
Christoph Schwarz
Version:
$Id: DNS.h 21 2010-09-05 04:18:17Z cschwarz1 $

Member Function Documentation

int base::DNS::errcode (  )  const

Returns error code of last query.

Returns:
error code, 0=success, other=failure
bool base::DNS::existsARecord ( const String host  ) 

Checks if an A record exists.

Parameters:
host the host name
Returns:
true=exists, false=does not exist
bool base::DNS::existsDomain ( const String domain  ) 

Checks if a domain exists (can send mail to user @ domain).

Parameters:
domain the domain name
Returns:
true=exists, false=does not exist
bool base::DNS::existsHost ( const String host  ) 

Checks if a host exists.

Parameters:
host the host name
Returns:
true=exists, false=does not exist
bool base::DNS::existsMX ( const String host  ) 

Checks if an mx record for a host exists.

Parameters:
host the host name
Returns:
true=exists, false=does not exist
bool base::DNS::existsRecord ( const String domain,
int *  types,
int  ntypes 
)

Queries dns.

Parameters:
domain domain name
types array of record types
ntypes number of entries in types array
Returns:
true=record exists, false=record does not exist
bool base::DNS::failed (  )  const

Checks if last query failed.

Returns:
flag: true=failed, false=succeeded
String base::DNS::fqdn (  ) 

Returns local host name, including domain (FQDN).

Returns:
local host name, including domain
String base::DNS::hostname (  ) 

Returns local host name.

Returns:
local host name
bool base::DNS::isValidEmailAddr ( const String email  ) 

Checks a email address for validity.

Parameters:
email address to check
Returns:
true if it is valid, false if not
String base::DNS::lookup ( const String ipaddr  ) 

Looks up the host name for an ip address.

Parameters:
ipaddr the ip address in dot-numbers notation
Returns:
the host name
String base::DNS::resolve ( const String host  ) 

Resolves a host name to an ip address.

Parameters:
host the hostname to resolve
Returns:
ip address

The documentation for this class was generated from the following file: