NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: NDN, CCN, CCNx, content centric networks
API Documentation
ns3::ndn::App Class Reference

Base class that all NDN applications should be derived from. More...

#include <ndn-app.hpp>

Inheritance diagram for ns3::ndn::App:
Collaboration diagram for ns3::ndn::App:

Public Types

typedef void(* InterestTraceCallback) (shared_ptr< const Interest >, Ptr< App >, shared_ptr< Face >)
 
typedef void(* DataTraceCallback) (shared_ptr< const Data >, Ptr< App >, shared_ptr< Face >)
 

Public Member Functions

 App ()
 Default constructor. More...
 
virtual ~App ()
 
uint32_t GetId () const
 Get application ID (ID of applications face) More...
 
virtual void OnInterest (shared_ptr< const Interest > interest)
 Method that will be called every time new Interest arrives. More...
 
virtual void OnData (shared_ptr< const Data > data)
 Method that will be called every time new Data arrives. More...
 

Static Public Member Functions

static TypeId GetTypeId ()
 

Protected Member Functions

virtual void DoInitialize ()
 
virtual void DoDispose ()
 
virtual void StartApplication ()
 Called at time specified by Start. More...
 
virtual void StopApplication ()
 Called at time specified by Stop. More...
 

Protected Attributes

bool m_active
 Flag to indicate that application is active (set by StartApplication and StopApplication) More...
 
shared_ptr< AppFacem_face
 automatically created application face through which application communicates More...
 
uint32_t m_appId
 
TracedCallback< shared_ptr< const Interest >, Ptr< App >, shared_ptr< Face > > m_receivedInterests
 App-level trace of received Interests. More...
 
TracedCallback< shared_ptr< const Data >, Ptr< App >, shared_ptr< Face > > m_receivedDatas
 App-level trace of received Data. More...
 
TracedCallback< shared_ptr< const Interest >, Ptr< App >, shared_ptr< Face > > m_transmittedInterests
 App-level trace of transmitted Interests. More...
 
TracedCallback< shared_ptr< const Data >, Ptr< App >, shared_ptr< Face > > m_transmittedDatas
 App-level trace of transmitted Data. More...
 

Detailed Description

Base class that all NDN applications should be derived from.

The class implements virtual calls onInterest, onNack, and onData

Config Paths

ns3::ndn::App is accessible through the following paths with Config::Set and Config::Connect:

  • "/NodeList/[i]/ApplicationList/[i]/$ns3::ndn::App"

No Attributes are defined for this type.

Attributes defined in parent class ns3::Application

  • StartTime: Time at which the application will start
    • Set with class: ns3::TimeValue
    • Underlying type: Time –9223372036854775808.0ns:+9223372036854775807.0ns
    • Initial value: +0.0ns
    • Flags: construct write read
  • StopTime: Time at which the application will stop
    • Set with class: ns3::TimeValue
    • Underlying type: Time –9223372036854775808.0ns:+9223372036854775807.0ns
    • Initial value: +0.0ns
    • Flags: construct write read

TraceSources

Size of this type is 232 bytes (on a 64-bit architecture).

Definition at line 47 of file ndn-app.hpp.

Member Typedef Documentation

typedef void(* ns3::ndn::App::InterestTraceCallback) (shared_ptr< const Interest >, Ptr< App >, shared_ptr< Face >)

Definition at line 84 of file ndn-app.hpp.

typedef void(* ns3::ndn::App::DataTraceCallback) (shared_ptr< const Data >, Ptr< App >, shared_ptr< Face >)

Definition at line 85 of file ndn-app.hpp.

Constructor & Destructor Documentation

ns3::ndn::App::App ( )

Default constructor.

Definition at line 61 of file ndn-app.cpp.

ns3::ndn::App::~App ( )
virtual

Definition at line 68 of file ndn-app.cpp.

Member Function Documentation

TypeId ns3::ndn::App::GetTypeId ( void  )
static
uint32_t ns3::ndn::App::GetId ( ) const

Get application ID (ID of applications face)

Definition at line 99 of file ndn-app.cpp.

References m_appId.

Referenced by ns3::ndn::ConsumerBatches::ConsumerBatches(), and ns3::ndn::Producer::OnInterest().

