#include <dns.h>
|
typedef std::map< std::string, int > | HostMap |
|
This class holds a number of static functions used for DNS related stuff.
You should not need to use these functions directly.
- Author
- Jakob Schröter js@ca.nosp@m.maya.nosp@m..net
- Since
- 0.3
Definition at line 61 of file dns.h.
◆ HostMap
typedef std::map<std::string, int> HostMap |
A list of strings (used for server addresses) and ints (used for port numbers).
Definition at line 68 of file dns.h.
◆ closeSocket()
void closeSocket |
( |
int |
fd, |
|
|
const LogSink & |
logInstance |
|
) |
| |
|
static |
Closes the given socket.
- Parameters
-
fd | The socket to close. |
logInstance | A LogSink to use for logging. |
Definition at line 518 of file dns.cpp.
◆ connect() [1/2]
int connect |
( |
const std::string & |
host, |
|
|
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
-
host | The host to resolve SRV records for. |
logInstance | A LogSink to use for logging. |
- Returns
- A file descriptor for the established connection.
Definition at line 247 of file dns.cpp.
◆ connect() [2/2]
int connect |
( |
const std::string & |
host, |
|
|
int |
port, |
|
|
const LogSink & |
logInstance |
|
) |
| |
|
static |
This is a convenience function which connects to the given host and port. No SRV records are resolved. Use this function for special setups.
- Parameters
-
host | The host/IP address 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 412 of file dns.cpp.
◆ getSocket()
int getSocket |
( |
const LogSink & |
logInstance | ) |
|
|
static |
A convenience function that prepares and returnes a simple, unconnected TCP socket.
- Parameters
-
logInstance | A LogSink to use for logging. |
- Returns
- A TCP socket.
Definition at line 339 of file dns.cpp.
◆ resolve() [1/2]
static HostMap resolve |
( |
const std::string & |
domain, |
|
|
const LogSink & |
logInstance |
|
) |
| |
|
inlinestatic |
This is a convenience funtion which uses resolve() to resolve SRV records for a given domain, using a service of xmpp-client 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 90 of file dns.h.
◆ resolve() [2/2]
DNS::HostMap resolve |
( |
const std::string & |
service, |
|
|
const std::string & |
proto, |
|
|
const std::string & |
domain, |
|
|
const LogSink & |
logInstance |
|
) |
| |
|
static |
This function 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 83 of file dns.cpp.
The documentation for this class was generated from the following files: