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

represents the ContentStore More...

#include <cs.hpp>

Inheritance diagram for nfd::cs::Cs:
Collaboration diagram for nfd::cs::Cs:

Classes

struct  EntryFromEntryImpl
 

Public Types

typedef std::function< void(const Interest &, const Data &data)> HitCallback
 
typedef std::function< void(const Interest &)> MissCallback
 
typedef boost::transform_iterator< EntryFromEntryImpl, iterator, const Entry & > const_iterator
 ContentStore iterator (public API) More...
 

Public Member Functions

 Cs (size_t nMaxPackets=10, unique_ptr< Policy > policy=makeDefaultPolicy())
 
void insert (const Data &data, bool isUnsolicited=false)
 inserts a Data packet More...
 
void find (const Interest &interest, const HitCallback &hitCallback, const MissCallback &missCallback) const
 finds the best matching Data packet More...
 
void erase (const Name &exactName)
 
void setLimit (size_t nMaxPackets)
 changes capacity (in number of packets) More...
 
size_t getLimit () const
 
void setPolicy (unique_ptr< Policy > policy)
 changes cs replacement policy More...
 
PolicygetPolicy () const
 
size_t size () const
 
const_iterator begin () const
 
const_iterator end () const
 

Detailed Description

represents the ContentStore

Definition at line 65 of file cs.hpp.

Member Typedef Documentation

◆ HitCallback

typedef std::function<void(const Interest&, const Data& data)> nfd::cs::Cs::HitCallback

Definition at line 76 of file cs.hpp.

◆ MissCallback

typedef std::function<void(const Interest&)> nfd::cs::Cs::MissCallback

Definition at line 77 of file cs.hpp.

◆ const_iterator

typedef boost::transform_iterator<EntryFromEntryImpl, iterator, const Entry&> nfd::cs::Cs::const_iterator

ContentStore iterator (public API)

Definition at line 147 of file cs.hpp.

Constructor & Destructor Documentation

◆ Cs()

nfd::cs::Cs::Cs ( size_t  nMaxPackets = 10,
unique_ptr< Policy policy = makeDefaultPolicy() 
)
explicit

Definition at line 54 of file cs.cpp.

Member Function Documentation

◆ insert()

void nfd::cs::Cs::insert ( const Data data,
bool  isUnsolicited = false 
)

◆ find()

void nfd::cs::Cs::find ( const Interest interest,
const HitCallback hitCallback,
const MissCallback missCallback 
) const

finds the best matching Data packet

Parameters
interestthe Interest for lookup
hitCallbacka callback if a match is found; must not be empty
missCallbacka callback if there's no match; must not be empty
Note
A lookup invokes either callback exactly once. The callback may be invoked either before or after find() returns

Definition at line 123 of file cs.cpp.

References nfd::cs::Entry::canSatisfy(), nfd::find_last_if(), ndn::Interest::getChildSelector(), ndn::Interest::getName(), ndn::Name::getPrefix(), ndn::Name::getSuccessor(), NFD_LOG_DEBUG, NFD_LOG_TRACE, and ndn::Name::size().

Referenced by nfd::Forwarder::startProcessNack().

◆ erase()

void nfd::cs::Cs::erase ( const Name exactName)
inline

Definition at line 92 of file cs.hpp.

References getLimit(), setLimit(), and setPolicy().

◆ setLimit()

void nfd::cs::Cs::setLimit ( size_t  nMaxPackets)

changes capacity (in number of packets)

Definition at line 61 of file cs.cpp.

Referenced by nfd::TablesConfigSection::ensureConfigured(), and erase().

◆ getLimit()

size_t nfd::cs::Cs::getLimit ( ) const
Returns
capacity (in number of packets)

Definition at line 67 of file cs.cpp.

Referenced by erase().

◆ setPolicy()

void nfd::cs::Cs::setPolicy ( unique_ptr< Policy policy)

changes cs replacement policy

Precondition
size() == 0

Definition at line 73 of file cs.cpp.

Referenced by erase().

◆ getPolicy()

Policy* nfd::cs::Cs::getPolicy ( ) const
inline
Returns
cs replacement policy

Definition at line 116 of file cs.hpp.

◆ size()

size_t nfd::cs::Cs::size ( ) const
inline
Returns
number of stored packets

Definition at line 124 of file cs.hpp.

References PUBLIC_WITH_TESTS_ELSE_PRIVATE.

Referenced by nfd::ForwarderStatusManager::ForwarderStatusManager().

◆ begin()

const_iterator nfd::cs::Cs::begin ( ) const
inline

Definition at line 150 of file cs.hpp.

◆ end()

const_iterator nfd::cs::Cs::end ( ) const
inline

Definition at line 156 of file cs.hpp.


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