NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: 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)
 
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...
 
size_t size () const
 get number of stored packets More...
 
size_t getLimit () const
 get capacity (in number of packets) More...
 
void setLimit (size_t nMaxPackets)
 change capacity (in number of packets) More...
 
PolicygetPolicy () const
 get replacement policy More...
 
void setPolicy (unique_ptr< Policy > policy)
 change replacement policy More...
 
bool shouldAdmit () const
 get CS_ENABLE_ADMIT flag More...
 
void enableAdmit (bool shouldAdmit)
 set CS_ENABLE_ADMIT flag More...
 
bool shouldServe () const
 get CS_ENABLE_SERVE flag More...
 
void enableServe (bool shouldServe)
 set CS_ENABLE_SERVE flag More...
 
const_iterator begin () const
 
const_iterator end () const
 

Detailed Description

represents the ContentStore

Definition at line 62 of file cs.hpp.

Member Typedef Documentation

◆ HitCallback

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

Definition at line 73 of file cs.hpp.

◆ MissCallback

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

Definition at line 74 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 171 of file cs.hpp.

Constructor & Destructor Documentation

◆ Cs()

nfd::cs::Cs::Cs ( size_t  nMaxPackets = 10)
explicit

Definition at line 46 of file cs.cpp.

References nfd::cs::makeDefaultPolicy().

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 92 of file cs.cpp.

References ndn::Interest::getChildSelector(), ndn::Interest::getName(), ndn::Name::getSuccessor(), NFD_LOG_DEBUG, and ndn::Name::size().

◆ size()

size_t nfd::cs::Cs::size ( ) const
inline

get number of stored packets

Definition at line 91 of file cs.hpp.

◆ getLimit()

size_t nfd::cs::Cs::getLimit ( ) const
inline

get capacity (in number of packets)

Definition at line 100 of file cs.hpp.

◆ setLimit()

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

change capacity (in number of packets)

Definition at line 108 of file cs.hpp.

Referenced by nfd::TablesConfigSection::ensureConfigured().

◆ getPolicy()

Policy* nfd::cs::Cs::getPolicy ( ) const
inline

get replacement policy

Definition at line 116 of file cs.hpp.

◆ setPolicy()

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

change replacement policy

Precondition
size() == 0

Definition at line 185 of file cs.cpp.

◆ shouldAdmit()

bool nfd::cs::Cs::shouldAdmit ( ) const
inline

get CS_ENABLE_ADMIT flag

See also
https://redmine.named-data.net/projects/nfd/wiki/CsMgmt#Update-config

Definition at line 131 of file cs.hpp.

Referenced by enableAdmit().

◆ enableAdmit()

void nfd::cs::Cs::enableAdmit ( bool  shouldAdmit)

set CS_ENABLE_ADMIT flag

See also
https://redmine.named-data.net/projects/nfd/wiki/CsMgmt#Update-config

Definition at line 208 of file cs.cpp.

References NFD_LOG_INFO, and shouldAdmit().

◆ shouldServe()

bool nfd::cs::Cs::shouldServe ( ) const
inline

get CS_ENABLE_SERVE flag

See also
https://redmine.named-data.net/projects/nfd/wiki/CsMgmt#Update-config

Definition at line 146 of file cs.hpp.

Referenced by enableServe().

◆ enableServe()

void nfd::cs::Cs::enableServe ( bool  shouldServe)

set CS_ENABLE_SERVE flag

See also
https://redmine.named-data.net/projects/nfd/wiki/CsMgmt#Update-config

Definition at line 218 of file cs.cpp.

References NFD_LOG_INFO, and shouldServe().

◆ begin()

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

Definition at line 174 of file cs.hpp.

◆ end()

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

Definition at line 180 of file cs.hpp.


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