NS-3 based Named Data Networking (NDN) simulator
ndnSIM: NDN, CCN, CCNx, content centric networks
API Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
ns3::ndn::ForwardingStrategy Class Referenceabstract

Abstract base class for Ndn forwarding strategies. More...

#include <ndn-forwarding-strategy.h>

Inheritance diagram for ns3::ndn::ForwardingStrategy:
Collaboration diagram for ns3::ndn::ForwardingStrategy:

Public Member Functions

 ForwardingStrategy ()
 Default constructor.
 
virtual void OnInterest (Ptr< Face > face, Ptr< Interest > interest)
 Actual processing of incoming Ndn interests. More...
 
virtual void OnData (Ptr< Face > face, Ptr< Data > data)
 Actual processing of incoming Ndn content objects. More...
 
virtual void WillEraseTimedOutPendingInterest (Ptr< pit::Entry > pitEntry)
 Event fired just before PIT entry is removed by timeout. More...
 
virtual void AddFace (Ptr< Face > face)
 Event fired every time face is added to NDN stack. More...
 
virtual void RemoveFace (Ptr< Face > face)
 Event fired every time face is removed from NDN stack. More...
 
virtual void DidAddFibEntry (Ptr< fib::Entry > fibEntry)
 Event fired every time a FIB entry is added to FIB. More...
 
virtual void WillRemoveFibEntry (Ptr< fib::Entry > fibEntry)
 Fired just before FIB entry will be removed from FIB. More...
 

Static Public Member Functions

static TypeId GetTypeId ()
 
static std::string GetLogName ()
 Helper function to retrieve logging name for the forwarding strategy.
 

Protected Member Functions

virtual void DidCreatePitEntry (Ptr< Face > inFace, Ptr< const Interest > interest, Ptr< pit::Entry > pitEntry)
 An event that is fired every time a new PIT entry is created. More...
 
virtual void FailedToCreatePitEntry (Ptr< Face > inFace, Ptr< const Interest > interest)
 An event that is fired every time a new PIT entry cannot be created (e.g., PIT container imposes a limit) More...
 
virtual void DidReceiveDuplicateInterest (Ptr< Face > inFace, Ptr< const Interest > interest, Ptr< pit::Entry > pitEntry)
 An event that is fired every time a duplicated Interest is received. More...
 
virtual void DidSuppressSimilarInterest (Ptr< Face > inFace, Ptr< const Interest > interest, Ptr< pit::Entry > pitEntry)
 An event that is fired every time when a similar Interest is received and suppressed (collapsed) More...
 
virtual void DidForwardSimilarInterest (Ptr< Face > inFace, Ptr< const Interest > interest, Ptr< pit::Entry > pitEntry)
 An event that is fired every time when a similar Interest is received and further forwarded (not suppressed/collapsed) More...
 
virtual void DidExhaustForwardingOptions (Ptr< Face > inFace, Ptr< const Interest > interest, Ptr< pit::Entry > pitEntry)
 An even that is fired when Interest cannot be forwarded. More...
 
virtual bool DetectRetransmittedInterest (Ptr< Face > inFace, Ptr< const Interest > interest, Ptr< pit::Entry > pitEntry)
 Method that implements logic to distinguish between new and retransmitted interest. More...
 
virtual void WillSatisfyPendingInterest (Ptr< Face > inFace, Ptr< pit::Entry > pitEntry)
 Even fired just before Interest will be satisfied. More...
 
virtual void SatisfyPendingInterest (Ptr< Face > inFace, Ptr< const Data > data, Ptr< pit::Entry > pitEntry)
 Actual procedure to satisfy Interest. More...
 
virtual void DidSendOutData (Ptr< Face > inFace, Ptr< Face > outFace, Ptr< const Data > data, Ptr< pit::Entry > pitEntry)
 Event which is fired just after data was send out on the face. More...
 