void ns3::ndn::App::OnInterest ( shared_ptr< const Interest interest)
virtual

Method that will be called every time new Interest arrives.

Parameters
interestInterest header
packet"Payload" of the interests packet. The actual payload should be zero, but packet itself may be useful to get packet tags

Reimplemented in ns3::ndn::Producer.

Definition at line 105 of file ndn-app.cpp.

References m_face, and m_receivedInterests.

Referenced by ns3::ndn::Producer::OnInterest(), and ns3::ndn::AppFace::sendInterest().

void ns3::ndn::App::OnData ( shared_ptr< const Data data)
virtual

Method that will be called every time new Data arrives.

Parameters
contentObjectData header
payloadpayload (potentially virtual) of the Data packet (may include packet tags of original packet)

Reimplemented in ns3::ndn::Consumer, and ns3::ndn::ConsumerWindow.

Definition at line 112 of file ndn-app.cpp.

References m_face, and m_receivedDatas.

Referenced by ns3::ndn::Consumer::OnData(), and ns3::ndn::AppFace::sendData().

void ns3::ndn::App::DoInitialize ( )
protectedvirtual

Definition at line 73 of file ndn-app.cpp.

References m_appId.

void ns3::ndn::App::DoDispose ( void  )
protectedvirtual

Definition at line 88 of file ndn-app.cpp.

void ns3::ndn::App::StartApplication ( )
protectedvirtual

Called at time specified by Start.

Reimplemented in ns3::ndn::Consumer, and ns3::ndn::Producer.

Definition at line 120 of file ndn-app.cpp.

References m_active, and m_face.

Referenced by ns3::ndn::Producer::StartApplication(), and ns3::ndn::Consumer::StartApplication().

void ns3::ndn::App::StopApplication ( )
protectedvirtual

Called at time specified by Stop.

Reimplemented in ns3::ndn::Consumer, and ns3::ndn::Producer.

Definition at line 138 of file ndn-app.cpp.

References m_active, and m_face.

Referenced by ns3::ndn::Producer::StopApplication(), and ns3::ndn::Consumer::StopApplication().

Member Data Documentation

bool ns3::ndn::App::m_active
protected

Flag to indicate that application is active (set by StartApplication and StopApplication)

Definition at line 102 of file ndn-app.hpp.

Referenced by ns3::ndn::Consumer::OnData(), ns3::ndn::Producer::OnInterest(), ns3::ndn::ConsumerZipfMandelbrot::SendPacket(), ns3::ndn::Consumer::SendPacket(), StartApplication(), and StopApplication().

shared_ptr<AppFace> ns3::ndn::App::m_face
protected
uint32_t ns3::ndn::App::m_appId
protected

Definition at line 104 of file ndn-app.hpp.

Referenced by DoInitialize(), and GetId().

TracedCallback<shared_ptr<const Interest>, Ptr<App>, shared_ptr<Face> > ns3::ndn::App::m_receivedInterests
protected

App-level trace of received Interests.

Definition at line 107 of file ndn-app.hpp.

Referenced by GetTypeId(), and OnInterest().

TracedCallback<shared_ptr<const Data>, Ptr<App>, shared_ptr<Face> > ns3::ndn::App::m_receivedDatas
protected

App-level trace of received Data.

Definition at line 110 of file ndn-app.hpp.

Referenced by GetTypeId(), and OnData().

TracedCallback<shared_ptr<const Interest>, Ptr<App>, shared_ptr<Face> > ns3::ndn::App::m_transmittedInterests
protected

App-level trace of transmitted Interests.

Definition at line 113 of file ndn-app.hpp.

Referenced by GetTypeId(), ns3::ndn::ConsumerZipfMandelbrot::SendPacket(), and ns3::ndn::Consumer::SendPacket().

TracedCallback<shared_ptr<const Data>, Ptr<App>, shared_ptr<Face> > ns3::ndn::App::m_transmittedDatas
protected

App-level trace of transmitted Data.

Definition at line 116 of file ndn-app.hpp.

Referenced by GetTypeId(), and ns3::ndn::Producer::OnInterest().


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