ns3::OnOffApplication Class Reference
[OnOffApplication]

Generate traffic to a single destination according to an OnOff pattern. More...

#include <onoff-application.h>

Inheritance diagram for ns3::OnOffApplication:
Inheritance graph
[legend]
Collaboration diagram for ns3::OnOffApplication:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 OnOffApplication ()
virtual ~OnOffApplication ()
void SetMaxBytes (uint32_t maxBytes)

Static Public Member Functions

static TypeId GetTypeId (void)
 This method returns the TypeId associated to ns3::OnOffApplication.

Protected Member Functions

virtual void DoDispose (void)

Private Member Functions

virtual void StartApplication (void)
 Application specific startup code.
virtual void StopApplication (void)
 Application specific shutdown code.
void CancelEvents ()
void Construct (Ptr< Node > n, const Address &remote, std::string tid, const RandomVariable &ontime, const RandomVariable &offtime, uint32_t size)
void StartSending ()
void StopSending ()
void SendPacket ()
void ScheduleNextTx ()
void ScheduleStartEvent ()
void ScheduleStopEvent ()
void ConnectionSucceeded (Ptr< Socket >)
void ConnectionFailed (Ptr< Socket >)
void Ignore (Ptr< Socket >)

Private Attributes

Ptr< Socketm_socket
Address m_peer
bool m_connected
RandomVariable m_onTime
RandomVariable m_offTime
DataRate m_cbrRate
uint32_t m_pktSize
RandomVariable m_jitter
uint32_t m_residualBits
Time m_lastStartTime
uint32_t m_maxBytes
uint32_t m_totBytes
EventId m_startStopEvent
EventId m_sendEvent
bool m_sending
TypeId m_tid
TracedCallback< Ptr< const
Packet > > 
m_txTrace

Detailed Description

Generate traffic to a single destination according to an OnOff pattern.

This traffic generator follows an On/Off pattern: after Application::StartApplication is called, "On" and "Off" states alternate. The duration of each of these states is determined with the onTime and the offTime random variables. During the "Off" state, no traffic is generated. During the "On" state, cbr traffic is generated. This cbr traffic is characterized by the specified "data rate" and "packet size".

Definition at line 68 of file onoff-application.h.


Constructor & Destructor Documentation

ns3::OnOffApplication::OnOffApplication (  ) 
ns3::OnOffApplication::~OnOffApplication (  )  [virtual]

Definition at line 106 of file onoff-application.cc.

References NS_LOG_FUNCTION_NOARGS.


Member Function Documentation

void ns3::OnOffApplication::CancelEvents (  )  [private]
void ns3::OnOffApplication::ConnectionFailed ( Ptr< Socket  )  [private]

Definition at line 262 of file onoff-application.cc.

References NS_LOG_FUNCTION_NOARGS.

void ns3::OnOffApplication::ConnectionSucceeded ( Ptr< Socket  )  [private]

Definition at line 254 of file onoff-application.cc.

References m_connected, NS_LOG_FUNCTION_NOARGS, and ScheduleStartEvent().

void ns3::OnOffApplication::Construct ( Ptr< Node n,
const Address remote,
std::string  tid,
const RandomVariable ontime,
const RandomVariable offtime,
uint32_t  size 
) [private]
void ns3::OnOffApplication::DoDispose ( void   )  [protected, virtual]

This method is called by Object::Dispose or by the object's destructor, whichever comes first.

Subclasses are expected to implement their real destruction code in an overriden version of this method and chain up to their parent's implementation once they are done. i.e., for simplicity, the destructor of every subclass should be empty and its content should be moved to the associated DoDispose method.

Reimplemented from ns3::Application.

Definition at line 120 of file onoff-application.cc.

References m_socket, and NS_LOG_FUNCTION_NOARGS.

TypeId ns3::OnOffApplication::GetTypeId ( void   )  [static]

This method returns the TypeId associated to ns3::OnOffApplication.

This object is accessible through the following paths with Config::Set and Config::Connect:

  • /NodeList/[i]/ApplicationList/[i]/$ns3OnOffApplication

Attributes defined for this type:

  • DataRate: The data rate in on state.
    • Set with class: DataRateValue
    • Underlying type: DataRate
    • Initial value: 500000bps
    • Flags: construct write read
  • PacketSize: The size of packets sent in on state
  • Jitter: RandomVariable used to add delay jitter (in seconds) to the sending period.
  • Remote: The address of the destination
    • Set with class: AddressValue
    • Underlying type: Address
    • Initial value: 00-00-00
    • Flags: construct write read
  • OnTime: A RandomVariable used to pick the duration of the 'On' state.
  • OffTime: A RandomVariable used to pick the duration of the 'Off' state.
  • MaxBytes: The total number of bytes to send. Once these bytes are sent, no packet is sent again, even in on state. The value zero means that there is no limit.
  • Protocol: The type of protocol to use.

