A Discrete-Event Network Simulator
API
point-to-point-net-device.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2007, 2008 University of Washington
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License version 2 as
6  * published by the Free Software Foundation;
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16  */
17 
19 
20 #include "point-to-point-channel.h"
21 #include "ppp-header.h"
22 
23 #include "ns3/error-model.h"
24 #include "ns3/llc-snap-header.h"
25 #include "ns3/log.h"
26 #include "ns3/mac48-address.h"
27 #include "ns3/pointer.h"
28 #include "ns3/queue.h"
29 #include "ns3/simulator.h"
30 #include "ns3/trace-source-accessor.h"
31 #include "ns3/uinteger.h"
32 
33 namespace ns3
34 {
35 
36 NS_LOG_COMPONENT_DEFINE("PointToPointNetDevice");
37 
38 NS_OBJECT_ENSURE_REGISTERED(PointToPointNetDevice);
39 
40 TypeId
42 {
43  static TypeId tid =
44  TypeId("ns3::PointToPointNetDevice")
46  .SetGroupName("PointToPoint")
47  .AddConstructor<PointToPointNetDevice>()
48  .AddAttribute("Mtu",
49  "The MAC-level Maximum Transmission Unit",
53  MakeUintegerChecker<uint16_t>())
54  .AddAttribute("Address",
55  "The MAC address of this device.",
56  Mac48AddressValue(Mac48Address("ff:ff:ff:ff:ff:ff")),
57  MakeMac48AddressAccessor(&PointToPointNetDevice::m_address),
58  MakeMac48AddressChecker())
59  .AddAttribute("DataRate",
60  "The default data rate for point to point links",
61  DataRateValue(DataRate("32768b/s")),
62  MakeDataRateAccessor(&PointToPointNetDevice::m_bps),
63  MakeDataRateChecker())
64  .AddAttribute("ReceiveErrorModel",
65  "The receiver error model used to simulate packet loss",
66  PointerValue(),
68  MakePointerChecker<ErrorModel>())
69  .AddAttribute("InterframeGap",
70  "The time to wait between packet (frame) transmissions",
71  TimeValue(Seconds(0.0)),
74 
75  //
76  // Transmit queueing discipline for the device which includes its own set
77  // of trace hooks.
78  //
79  .AddAttribute("TxQueue",
80  "A queue to use as the transmit queue in the device.",
81  PointerValue(),
83  MakePointerChecker<Queue<Packet>>())
84 
85  //
86  // Trace sources at the "top" of the net device, where packets transition
87  // to/from higher layers.
88  //
89  .AddTraceSource("MacTx",
90  "Trace source indicating a packet has arrived "
91  "for transmission by this device",
93  "ns3::Packet::TracedCallback")
94  .AddTraceSource("MacTxDrop",
95  "Trace source indicating a packet has been dropped "
96  "by the device before transmission",
98  "ns3::Packet::TracedCallback")
99  .AddTraceSource("MacPromiscRx",
100  "A packet has been received by this device, "
101  "has been passed up from the physical layer "
102  "and is being forwarded up the local protocol stack. "
103  "This is a promiscuous trace,",
105  "ns3::Packet::TracedCallback")
106  .AddTraceSource("MacRx",
107  "A packet has been received by this device, "
108  "has been passed up from the physical layer "
109  "and is being forwarded up the local protocol stack. "
110  "This is a non-promiscuous trace,",
112  "ns3::Packet::TracedCallback")
113 #if 0
114  // Not currently implemented for this device
115  .AddTraceSource ("MacRxDrop",
116  "Trace source indicating a packet was dropped "
117  "before being forwarded up the stack",
119  "ns3::Packet::TracedCallback")
120 #endif
121  //
122  // Trace sources at the "bottom" of the net device, where packets transition
123  // to/from the channel.
124  //
125  .AddTraceSource("PhyTxBegin",
126  "Trace source indicating a packet has begun "
127  "transmitting over the channel",
129  "ns3::Packet::TracedCallback")
130  .AddTraceSource("PhyTxEnd",
131  "Trace source indicating a packet has been "
132  "completely transmitted over the channel",
134  "ns3::Packet::TracedCallback")
135  .AddTraceSource("PhyTxDrop",
136  "Trace source indicating a packet has been "
137  "dropped by the device during transmission",
139  "ns3::Packet::TracedCallback")
140 #if 0
141  // Not currently implemented for this device
142  .AddTraceSource ("PhyRxBegin",
143  "Trace source indicating a packet has begun "
144  "being received by the device",
146  "ns3::Packet::TracedCallback")
147 #endif
148  .AddTraceSource("PhyRxEnd",
149  "Trace source indicating a packet has been "
150  "completely received by the device",
152  "ns3::Packet::TracedCallback")
153  .AddTraceSource("PhyRxDrop",
154  "Trace source indicating a packet has been "
155  "dropped by the device during reception",
157  "ns3::Packet::TracedCallback")
158 
159  //
160  // Trace sources designed to simulate a packet sniffer facility (tcpdump).
161  // Note that there is really no difference between promiscuous and
162  // non-promiscuous traces in a point-to-point link.
163  //
164  .AddTraceSource("Sniffer",
165  "Trace source simulating a non-promiscuous packet sniffer "
166  "attached to the device",
168  "ns3::Packet::TracedCallback")
169  .AddTraceSource("PromiscSniffer",
170  "Trace source simulating a promiscuous packet sniffer "
171  "attached to the device",
173  "ns3::Packet::TracedCallback");
174  return tid;
175 }
176 
178  : m_txMachineState(READY),
179  m_channel(nullptr),
180  m_linkUp(false),
181  m_currentPkt(nullptr)
182 {
183  NS_LOG_FUNCTION(this);
184 }
185 
187 {
188  NS_LOG_FUNCTION(this);
189 }
190 
191 void
193 {
194  NS_LOG_FUNCTION(this << p << protocolNumber);
195  PppHeader ppp;
196  ppp.SetProtocol(EtherToPpp(protocolNumber));
197  p->AddHeader(ppp);
198 }
199 
200 bool
202 {
203  NS_LOG_FUNCTION(this << p << param);
204  PppHeader ppp;
205  p->RemoveHeader(ppp);
206  param = PppToEther(ppp.GetProtocol());
207  return true;
208 }
209 
210 void
212 {
213  NS_LOG_FUNCTION(this);
214  m_node = nullptr;
215  m_channel = nullptr;
216  m_receiveErrorModel = nullptr;
217  m_currentPkt = nullptr;
218  m_queue = nullptr;
220 }
221 
222 void
224 {
225  NS_LOG_FUNCTION(this);
226  m_bps = bps;
227 }
228 
229 void
231 {
232  NS_LOG_FUNCTION(this << t.As(Time::S));
233  m_tInterframeGap = t;
234 }
235 
236 bool
238 {
239  NS_LOG_FUNCTION(this << p);
240  NS_LOG_LOGIC("UID is " << p->GetUid() << ")");
241 
242  //
243  // This function is called to start the process of transmitting a packet.
244  // We need to tell the channel that we've started wiggling the wire and
245  // schedule an event that will be executed when the transmission is complete.
246  //
247  NS_ASSERT_MSG(m_txMachineState == READY, "Must be READY to transmit");
249  m_currentPkt = p;
251 
252  Time txTime = m_bps.CalculateBytesTxTime(p->GetSize());
253  Time txCompleteTime = txTime + m_tInterframeGap;
254 
255  NS_LOG_LOGIC("Schedule TransmitCompleteEvent in " << txCompleteTime.As(Time::S));
257 
258  bool result = m_channel->TransmitStart(p, this, txTime);
259  if (result == false)
260  {
261  m_phyTxDropTrace(p);
262  }
263  return result;
264 }
265 
266 void
268 {
269  NS_LOG_FUNCTION(this);
270 
271  //
272  // This function is called to when we're all done transmitting a packet.
273  // We try and pull another packet off of the transmit queue. If the queue
274  // is empty, we are done, otherwise we need to start transmitting the
275  // next packet.
276  //
277  NS_ASSERT_MSG(m_txMachineState == BUSY, "Must be BUSY if transmitting");
279 
280  NS_ASSERT_MSG(m_currentPkt, "PointToPointNetDevice::TransmitComplete(): m_currentPkt zero");
281 
283  m_currentPkt = nullptr;
284 
285  Ptr<Packet> p = m_queue->Dequeue();
286  if (!p)
287  {
288  NS_LOG_LOGIC("No pending packets in device queue after tx complete");
289  return;
290  }
291 
292  //
293  // Got another packet off of the queue, so start the transmit process again.
294  //
295  m_snifferTrace(p);
297  TransmitStart(p);
298 }
299 
300 bool
302 {
303  NS_LOG_FUNCTION(this << &ch);
304 
305  m_channel = ch;
306 
307  m_channel->Attach(this);
308 
309  //
310  // This device is up whenever it is attached to a channel. A better plan
311  // would be to have the link come up when both devices are attached, but this
312  // is not done for now.
313  //
314  NotifyLinkUp();
315  return true;
316 }
317 
318 void
320 {
321  NS_LOG_FUNCTION(this << q);
322  m_queue = q;
323 }
324 
325 void
327 {
328  NS_LOG_FUNCTION(this << em);
329  m_receiveErrorModel = em;
330 }
331 
332 void
334 {
335  NS_LOG_FUNCTION(this << packet);
336  uint16_t protocol = 0;
337 
338  if (m_receiveErrorModel && m_receiveErrorModel->IsCorrupt(packet))
339  {
340  //
341  // If we have an error model and it indicates that it is time to lose a
342  // corrupted packet, don't forward this packet up, let it go.
343  //
344  m_phyRxDropTrace(packet);
345  }
346  else
347  {
348  //
349  // Hit the trace hooks. All of these hooks are in the same place in this
350  // device because it is so simple, but this is not usually the case in
351  // more complicated devices.
352  //
353  m_snifferTrace(packet);
354  m_promiscSnifferTrace(packet);
355  m_phyRxEndTrace(packet);
356 
357  //
358  // Trace sinks will expect complete packets, not packets without some of the
359  // headers.
360  //
361  Ptr<Packet> originalPacket = packet->Copy();
362 
363  //
364  // Strip off the point-to-point protocol header and forward this packet
365  // up the protocol stack. Since this is a simple point-to-point link,
366  // there is no difference in what the promisc callback sees and what the
367  // normal receive callback sees.
368  //
369  ProcessHeader(packet, protocol);
370 
371  if (!m_promiscCallback.IsNull())
372  {
373  m_macPromiscRxTrace(originalPacket);
374  m_promiscCallback(this,
375  packet,
376  protocol,
377  GetRemote(),
378  GetAddress(),
380  }
381 
382  m_macRxTrace(originalPacket);
383  m_rxCallback(this, packet, protocol, GetRemote());
384  }
385 }
386 
389 {
390  NS_LOG_FUNCTION(this);
391  return m_queue;
392 }
393 
394 void
396 {
397  NS_LOG_FUNCTION(this);
398  m_linkUp = true;
400 }
401 
402 void
404 {
405  NS_LOG_FUNCTION(this);
406  m_ifIndex = index;
407 }
408 
409 uint32_t
411 {
412  return m_ifIndex;
413 }
414 
417 {
418  return m_channel;
419 }
420 
421 //
422 // This is a point-to-point device, so we really don't need any kind of address
423 // information. However, the base class NetDevice wants us to define the
424 // methods to get and set the address. Rather than be rude and assert, we let
425 // clients get and set the address, but simply ignore them.
426 
427 void
429 {
430  NS_LOG_FUNCTION(this << address);
432 }
433 
434 Address
436 {
437  return m_address;
438 }
439 
440 bool
442 {
443  NS_LOG_FUNCTION(this);
444  return m_linkUp;
445 }
446 
447 void
449 {
450  NS_LOG_FUNCTION(this);
452 }
453 
454 //
455 // This is a point-to-point device, so every transmission is a broadcast to
456 // all of the devices on the network.
457 //
458 bool
460 {
461  NS_LOG_FUNCTION(this);
462  return true;
463 }
464 
465 //
466 // We don't really need any addressing information since this is a
467 // point-to-point device. The base class NetDevice wants us to return a
468 // broadcast address, so we make up something reasonable.
469 //
470 Address
472 {
473  NS_LOG_FUNCTION(this);
474  return Mac48Address("ff:ff:ff:ff:ff:ff");
475 }
476 
477 bool
479 {
480  NS_LOG_FUNCTION(this);
481  return true;
482 }
483 
484 Address
486 {
487  NS_LOG_FUNCTION(this);
488  return Mac48Address("01:00:5e:00:00:00");
489 }
490 
491 Address
493 {
494  NS_LOG_FUNCTION(this << addr);
495  return Mac48Address("33:33:00:00:00:00");
496 }
497 
498 bool
500 {
501  NS_LOG_FUNCTION(this);
502  return true;
503 }
504 
505 bool
507 {
508  NS_LOG_FUNCTION(this);
509  return false;
510 }
511 
512 bool
513 PointToPointNetDevice::Send(Ptr<Packet> packet, const Address& dest, uint16_t protocolNumber)
514 {
515  NS_LOG_FUNCTION(this << packet << dest << protocolNumber);
516  NS_LOG_LOGIC("p=" << packet << ", dest=" << &dest);
517  NS_LOG_LOGIC("UID is " << packet->GetUid());
518 
519  //
520  // If IsLinkUp() is false it means there is no channel to send any packet
521  // over so we just hit the drop trace on the packet and return an error.
522  //
523  if (IsLinkUp() == false)
524  {
525  m_macTxDropTrace(packet);
526  return false;
527  }
528 
529  //
530  // Stick a point to point protocol header on the packet in preparation for
531  // shoving it out the door.
532  //
533  AddHeader(packet, protocolNumber);
534 
535  m_macTxTrace(packet);
536 
537  //
538  // We should enqueue and dequeue the packet to hit the tracing hooks.
539  //
540  if (m_queue->Enqueue(packet))
541  {
542  //
543  // If the channel is ready for transition we send the packet right now
544  //
545  if (m_txMachineState == READY)
546  {
547  packet = m_queue->Dequeue();
548  m_snifferTrace(packet);
549  m_promiscSnifferTrace(packet);
550  bool ret = TransmitStart(packet);
551  return ret;
552  }
553  return true;
554  }
555 
556  // Enqueue may fail (overflow)
557 
558  m_macTxDropTrace(packet);
559  return false;
560 }
561 
562 bool
564  const Address& source,
565  const Address& dest,
566  uint16_t protocolNumber)
567 {
568  NS_LOG_FUNCTION(this << packet << source << dest << protocolNumber);
569  return false;
570 }
571 
572 Ptr<Node>
574 {
575  return m_node;
576 }
577 
578 void
580 {
581  NS_LOG_FUNCTION(this);
582  m_node = node;
583 }
584 
585 bool
587 {
588  NS_LOG_FUNCTION(this);
589  return false;
590 }
591 
592 void
594 {
595  m_rxCallback = cb;
596 }
597 
598 void
600 {
601  m_promiscCallback = cb;
602 }
603 
604 bool
606 {
607  NS_LOG_FUNCTION(this);
608  return false;
609 }
610 
611 void
613 {
614  NS_LOG_FUNCTION(this << p);
615  Receive(p);
616 }
617 
618 Address
620 {
621  NS_LOG_FUNCTION(this);
622  NS_ASSERT(m_channel->GetNDevices() == 2);
623  for (std::size_t i = 0; i < m_channel->GetNDevices(); ++i)
624  {
625  Ptr<NetDevice> tmp = m_channel->GetDevice(i);
626  if (tmp != this)
627  {
628  return tmp->GetAddress();
629  }
630  }
631  NS_ASSERT(false);
632  // quiet compiler.
633  return Address();
634 }
635 
636 bool
638 {
639  NS_LOG_FUNCTION(this << mtu);
640  m_mtu = mtu;
641  return true;
642 }
643 
644 uint16_t
646 {
647  NS_LOG_FUNCTION(this);
648  return m_mtu;
649 }
650 
651 uint16_t
653 {
655  switch (proto)
656  {
657  case 0x0021:
658  return 0x0800; // IPv4
659  case 0x0057:
660  return 0x86DD; // IPv6
661  default:
662  NS_ASSERT_MSG(false, "PPP Protocol number not defined!");
663  }
664  return 0;
665 }
666 
667 uint16_t
669 {
671  switch (proto)
672  {
673  case 0x0800:
674  return 0x0021; // IPv4
675  case 0x86DD:
676  return 0x0057; // IPv6
677  default:
678  NS_ASSERT_MSG(false, "PPP Protocol number not defined!");
679  }
680  return 0;
681 }
682 
683 } // namespace ns3
a polymophic address class
Definition: address.h:100
bool IsNull() const
Check for null implementation.
Definition: callback.h:572
Class for representing data rates.
Definition: data-rate.h:90
Time CalculateBytesTxTime(uint32_t bytes) const
Calculate transmission time.
Definition: data-rate.cc:291
AttributeValue implementation for DataRate.
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:43
Describes an IPv6 address.
Definition: ipv6-address.h:50
an EUI-48 address
Definition: mac48-address.h:46
static Mac48Address ConvertFrom(const Address &address)
AttributeValue implementation for Mac48Address.
Network layer to device interface.
Definition: net-device.h:98
@ PACKET_HOST
Packet addressed to us.
Definition: net-device.h:301
virtual void DoDispose()
Destructor implementation.
Definition: object.cc:353
uint32_t RemoveHeader(Header &header)
Deserialize and remove the header from the internal buffer.
Definition: packet.cc:294
void AddHeader(const Header &header)
Add header to this packet.
Definition: packet.cc:268
uint32_t GetSize() const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
Definition: packet.h:863
Ptr< Packet > Copy() const
performs a COW copy of the packet.
Definition: packet.cc:131
uint64_t GetUid() const
Returns the packet's Uid.
Definition: packet.cc:412
A Device for a Point to Point Network Link.
void AddHeader(Ptr< Packet > p, uint16_t protocolNumber)
Adds the necessary headers and trailers to a packet of data in order to respect the protocol implemen...
static const uint16_t DEFAULT_MTU
Default MTU.
Ptr< Node > GetNode() const override
TracedCallback< Ptr< const Packet > > m_phyRxEndTrace
The trace source fired when a packet ends the reception process from the medium.
Address GetMulticast(Ipv4Address multicastGroup) const override
Make and return a MAC multicast address using the provided multicast group.
Address GetBroadcast() const override
TracedCallback< Ptr< const Packet > > m_macPromiscRxTrace
The trace source fired for packets successfully received by the device immediately before being forwa...
PointToPointNetDevice()
Construct a PointToPointNetDevice.
Ptr< PointToPointChannel > m_channel
The PointToPointChannel to which this PointToPointNetDevice has been attached.
DataRate m_bps
The data rate that the Net Device uses to simulate packet transmission timing.
bool TransmitStart(Ptr< Packet > p)
Start Sending a Packet Down the Wire.
TracedCallback< Ptr< const Packet > > m_macRxTrace
The trace source fired for packets successfully received by the device immediately before being forwa...
TracedCallback< Ptr< const Packet > > m_macRxDropTrace
The trace source fired for packets successfully received by the device but are dropped before being f...
TracedCallback m_linkChangeCallbacks
Callback for the link change event.
TracedCallback< Ptr< const Packet > > m_macTxTrace
The trace source fired when packets come into the "top" of the device at the L3/L2 transition,...
bool SendFrom(Ptr< Packet > packet, const Address &source, const Address &dest, uint16_t protocolNumber) override
void SetNode(Ptr< Node > node) override
void SetIfIndex(const uint32_t index) override
void AddLinkChangeCallback(Callback< void > callback) override
bool Send(Ptr< Packet > packet, const Address &dest, uint16_t protocolNumber) override
bool IsPointToPoint() const override
Return true if the net device is on a point-to-point link.
bool Attach(Ptr< PointToPointChannel > ch)
Attach the device to a channel.
static uint16_t EtherToPpp(uint16_t protocol)
Ethernet to PPP protocol number mapping.
void SetReceiveErrorModel(Ptr< ErrorModel > em)
Attach a receive ErrorModel to the PointToPointNetDevice.
TracedCallback< Ptr< const Packet > > m_phyTxDropTrace
The trace source fired when the phy layer drops a packet before it tries to transmit it.
Ptr< ErrorModel > m_receiveErrorModel
Error model for receive packet events.
void SetInterframeGap(Time t)
Set the interframe gap used to separate packets.
void SetReceiveCallback(NetDevice::ReceiveCallback cb) override
bool m_linkUp
Identify if the link is up or not.
uint16_t GetMtu() const override
TracedCallback< Ptr< const Packet > > m_phyRxDropTrace
The trace source fired when the phy layer drops a packet it has received.
void NotifyLinkUp()
Make the link up and running.
Ptr< Queue< Packet > > GetQueue() const
Get a copy of the attached Queue.
@ READY
The transmitter is ready to begin transmission of a packet.
@ BUSY
The transmitter is busy transmitting a packet.
static uint16_t PppToEther(uint16_t protocol)
PPP to Ethernet protocol number mapping.
Address GetAddress() const override
bool IsBridge() const override
Return true if the net device is acting as a bridge.
void SetQueue(Ptr< Queue< Packet >> queue)
Attach a queue to the PointToPointNetDevice.
Ptr< Channel > GetChannel() const override
TracedCallback< Ptr< const Packet > > m_phyTxBeginTrace
The trace source fired when a packet begins the transmission process on the medium.
void DoDispose() override
Dispose of the object.
void SetAddress(Address address) override
Set the address of this interface.
void TransmitComplete()
Stop Sending a Packet Down the Wire and Begin the Interframe Gap.
~PointToPointNetDevice() override
Destroy a PointToPointNetDevice.
static TypeId GetTypeId()
Get the TypeId.
Mac48Address m_address
Mac48Address of this NetDevice.
uint32_t GetIfIndex() const override
Time m_tInterframeGap
The interframe gap that the Net Device uses to throttle packet transmission.
Ptr< Packet > m_currentPkt
Current packet processed.
bool ProcessHeader(Ptr< Packet > p, uint16_t &param)
Removes, from a packet of data, all headers and trailers that relate to the protocol implemented by t...
void Receive(Ptr< Packet > p)
Receive a packet from a connected PointToPointChannel.
TracedCallback< Ptr< const Packet > > m_phyRxBeginTrace
The trace source fired when a packet begins the reception process from the medium – when the simulate...
Ptr< Queue< Packet > > m_queue
The Queue which this PointToPointNetDevice uses as a packet source.
TracedCallback< Ptr< const Packet > > m_promiscSnifferTrace
A trace source that emulates a promiscuous mode protocol sniffer connected to the device.
TracedCallback< Ptr< const Packet > > m_phyTxEndTrace
The trace source fired when a packet ends the transmission process on the medium.
TxMachineState m_txMachineState
The state of the Net Device transmit state machine.
void DoMpiReceive(Ptr< Packet > p)
Handler for MPI receive event.
void SetDataRate(DataRate bps)
Set the Data Rate used for transmission of packets.
uint32_t m_mtu
The Maximum Transmission Unit.
Ptr< Node > m_node
Node owning this NetDevice.
TracedCallback< Ptr< const Packet > > m_snifferTrace
A trace source that emulates a non-promiscuous protocol sniffer connected to the device.
bool SetMtu(const uint16_t mtu) override
TracedCallback< Ptr< const Packet > > m_macTxDropTrace
The trace source fired when packets coming into the "top" of the device at the L3/L2 transition are d...
NetDevice::PromiscReceiveCallback m_promiscCallback
Receive callback.
NetDevice::ReceiveCallback m_rxCallback
Receive callback.
void SetPromiscReceiveCallback(PromiscReceiveCallback cb) override
uint32_t m_ifIndex
Index of the interface.
Hold objects of type Ptr<T>.
Definition: pointer.h:37
Packet header for PPP.
Definition: ppp-header.h:49
void SetProtocol(uint16_t protocol)
Set the protocol type carried by this PPP packet.
Definition: ppp-header.cc:97
uint16_t GetProtocol() const
Get the protocol type carried by this PPP packet.
Definition: ppp-header.cc:103
static EventId Schedule(const Time &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
Definition: simulator.h:568
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:105
TimeWithUnit As(const Unit unit=Time::AUTO) const
Attach a unit to a Time, to facilitate output in a specific unit.
Definition: time.cc:417
@ S
second
Definition: nstime.h:116
AttributeValue implementation for Time.
Definition: nstime.h:1423
void ConnectWithoutContext(const CallbackBase &callback)
Append a Callback to the chain (without a context).
a unique identifier for an interface.
Definition: type-id.h:60
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:935
Hold an unsigned integer type.
Definition: uinteger.h:45
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Definition: assert.h:66
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Definition: assert.h:86
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:231
Ptr< const AttributeAccessor > MakeTimeAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Definition: nstime.h:1424
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:46
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:202
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition: log.h:282
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
void(* DataRate)(DataRate oldValue, DataRate newValue)
TracedValue callback signature for DataRate.
Definition: data-rate.h:328
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:46
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1336
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
address
Definition: first.py:40
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Ptr< const AttributeChecker > MakeTimeChecker(const Time min, const Time max)
Helper to make a Time checker with bounded range.
Definition: time.cc:535