NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.3: NDN, CCN, CCNx, content centric networks
API Documentation
nfd::strategy_choice::StrategyChoice Class Reference

represents the Strategy Choice table More...

#include <strategy-choice.hpp>

Inheritance diagram for nfd::strategy_choice::StrategyChoice:
Collaboration diagram for nfd::strategy_choice::StrategyChoice:

Classes

class  InsertResult
 

Public Types

typedef boost::transformed_range< name_tree::GetTableEntry< Entry >, const name_tree::RangeRange
 
typedef boost::range_iterator< Range >::type const_iterator
 

Public Member Functions

 StrategyChoice (Forwarder &forwarder)
 
size_t size () const
 
void setDefaultStrategy (const Name &strategyName)
 set the default strategy More...
 
InsertResult insert (const Name &prefix, const Name &strategyName)
 set strategy of prefix to be strategyName More...
 
void erase (const Name &prefix)
 make prefix to inherit strategy from its parent More...
 
std::pair< bool, Nameget (const Name &prefix) const
 get strategy Name of prefix More...
 
fw::StrategyfindEffectiveStrategy (const Name &prefix) const
 get effective strategy for prefix More...
 
fw::StrategyfindEffectiveStrategy (const pit::Entry &pitEntry) const
 get effective strategy for pitEntry More...
 
fw::StrategyfindEffectiveStrategy (const measurements::Entry &measurementsEntry) const
 get effective strategy for measurementsEntry More...
 
const_iterator begin () const
 
const_iterator end () const
 
template<typename K >
Strategy & findEffectiveStrategyImpl (const K &key) const
 

Detailed Description

represents the Strategy Choice table

The Strategy Choice table maintains available Strategy types, and associates Name prefixes with Strategy types.

Each strategy is identified by a strategyName. It's recommended to include a version number as the last component of strategyName.

A Name prefix is owned by a strategy if a longest prefix match on the Strategy Choice table returns that strategy.

Definition at line 51 of file strategy-choice.hpp.

Member Typedef Documentation

Definition at line 148 of file strategy-choice.hpp.

typedef boost::range_iterator<Range>::type nfd::strategy_choice::StrategyChoice::const_iterator

Definition at line 149 of file strategy-choice.hpp.

Constructor & Destructor Documentation

nfd::strategy_choice::StrategyChoice::StrategyChoice ( Forwarder forwarder)
explicit

Definition at line 48 of file strategy-choice.cpp.

Member Function Documentation

size_t nfd::strategy_choice::StrategyChoice::size ( ) const
inline

Definition at line 58 of file strategy-choice.hpp.

References setDefaultStrategy().

void nfd::strategy_choice::StrategyChoice::setDefaultStrategy ( const Name strategyName)

set the default strategy

This must be called by forwarder constructor.

Definition at line 56 of file strategy-choice.cpp.

References ns3::ndn::Name, and NFD_LOG_INFO.

Referenced by size().

StrategyChoice::InsertResult nfd::strategy_choice::StrategyChoice::insert ( const Name prefix,
const Name strategyName 
)

set strategy of prefix to be strategyName

Parameters
prefixthe name prefix to change strategy
strategyNamestrategy instance name, may contain version and parameters; strategy must have been registered
Returns
convertible to true on success; convertible to false on failure

Definition at line 70 of file strategy-choice.cpp.

References findEffectiveStrategy(), nfd::strategy_choice::Entry::getStrategy(), nfd::name_tree::Entry::getStrategyChoiceEntry(), nfd::strategy_choice::Entry::getStrategyInstanceName(), NFD_LOG_ERROR, NFD_LOG_TRACE, nfd::strategy_choice::Entry::setStrategy(), nfd::name_tree::Entry::setStrategyChoiceEntry(), ndn::Name::size(), and nfd::fw::Strategy.

Referenced by nfd::StrategyChoiceManager::StrategyChoiceManager().

void nfd::strategy_choice::StrategyChoice::erase ( const Name prefix)

make prefix to inherit strategy from its parent

not allowed for root prefix (ndn:/)

Definition at line 140 of file strategy-choice.cpp.

References findEffectiveStrategy(), ndn::Name::getPrefix(), nfd::strategy_choice::Entry::getStrategy(), ndn::Name::size(), and nfd::fw::Strategy.

Referenced by nfd::StrategyChoiceManager::StrategyChoiceManager().

std::pair< bool, Name > nfd::strategy_choice::StrategyChoice::get ( const Name prefix) const

get strategy Name of prefix

Returns
true and strategyName at exact match, or false

Definition at line 165 of file strategy-choice.cpp.

References nfd::name_tree::Entry::getStrategyChoiceEntry(), nfd::strategy_choice::Entry::getStrategyInstanceName(), ns3::ndn::Name, and nfd::fw::Strategy.

Referenced by nfd::StrategyChoiceManager::StrategyChoiceManager().

Strategy & nfd::strategy_choice::StrategyChoice::findEffectiveStrategy ( const Name prefix) const

get effective strategy for prefix

Definition at line 190 of file strategy-choice.cpp.

References nfd::fw::Strategy.

Referenced by erase(), and insert().

Strategy & nfd::strategy_choice::StrategyChoice::findEffectiveStrategy ( const pit::Entry pitEntry) const

get effective strategy for pitEntry

This is equivalent to .findEffectiveStrategy(pitEntry.getName())

Definition at line 196 of file strategy-choice.cpp.

References nfd::fw::Strategy.

Strategy & nfd::strategy_choice::StrategyChoice::findEffectiveStrategy ( const measurements::Entry measurementsEntry) const

get effective strategy for measurementsEntry

This is equivalent to .findEffectiveStrategy(measurementsEntry.getName())

Definition at line 202 of file strategy-choice.cpp.

const_iterator nfd::strategy_choice::StrategyChoice::begin ( ) const
inline
Returns
an iterator to the beginning
Note
Iteration order is implementation-defined.
Warning
Undefined behavior may occur if a FIB/PIT/Measurements/StrategyChoice entry is inserted or erased during enumeration.

Definition at line 157 of file strategy-choice.hpp.

const_iterator nfd::strategy_choice::StrategyChoice::end ( ) const
inline
template<typename K >
Strategy& nfd::strategy_choice::StrategyChoice::findEffectiveStrategyImpl ( const K &  key) const

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