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

NDN application for sending out Interest packets. More...

#include <ndn-consumer.hpp>

Inheritance diagram for ns3::ndn::Consumer:
Collaboration diagram for ns3::ndn::Consumer:

Public Types

typedef void(* LastRetransmittedInterestDataDelayCallback) (Ptr< App > app, uint32_t seqno, Time delay, int32_t hopCount)
 
typedef void(* FirstInterestDataDelayCallback) (Ptr< App > app, uint32_t seqno, Time delay, uint32_t retxCount, int32_t hopCount)
 
- Public Types inherited from ns3::ndn::App
typedef void(* InterestTraceCallback) (shared_ptr< const Interest >, Ptr< App >, shared_ptr< Face >)
 
typedef void(* DataTraceCallback) (shared_ptr< const Data >, Ptr< App >, shared_ptr< Face >)
 
typedef void(* NackTraceCallback) (shared_ptr< const lp::Nack >, Ptr< App >, shared_ptr< Face >)
 

Public Member Functions

 Consumer ()
 Default constructor Sets up randomizer function and packet sequence number. More...
 
virtual ~Consumer ()
 
virtual void OnData (shared_ptr< const Data > contentObject)
 Method that will be called every time new Data arrives. More...
 
virtual void OnNack (shared_ptr< const lp::Nack > nack)
 Method that will be called every time new Nack arrives. More...
 
virtual void OnTimeout (uint32_t sequenceNumber)
 Timeout event. More...
 
void SendPacket ()
 Actually send packet. More...
 
virtual void WillSendOutInterest (uint32_t sequenceNumber)
 An event that is fired just before an Interest packet is actually send out (send is inevitable) More...
 
- Public Member Functions inherited from ns3::ndn::App
 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...
 

Static Public Member Functions

static TypeId GetTypeId ()
 
- Static Public Member Functions inherited from ns3::ndn::App
static TypeId GetTypeId ()
 

Protected Member Functions

virtual void StartApplication ()
 Called at time specified by Start. More...
 
virtual void StopApplication ()
 Called at time specified by Stop. More...
 
virtual void ScheduleNextPacket ()=0
 Constructs the Interest packet and sends it using a callback to the underlying NDN protocol. More...
 
void CheckRetxTimeout ()
 Checks if the packet need to be retransmitted becuase of retransmission timer expiration. More...
 
void SetRetxTimer (Time retxTimer)
 Modifies the frequency of checking the retransmission timeouts. More...
 
Time GetRetxTimer () const
 Returns the frequency of checking the retransmission timeouts. More...
 
- Protected Member Functions inherited from ns3::ndn::App
virtual void DoInitialize ()
 
virtual void DoDispose ()
 

Protected Attributes

Ptr< UniformRandomVariable > m_rand
 nonce generator More...
 
uint32_t m_seq
 currently requested sequence number More...
 
uint32_t m_seqMax
 maximum number of sequence number More...
 
EventId m_sendEvent
 EventId of pending "send packet" event. More...
 
Time m_retxTimer
 Currently estimated retransmission timer. More...
 
EventId m_retxEvent
 Event to check whether or not retransmission should be performed. More...
 
Ptr< RttEstimatorm_rtt
 RTT estimator. More...
 
Time m_offTime
 Time interval between packets. More...
 
Name m_interestName
 NDN Name of the Interest (use Name) More...
 
Time m_interestLifeTime
 LifeTime for interest packet. More...
 
- Protected Attributes inherited from ns3::ndn::App
bool m_active
 Flag to indicate that application is active (set by StartApplication and StopApplication) More...
 
shared_ptr< Facem_face
 
AppLinkServicem_appLink
 
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 lp::Nack >, Ptr< App >, shared_ptr< Face > > m_receivedNacks
 App-level trace of received Nacks. 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...
 
TracedCallback< shared_ptr< const lp::Nack >, Ptr< App >, shared_ptr< Face > > m_transmittedNacks
 App-level trace of transmitted Nacks. More...
 

