tdns
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Classes | Functions | Variables
tres.cc File Reference

Teachable resolver. More...

#include <fstream>
#include <vector>
#include <map>
#include <stdexcept>
#include "sclasses.hh"
#include <signal.h>
#include <random>
#include "record-types.hh"
#include <thread>
Include dependency graph for tres.cc:

Classes

struct  TooManyQueriesException
 Thrown if too many queries have been sent. More...
 
struct  NxdomainException
 this is a different kind of error: we KNOW your name does not exist More...
 
struct  NodataException
 Or if your type does not exist. More...
 
struct  ResolveRR
 This describes a single resource record. More...
 
struct  ResolveResult
 This is the end result of our resolving work. More...
 

Functions

DNSMessageReader getResponse (const ComboAddress &server, const DNSName &dn, const DNSType &dt, int depth=0)
 
ResolveResult resolveAt (const DNSName &dn, const DNSType &dt, int depth=0, const DNSName &auth={}, const multimap< DNSName, ComboAddress > &mservers=g_root)
 
void processQuery (int sock, ComboAddress client, DNSMessageReader dmr)
 This is a thread that will create an answer to the query in dmr More...
 
int main (int argc, char **argv)
 

Variables

multimap< DNSName, ComboAddress > g_root
 
unsigned int g_numqueries
 
bool g_skipIPv6 false
 set this if you have no functioning IPv6 More...
 
ofstream g_dot
 

Detailed Description

Teachable resolver.

Function Documentation

DNSMessageReader getResponse ( const ComboAddress &  server,
const DNSName dn,
const DNSType dt,
int  depth = 0 
)

This function guarantees that you will get an answer from this server. It will drop EDNS for you and eventually it will even fall back to TCP for you. If nothing works, an exception is thrown. Note that this function does not think about actual DNS errors, you get those back verbatim. Only the TC bit is checked.

This function does check if the ID field of the response matches the query, but the caller should check qname and qtype.

Here is the call graph for this function:

int main ( int  argc,
char **  argv 
)

Here is the call graph for this function:

void processQuery ( int  sock,
ComboAddress  client,
DNSMessageReader  dmr 
)

This is a thread that will create an answer to the query in dmr

Here is the call graph for this function:

ResolveResult resolveAt ( const DNSName dn,
const DNSType dt,
int  depth = 0,
const DNSName auth = {},
const multimap< DNSName, ComboAddress > &  mservers = g_root 
)

This attempts to look up the name dn with type dt. The depth parameter is for trace output. the 'auth' field describes the authority of the servers we will be talking to. Defaults to root ('believe everything') The multimap specifies the servers to try with. Defaults to a list of root-servers.

Variable Documentation

bool g_skipIPv6 false

set this if you have no functioning IPv6

ofstream g_dot
unsigned int g_numqueries
multimap<DNSName, ComboAddress> g_root