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

represents a face More...

#include <face.hpp>

Inheritance diagram for nfd::Face:
Collaboration diagram for nfd::Face:

Classes

class  Error
 Face-related error. More...
 

Public Member Functions

 Face (const FaceUri &remoteUri, const FaceUri &localUri, bool isLocal=false)
 
virtual ~Face ()
 
virtual void sendInterest (const Interest &interest)=0
 send an Interest More...
 
virtual void sendData (const Data &data)=0
 send a Data More...
 
virtual void close ()=0
 Close the face. More...
 
FaceId getId () const
 
virtual void setDescription (const std::string &description)
 Set the description. More...
 
virtual const std::string & getDescription () const
 Get the description. More...
 
void setMetric (uint64_t metric)
 
uint64_t getMetric () const
 
bool isLocal () const
 Get whether face is connected to a local app. More...
 
virtual bool isMultiAccess () const
 Get whether packets sent this Face may reach multiple peers. More...
 
virtual bool isUp () const
 Get whether underlying communication is up. More...
 
bool isOnDemand () const
 Get whether face is created on demand or explicitly via FaceManagement protocol. More...
 
const FaceCountersgetCounters () const
 
const FaceUri & getRemoteUri () const
 
const FaceUri & getLocalUri () const
 
template<typename FaceTraits >
void copyStatusTo (FaceTraits &traits) const
 
virtual ndn::nfd::FaceStatus getFaceStatus () const
 

Public Attributes

EventEmitter< Interest > onReceiveInterest
 fires when an Interest is received More...
 
EventEmitter< Data > onReceiveData
 fires when a Data is received More...
 
EventEmitter< Interest > onSendInterest
 fires when an Interest is sent out More...
 
EventEmitter< Data > onSendData
 fires when a Data is sent out More...
 
EventEmitter< std::string > onFail
 fires when face disconnects or fails to perform properly More...
 

Protected Member Functions

bool decodeAndDispatchInput (const Block &element)
 
FaceCountersgetMutableCounters ()
 
void setOnDemand (bool isOnDemand)
 
void fail (const std::string &reason)
 fail the face and raise onFail event if it's UP; otherwise do nothing More...
 

Friends

class FaceTable
 

Detailed Description

represents a face

Definition at line 59 of file face.hpp.

Constructor & Destructor Documentation

nfd::Face::Face ( const FaceUri &  remoteUri,
const FaceUri &  localUri,
bool  isLocal = false 
)
nfd::Face::~Face ( )
virtual

Definition at line 46 of file face.cpp.

Member Function Documentation

virtual void nfd::Face::close ( )
pure virtual

Close the face.

This terminates all communication on the face and cause onFail() method event to be invoked

Implemented in ns3::ndn::AppFace, nfd::InternalFace, ns3::ndn::NetDeviceFace, and nfd::NullFace.

template<typename FaceTraits >
void nfd::Face::copyStatusTo ( FaceTraits &  traits) const
Returns
FaceTraits data structure filled with the current FaceTraits status

Definition at line 130 of file face.cpp.

References getId(), getLocalUri(), getRemoteUri(), isLocal(), and isOnDemand().

Referenced by getFaceStatus().

bool nfd::Face::decodeAndDispatchInput ( const Block &  element)
protected
Todo:
Ensure lazy field decoding process

Definition at line 88 of file face.cpp.

References onReceiveData, and onReceiveInterest.

void nfd::Face::fail ( const std::string &  reason)
protected

fail the face and raise onFail event if it's UP; otherwise do nothing

Definition at line 116 of file face.cpp.

References onFail.

Referenced by nfd::NullFace::close(), ns3::ndn::NetDeviceFace::close(), and ns3::ndn::AppFace::close().

const FaceCounters & nfd::Face::getCounters ( ) const
inline

Definition at line 222 of file face.hpp.

Referenced by getFaceStatus().

const std::string & nfd::Face::getDescription ( ) const
virtual

Get the description.

Definition at line 70 of file face.cpp.