Detailed Description

NDN application for sending out Interest packets.

Config Paths

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

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

Attributes

  • StartSeq: Initial sequence number
    • Set with class: ns3::IntegerValue
    • Underlying type: int32_t -2147483648:2147483647
    • Initial value: 0
    • Flags: construct write read
  • Prefix: Name of the Interest
    • Set with class: NameValue
    • Underlying type: Name
    • Initial value: /
    • Flags: construct write read
  • LifeTime: LifeTime for interest packet
    • Set with class: ns3::TimeValue
    • Underlying type: Time –9223372036854775808.0ns:+9223372036854775807.0ns
    • Initial value: 2s
    • Flags: construct write read
  • RetxTimer: Timeout defining how frequent retransmission timeouts should be checked
    • Set with class: ns3::TimeValue
    • Underlying type: Time –9223372036854775808.0ns:+9223372036854775807.0ns
    • Initial value: 50ms
    • Flags: construct write read

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

TraceSources defined in parent class ns3::ndn::App

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

Definition at line 49 of file ndn-consumer.hpp.

Member Typedef Documentation

◆ LastRetransmittedInterestDataDelayCallback

typedef void(* ns3::ndn::Consumer::LastRetransmittedInterestDataDelayCallback) (Ptr< App > app, uint32_t seqno, Time delay, int32_t hopCount)

Definition at line 96 of file ndn-consumer.hpp.

◆ FirstInterestDataDelayCallback

typedef void(* ns3::ndn::Consumer::FirstInterestDataDelayCallback) (Ptr< App > app, uint32_t seqno, Time delay, uint32_t retxCount, int32_t hopCount)

Definition at line 97 of file ndn-consumer.hpp.

Constructor & Destructor Documentation

◆ Consumer()

ns3::ndn::Consumer::Consumer ( )

Default constructor Sets up randomizer function and packet sequence number.

Definition at line 81 of file ndn-consumer.cpp.

References m_rtt.

◆ ~Consumer()

virtual ns3::ndn::Consumer::~Consumer ( )
inlinevirtual

Definition at line 59 of file ndn-consumer.hpp.

Member Function Documentation

◆ GetTypeId()

TypeId ns3::ndn::Consumer::GetTypeId ( )
static

◆ OnData()

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

Method that will be called every time new Data arrives.

Reimplemented from ns3::ndn::App.

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

Definition at line 213 of file ndn-consumer.cpp.

References ns3::ndn::App::m_active, m_rtt, and ns3::ndn::App::OnData().

Referenced by ns3::ndn::ConsumerWindow::OnData(), and ns3::ndn::ConsumerPcon::OnData().

◆ OnNack()

void ns3::ndn::Consumer::OnNack ( shared_ptr< const lp::Nack nack)
virtual

Method that will be called every time new Nack arrives.

Reimplemented from ns3::ndn::App.

Definition at line 256 of file ndn-consumer.cpp.

References ndn::lp::Nack::getInterest(), ndn::Interest::getName(), ndn::lp::Nack::getReason(), and ns3::ndn::App::OnNack().

◆ OnTimeout()

void ns3::ndn::Consumer::OnTimeout ( uint32_t  sequenceNumber)
virtual

Timeout event.

Parameters
sequenceNumbertime outed sequence number

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

Definition at line 266 of file ndn-consumer.cpp.

References m_rtt, and ScheduleNextPacket().

Referenced by CheckRetxTimeout(), ns3::ndn::ConsumerWindow::OnTimeout(), and ns3::ndn::ConsumerPcon::OnTimeout().

◆ SendPacket()

◆ WillSendOutInterest()

void ns3::ndn::Consumer::WillSendOutInterest ( uint32_t  sequenceNumber)
virtual

An event that is fired just before an Interest packet is actually send out (send is inevitable)

The reason for "before" even is that in certain cases (when it is possible to satisfy from the local cache), the send call will immediately return data, and if "after" even was used, this after would be called after all processing of incoming data, potentially producing unexpected results.