virtual void DidReceiveSolicitedData (Ptr< Face > inFace, Ptr< const Data > data, bool didCreateCacheEntry)
 Event which is fired every time a requested (solicited) DATA packet (there is an active PIT entry) is received. More...
 
virtual void DidReceiveUnsolicitedData (Ptr< Face > inFace, Ptr< const Data > data, bool didCreateCacheEntry)
 Event which is fired every time an unsolicited DATA packet (no active PIT entry) is received. More...
 
virtual bool ShouldSuppressIncomingInterest (Ptr< Face > inFace, Ptr< const Interest > interest, Ptr< pit::Entry > pitEntry)
 Method implementing logic to suppress (collapse) similar Interests. More...
 
virtual bool CanSendOutInterest (Ptr< Face > inFace, Ptr< Face > outFace, Ptr< const Interest > interest, Ptr< pit::Entry > pitEntry)
 Method to check whether Interest can be send out on the particular face or not. More...
 
virtual bool TrySendOutInterest (Ptr< Face > inFace, Ptr< Face > outFace, Ptr< const Interest > interest, Ptr< pit::Entry > pitEntry)
 Method implementing actual interest forwarding, taking into account CanSendOutInterest decision. More...
 
virtual void DidSendOutInterest (Ptr< Face > inFace, Ptr< Face > outFace, Ptr< const Interest > interest, Ptr< pit::Entry > pitEntry)
 Event fired just after forwarding the Interest. More...
 
virtual void PropagateInterest (Ptr< Face > inFace, Ptr< const Interest > interest, Ptr< pit::Entry > pitEntry)
 Wrapper method, which performs general tasks and calls DoPropagateInterest method. More...
 
virtual bool DoPropagateInterest (Ptr< Face > inFace, Ptr< const Interest > interest, Ptr< pit::Entry > pitEntry)=0
 Virtual method to perform Interest propagation according to the forwarding strategy logic. More...
 
virtual void NotifyNewAggregate ()
 Even when object is aggregated to another Object.
 
virtual void DoDispose ()
 Do cleanup.
 

Protected Attributes

Ptr< Pitm_pit
 Reference to PIT to which this forwarding strategy is associated.
 
Ptr< Fibm_fib
 FIB.
 
Ptr< ContentStorem_contentStore
 Content store (for caching purposes only)
 
bool m_cacheUnsolicitedDataFromApps
 
bool m_cacheUnsolicitedData
 
bool m_detectRetransmissions
 
TracedCallback< Ptr< const
Interest >, Ptr< const Face > > 
m_outInterests
 Transmitted interests trace.
 
TracedCallback< Ptr< const
Interest >, Ptr< const Face > > 
m_inInterests
 trace of incoming Interests
 
TracedCallback< Ptr< const
Interest >, Ptr< const Face > > 
m_dropInterests
 trace of dropped Interests
 
TracedCallback< Ptr< const
Data >, bool, Ptr< const Face > > 
m_outData
 trace of outgoing Data
 
TracedCallback< Ptr< const
Data >, Ptr< const Face > > 
m_inData
 trace of incoming Data
 
TracedCallback< Ptr< const
Data >, Ptr< const Face > > 
m_dropData
 trace of dropped Data
 
TracedCallback< Ptr< const
pit::Entry > > 
m_satisfiedInterests
 
TracedCallback< Ptr< const
pit::Entry > > 
m_timedOutInterests
 

Detailed Description

Abstract base class for Ndn forwarding strategies.

Doxygen introspection did not find any typical Config paths.

Attributes

  • CacheUnsolicitedDataFromApps: Cache unsolicited data that has been pushed from applications
    • Set with class: BooleanValue
    • Underlying type: bool
    • Initial value: true
    • Flags: construct write read
  • CacheUnsolicitedData: Cache overheard data that have not been requested
    • Set with class: BooleanValue
    • Underlying type: bool
    • Initial value: false
    • Flags: construct write read
  • DetectRetransmissions: If non-duplicate interest is received on the same face more than once, it is considered a retransmission
    • Set with class: BooleanValue
    • Underlying type: bool
    • Initial value: true
    • Flags: construct write read

