reSIProcate
SIP stack, Dialog Usage Manager and related libraries
Loading...
Searching...
No Matches
resip::DnsResult Class Reference

#include <DnsResult.hxx>

Inheritance diagram for resip::DnsResult:
[legend]

Classes

class  NAPTR
 
class  SRV
 

Public Types

enum  Type { Available , Pending , Finished , Destroyed }
 
typedef std::vector< Data > DataVector
 

Public Member Functions

 RESIP_HeapCount (DnsResult)
 
 DnsResult (DnsInterface &interfaceObj, DnsStub &dns, RRVip &vip, DnsHandler *handler)
 
virtual ~DnsResult ()
 
void lookup (const Uri &uri)
 
bool blacklistLast (uint64_t expiry)
 
bool greylistLast (uint64_t expiry)
 
Type available ()
 
Tuple next ()
 
void whitelistLast ()
 
Data target () const
 
unsigned int getSRVResultsSize () const
 
void destroy ()
 
- Public Member Functions inherited from resip::DnsResultSink
virtual ~DnsResultSink ()
 
virtual void onLogDnsResult (const DNSResult< DnsHostRecord > &)
 
virtual void onLogDnsResult (const DNSResult< DnsAAAARecord > &)
 
virtual void onLogDnsResult (const DNSResult< DnsSrvRecord > &)
 
virtual void onLogDnsResult (const DNSResult< DnsNaptrRecord > &)
 
virtual void onLogDnsResult (const DNSResult< DnsCnameRecord > &)
 

Friends

class LookupCommand
 
class DnsInterface
 
EncodeStream & operator<< (EncodeStream &strm, const DnsResult &)
 
EncodeStream & operator<< (EncodeStream &strm, const DnsResult::SRV &)
 
EncodeStream & operator<< (EncodeStream &strm, const DnsResult::NAPTR &)
 

Detailed Description

Definition at line 65 of file DnsResult.hxx.

Member Typedef Documentation

◆ DataVector

typedef std::vector<Data> resip::DnsResult::DataVector

Definition at line 82 of file DnsResult.hxx.

Member Enumeration Documentation

◆ Type

Enumerator
Available 
Pending 
Finished 
Destroyed 

Definition at line 72 of file DnsResult.hxx.

Constructor & Destructor Documentation

◆ DnsResult()

DnsResult::DnsResult ( DnsInterface &  interfaceObj,
DnsStub &  dns,
RRVip &  vip,
DnsHandler *  handler 
)

Definition at line 94 of file DnsResult.cxx.

◆ ~DnsResult()

DnsResult::~DnsResult ( )
virtual

Definition at line 111 of file DnsResult.cxx.

Member Function Documentation

◆ available()

DnsResult::Type DnsResult::available ( )

Tries to load the next tuple. If Available is returned, the tuple may be accessed using current(). Safe to call after DnsHandler::handle callback has been called.

Returns
Available if there is a result ready, Pending if it needs to follow an SRV (more results might come in later), or Finished if there are definitively no more results.
Note
ALWAYS call this before calling next()

Definition at line 192 of file DnsResult.cxx.

◆ blacklistLast()

bool DnsResult::blacklistLast ( uint64_t  expiry)

Blacklist the last returned result until the specified time (ms). This call is threadsafe.

Parameters
expiryThe absolute expiry, in ms, of this blacklist.
Returns
true iff the last result could be blacklisted
Note
This is a no-op if no results have been returned.

Definition at line 147 of file DnsResult.cxx.

◆ destroy()

void DnsResult::destroy ( )

Definition at line 130 of file DnsResult.cxx.

◆ getSRVResultsSize()

unsigned int resip::DnsResult::getSRVResultsSize ( ) const
inline

Definition at line 158 of file DnsResult.hxx.

◆ greylistLast()

bool DnsResult::greylistLast ( uint64_t  expiry)

Greylist the last returned result until the specified time (ms) Greylisting a tuple effectively de-prioritizes it, so it will not be tried if there are any non-grey or blacklisted tuples left to try. This call is threadsafe.

Parameters
expiryThe absolute expiry, in ms, of this blacklist.
Returns
true iff the last result could be greylisted
Note
This is a no-op if no results have been returned.

Definition at line 165 of file DnsResult.cxx.

◆ lookup()

void DnsResult::lookup ( const Uri &  uri)

Starts a lookup. Has the rules for determining the transport from a uri as per rfc3263 and then does a NAPTR lookup or an A lookup depending on the uri. Also does ENUM lookups if domain matches a configured enum domain. This call is threadsafe.

Parameters
uriThe uri to resolve.

Definition at line 261 of file DnsResult.cxx.

◆ next()

Tuple DnsResult::next ( )

Return the next tuple available for this query. Safe to call after DnsHandler::handle callback has been called.

Returns
The next Tuple available for this query.
Note
ALWAYS call available() and verify the return is Available before calling this function.
This no longer results in the last result being blacklisted. To blacklist the last result, use blacklistLast().

Definition at line 214 of file DnsResult.cxx.

◆ RESIP_HeapCount()

resip::DnsResult::RESIP_HeapCount ( DnsResult  )

◆ target()

Data resip::DnsResult::target ( ) const
inline

Definition at line 157 of file DnsResult.hxx.

◆ whitelistLast()

void DnsResult::whitelistLast ( )

Whitelist the last tuple returned by next(). This means that the path to this result (NAPTR->SRV->A/AAAA) will be favored by the resolver from now on. (ie, this NAPTR will be favored above all others that match, even if the order/preference changes in the DNS, and this A/AAAA record will be favored above all others that match, even if new ones are added.) This call is threadsafe.

Note
It can be argued that using this is harmful, since the load- leveling capabilities of DNS are ignored from here on.
This will also re-order SRV records, but the order in which SRVs arrive is ignored by DnsResult (they are just re-sorted)

Definition at line 241 of file DnsResult.cxx.

Friends And Related Symbol Documentation

◆ DnsInterface

friend class DnsInterface
friend

Definition at line 298 of file DnsResult.hxx.

◆ LookupCommand

friend class LookupCommand
friend

Definition at line 220 of file DnsResult.hxx.

◆ operator<< [1/3]

EncodeStream & operator<< ( EncodeStream &  strm,
const DnsResult &   
)
friend

◆ operator<< [2/3]

EncodeStream & operator<< ( EncodeStream &  strm,
const DnsResult::NAPTR &   
)
friend

◆ operator<< [3/3]

EncodeStream & operator<< ( EncodeStream &  strm,
const DnsResult::SRV &   
)
friend

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