13#ifndef ONOFF_APPLICATION_H
14#define ONOFF_APPLICATION_H
18#include "ns3/address.h"
19#include "ns3/application.h"
20#include "ns3/data-rate.h"
21#include "ns3/event-id.h"
23#include "ns3/traced-callback.h"
29class RandomVariableStream;
a polymophic address class
The base class for all ns3 applications.
Class for representing data rates.
An identifier for simulation events.
Generate traffic to a single destination according to an OnOff pattern.
static TypeId GetTypeId()
Get the type ID.
uint8_t m_tos
The packets Type of Service.
uint32_t m_residualBits
Number of generated, but not sent, bits.
void ConnectionSucceeded(Ptr< Socket > socket)
Handle a Connection Succeed event.
EventId m_sendEvent
Event id of pending "send packet" event.
void ScheduleStartEvent()
Schedule the next On period start.
bool m_connected
True if connected.
uint32_t m_pktSize
Size of packets.
Ptr< Socket > GetSocket() const
Return a pointer to associated socket.
Ptr< Socket > m_socket
Associated socket.
TracedCallback< Ptr< const Packet > > m_txTrace
Traced Callback: transmitted packets.
void SetMaxBytes(uint64_t maxBytes)
Set the total number of bytes to send.
Ptr< RandomVariableStream > m_offTime
rng for Off Time
~OnOffApplication() override
void StartApplication() override
Application specific startup code.
Ptr< Packet > m_unsentPacket
Unsent packet cached for future attempt.
int64_t AssignStreams(int64_t stream) override
Assign a fixed random variable stream number to the random variables used by this Application object.
TracedCallback< Ptr< const Packet >, const Address &, const Address & > m_txTraceWithAddresses
Callbacks for tracing the packet Tx events, includes source and destination addresses.
void DoDispose() override
Destructor implementation.
EventId m_startStopEvent
Event id for next start or stop event.
void ScheduleNextTx()
Schedule the next packet transmission.
DataRate m_cbrRateFailSafe
Rate that data is generated (check copy)
void ConnectionFailed(Ptr< Socket > socket)
Handle a Connection Failed event.
void ScheduleStopEvent()
Schedule the next Off period start.
TracedCallback< Ptr< const Packet >, const Address &, const Address &, const SeqTsSizeHeader & > m_txTraceWithSeqTsSize
Callback for tracing the packet Tx events, includes source, destination, the packet sent,...
uint64_t m_maxBytes
Limit total number of bytes sent.
Time m_lastStartTime
Time last packet sent.
uint64_t m_totBytes
Total bytes sent so far.
void StopSending()
Start an Off period.
void StartSending()
Start an On period.
Address m_local
Local address to bind to.
Ptr< RandomVariableStream > m_onTime
rng for On Time
bool m_enableSeqTsSizeHeader
Enable or disable the use of SeqTsSizeHeader.
TypeId m_tid
Type of the socket used.
DataRate m_cbrRate
Rate that data is generated.
void StopApplication() override
Application specific shutdown code.
Address m_peer
Peer address.
void CancelEvents()
Cancel all pending events.
void SendPacket()
Send a packet.
Smart pointer class similar to boost::intrusive_ptr.
Simulation virtual time values and global simulation resolution.
Forward calls to a chain of Callback.
a unique identifier for an interface.
Every class exported by the ns3 library is enclosed in the ns3 namespace.