TraceSources

  • OutInterests: OutInterests
  • InInterests: InInterests
  • DropInterests: DropInterests
  • OutData: OutData
  • InData: InData
  • DropData: DropData
  • SatisfiedInterests: SatisfiedInterests
  • TimedOutInterests: TimedOutInterests

Definition at line 61 of file ndn-forwarding-strategy.h.

Member Function Documentation

bool ns3::ndn::ForwardingStrategy::CanSendOutInterest ( Ptr< Face inFace,
Ptr< Face outFace,
Ptr< const Interest interest,
Ptr< pit::Entry pitEntry 
)
protectedvirtual

Method to check whether Interest can be send out on the particular face or not.

In the base class, this method perfoms two checks:

  1. If inFace is equal to outFace (when equal, Interest forwarding is prohibited)
  2. Whether Interest should be suppressed (list of outgoing faces include outFace), considering (if enabled) retransmission logic
Parameters
inFaceincoming face of the Interest
outFaceproposed outgoing face of the Interest
interestInterest packet
pitEntryreference to PIT entry (reference to corresponding FIB entry inside)
See also
DetectRetransmittedInterest

Reimplemented in ns3::ndn::fw::PerFibLimits< ::ns3::ndn::fw::PerOutFaceLimits< SmartFlooding > >, ns3::ndn::fw::PerFibLimits< ::ns3::ndn::fw::PerOutFaceLimits< BestRoute > >, ns3::ndn::fw::PerFibLimits< ::ns3::ndn::fw::PerOutFaceLimits< Flooding > >, ns3::ndn::fw::PerOutFaceLimits< SmartFlooding >, ns3::ndn::fw::PerOutFaceLimits< BestRoute >, and ns3::ndn::fw::PerOutFaceLimits< Flooding >.

Definition at line 493 of file ndn-forwarding-strategy.cc.

Referenced by TrySendOutInterest().

bool ns3::ndn::ForwardingStrategy::DetectRetransmittedInterest ( Ptr< Face inFace,
Ptr< const Interest interest,
Ptr< pit::Entry pitEntry 
)
protectedvirtual

Method that implements logic to distinguish between new and retransmitted interest.

This method is called only when DetectRetransmissions attribute is set true (by default).

Currently, the retransmission detection logic relies on the fact that list of incoming faces already has inFace (i.e., a similar interest is received on the same face more than once).

Parameters
inFaceincoming face
interestInterest header
pitEntryan existing PIT entry, corresponding to the duplicated Interest
Returns
true if Interest should be considered as retransmitted

Definition at line 338 of file ndn-forwarding-strategy.cc.

Referenced by PropagateInterest(), and ShouldSuppressIncomingInterest().

void ns3::ndn::ForwardingStrategy::DidAddFibEntry ( Ptr< fib::Entry fibEntry)
virtual
void ns3::ndn::ForwardingStrategy::DidCreatePitEntry ( Ptr< Face inFace,
Ptr< const Interest interest,
Ptr< pit::Entry pitEntry 
)
protectedvirtual

An event that is fired every time a new PIT entry is created.

Note that if NDN node is receiving a similar interest (interest for the same name), then either DidReceiveDuplicateInterest, DidSuppressSimilarInterest, or DidForwardSimilarInterest will be called

Suppression of similar Interests is controlled using ShouldSuppressIncomingInterest virtual method

Parameters
inFaceincoming face
headerdeserialized Interest header
pitEntrycreated PIT entry (incoming and outgoing face sets are empty)
See also
DidReceiveDuplicateInterest, DidSuppressSimilarInterest, DidForwardSimilarInterest, ShouldSuppressIncomingInterest

Definition at line 273 of file ndn-forwarding-strategy.cc.

Referenced by OnInterest().

void ns3::ndn::ForwardingStrategy::DidExhaustForwardingOptions ( Ptr< Face inFace,
Ptr< const Interest interest,
Ptr< pit::Entry pitEntry 
)
protectedvirtual

