ndn::tools::autoconfig::GuessFromSearchDomains Class Reference

Guessing home router based on DNS query with default suffix. More...

#include <guess-from-search-domains.hpp>

Inheritance diagram for ndn::tools::autoconfig::GuessFromSearchDomains:
Collaboration diagram for ndn::tools::autoconfig::GuessFromSearchDomains:

Public Types

typedef std::function< void(const std::string &)> NextStageCallback
 Callback to be called when the stage fails. More...
 

Public Member Functions

 GuessFromSearchDomains (Face &face, KeyChain &keyChain, const NextStageCallback &nextStageOnFailure)
 Create stage to guess home router based on DNS query with default suffix. More...
 
virtual void start () override
 Start the stage. More...
 

Protected Member Functions

std::string querySrvRr (const std::string &fqdn)
 Send DNS SRV request for a fqdn fully qualified domain name. More...
 
std::string querySrvRrSearch ()
 Send DNS SRV request using search domain list. More...
 
void connectToHub (const std::string &uri)
 Attempt to connect to local hub using the uri FaceUri. More...
 

Protected Attributes

Face & m_face
 
KeyChain & m_keyChain
 
nfd::Controller m_controller
 
NextStageCallback m_nextStageOnFailure
 

Detailed Description

Guessing home router based on DNS query with default suffix.

  • Request

    The end host sends a DNS query that is equivalent to this command:

    dig +search +short +cmd +tries=2 +ndots=10 _ndn._udp srv
    
  • Response

    The DNS server should answer with an SRV record that contains the hostname and UDP port number of the NDN router.

Definition at line 49 of file guess-from-search-domains.hpp.

Member Typedef Documentation

typedef std::function<void(const std::string&)> ndn::tools::autoconfig::Base::NextStageCallback
inherited

Callback to be called when the stage fails.

Definition at line 61 of file base.hpp.

Constructor & Destructor Documentation

ndn::tools::autoconfig::GuessFromSearchDomains::GuessFromSearchDomains ( Face &  face,
KeyChain &  keyChain,
const NextStageCallback nextStageOnFailure 
)

Create stage to guess home router based on DNS query with default suffix.

See also
Base::Base

Definition at line 32 of file guess-from-search-domains.cpp.

Member Function Documentation

void ndn::tools::autoconfig::Base::connectToHub ( const std::string &  uri)
protectedinherited

Attempt to connect to local hub using the uri FaceUri.

Exceptions
Base::Errorwhen failed to establish the tunnel

Definition at line 41 of file base.cpp.

std::string ndn::tools::autoconfig::BaseDns::querySrvRr ( const std::string &  fqdn)
protectedinherited

Send DNS SRV request for a fqdn fully qualified domain name.

Returns
FaceUri of the hub from the requested SRV record
Exceptions
Errorif query returns nothing or SRV record cannot be parsed

Definition at line 53 of file base-dns.cpp.

std::string ndn::tools::autoconfig::BaseDns::querySrvRrSearch ( )
protectedinherited

Send DNS SRV request using search domain list.

Returns
FaceUri of the hub from the requested SRV record
Exceptions
Errorif query returns nothing or SRV record cannot be parsed

Definition at line 80 of file base-dns.cpp.

void ndn::tools::autoconfig::GuessFromSearchDomains::start ( )
overridevirtual

Start the stage.

Implements ndn::tools::autoconfig::Base.

Definition at line 39 of file guess-from-search-domains.cpp.

Member Data Documentation

nfd::Controller ndn::tools::autoconfig::Base::m_controller
protectedinherited

Definition at line 110 of file base.hpp.

Face& ndn::tools::autoconfig::Base::m_face
protectedinherited

Definition at line 108 of file base.hpp.

KeyChain& ndn::tools::autoconfig::Base::m_keyChain
protectedinherited

Definition at line 109 of file base.hpp.

NextStageCallback ndn::tools::autoconfig::Base::m_nextStageOnFailure
protectedinherited

Definition at line 111 of file base.hpp.