DNS Class Reference

This class holds a number of static functions used for DNS related stuff. More...

#include <dns.h>

List of all members.

Public Types

typedef std::map< std::string,
int > 
HostMap
enum  DNSError { DNS_COULD_NOT_CONNECT = 1, DNS_NO_HOSTS_FOUND, DNS_COULD_NOT_RESOLVE }

Static Public Member Functions

static HostMap resolve (const std::string &service, const std::string &proto, const std::string &domain)
static HostMap resolve (const std::string &domain)
static int connect (const std::string &domain)
static int connect (const std::string &domain, int port)


Detailed Description

This class holds a number of static functions used for DNS related stuff.

You should not need to use these functions directly.

Author:
Jakob Schroeter <js@camaya.net>
Since:
0.3

Definition at line 53 of file dns.h.


Member Typedef Documentation

typedef std::map<std::string, int> HostMap
 

A list of strings (used for server addresses) and ints (used for port numbers).

Definition at line 70 of file dns.h.


Member Enumeration Documentation

enum DNSError
 

Possible errors occuring while resolving and connecting.

Enumerator:
DNS_COULD_NOT_CONNECT  None of the resolved hosts could be contacted.
DNS_NO_HOSTS_FOUND  It was not possible to resolve SRV record.
DNS_COULD_NOT_RESOLVE  The given domain name could not be resolved.

Definition at line 60 of file dns.h.


Member Function Documentation

int connect const std::string &  domain,
int  port
[static]
 

This is a convenience function which uses connects to the given host and port. No SRV records are resolved. Use this function for special setups.

Parameters:
domain The domain to connect to.
port A custom port to connect to.
Returns:
A file descriptor for the established connection.

Definition at line 217 of file dns.cpp.

References DNS::DNS_COULD_NOT_CONNECT, and DNS::DNS_COULD_NOT_RESOLVE.

int connect const std::string &  domain  )  [static]
 

This is a convenience function which uses resolve() to get a list of hosts and connects to one of them.

Parameters:
domain The domain to resolve SRV records for.
Returns:
A file descriptor for the established connection.

Definition at line 162 of file dns.cpp.

References DNS::DNS_COULD_NOT_RESOLVE, DNS::DNS_NO_HOSTS_FOUND, and DNS::resolve().

Referenced by Connection::connect().

DNS::HostMap resolve const std::string &  domain  )  [static]
 

This is a convenience funtion which uses resolve() to resolve SRV records for a given domain, using a service of xmpp and a proto of tcp.

Parameters:
domain The domain to resolve SRV records for.
Returns:
A list of weighted hostname/port pairs from SRV records, or A records if no SRV records where found.

Definition at line 65 of file dns.cpp.

References DNS::resolve().

DNS::HostMap resolve const std::string &  service,
const std::string &  proto,
const std::string &  domain
[static]
 

This funtion resolves a service/protocol/domain tuple.

Parameters:
service The SRV service type.
proto The SRV protocol.
domain The domain to search for SRV records.
Returns:
A list of weighted hostname/port pairs from SRV records, or A records if no SRV records where found.

Definition at line 73 of file dns.cpp.

Referenced by DNS::connect(), and DNS::resolve().


The documentation for this class was generated from the following files:
Generated on Mon Jan 16 16:19:58 2006 for gloox by  doxygen 1.4.6