An even that is fired when Interest cannot be forwarded.

Note that the event will not fire if retransmission detection is enabled (by default) and retransmitted Interest cannot by forwarded. For more details, refer to the implementation.

Parameters
inFaceincoming face
interestInterest header
pitEntryan existing PIT entry, corresponding to the duplicated Interest
See also
DetectRetransmittedInterest

Reimplemented in ns3::ndn::fw::Nacks.

Definition at line 315 of file ndn-forwarding-strategy.cc.

References m_dropInterests, and m_pit.

Referenced by ns3::ndn::fw::Nacks::DidExhaustForwardingOptions(), and PropagateInterest().

void ns3::ndn::ForwardingStrategy::DidForwardSimilarInterest ( Ptr< Face inFace,
Ptr< const Interest interest,
Ptr< pit::Entry pitEntry 
)
protectedvirtual

An event that is fired every time when a similar Interest is received and further forwarded (not suppressed/collapsed)

This even is fired just before handling the Interest to PropagateInterest method

Parameters
inFaceincoming face
interestInterest packet
pitEntryan existing PIT entry, corresponding to the duplicated Interest
See also
DidReceiveDuplicateInterest, DidSuppressSimilarInterest, ShouldSuppressIncomingInterest

Definition at line 308 of file ndn-forwarding-strategy.cc.

Referenced by OnInterest().

void ns3::ndn::ForwardingStrategy::DidReceiveDuplicateInterest ( Ptr< Face inFace,
Ptr< const Interest interest,
Ptr< pit::Entry pitEntry 
)
protectedvirtual

An event that is fired every time a duplicated Interest is received.

This even is the last action that is performed before the Interest processing is halted

Parameters
inFaceincoming face
interestInterest packet
pitEntryan existing PIT entry, corresponding to the duplicated Interest
See also
DidReceiveDuplicateInterest, DidSuppressSimilarInterest, DidForwardSimilarInterest, ShouldSuppressIncomingInterest

Reimplemented in ns3::ndn::fw::Nacks.

Definition at line 287 of file ndn-forwarding-strategy.cc.

References m_dropInterests.

Referenced by ns3::ndn::fw::Nacks::DidReceiveDuplicateInterest(), and OnInterest().

void ns3::ndn::ForwardingStrategy::DidReceiveSolicitedData ( Ptr< Face inFace,
Ptr< const Data data,
bool  didCreateCacheEntry 
)
protectedvirtual

Event which is fired every time a requested (solicited) DATA packet (there is an active PIT entry) is received.

Parameters
inFaceincoming face
dataData packet
didCreateCacheEntryflag indicating whether a cache entry was added for this data packet or not (e.g., packet already exists in cache)

Definition at line 389 of file ndn-forwarding-strategy.cc.

Referenced by OnData().

void ns3::ndn::ForwardingStrategy::DidReceiveUnsolicitedData ( Ptr< Face inFace,
Ptr< const Data data,
bool  didCreateCacheEntry 
)
protectedvirtual

Event which is fired every time an unsolicited DATA packet (no active PIT entry) is received.

The current implementation allows ignoring unsolicited DATA (by default), or cache it by setting attribute CacheUnsolicitedData true

Parameters
inFaceincoming face
dataData packet
didCreateCacheEntryflag indicating whether a cache entry was added for this data packet or not (e.g., packet already exists in cache)

Definition at line 397 of file ndn-forwarding-strategy.cc.

Referenced by OnData().

void ns3::ndn::ForwardingStrategy::DidSendOutData ( Ptr< Face inFace,
Ptr< Face outFace,
Ptr< const Data data,
Ptr< pit::Entry pitEntry 
)
protectedvirtual

Event which is fired just after data was send out on the face.

Parameters
inFaceincoming face of the Data
outFaceoutgoing face
dataData packet
pitEntryan existing PIT entry, corresponding to the duplicated Interest