TraceSources defined for this type:

  • Tx: A new packet is created and is sent

Reimplemented from ns3::Application.

Definition at line 49 of file onoff-application.cc.

References ns3::TypeId::AddAttribute(), ns3::TypeId::AddTraceSource(), ns3::UdpSocketFactory::GetTypeId(), m_cbrRate, m_jitter, m_maxBytes, m_offTime, m_onTime, m_peer, m_pktSize, m_tid, m_txTrace, ns3::MakeTraceSourceAccessor(), and ns3::TypeId::SetParent().

void ns3::OnOffApplication::Ignore ( Ptr< Socket  )  [private]
void ns3::OnOffApplication::ScheduleNextTx (  )  [private]
void ns3::OnOffApplication::ScheduleStartEvent (  )  [private]
void ns3::OnOffApplication::ScheduleStopEvent (  )  [private]
void ns3::OnOffApplication::SendPacket (  )  [private]
void ns3::OnOffApplication::SetMaxBytes ( uint32_t  maxBytes  ) 

Definition at line 112 of file onoff-application.cc.

References m_maxBytes, and NS_LOG_FUNCTION.

void ns3::OnOffApplication::StartApplication ( void   )  [private, virtual]

Application specific startup code.

The StartApplication method is called at the start time specifed by Start This method should be overridden by all or most application subclasses.

Reimplemented from ns3::Application.

Definition at line 130 of file onoff-application.cc.

References CancelEvents(), ns3::Socket::CreateSocket(), ns3::Application::GetNode(), m_peer, m_socket, m_tid, NS_LOG_FUNCTION_NOARGS, and ScheduleStartEvent().

void ns3::OnOffApplication::StartSending (  )  [private]

Definition at line 180 of file onoff-application.cc.

References NS_LOG_FUNCTION_NOARGS, ScheduleNextTx(), and ScheduleStopEvent().

Referenced by ScheduleStartEvent().

void ns3::OnOffApplication::StopApplication ( void   )  [private, virtual]

Application specific shutdown code.

The StopApplication method is called at the stop time specifed by Stop This method should be overridden by all or most application subclasses.

Reimplemented from ns3::Application.

Definition at line 149 of file onoff-application.cc.

References CancelEvents(), m_socket, NS_LOG_FUNCTION_NOARGS, and NS_LOG_WARN.

Referenced by ScheduleNextTx().

void ns3::OnOffApplication::StopSending (  )  [private]

Definition at line 188 of file onoff-application.cc.

References CancelEvents(), NS_LOG_FUNCTION_NOARGS, and ScheduleStartEvent().

Referenced by ScheduleStopEvent().


Member Data Documentation

Definition at line 107 of file onoff-application.h.

Referenced by CancelEvents(), GetTypeId(), and ScheduleNextTx().

Definition at line 104 of file onoff-application.h.

Referenced by ConnectionSucceeded(), and OnOffApplication().

Definition at line 109 of file onoff-application.h.

Referenced by GetTypeId(), and ScheduleNextTx().

Definition at line 111 of file onoff-application.h.

Referenced by CancelEvents(), OnOffApplication(), and SendPacket().

Definition at line 112 of file onoff-application.h.

Referenced by GetTypeId(), ScheduleNextTx(), and SetMaxBytes().

Definition at line 106 of file onoff-application.h.

Referenced by GetTypeId(), and ScheduleStartEvent().

Definition at line 105 of file onoff-application.h.

Referenced by GetTypeId(), and ScheduleStopEvent().

Definition at line 103 of file onoff-application.h.

Referenced by GetTypeId(), and StartApplication().

Definition at line 108 of file onoff-application.h.

Referenced by GetTypeId(), ScheduleNextTx(), and SendPacket().

Definition at line 110 of file onoff-application.h.

Referenced by CancelEvents(), OnOffApplication(), ScheduleNextTx(), and SendPacket().

Definition at line 115 of file onoff-application.h.

Referenced by CancelEvents(), ScheduleNextTx(), and SendPacket().

Definition at line 116 of file onoff-application.h.

Definition at line 114 of file onoff-application.h.

Referenced by CancelEvents(), ScheduleStartEvent(), and ScheduleStopEvent().

Identifies the type of this object instance.

Reimplemented from ns3::Object.

Definition at line 117 of file onoff-application.h.

Referenced by GetTypeId(), and StartApplication().

Definition at line 113 of file onoff-application.h.

Referenced by OnOffApplication(), ScheduleNextTx(), and SendPacket().

Definition at line 118 of file onoff-application.h.

Referenced by GetTypeId(), and SendPacket().


The documentation for this class was generated from the following files:
Generated on Thu Dec 3 14:09:52 2009 for NS-3 by  doxygen 1.6.3