ndn::tools::autoconfig::GuessFromIdentityName Class Reference

Guessing home router based on the default identity name. More...

#include <guess-from-identity-name.hpp>

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

Public Types

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

Public Member Functions

 GuessFromIdentityName (Face &face, KeyChain &keyChain, const NextStageCallback &nextStageOnFailure)
 Create stage to guess home router based on the default identity name. 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
 
ndn::nfd::Controller m_controller
 
NextStageCallback m_nextStageOnFailure
 

Detailed Description

Guessing home router based on the default identity name.

This stage assumes that user has configured default certificate using http://ndncert.named-data.net/

  • Request

    The end host loads the default user identity (eg. /ndn/edu/ucla/cs/afanasev), and converts it to DNS format.

    The end host sends a DNS query for an SRV record of name _ndn._udp. + user identity in DNS format + _homehub._auto-conf.named-data.net. For example:

    _ndn._udp.afanasev.cs.ucla.edu.ndn._homehub._autoconf.named-data.net
    
  • Response

    The DNS server should answer with an SRV record that contains the hostname and UDP port number of the home NDN router of this user's site.

Definition at line 56 of file guess-from-identity-name.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 64 of file base.hpp.

Constructor & Destructor Documentation

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

Create stage to guess home router based on the default identity name.

See also
Base::Base

Definition at line 32 of file guess-from-identity-name.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::GuessFromIdentityName::start ( )
overridevirtual

Start the stage.

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

Definition at line 39 of file guess-from-identity-name.cpp.

Member Data Documentation

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

Definition at line 113 of file base.hpp.

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

Definition at line 111 of file base.hpp.

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

Definition at line 112 of file base.hpp.

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

Definition at line 114 of file base.hpp.