Reimplemented in ns3::ndn::ConsumerWindow.

Definition at line 280 of file ndn-consumer.cpp.

References m_rtt.

Referenced by SendPacket(), and ns3::ndn::ConsumerWindow::WillSendOutInterest().

◆ StartApplication()

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

Called at time specified by Start.

Reimplemented from ns3::ndn::App.

Definition at line 136 of file ndn-consumer.cpp.

References ScheduleNextPacket(), and ns3::ndn::App::StartApplication().

◆ StopApplication()

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

Called at time specified by Stop.

Reimplemented from ns3::ndn::App.

Definition at line 147 of file ndn-consumer.cpp.

References m_sendEvent, and ns3::ndn::App::StopApplication().

◆ ScheduleNextPacket()

virtual void ns3::ndn::Consumer::ScheduleNextPacket ( )
protectedpure virtual

Constructs the Interest packet and sends it using a callback to the underlying NDN protocol.

Implemented in ns3::ndn::ConsumerZipfMandelbrot, ns3::ndn::ConsumerWindow, ns3::ndn::ConsumerBatches, and ns3::ndn::ConsumerCbr.

Referenced by OnTimeout(), SendPacket(), and StartApplication().

◆ CheckRetxTimeout()

void ns3::ndn::Consumer::CheckRetxTimeout ( )
protected

Checks if the packet need to be retransmitted becuase of retransmission timer expiration.

Definition at line 111 of file ndn-consumer.cpp.

References m_retxEvent, m_retxTimer, m_rtt, and OnTimeout().

Referenced by SetRetxTimer().

◆ SetRetxTimer()

void ns3::ndn::Consumer::SetRetxTimer ( Time  retxTimer)
protected

Modifies the frequency of checking the retransmission timeouts.

Parameters
retxTimerTimeout defining how frequent retransmission timeouts should be checked

Definition at line 92 of file ndn-consumer.cpp.

References CheckRetxTimeout(), m_retxEvent, and m_retxTimer.

Referenced by GetTypeId().

◆ GetRetxTimer()

Time ns3::ndn::Consumer::GetRetxTimer ( ) const
protected

Returns the frequency of checking the retransmission timeouts.

Returns
Timeout defining how frequent retransmission timeouts should be checked

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

References m_retxTimer.

Referenced by GetTypeId().

Member Data Documentation

◆ m_rand

Ptr<UniformRandomVariable> ns3::ndn::Consumer::m_rand
protected

nonce generator

Definition at line 135 of file ndn-consumer.hpp.

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

◆ m_seq

uint32_t ns3::ndn::Consumer::m_seq
protected

currently requested sequence number

Definition at line 137 of file ndn-consumer.hpp.

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

◆ m_seqMax

uint32_t ns3::ndn::Consumer::m_seqMax
protected

◆ m_sendEvent

◆ m_retxTimer

Time ns3::ndn::Consumer::m_retxTimer
protected

Currently estimated retransmission timer.

Definition at line 140 of file ndn-consumer.hpp.

Referenced by CheckRetxTimeout(), GetRetxTimer(), and SetRetxTimer().

◆ m_retxEvent

EventId ns3::ndn::Consumer::m_retxEvent
protected

Event to check whether or not retransmission should be performed.

Definition at line 141 of file ndn-consumer.hpp.

Referenced by CheckRetxTimeout(), and SetRetxTimer().

◆ m_rtt

◆ m_offTime

Time ns3::ndn::Consumer::m_offTime
protected

Time interval between packets.

Definition at line 145 of file ndn-consumer.hpp.

◆ m_interestName

Name ns3::ndn::Consumer::m_interestName
protected

NDN Name of the Interest (use Name)

Definition at line 146 of file ndn-consumer.hpp.

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

◆ m_interestLifeTime

Time ns3::ndn::Consumer::m_interestLifeTime
protected

LifeTime for interest packet.

Definition at line 147 of file ndn-consumer.hpp.

Referenced by GetTypeId(), and SendPacket().


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