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::Face Class Reference

Virtual class defining NDN face. More...

#include <ndn-face.h>

Inheritance diagram for ns3::ndn::Face:
Collaboration diagram for ns3::ndn::Face:

Public Types

enum  Flags { APPLICATION = 1 }
 List of currently defined face flags. More...
 
typedef Callback< void, Ptr
< Face >, Ptr< Interest > > 
InterestHandler
 NDN protocol handlers. More...
 
typedef Callback< void, Ptr
< Face >, Ptr< Data > > 
DataHandler
 

Public Member Functions

 Face (Ptr< Node > node)
 Default constructor. More...
 
Ptr< Node > GetNode () const
 Get node to which this face is associated.
 
virtual void RegisterProtocolHandlers (const InterestHandler &interestHandler, const DataHandler &dataHandler)
 Register callback to call when new packet arrives on the face. More...
 
virtual void UnRegisterProtocolHandlers ()
 Un-Register callback to call when new packet arrives on the face. More...
 
virtual bool SendInterest (Ptr< const Interest > interest)
 Send out interest through the face. More...
 
virtual bool SendData (Ptr< const Data > data)
 Send out Dat packet through the face. More...
 
virtual bool ReceiveInterest (Ptr< Interest > interest)
 Receive interest from application or another node and forward it up to the NDN stack. More...
 
virtual bool ReceiveData (Ptr< Data > data)
 Receive Data packet from application or another node and forward it up to the NDN stack. More...
 
virtual void SetMetric (uint16_t metric)
 Assign routing/forwarding metric with face. More...
 
virtual uint16_t GetMetric (void) const
 Get routing/forwarding metric assigned to the face. More...
 
void SetUp (bool up=true)
 These are face states and may be distinct from actual lower-layer device states, such as found in real implementations (where the device may be down but ndn face state is still up). More...
 
bool IsUp () const
 Returns true if this face is enabled, false otherwise.
 
uint32_t GetFlags () const
 Get face flags. More...
 
virtual std::ostream & Print (std::ostream &os) const
 Print information about the face into the stream. More...
 
void SetId (uint32_t id)
 Set face Id. More...
 
uint32_t GetId () const
 Get face Id. More...
 
bool operator== (const Face &face) const
 Compare two faces. More...
 
bool operator!= (const Face &face) const
 Compare two faces. More...
 
bool operator< (const Face &face) const
 Compare two faces. More...
 

Static Public Member Functions

static TypeId GetTypeId ()
 

Protected Member Functions

virtual bool Send (Ptr< Packet > packet)
 Send packet down to the stack (towards app or network)
 
virtual bool Receive (Ptr< const Packet > p)
 Send packet up to the stack (towards forwarding strategy)
 
void SetFlags (uint32_t flags)
 Set face flags.
 

Protected Attributes

Ptr< Node > m_node
 Smart pointer to Node.
 

Detailed Description

Virtual class defining NDN face.

This class defines basic functionality of NDN face. Face is core component responsible for actual delivery of data packet to and from NDN stack

See also
ndn::AppFace, ndn::NetDeviceFace

Doxygen introspection did not find any typical Config paths.

Attributes

  • Id: Face id (unique integer for the Ndn stack on this node)
    • Set with class: ns3::UintegerValue
    • Underlying type: uint32_t 0:4294967295
    • Flags: read

No TraceSources are defined for this type.

Definition at line 58 of file ndn-face.h.

Member Typedef Documentation

typedef Callback<void, Ptr<Face>, Ptr<Interest> > ns3::ndn::Face::InterestHandler

NDN protocol handlers.

Parameters
faceFace from which packet has been received
packetOriginal packet

Definition at line 71 of file ndn-face.h.

Member Enumeration Documentation

List of currently defined face flags.

Enumerator
APPLICATION 

An application face.

Definition at line 189 of file ndn-face.h.

Constructor & Destructor Documentation

ns3::ndn::Face::Face ( Ptr< Node >  node)

Default constructor.

By default, Ndn face are created in the "down" state with no IP addresses.

Before becoming useable, the user must invoke SetUp on them once an Ndn address and mask have been set.

Definition at line 69 of file ndn-face.cc.

Member Function Documentation

uint32_t ns3::ndn::Face::GetFlags ( ) const
inline

Get face flags.

Face flags may indicate various properties of the face. For example, if the face is an application face, than the returned flags have Face::APPLICATION bit set.

See also
ndn::Face::Flags for the list of currently defined face flags

Definition at line 296 of file ndn-face.h.

uint32_t ns3::ndn::Face::GetId ( ) const
inline

Get face Id.

Id is purely informative and should not be used for any other purpose

Returns
id id to set

Definition at line 314 of file ndn-face.h.

Referenced by ns3::ndn::UdpFace::Print(), ns3::ndn::AppFace::Print(), ns3::ndn::NetDeviceFace::Print(), ns3::ndn::TcpFace::Print(), ns3::ndn::ApiFace::Print(), Print(), and ns3::ndn::ApiFace::SetInterestFilter().

