The InspIRCd Project
Home | Developers | Wiki | Forums | Bug Tracker | SVN | Download
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

ServernameResolver Class Reference

This class is used to resolve server hostnames during /connect and autoconnect. More...

#include <resolvers.h>

Inheritance diagram for ServernameResolver:

Inheritance graph
[legend]
Collaboration diagram for ServernameResolver:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ServernameResolver (Module *me, SpanningTreeUtilities *Util, InspIRCd *Instance, const std::string &hostname, Link x, bool &cached, QueryType qt)
 This class is used to resolve server hostnames during /connect and autoconnect.
void OnLookupComplete (const std::string &result, unsigned int ttl, bool cached, int resultnum=0)
 When your lookup completes, this method will be called.
void OnError (ResolverError e, const std::string &errormessage)
 If an error occurs (such as NXDOMAIN, no domain name found) then this method will be called.

Private Attributes

Link MyLink
 A copy of the Link tag info for what we're connecting to.
SpanningTreeUtilitiesUtils
QueryType query
std::string host
Modulemine

Detailed Description

This class is used to resolve server hostnames during /connect and autoconnect.

As of 1.1, the resolver system is seperated out from BufferedSocket, so we must do this resolver step first ourselves if we need it. This is totally nonblocking, and will callback to OnLookupComplete or OnError when completed. Once it has completed we will have an IP address which we can then use to continue our connection.

Definition at line 67 of file resolvers.h.


Constructor & Destructor Documentation

ServernameResolver::ServernameResolver Module me,
SpanningTreeUtilities Util,
InspIRCd Instance,
const std::string hostname,
Link  x,
bool &  cached,
QueryType  qt
 

This class is used to resolve server hostnames during /connect and autoconnect.

As of 1.1, the resolver system is seperated out from BufferedSocket, so we must do this resolver step first ourselves if we need it. This is totally nonblocking, and will callback to OnLookupComplete or OnError when completed. Once it has completed we will have an IP address which we can then use to continue our connection.

Definition at line 36 of file resolvers.cpp.

Referenced by OnError().


Member Function Documentation

void ServernameResolver::OnError ResolverError  e,
const std::string errormessage
[virtual]
 

If an error occurs (such as NXDOMAIN, no domain name found) then this method will be called.

Parameters:
e A ResolverError enum containing the error type which has occured.
errormessage The error text of the error that occured.

Reimplemented from Resolver.

Definition at line 74 of file resolvers.cpp.

References InspIRCd::AddResolver(), DNS_QUERY_A, DNS_QUERY_AAAA, SpanningTreeUtilities::DoFailOver(), host, mine, MyLink, Link::Name, query, Resolver::ServerInstance, ServernameResolver(), InspIRCd::SNO, Utils, and SnomaskManager::WriteToSnoMask().

void ServernameResolver::OnLookupComplete const std::string result,
unsigned int  ttl,
bool  cached,
int  resultnum = 0
[virtual]
 

When your lookup completes, this method will be called.

Parameters:
result The resulting DNS lookup, either an IP address or a hostname.
ttl The time-to-live value of the result, in the instance of a cached result, this is the number of seconds remaining before refresh/expiry.
cached True if the result is a cached result, false if it was requested from the DNS server.
resultnum Result number, for records with multiple matching results. Normally, you will only want to act on this when the result is 0.

Implements Resolver.

Definition at line 41 of file resolvers.cpp.

References Link::Bind, SpanningTreeUtilities::DoFailOver(), SpanningTreeUtilities::FindServer(), EventHandler::GetFd(), Link::Hook, SpanningTreeUtilities::hooks, MyLink, Link::Name, Link::Port, Resolver::ServerInstance, InspIRCd::SNO, InspIRCd::SocketCull, Link::Timeout, Utils, and SnomaskManager::WriteToSnoMask().


Member Data Documentation

std::string ServernameResolver::host [private]
 

Definition at line 77 of file resolvers.h.

Referenced by OnError().

Module* ServernameResolver::mine [private]
 

Definition at line 78 of file resolvers.h.

Referenced by OnError().

Link ServernameResolver::MyLink [private]
 

A copy of the Link tag info for what we're connecting to.

We take a copy, rather than using a pointer, just in case the admin takes the tag away and rehashes while the domain is resolving.

Definition at line 74 of file resolvers.h.

Referenced by OnError(), and OnLookupComplete().

QueryType ServernameResolver::query [private]
 

Definition at line 76 of file resolvers.h.

Referenced by OnError().

SpanningTreeUtilities* ServernameResolver::Utils [private]
 

Definition at line 75 of file resolvers.h.

Referenced by OnError(), and OnLookupComplete().


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