A Discrete-Event Network Simulator
API
onoff-application.cc
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2 //
3 // Copyright (c) 2006 Georgia Tech Research Corporation
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License version 2 as
7 // published by the Free Software Foundation;
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program; if not, write to the Free Software
16 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 //
18 // Author: George F. Riley<riley@ece.gatech.edu>
19 //
20 
21 // ns3 - On/Off Data Source Application class
22 // George F. Riley, Georgia Tech, Spring 2007
23 // Adapted from ApplicationOnOff in GTNetS.
24 
25 #include "ns3/log.h"
26 #include "ns3/address.h"
27 #include "ns3/inet-socket-address.h"
28 #include "ns3/inet6-socket-address.h"
29 #include "ns3/packet-socket-address.h"
30 #include "ns3/node.h"
31 #include "ns3/nstime.h"
32 #include "ns3/data-rate.h"
33 #include "ns3/random-variable-stream.h"
34 #include "ns3/socket.h"
35 #include "ns3/simulator.h"
36 #include "ns3/socket-factory.h"
37 #include "ns3/packet.h"
38 #include "ns3/uinteger.h"
39 #include "ns3/trace-source-accessor.h"
40 #include "onoff-application.h"
41 #include "ns3/udp-socket-factory.h"
42 #include "ns3/string.h"
43 #include "ns3/pointer.h"
44 #include "ns3/boolean.h"
45 
46 namespace ns3 {
47 
48 NS_LOG_COMPONENT_DEFINE ("OnOffApplication");
49 
50 NS_OBJECT_ENSURE_REGISTERED (OnOffApplication);
51 
52 TypeId
54 {
55  static TypeId tid = TypeId ("ns3::OnOffApplication")
57  .SetGroupName("Applications")
58  .AddConstructor<OnOffApplication> ()
59  .AddAttribute ("DataRate", "The data rate in on state.",
60  DataRateValue (DataRate ("500kb/s")),
63  .AddAttribute ("PacketSize", "The size of packets sent in on state",
64  UintegerValue (512),
66  MakeUintegerChecker<uint32_t> (1))
67  .AddAttribute ("Remote", "The address of the destination",
68  AddressValue (),
71  .AddAttribute ("Local",
72  "The Address on which to bind the socket. If not set, it is generated automatically.",
73  AddressValue (),
76  .AddAttribute ("OnTime", "A RandomVariableStream used to pick the duration of the 'On' state.",
77  StringValue ("ns3::ConstantRandomVariable[Constant=1.0]"),
79  MakePointerChecker <RandomVariableStream>())
80  .AddAttribute ("OffTime", "A RandomVariableStream used to pick the duration of the 'Off' state.",
81  StringValue ("ns3::ConstantRandomVariable[Constant=1.0]"),
83  MakePointerChecker <RandomVariableStream>())
84  .AddAttribute ("MaxBytes",
85  "The total number of bytes to send. Once these bytes are sent, "
86  "no packet is sent again, even in on state. The value zero means "
87  "that there is no limit.",
88  UintegerValue (0),
90  MakeUintegerChecker<uint64_t> ())
91  .AddAttribute ("Protocol", "The type of protocol to use. This should be "
92  "a subclass of ns3::SocketFactory",
95  // This should check for SocketFactory as a parent
97  .AddAttribute ("EnableSeqTsSizeHeader",
98  "Enable use of SeqTsSizeHeader for sequence number and timestamp",
99  BooleanValue (false),
102  .AddTraceSource ("Tx", "A new packet is created and is sent",
104  "ns3::Packet::TracedCallback")
105  .AddTraceSource ("TxWithAddresses", "A new packet is created and is sent",
107  "ns3::Packet::TwoAddressTracedCallback")
108  .AddTraceSource ("TxWithSeqTsSize", "A new packet is created with SeqTsSizeHeader",
110  "ns3::PacketSink::SeqTsSizeCallback")
111  ;
112  return tid;
113 }
114 
115 
117  : m_socket (0),
118  m_connected (false),
119  m_residualBits (0),
120  m_lastStartTime (Seconds (0)),
121  m_totBytes (0),
122  m_unsentPacket (0)
123 {
124  NS_LOG_FUNCTION (this);
125 }
126 
128 {
129  NS_LOG_FUNCTION (this);
130 }
131 
132 void
133 OnOffApplication::SetMaxBytes (uint64_t maxBytes)
134 {
135  NS_LOG_FUNCTION (this << maxBytes);
136  m_maxBytes = maxBytes;
137 }
138 
141 {
142  NS_LOG_FUNCTION (this);
143  return m_socket;
144 }
145 
146 int64_t
148 {
149  NS_LOG_FUNCTION (this << stream);
150  m_onTime->SetStream (stream);
151  m_offTime->SetStream (stream + 1);
152  return 2;
153 }
154 
155 void
157 {
158  NS_LOG_FUNCTION (this);
159 
160  CancelEvents ();
161  m_socket = 0;
162  m_unsentPacket = 0;
163  // chain up
165 }
166 
167 // Application Methods
168 void OnOffApplication::StartApplication () // Called at time specified by Start
169 {
170  NS_LOG_FUNCTION (this);
171 
172  // Create the socket if not already
173  if (!m_socket)
174  {
176  int ret = -1;
177 
178  if (! m_local.IsInvalid())
179  {
182  "Incompatible peer and local address IP version");
183  ret = m_socket->Bind (m_local);
184  }
185  else
186  {
188  {
189  ret = m_socket->Bind6 ();
190  }
193  {
194  ret = m_socket->Bind ();
195  }
196  }
197 
198  if (ret == -1)
199  {
200  NS_FATAL_ERROR ("Failed to bind socket");
201  }
202 
204  m_socket->SetAllowBroadcast (true);
206 
210  }
212 
213  // Insure no pending event
214  CancelEvents ();
215  // If we are not yet connected, there is nothing to do here
216  // The ConnectionComplete upcall will start timers at that time
217  //if (!m_connected) return;
219 }
220 
221 void OnOffApplication::StopApplication () // Called at time specified by Stop
222 {
223  NS_LOG_FUNCTION (this);
224 
225  CancelEvents ();
226  if(m_socket != 0)
227  {
228  m_socket->Close ();
229  }
230  else
231  {
232  NS_LOG_WARN ("OnOffApplication found null socket to close in StopApplication");
233  }
234 }
235 
237 {
238  NS_LOG_FUNCTION (this);
239 
241  { // Cancel the pending send packet event
242  // Calculate residual bits since last packet sent
243  Time delta (Simulator::Now () - m_lastStartTime);
244  int64x64_t bits = delta.To (Time::S) * m_cbrRate.GetBitRate ();
245  m_residualBits += bits.GetHigh ();
246  }
250  // Canceling events may cause discontinuity in sequence number if the
251  // SeqTsSizeHeader is header, and m_unsentPacket is true
252  if (m_unsentPacket)
253  {
254  NS_LOG_DEBUG ("Discarding cached packet upon CancelEvents ()");
255  }
256  m_unsentPacket = 0;
257 }
258 
259 // Event handlers
261 {
262  NS_LOG_FUNCTION (this);
264  ScheduleNextTx (); // Schedule the send packet event
266 }
267 
269 {
270  NS_LOG_FUNCTION (this);
271  CancelEvents ();
272 
274 }
275 
276 // Private helpers
278 {
279  NS_LOG_FUNCTION (this);
280 
281  if (m_maxBytes == 0 || m_totBytes < m_maxBytes)
282  {
283  NS_ABORT_MSG_IF (m_residualBits > m_pktSize * 8, "Calculation to compute next send time will overflow");
284  uint32_t bits = m_pktSize * 8 - m_residualBits;
285  NS_LOG_LOGIC ("bits = " << bits);
286  Time nextTime (Seconds (bits /
287  static_cast<double>(m_cbrRate.GetBitRate ()))); // Time till next packet
288  NS_LOG_LOGIC ("nextTime = " << nextTime.As (Time::S));
289  m_sendEvent = Simulator::Schedule (nextTime,
291  }
292  else
293  { // All done, cancel any pending events
294  StopApplication ();
295  }
296 }
297 
299 { // Schedules the event to start sending data (switch to the "On" state)
300  NS_LOG_FUNCTION (this);
301 
302  Time offInterval = Seconds (m_offTime->GetValue ());
303  NS_LOG_LOGIC ("start at " << offInterval.As (Time::S));
305 }
306 
308 { // Schedules the event to stop sending data (switch to "Off" state)
309  NS_LOG_FUNCTION (this);
310 
311  Time onInterval = Seconds (m_onTime->GetValue ());
312  NS_LOG_LOGIC ("stop at " << onInterval.As (Time::S));
314 }
315 
316 
318 {
319  NS_LOG_FUNCTION (this);
320 
322 
323  Ptr<Packet> packet;
324  if (m_unsentPacket)
325  {
326  packet = m_unsentPacket;
327  }
328  else if (m_enableSeqTsSizeHeader)
329  {
330  Address from, to;
331  m_socket->GetSockName (from);
332  m_socket->GetPeerName (to);
333  SeqTsSizeHeader header;
334  header.SetSeq (m_seq++);
335  header.SetSize (m_pktSize);
337  packet = Create<Packet> (m_pktSize - header.GetSerializedSize ());
338  // Trace before adding header, for consistency with PacketSink
339  m_txTraceWithSeqTsSize (packet, from, to, header);
340  packet->AddHeader (header);
341  }
342  else
343  {
344  packet = Create<Packet> (m_pktSize);
345  }
346 
347  int actual = m_socket->Send (packet);
348  if ((unsigned) actual == m_pktSize)
349  {
350  m_txTrace (packet);
352  m_unsentPacket = 0;
353  Address localAddress;
354  m_socket->GetSockName (localAddress);
356  {
357  NS_LOG_INFO ("At time " << Simulator::Now ().As (Time::S)
358  << " on-off application sent "
359  << packet->GetSize () << " bytes to "
361  << " port " << InetSocketAddress::ConvertFrom (m_peer).GetPort ()
362  << " total Tx " << m_totBytes << " bytes");
364  }
366  {
367  NS_LOG_INFO ("At time " << Simulator::Now ().As (Time::S)
368  << " on-off application sent "
369  << packet->GetSize () << " bytes to "
372  << " total Tx " << m_totBytes << " bytes");
374  }
375  }
376  else
377  {
378  NS_LOG_DEBUG ("Unable to send packet; actual " << actual << " size " << m_pktSize << "; caching for later attempt");
379  m_unsentPacket = packet;
380  }
381  m_residualBits = 0;
383  ScheduleNextTx ();
384 }
385 
386 
388 {
389  NS_LOG_FUNCTION (this << socket);
390  m_connected = true;
391 }
392 
394 {
395  NS_LOG_FUNCTION (this << socket);
396  NS_FATAL_ERROR ("Can't connect");
397 }
398 
399 
400 } // Namespace ns3
ns3::TypeId
a unique identifier for an interface.
Definition: type-id.h:59
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:205
ns3::SeqTsSizeHeader::GetSerializedSize
virtual uint32_t GetSerializedSize(void) const override
Definition: seq-ts-size-header.cc:75
ns3::DataRateValue
AttributeValue implementation for DataRate.
Definition: data-rate.h:298
ns3::Inet6SocketAddress::IsMatchingType
static bool IsMatchingType(const Address &addr)
If the address match.
Definition: inet6-socket-address.cc:89
ns3::Socket::SetAllowBroadcast
virtual bool SetAllowBroadcast(bool allowBroadcast)=0
Configure whether broadcast datagram transmissions are allowed.
NS_OBJECT_ENSURE_REGISTERED
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:45
NS_ASSERT
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Definition: assert.h:67
ns3::SeqTsSizeHeader
Header with a sequence, a timestamp, and a "size" attribute.
Definition: seq-ts-size-header.h:38
ns3::OnOffApplication::AssignStreams
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
Definition: onoff-application.cc:147
ns3::InetSocketAddress::IsMatchingType
static bool IsMatchingType(const Address &address)
Definition: inet-socket-address.cc:103
ns3::BooleanValue
AttributeValue implementation for Boolean.
Definition: boolean.h:37
ns3::Socket::Bind
virtual int Bind(const Address &address)=0
Allocate a local endpoint for this socket.
ns3::Packet::GetSize
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
Definition: packet.h:852
ns3::Packet::AddHeader
void AddHeader(const Header &header)
Add header to this packet.
Definition: packet.cc:256
ns3::InetSocketAddress::GetPort
uint16_t GetPort(void) const
Definition: inet-socket-address.cc:65
ns3::MakeAddressAccessor
Ptr< const AttributeAccessor > MakeAddressAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Definition: address.h:278
ns3::Simulator::Now
static Time Now(void)
Return the current simulation virtual time.
Definition: simulator.cc:195
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::MakeDataRateAccessor
Ptr< const AttributeAccessor > MakeDataRateAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Definition: data-rate.h:298
ns3::SeqTsHeader::SetSeq
void SetSeq(uint32_t seq)
Definition: seq-ts-header.cc:41
ns3::OnOffApplication::GetTypeId
static TypeId GetTypeId(void)
Get the type ID.
Definition: onoff-application.cc:53
ns3::AddressValue
AttributeValue implementation for Address.
Definition: address.h:278
ns3::OnOffApplication::m_startStopEvent
EventId m_startStopEvent
Event id for next start or stop event.
Definition: onoff-application.h:173
ns3::OnOffApplication::m_connected
bool m_connected
True if connected.
Definition: onoff-application.h:163
NS_LOG_WARN
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
Definition: log.h:265
ns3::Socket::SetConnectCallback
void SetConnectCallback(Callback< void, Ptr< Socket > > connectionSucceeded, Callback< void, Ptr< Socket > > connectionFailed)
Specify callbacks to allow the caller to determine if the connection succeeds of fails.
Definition: socket.cc:84
ns3::OnOffApplication::m_maxBytes
uint64_t m_maxBytes
Limit total number of bytes sent.
Definition: onoff-application.h:171
ns3::OnOffApplication::OnOffApplication
OnOffApplication()
Definition: onoff-application.cc:116
ns3::Socket::Bind6
virtual int Bind6()=0
Allocate a local IPv6 endpoint for this socket.
ns3::OnOffApplication::m_txTraceWithAddresses
TracedCallback< Ptr< const Packet >, const Address &, const Address & > m_txTraceWithAddresses
Callbacks for tracing the packet Tx events, includes source and destination addresses.
Definition: onoff-application.h:185
ns3::OnOffApplication::SetMaxBytes
void SetMaxBytes(uint64_t maxBytes)
Set the total number of bytes to send.
Definition: onoff-application.cc:133
ns3::OnOffApplication::m_residualBits
uint32_t m_residualBits
Number of generated, but not sent, bits.
Definition: onoff-application.h:169
ns3::OnOffApplication::m_cbrRateFailSafe
DataRate m_cbrRateFailSafe
Rate that data is generated (check copy)
Definition: onoff-application.h:167
ns3::Application::DoDispose
virtual void DoDispose(void)
Destructor implementation.
Definition: application.cc:83
ns3::Time::As
TimeWithUnit As(const enum Unit unit=Time::AUTO) const
Attach a unit to a Time, to facilitate output in a specific unit.
Definition: time.cc:429
ns3::OnOffApplication::m_cbrRate
DataRate m_cbrRate
Rate that data is generated.
Definition: onoff-application.h:166
ns3::Simulator::Schedule
static EventId Schedule(Time const &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
Definition: simulator.h:556
ns3::MakeBooleanAccessor
Ptr< const AttributeAccessor > MakeBooleanAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Definition: boolean.h:85
ns3::int64x64_t
High precision numerical type, implementing Q64.64 fixed precision.
Definition: int64x64-128.h:46
ns3::InetSocketAddress::ConvertFrom
static InetSocketAddress ConvertFrom(const Address &address)
Returns an InetSocketAddress which corresponds to the input Address.
Definition: inet-socket-address.cc:126
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:923
ns3::MakeTraceSourceAccessor
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
Definition: trace-source-accessor.h:202
ns3::OnOffApplication::m_seq
uint32_t m_seq
Sequence.
Definition: onoff-application.h:176
ns3::Inet6SocketAddress::GetPort
uint16_t GetPort(void) const
Get the port.
Definition: inet6-socket-address.cc:65
ns3::OnOffApplication::m_txTraceWithSeqTsSize
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,...
Definition: onoff-application.h:188
ns3::Inet6SocketAddress::ConvertFrom
static Inet6SocketAddress ConvertFrom(const Address &addr)
Convert the address to a InetSocketAddress.
Definition: inet6-socket-address.cc:110
ns3::PacketSocketAddress::IsMatchingType
static bool IsMatchingType(const Address &address)
Definition: packet-socket-address.cc:138
ns3::OnOffApplication::StopApplication
virtual void StopApplication(void)
Application specific shutdown code.
Definition: onoff-application.cc:221
ns3::OnOffApplication::m_local
Address m_local
Local address to bind to.
Definition: onoff-application.h:162
ns3::Ptr< Socket >
NS_FATAL_ERROR
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:165
ns3::DataRate
Class for representing data rates.
Definition: data-rate.h:89
ns3::MakeAddressChecker
Ptr< const AttributeChecker > MakeAddressChecker(void)
Definition: address.cc:172
ns3::Socket::Send
virtual int Send(Ptr< Packet > p, uint32_t flags)=0
Send data (or dummy data) to the remote host.
ns3::EventId::IsRunning
bool IsRunning(void) const
This method is syntactic sugar for !IsExpired().
Definition: event-id.cc:71
ns3::OnOffApplication::StopSending
void StopSending()
Start an Off period.
Definition: onoff-application.cc:268
ns3::TypeIdValue
AttributeValue implementation for TypeId.
Definition: type-id.h:595
ns3::Address
a polymophic address class
Definition: address.h:91
ns3::OnOffApplication::m_pktSize
uint32_t m_pktSize
Size of packets.
Definition: onoff-application.h:168
ns3::OnOffApplication::~OnOffApplication
virtual ~OnOffApplication()
Definition: onoff-application.cc:127
ns3::Simulator::Cancel
static void Cancel(const EventId &id)
Set the cancel bit on this event: the event's associated function will not be invoked when it expires...
Definition: simulator.cc:268
NS_LOG_INFO
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition: log.h:281
ns3::InetSocketAddress::GetIpv4
Ipv4Address GetIpv4(void) const
Definition: inet-socket-address.cc:71
ns3::OnOffApplication::m_onTime
Ptr< RandomVariableStream > m_onTime
rng for On Time
Definition: onoff-application.h:164
ns3::OnOffApplication::ScheduleNextTx
void ScheduleNextTx()
Schedule the next packet transmission.
Definition: onoff-application.cc:277
ns3::OnOffApplication::ConnectionFailed
void ConnectionFailed(Ptr< Socket > socket)
Handle a Connection Failed event.
Definition: onoff-application.cc:393
ns3::OnOffApplication::SendPacket
void SendPacket()
Send a packet.
Definition: onoff-application.cc:317
ns3::MakeBooleanChecker
Ptr< const AttributeChecker > MakeBooleanChecker(void)
Definition: boolean.cc:121
ns3::OnOffApplication::StartSending
void StartSending()
Start an On period.
Definition: onoff-application.cc:260
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:104
ns3::Socket::Close
virtual int Close(void)=0
Close a socket.
NS_ABORT_MSG_IF
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
Definition: abort.h:108
ns3::OnOffApplication::m_sendEvent
EventId m_sendEvent
Event id of pending "send packet" event.
Definition: onoff-application.h:174
ns3::OnOffApplication::CancelEvents
void CancelEvents()
Cancel all pending events.
Definition: onoff-application.cc:236
ns3::SeqTsSizeHeader::SetSize
void SetSize(uint64_t size)
Set the size information that the header will carry.
Definition: seq-ts-size-header.cc:55
ns3::DataRate::GetBitRate
uint64_t GetBitRate() const
Get the underlying bitrate.
Definition: data-rate.cc:287
ns3::OnOffApplication::m_peer
Address m_peer
Peer address.
Definition: onoff-application.h:161
ns3::MakeCallback
Callback< R, Ts... > MakeCallback(R(T::*memPtr)(Ts...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
Definition: callback.h:1642
NS_LOG_LOGIC
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition: log.h:289
ns3::Socket::GetPeerName
virtual int GetPeerName(Address &address) const =0
Get the peer address of a connected socket.
ns3::MakePointerAccessor
Ptr< const AttributeAccessor > MakePointerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Definition: pointer.h:227
ns3::Inet6SocketAddress::GetIpv6
Ipv6Address GetIpv6(void) const
Get the IPv6 address.
Definition: inet6-socket-address.cc:77
ns3::StringValue
Hold variables of type string.
Definition: string.h:41
ns3::UdpSocketFactory::GetTypeId
static TypeId GetTypeId(void)
Get the type ID.
Definition: udp-socket-factory.cc:27
NS_ABORT_IF
#define NS_ABORT_IF(cond)
Abnormal program termination if a condition is true.
Definition: abort.h:77
onoff-application.h
ns3::OnOffApplication
Generate traffic to a single destination according to an OnOff pattern.
Definition: onoff-application.h:96
ns3::OnOffApplication::m_offTime
Ptr< RandomVariableStream > m_offTime
rng for Off Time
Definition: onoff-application.h:165
ns3::int64x64_t::GetHigh
int64_t GetHigh(void) const
Get the integer portion.
Definition: int64x64-128.h:222
ns3::OnOffApplication::m_totBytes
uint64_t m_totBytes
Total bytes sent so far.
Definition: onoff-application.h:172
NS_LOG_DEBUG
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:273
ns3::OnOffApplication::m_unsentPacket
Ptr< Packet > m_unsentPacket
Unsent packet cached for future attempt.
Definition: onoff-application.h:177
ns3::Socket::Connect
virtual int Connect(const Address &address)=0
Initiate a connection to a remote host.
ns3::RandomVariableStream::GetValue
virtual double GetValue(void)=0
Get the next random value as a double drawn from the distribution.
ns3::Address::IsInvalid
bool IsInvalid(void) const
Definition: address.cc:68
ns3::Seconds
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1289
ns3::Time::S
@ S
second
Definition: nstime.h:115
ns3::OnOffApplication::ScheduleStartEvent
void ScheduleStartEvent()
Schedule the next On period start.
Definition: onoff-application.cc:298
NS_LOG_FUNCTION
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
Definition: log-macros-enabled.h:244
ns3::RandomVariableStream::SetStream
void SetStream(int64_t stream)
Specifies the stream number for the RngStream.
Definition: random-variable-stream.cc:100
ns3::UintegerValue
Hold an unsigned integer type.
Definition: uinteger.h:44
ns3::OnOffApplication::GetSocket
Ptr< Socket > GetSocket(void) const
Return a pointer to associated socket.
Definition: onoff-application.cc:140
ns3::Application::GetNode
Ptr< Node > GetNode() const
Definition: application.cc:104
ns3::Socket::CreateSocket
static Ptr< Socket > CreateSocket(Ptr< Node > node, TypeId tid)
This method wraps the creation of sockets that is performed on a given node by a SocketFactory specif...
Definition: socket.cc:71
ns3::OnOffApplication::m_lastStartTime
Time m_lastStartTime
Time last packet sent.
Definition: onoff-application.h:170
ns3::OnOffApplication::m_socket
Ptr< Socket > m_socket
Associated socket.
Definition: onoff-application.h:160
ns3::MakeUintegerAccessor
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Definition: uinteger.h:45
ns3::Application
The base class for all ns3 applications.
Definition: application.h:61
ns3::Socket::GetSockName
virtual int GetSockName(Address &address) const =0
Get socket address.
ns3::Socket::ShutdownRecv
virtual int ShutdownRecv(void)=0
ns3::OnOffApplication::ConnectionSucceeded
void ConnectionSucceeded(Ptr< Socket > socket)
Handle a Connection Succeed event.
Definition: onoff-application.cc:387
ns3::OnOffApplication::m_enableSeqTsSizeHeader
bool m_enableSeqTsSizeHeader
Enable or disable the use of SeqTsSizeHeader.
Definition: onoff-application.h:178
ns3::OnOffApplication::m_tid
TypeId m_tid
Type of the socket used.
Definition: onoff-application.h:175
ns3::OnOffApplication::DoDispose
virtual void DoDispose(void)
Destructor implementation.
Definition: onoff-application.cc:156
ns3::Time::To
int64x64_t To(enum Unit unit) const
Get the Time value expressed in a particular unit.
Definition: nstime.h:534
ns3::OnOffApplication::m_txTrace
TracedCallback< Ptr< const Packet > > m_txTrace
Traced Callback: transmitted packets.
Definition: onoff-application.h:182
ns3::MakeDataRateChecker
Ptr< const AttributeChecker > MakeDataRateChecker(void)
Definition: data-rate.cc:30
ns3::MakeTypeIdChecker
Ptr< const AttributeChecker > MakeTypeIdChecker(void)
Definition: type-id.cc:1227
ns3::MakeTypeIdAccessor
Ptr< const AttributeAccessor > MakeTypeIdAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Definition: type-id.h:595
ns3::EventId::IsExpired
bool IsExpired(void) const
This method is syntactic sugar for the ns3::Simulator::IsExpired method.
Definition: event-id.cc:65
ns3::OnOffApplication::StartApplication
virtual void StartApplication(void)
Application specific startup code.
Definition: onoff-application.cc:168
ns3::OnOffApplication::ScheduleStopEvent
void ScheduleStopEvent()
Schedule the next Off period start.
Definition: onoff-application.cc:307