NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: NDN, CCN, CCNx, content centric networks
API Documentation
nfd::DatagramFace< Protocol, Addressing > Class Template Reference

#include <datagram-face.hpp>

Inheritance diagram for nfd::DatagramFace< Protocol, Addressing >:
Collaboration diagram for nfd::DatagramFace< Protocol, Addressing >:

Public Types

typedef Protocol protocol
 

Public Member Functions

 DatagramFace (const FaceUri &remoteUri, const FaceUri &localUri, typename protocol::socket socket)
 Construct datagram face. More...
 
void sendInterest (const Interest &interest) 1
 send an Interest More...
 
void sendData (const Data &data) 1
 send a Data More...
 
void close () 1
 Close the face. More...
 
void receiveDatagram (const uint8_t *buffer, size_t nBytesReceived, const boost::system::error_code &error)
 
- Public Member Functions inherited from nfd::Face
 Face (const FaceUri &remoteUri, const FaceUri &localUri, bool isLocal=false, bool isMultiAccess=false)
 
virtual ~Face ()
 
FaceId getId () const
 
const std::string & getDescription () const
 Get the description. More...
 
void setDescription (const std::string &description)
 Set the face description. More...
 
void setMetric (uint64_t metric)
 
uint64_t getMetric () const
 
bool isLocal () const
 Get whether face is connected to a local app. More...
 
ndn::nfd::FacePersistency getPersistency () const
 Get the persistency setting. More...
 
bool isMultiAccess () const
 Get whether packets sent by this face may reach multiple peers. More...
 
virtual bool isUp () const
 Get whether underlying communication is up. More...
 
const FaceCountersgetCounters () const
 
const FaceUrigetRemoteUri () const
 
const FaceUrigetLocalUri () const
 
template<typename FaceTraits >
void copyStatusTo (FaceTraits &traits) const
 
virtual ndn::nfd::FaceStatus getFaceStatus () const
 

Protected Member Functions

void processErrorCode (const boost::system::error_code &error)
 
void handleSend (const boost::system::error_code &error, size_t nBytesSent, const Block &payload)
 
void handleReceive (const boost::system::error_code &error, size_t nBytesReceived)
 
void keepFaceAliveUntilAllHandlersExecuted (const shared_ptr< Face > &face)
 
void closeSocket ()
 
bool hasBeenUsedRecently () const
 
void resetRecentUsage ()
 Set m_hasBeenUsedRecently to false. More...
 
 NFD_LOG_INCLASS_DECLARE ()
 
- Protected Member Functions inherited from nfd::Face
void setPersistency (ndn::nfd::FacePersistency persistency)
 
bool decodeAndDispatchInput (const Block &element)
 
void fail (const std::string &reason)
 fail the face and raise onFail event if it's UP; otherwise do nothing More...
 
FaceCountersgetMutableCounters ()
 

Protected Attributes

protocol::socket m_socket
 

Additional Inherited Members

- Public Attributes inherited from nfd::Face
signal::Signal< Face, InterestonReceiveInterest
 fires when an Interest is received More...
 
signal::Signal< Face, DataonReceiveData
 fires when a Data is received More...
 
signal::Signal< Face, InterestonSendInterest
 fires when an Interest is sent out More...
 
signal::Signal< Face, DataonSendData
 fires when a Data is sent out More...
 
signal::Signal< Face, std::string > onFail
 fires when face disconnects or fails to perform properly More...
 

Detailed Description

template<class Protocol, class Addressing = Unicast>
class nfd::DatagramFace< Protocol, Addressing >

Definition at line 38 of file datagram-face.hpp.

Member Typedef Documentation

template<class Protocol, class Addressing = Unicast>
typedef Protocol nfd::DatagramFace< Protocol, Addressing >::protocol

Definition at line 41 of file datagram-face.hpp.

Constructor & Destructor Documentation

template<class Protocol, class Addressing = Unicast>
nfd::DatagramFace< T, U >::DatagramFace ( const FaceUri remoteUri,
const FaceUri localUri,
typename protocol::socket  socket 
)
inline

Construct datagram face.

Parameters
socketProtocol-specific socket for the created face

Definition at line 106 of file datagram-face.hpp.

References ndn::MAX_NDN_PACKET_SIZE, and NFD_LOG_FACE_INFO.

Member Function Documentation

template<class T , class U >
void nfd::DatagramFace< T, U >::sendInterest ( const Interest interest)
inlinevirtual

send an Interest

Implements nfd::Face.

Definition at line 121 of file datagram-face.hpp.

References emitSignal, NFD_LOG_FACE_TRACE, ndn::Block::size(), ndn::Block::wire(), and ndn::Interest::wireEncode().

template<class T , class U >
void nfd::DatagramFace< T, U >::sendData ( const Data data)
inlinevirtual

send a Data

Implements nfd::Face.

Definition at line 137 of file datagram-face.hpp.

References emitSignal, NFD_LOG_FACE_TRACE, ndn::Block::size(), ndn::Block::wire(), and ndn::Data::wireEncode().

template<class T , class U >
void nfd::DatagramFace< T, U >::close ( )
inlinevirtual

Close the face.

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

Implements nfd::Face.

Definition at line 153 of file datagram-face.hpp.

References NFD_LOG_FACE_INFO.

template<class T , class U >
void nfd::DatagramFace< T, U >::receiveDatagram ( const uint8_t *  buffer,
size_t  nBytesReceived,
const boost::system::error_code &  error 
)
inline
template<class T , class U >
void nfd::DatagramFace< T, U >::processErrorCode ( const boost::system::error_code &  error)
inlineprotected
template<class T , class U >
void nfd::DatagramFace< T, U >::handleSend ( const boost::system::error_code &  error,
size_t  nBytesSent,
const Block payload 
)
inlineprotected

Definition at line 194 of file datagram-face.hpp.

References NFD_LOG_FACE_TRACE.

template<class T , class U >
void nfd::DatagramFace< T, U >::handleReceive ( const boost::system::error_code &  error,
size_t  nBytesReceived 
)
inlineprotected

Definition at line 208 of file datagram-face.hpp.

References ndn::MAX_NDN_PACKET_SIZE.

template<class T , class U >
void nfd::DatagramFace< T, U >::keepFaceAliveUntilAllHandlersExecuted ( const shared_ptr< Face > &  face)
inlineprotected

Definition at line 261 of file datagram-face.hpp.

References NFD_LOG_FACE_TRACE.

template<class T , class U >
void nfd::DatagramFace< T, U >::closeSocket ( )
inlineprotected

Definition at line 268 of file datagram-face.hpp.

References nfd::getGlobalIoService(), and NFD_LOG_FACE_TRACE.

template<class T , class U >
bool nfd::DatagramFace< T, U >::hasBeenUsedRecently ( ) const
inlineprotected

Definition at line 286 of file datagram-face.hpp.

template<class T , class U >
void nfd::DatagramFace< T, U >::resetRecentUsage ( )
inlineprotected

Set m_hasBeenUsedRecently to false.

Definition at line 293 of file datagram-face.hpp.

template<class Protocol, class Addressing = Unicast>
nfd::DatagramFace< Protocol, Addressing >::NFD_LOG_INCLASS_DECLARE ( )
protected

Member Data Documentation

template<class Protocol, class Addressing = Unicast>
protocol::socket nfd::DatagramFace< Protocol, Addressing >::m_socket
protected

Definition at line 94 of file datagram-face.hpp.


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