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

Static Public Member Functions

static HostMap resolve (const std::string &service, const std::string &proto, const std::string &domain, const LogSink &logInstance)
static HostMap resolve (const std::string &domain, const LogSink &logInstance)
static int connect (const std::string &domain, const LogSink &logInstance)
static int connect (const std::string &domain, unsigned short port, const LogSink &logInstance)
static int getSocket ()
static void closeSocket (int fd)


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 55 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 62 of file dns.h.


Member Function Documentation

DNS::HostMap resolve ( const std::string &  service,
const std::string &  proto,
const std::string &  domain,
const LogSink logInstance 
) [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.
logInstance A LogSink to use for logging.
Returns:
A list of weighted hostname/port pairs from SRV records, or A records if no SRV records where found.

Definition at line 82 of file dns.cpp.

static HostMap resolve ( const std::string &  domain,
const LogSink logInstance 
) [inline, 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.
logInstance A LogSink to use for logging.
Returns:
A list of weighted hostname/port pairs from SRV records, or A records if no SRV records where found.

Definition at line 84 of file dns.h.

int connect ( const std::string &  domain,
const LogSink logInstance 
) [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.
logInstance A LogSink to use for logging.
Returns:
A file descriptor for the established connection.

Definition at line 210 of file dns.cpp.

int connect ( const std::string &  domain,
unsigned short  port,
const LogSink logInstance 
) [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.
logInstance A LogSink to use for logging.
Returns:
A file descriptor for the established connection.

Definition at line 257 of file dns.cpp.

int getSocket (  )  [static]

Prepares and returnes a simple socket.

Returns:
A simple socket.

Definition at line 227 of file dns.cpp.

void closeSocket ( int  fd  )  [static]

Closes the given socket.

Parameters:
fd The socket to close.

Definition at line 309 of file dns.cpp.


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

Generated on Fri Oct 10 15:26:17 2008 for gloox by  doxygen 1.5.6