ndn::nfd::FaceStatus nfd::Face::getFaceStatus ( ) const
virtual
Returns
FaceStatus data structure filled with the current Face status

Definition at line 158 of file face.cpp.

References copyStatusTo(), nfd::FaceCounters::copyTo(), and getCounters().

FaceId nfd::Face::getId ( ) const
const FaceUri & nfd::Face::getLocalUri ( ) const
inline
Returns
a FaceUri that represents the local endpoint (NFD side)

Definition at line 240 of file face.hpp.

Referenced by copyStatusTo(), and nfd::operator<<().

uint64_t nfd::Face::getMetric ( ) const
inline

Definition at line 264 of file face.hpp.

FaceCounters & nfd::Face::getMutableCounters ( )
inlineprotected

Definition at line 228 of file face.hpp.

const FaceUri & nfd::Face::getRemoteUri ( ) const
inline
Returns
a FaceUri that represents the remote endpoint

Definition at line 234 of file face.hpp.

Referenced by copyStatusTo().

bool nfd::Face::isLocal ( ) const
inline

Get whether face is connected to a local app.

Definition at line 216 of file face.hpp.

Referenced by copyStatusTo(), and nfd::pit::Entry::violatesScope().

bool nfd::Face::isMultiAccess ( ) const
virtual

Get whether packets sent this Face may reach multiple peers.

In this base class this property is always false.

Definition at line 76 of file face.cpp.

bool nfd::Face::isOnDemand ( ) const
inline

Get whether face is created on demand or explicitly via FaceManagement protocol.

Definition at line 252 of file face.hpp.

Referenced by copyStatusTo(), and setOnDemand().

bool nfd::Face::isUp ( ) const
virtual

Get whether underlying communication is up.

In this base class this property is always true.

Definition at line 82 of file face.cpp.

virtual void nfd::Face::sendData ( const Data &  data)
pure virtual

send a Data

Implemented in nfd::InternalFace, and nfd::NullFace.

virtual void nfd::Face::sendInterest ( const Interest &  interest)
pure virtual

send an Interest

Implemented in nfd::InternalFace, and nfd::NullFace.

void nfd::Face::setDescription ( const std::string &  description)
virtual

Set the description.

This is typically invoked by mgmt on set description command

Definition at line 64 of file face.cpp.

void nfd::Face::setMetric ( uint64_t  metric)
inline

Definition at line 258 of file face.hpp.

Referenced by ns3::ndn::NetDeviceFace::NetDeviceFace().

void nfd::Face::setOnDemand ( bool  isOnDemand)
inlineprotected

Definition at line 246 of file face.hpp.

References isOnDemand().

Friends And Related Function Documentation

friend class FaceTable
friend

Definition at line 212 of file face.hpp.

Member Data Documentation

EventEmitter<std::string> nfd::Face::onFail

fires when face disconnects or fails to perform properly

Definition at line 93 of file face.hpp.

Referenced by fail().

EventEmitter<Data> nfd::Face::onReceiveData

fires when a Data is received

Definition at line 84 of file face.hpp.

Referenced by nfd::LocalFace::decodeAndDispatchInput(), decodeAndDispatchInput(), Face(), and nfd::InternalFace::put().

EventEmitter<Interest> nfd::Face::onReceiveInterest

fires when an Interest is received

Definition at line 81 of file face.hpp.

Referenced by nfd::LocalFace::decodeAndDispatchInput(), decodeAndDispatchInput(), and Face().

EventEmitter<Data> nfd::Face::onSendData

fires when a Data is sent out

Definition at line 90 of file face.hpp.

Referenced by Face(), ns3::ndn::NetDeviceFace::sendData(), nfd::InternalFace::sendData(), and ns3::ndn::AppFace::sendData().

EventEmitter<Interest> nfd::Face::onSendInterest

fires when an Interest is sent out

Definition at line 87 of file face.hpp.

Referenced by Face(), ns3::ndn::NetDeviceFace::sendInterest(), ns3::ndn::AppFace::sendInterest(), and nfd::InternalFace::sendInterest().


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