Definition at line 557 of file ndn-forwarding-strategy.cc.

References m_outData.

Referenced by SatisfyPendingInterest().

void ns3::ndn::ForwardingStrategy::DidSendOutInterest ( Ptr< Face inFace,
Ptr< Face outFace,
Ptr< const Interest interest,
Ptr< pit::Entry pitEntry 
)
protectedvirtual

Event fired just after forwarding the Interest.

Parameters
inFaceincoming face of the Interest
outFaceoutgoing face of the Interest
interestInterest packet
pitEntryreference to PIT entry (reference to corresponding FIB entry inside)

Definition at line 548 of file ndn-forwarding-strategy.cc.

References m_outInterests.

Referenced by TrySendOutInterest().

void ns3::ndn::ForwardingStrategy::DidSuppressSimilarInterest ( Ptr< Face inFace,
Ptr< const Interest interest,
Ptr< pit::Entry pitEntry 
)
protectedvirtual

An event that is fired every time when a similar Interest is received and suppressed (collapsed)

This even is the last action that is performed before the Interest processing is halted

Parameters
inFaceincoming face
interestInterest packet
pitEntryan existing PIT entry, corresponding to the duplicated Interest
See also
DidReceiveDuplicateInterest, DidForwardSimilarInterest, ShouldSuppressIncomingInterest

Definition at line 301 of file ndn-forwarding-strategy.cc.

Referenced by OnInterest().

virtual bool ns3::ndn::ForwardingStrategy::DoPropagateInterest ( Ptr< Face inFace,
Ptr< const Interest interest,
Ptr< pit::Entry pitEntry 
)
protectedpure virtual

Virtual method to perform Interest propagation according to the forwarding strategy logic.

In most cases, this is the call that needs to be implemented/re-implemented in order to perform forwarding of Interests according to the desired logic.