uint16_t ns3::ndn::Face::GetMetric ( void  ) const
virtual

Get routing/forwarding metric assigned to the face.

Returns
configured routing/forwarding metric (cost) of this face

Definition at line 237 of file ndn-face.cc.

bool ns3::ndn::Face::operator!= ( const Face face) const
inline

Compare two faces.

Only two faces on the same node could be compared.

Internal index is used for comparison.

Definition at line 320 of file ndn-face.h.

bool ns3::ndn::Face::operator< ( const Face face) const

Compare two faces.

Only two faces on the same node could be compared.

Internal index is used for comparison.

Definition at line 258 of file ndn-face.cc.

References m_node.

bool ns3::ndn::Face::operator== ( const Face face) const

Compare two faces.

Only two faces on the same node could be compared.

Internal index is used for comparison.

Definition at line 249 of file ndn-face.cc.

References m_node.

std::ostream & ns3::ndn::Face::Print ( std::ostream &  os) const
virtual

Print information about the face into the stream.

Parameters
osstream to write information to

Reimplemented in ns3::ndn::ApiFace, ns3::ndn::TcpFace, ns3::ndn::NetDeviceFace, ns3::ndn::AppFace, and ns3::ndn::UdpFace.

Definition at line 267 of file ndn-face.cc.

References GetId().

bool ns3::ndn::Face::ReceiveData ( Ptr< Data data)
virtual

Receive Data packet from application or another node and forward it up to the NDN stack.

By default it is called from inside Receive method, but can be used directly, if appropriate

Definition at line 217 of file ndn-face.cc.

References IsUp().

Referenced by ns3::ndn::ApiFace::Put(), and Receive().

bool ns3::ndn::Face::ReceiveInterest ( Ptr< Interest interest)
virtual

Receive interest from application or another node and forward it up to the NDN stack.

By default it is called from inside Receive method, but can be used directly, if appropriate

Definition at line 204 of file ndn-face.cc.

References IsUp().

Referenced by ns3::ndn::ApiFace::ExpressInterest(), and Receive().

void ns3::ndn::Face::RegisterProtocolHandlers ( const InterestHandler interestHandler,
const DataHandler &  dataHandler 
)
virtual

Register callback to call when new packet arrives on the face.

This method should call protocol-dependent registration function

Reimplemented in ns3::ndn::TcpFace, and ns3::ndn::NetDeviceFace.

Definition at line 104 of file ndn-face.cc.

Referenced by ns3::ndn::NetDeviceFace::RegisterProtocolHandlers(), and ns3::ndn::TcpFace::RegisterProtocolHandlers().

bool ns3::ndn::Face::SendData ( Ptr< const Data data)
virtual

Send out Dat packet through the face.

Parameters
dataData packet to send out
packetData packet payload, can also carry packet tags
Returns
true if Data packet is considered to be send out (enqueued)

Reimplemented in ns3::ndn::ApiFace, and ns3::ndn::AppFace.

Definition at line 136 of file ndn-face.cc.

References IsUp(), and Send().

bool ns3::ndn::Face::SendInterest ( Ptr< const Interest interest)
virtual

Send out interest through the face.

Parameters
interestInterest to send out
packet"payload" that is attached to the interest (can carry some packet tags)
Returns
true if interest is considered to be send out (enqueued)

Reimplemented in ns3::ndn::ApiFace, and ns3::ndn::AppFace.

Definition at line 123 of file ndn-face.cc.

References IsUp(), and Send().

void ns3::ndn::Face::SetId ( uint32_t  id)
inline

Set face Id.

Id is purely informative and should not be used for any other purpose

Parameters
idid to set

Definition at line 308 of file ndn-face.h.

void ns3::ndn::Face::SetMetric ( uint16_t  metric)
virtual

Assign routing/forwarding metric with face.

Parameters
metricconfigured routing metric (cost) of this face

Definition at line 230 of file ndn-face.cc.

Referenced by ns3::ndn::NetDeviceFace::NetDeviceFace(), ns3::ndn::TcpFace::TcpFace(), and ns3::ndn::UdpFace::UdpFace().

void ns3::ndn::Face::SetUp ( bool  up = true)
inline

These are face states and may be distinct from actual lower-layer device states, such as found in real implementations (where the device may be down but ndn face state is still up).

Enable or disable this face

Definition at line 290 of file ndn-face.h.

Referenced by ns3::ndn::ApiFace::ApiFace(), and ns3::ndn::ApiFace::Shutdown().

void ns3::ndn::Face::UnRegisterProtocolHandlers ( )
virtual

Un-Register callback to call when new packet arrives on the face.

This method should call protocol-dependent registration function

Reimplemented in ns3::ndn::TcpFace, and ns3::ndn::NetDeviceFace.

Definition at line 113 of file ndn-face.cc.

Referenced by ns3::ndn::NetDeviceFace::UnRegisterProtocolHandlers(), and ns3::ndn::TcpFace::UnRegisterProtocolHandlers().


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