There is also PropagateInterest method (generally, do not require to be overriden) which performs general tasks (adding face to the list of incoming face, updating PIT entry lifetime, calling DoPropagateInterest, as well as perform retransmissions (enabled by default).

Parameters
inFaceincoming face
interestInterest packet
pitEntryreference to PIT entry (reference to corresponding FIB entry inside)
Returns
true if interest was successfully propagated, false if all options have failed
See also
PropagateInterest

Implemented in ns3::ndn::fw::Flooding, ns3::ndn::fw::BestRoute, ns3::ndn::fw::SmartFlooding, and ns3::ndn::fw::GreenYellowRed.

Referenced by PropagateInterest().

void ns3::ndn::ForwardingStrategy::FailedToCreatePitEntry ( Ptr< Face inFace,
Ptr< const Interest interest 
)
protectedvirtual

An event that is fired every time a new PIT entry cannot be created (e.g., PIT container imposes a limit)

Note that this call can be called only for non-similar Interest (i.e., there is an attempt to create a new PIT entry). For any non-similar Interests, either FailedToCreatePitEntry or DidCreatePitEntry is called.

Parameters
inFaceincoming face
interestInterest packet

Definition at line 280 of file ndn-forwarding-strategy.cc.

References m_dropInterests.

Referenced by OnInterest().

void ns3::ndn::ForwardingStrategy::OnData ( Ptr< Face face,
Ptr< Data data 
)
virtual

Actual processing of incoming Ndn content objects.

Processing Data packets

Parameters
faceincoming face
dataData packet

Definition at line 224 of file ndn-forwarding-strategy.cc.

References ns3::ndn::Face::APPLICATION, DidReceiveSolicitedData(), DidReceiveUnsolicitedData(), m_contentStore, m_dropData, m_inData, m_pit, SatisfyPendingInterest(), and WillSatisfyPendingInterest().

Referenced by ns3::ndn::L3Protocol::AddFace().

void ns3::ndn::ForwardingStrategy::OnInterest ( Ptr< Face face,
Ptr< Interest interest 
)
virtual
void ns3::ndn::ForwardingStrategy::PropagateInterest ( Ptr< Face inFace,
Ptr< const Interest interest,
Ptr< pit::Entry pitEntry 
)
protectedvirtual

Wrapper method, which performs general tasks and calls DoPropagateInterest method.

General tasks so far are adding face to the list of incoming face, updating PIT entry lifetime, calling DoPropagateInterest, and retransmissions (enabled by default).

Parameters
inFaceincoming face
interestInterest packet
pitEntryreference to PIT entry (reference to corresponding FIB entry inside)
See also
DoPropagateInterest
Todo:
Make lifetime per incoming interface

Definition at line 454 of file ndn-forwarding-strategy.cc.

References DetectRetransmittedInterest(), DidExhaustForwardingOptions(), and DoPropagateInterest().

Referenced by OnInterest().

void ns3::ndn::ForwardingStrategy::RemoveFace ( Ptr< Face face)
virtual

Event fired every time face is removed from NDN stack.

Parameters
faceface to be removed

For example, when an application terminates, AppFace is removed and this method called by NDN stack.

Definition at line 578 of file ndn-forwarding-strategy.cc.

void ns3::ndn::ForwardingStrategy::SatisfyPendingInterest ( Ptr< Face inFace,
Ptr< const Data data,
Ptr< pit::Entry pitEntry 
)
protectedvirtual

Actual procedure to satisfy Interest.

Note that when Interest is satisfied from the cache, incoming face will be 0

Parameters
inFaceincoming face
dataData packet
pitEntryan existing PIT entry, corresponding to the duplicated Interest

Definition at line 356 of file ndn-forwarding-strategy.cc.

References DidSendOutData(), m_dropData, ns3::ndn::pit::IncomingFace::m_face, and m_pit.

Referenced by OnData(), and OnInterest().

bool ns3::ndn::ForwardingStrategy::ShouldSuppressIncomingInterest ( Ptr< Face inFace,
Ptr< const Interest interest,
Ptr< pit::Entry pitEntry 
)
protectedvirtual

Method implementing logic to suppress (collapse) similar Interests.

In the base class implementation this method checks list of incoming/outgoing faces of the PIT entry (for new Intersets, both lists are empty before this call)

For more details, refer to the source code.

Parameters
inFaceincoming face
interestInterest packet
payloadData payload

Definition at line 420 of file ndn-forwarding-strategy.cc.

References DetectRetransmittedInterest().

Referenced by OnInterest().

bool ns3::ndn::ForwardingStrategy::TrySendOutInterest ( Ptr< Face inFace,
Ptr< Face outFace,
Ptr< const Interest interest,
Ptr< pit::Entry pitEntry 
)
protectedvirtual

Method implementing actual interest forwarding, taking into account CanSendOutInterest decision.

If event returns false, then there is some kind of a problem exists

Parameters
inFaceincoming face of the Interest
outFaceproposed outgoing face of the Interest
interestInterest packet
pitEntryreference to PIT entry (reference to corresponding FIB entry inside)
See also
CanSendOutInterest

Definition at line 523 of file ndn-forwarding-strategy.cc.

References CanSendOutInterest(), DidSendOutInterest(), and m_dropInterests.

Referenced by ns3::ndn::fw::GreenYellowRed::DoPropagateInterest(), ns3::ndn::fw::SmartFlooding::DoPropagateInterest(), ns3::ndn::fw::BestRoute::DoPropagateInterest(), and ns3::ndn::fw::Flooding::DoPropagateInterest().

void ns3::ndn::ForwardingStrategy::WillRemoveFibEntry ( Ptr< fib::Entry fibEntry)
virtual

Fired just before FIB entry will be removed from FIB.

Parameters
fibEntryFIB entry that will be removed

Definition at line 590 of file ndn-forwarding-strategy.cc.

void ns3::ndn::ForwardingStrategy::WillSatisfyPendingInterest ( Ptr< Face inFace,
Ptr< pit::Entry pitEntry 
)
protectedvirtual

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