A Discrete-Event Network Simulator
API
lr-wpan-csmaca.cc
Go to the documentation of this file.
1 /* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
2 /*
3  * Copyright (c) 2011 The Boeing Company
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:
19  * kwong yin <kwong-sang.yin@boeing.com>
20  * Sascha Alexander Jopen <jopen@cs.uni-bonn.de>
21  * Alberto Gallegos Ramonet <ramonet@fc.ritsumei.ac.jp>
22  */
23 
24 #include "lr-wpan-csmaca.h"
25 #include <ns3/random-variable-stream.h>
26 #include <ns3/simulator.h>
27 #include <ns3/log.h>
28 #include <algorithm>
29 
30 #undef NS_LOG_APPEND_CONTEXT
31 #define NS_LOG_APPEND_CONTEXT \
32  std::clog << "[address " << m_mac->GetShortAddress () << "] ";
33 
34 namespace ns3 {
35 
36 NS_LOG_COMPONENT_DEFINE ("LrWpanCsmaCa");
37 
38 NS_OBJECT_ENSURE_REGISTERED (LrWpanCsmaCa);
39 
40 TypeId
42 {
43  static TypeId tid = TypeId ("ns3::LrWpanCsmaCa")
44  .SetParent<Object> ()
45  .SetGroupName ("LrWpan")
46  .AddConstructor<LrWpanCsmaCa> ()
47  ;
48  return tid;
49 }
50 
52 {
53  // TODO-- make these into ns-3 attributes
54 
55  m_isSlotted = false;
56  m_NB = 0;
57  m_CW = 2;
58  m_macBattLifeExt = false;
59  m_macMinBE = 3;
60  m_macMaxBE = 5;
62  m_aUnitBackoffPeriod = 20; // symbols
63  m_random = CreateObject<UniformRandomVariable> ();
64  m_BE = m_macMinBE;
65  m_ccaRequestRunning = false;
67  m_coorDest = false;
68 }
69 
71 {
72  m_mac = 0;
73 }
74 
75 void
77 {
78  m_lrWpanMacStateCallback = MakeNullCallback <void, LrWpanMacState> ();
79  m_lrWpanMacTransCostCallback = MakeNullCallback <void, uint32_t> ();
80 
81  Cancel ();
82  m_mac = 0;
83 }
84 
85 void
87 {
88  m_mac = mac;
89 }
90 
93 {
94  return m_mac;
95 }
96 
97 void
99 {
100  NS_LOG_FUNCTION (this);
101  m_isSlotted = true;
102 }
103 
104 void
106 {
107  NS_LOG_FUNCTION (this);
108  m_isSlotted = false;
109 }
110 
111 bool
113 {
114  NS_LOG_FUNCTION (this);
115  return (m_isSlotted);
116 }
117 
118 bool
120 {
121  NS_LOG_FUNCTION (this);
122  return (!m_isSlotted);
123 }
124 
125 void
126 LrWpanCsmaCa::SetMacMinBE (uint8_t macMinBE)
127 {
128  NS_LOG_FUNCTION (this << macMinBE);
129  m_macMinBE = macMinBE;
130 }
131 
132 uint8_t
134 {
135  NS_LOG_FUNCTION (this);
136  return m_macMinBE;
137 }
138 
139 void
140 LrWpanCsmaCa::SetMacMaxBE (uint8_t macMaxBE)
141 {
142  NS_LOG_FUNCTION (this << macMaxBE);
143  m_macMinBE = macMaxBE;
144 }
145 
146 uint8_t
148 {
149  NS_LOG_FUNCTION (this);
150  return m_macMaxBE;
151 }
152 
153 void
154 LrWpanCsmaCa::SetMacMaxCSMABackoffs (uint8_t macMaxCSMABackoffs)
155 {
156  NS_LOG_FUNCTION (this << macMaxCSMABackoffs);
157  m_macMaxCSMABackoffs = macMaxCSMABackoffs;
158 }
159 
160 uint8_t
162 {
163  NS_LOG_FUNCTION (this);
164  return m_macMaxCSMABackoffs;
165 }
166 
167 void
168 LrWpanCsmaCa::SetUnitBackoffPeriod (uint64_t unitBackoffPeriod)
169 {
170  NS_LOG_FUNCTION (this << unitBackoffPeriod);
171  m_aUnitBackoffPeriod = unitBackoffPeriod;
172 }
173 
174 uint64_t
176 {
177  NS_LOG_FUNCTION (this);
178  return m_aUnitBackoffPeriod;
179 }
180 
181 
182 Time
184 {
185  NS_LOG_FUNCTION (this);
186 
187  // The reference for the beginning of the SUPERFRAME (the active period) changes depending
188  // on the data packet being sent from the Coordinator/outgoing frame (Tx beacon time reference)
189  // or other device/incoming frame (Rx beacon time reference ).
190 
191  Time elapsedSuperframe; // (i.e The beacon + the elapsed CAP)
192  Time currentTime;
193  double symbolsToBoundary;
194  Time nextBoundary;
195  uint64_t elapsedSuperframeSymbols;
196  uint64_t symbolRate;
197  Time timeAtBoundary;
198  [[maybe_unused]] Time elapsedCap;
199  [[maybe_unused]] Time beaconTime;
200 
201 
202  currentTime = Simulator::Now ();
203  symbolRate = (uint64_t) m_mac->GetPhy ()->GetDataOrSymbolRate (false); //symbols per second
204 
205  if (m_coorDest)
206  {
207  // Take the Incoming Frame Reference
208  elapsedSuperframe = currentTime - m_mac->m_macBeaconRxTime;
209 
210  beaconTime = Seconds ((double) m_mac->m_rxBeaconSymbols / symbolRate);
211  elapsedCap = elapsedSuperframe - beaconTime;
212  NS_LOG_DEBUG ("Elapsed incoming CAP symbols: " << (elapsedCap.GetSeconds () * symbolRate) << " (" << elapsedCap.As (Time::S) << ")");
213  }
214  else
215  {
216  // Take the Outgoing Frame Reference
217  elapsedSuperframe = currentTime - m_mac->m_macBeaconTxTime;
218  }
219 
220  // get a close value to the the boundary in symbols
221  elapsedSuperframeSymbols = elapsedSuperframe.GetSeconds () * symbolRate;
222  symbolsToBoundary = m_aUnitBackoffPeriod - std::fmod ((double) elapsedSuperframeSymbols,m_aUnitBackoffPeriod);
223 
224  timeAtBoundary = Seconds ((double)(elapsedSuperframeSymbols + symbolsToBoundary) / symbolRate);
225 
226  // get the exact time boundary
227  nextBoundary = timeAtBoundary - elapsedSuperframe;
228 
229  NS_LOG_DEBUG ("Elapsed Superframe symbols: " << elapsedSuperframeSymbols << " ("
230  << elapsedSuperframe.As (Time::S) << ")");
231 
232  NS_LOG_DEBUG ("Next backoff period boundary in approx. " << nextBoundary.GetSeconds () * symbolRate << " symbols ("
233  << nextBoundary.As (Time::S) << ")");
234 
235  return nextBoundary;
236 
237 }
238 
239 
240 void
242 {
243  NS_LOG_FUNCTION (this);
244  m_NB = 0;
245  if (IsSlottedCsmaCa ())
246  {
247  // TODO: Check if the current PHY is using the Japanese band 950 Mhz:
248  // (IEEE_802_15_4_950MHZ_BPSK and IEEE_802_15_4_950MHZ_2GFSK)
249  // if in use, m_CW = 1.
250  // Currently 950 Mhz band PHYs are not supported in ns-3.
251  // To know the current used PHY, making the method for GetPhy()->GetMyPhyOption()
252  // public is necessary. Alternatively, the current PHY used
253  // can be known using phyCurrentPage variable.
254 
255  m_CW = 2;
256 
257  if (m_macBattLifeExt)
258  {
259  m_BE = std::min (static_cast<uint8_t> (2), m_macMinBE);
260  }
261  else
262  {
263  m_BE = m_macMinBE;
264  }
265 
266  // m_coorDest to decide between incoming and outgoing superframes times
267  m_coorDest = m_mac->isCoordDest ();
268 
269  // Locate backoff period boundary. (i.e. a time delay to align with the next backoff period boundary)
270  Time backoffBoundary = GetTimeToNextSlot ();
272 
273  }
274  else
275  {
276  m_BE = m_macMinBE;
278  }
279 }
280 
281 void
283 {
287 }
288 
289 
290 
291 void
293 {
294  NS_LOG_FUNCTION (this);
295 
296  uint64_t upperBound = (uint64_t) pow (2, m_BE) - 1;
297  Time randomBackoff;
298  uint64_t symbolRate;
299  Time timeLeftInCap;
300 
301  symbolRate = (uint64_t) m_mac->GetPhy ()->GetDataOrSymbolRate (false); //symbols per second
302 
303  // We should not recalculate the random backoffPeriods if we are in a slotted CSMA-CA and the
304  // transmission was previously deferred (m_randomBackoffPeriods != 0)
306  {
307  m_randomBackoffPeriodsLeft = (uint64_t)m_random->GetValue (0, upperBound + 1);
308  }
309 
310  randomBackoff = Seconds ((double) (m_randomBackoffPeriodsLeft * GetUnitBackoffPeriod ()) / symbolRate);
311 
312  if (IsUnSlottedCsmaCa ())
313  {
314  NS_LOG_DEBUG ("Unslotted CSMA-CA: requesting CCA after backoff of " << m_randomBackoffPeriodsLeft <<
315  " periods (" << randomBackoff.As (Time::S) << ")");
317  }
318  else
319  {
320  // We must make sure there is enough time left in the CAP, otherwise we continue in
321  // the CAP of the next superframe after the transmission/reception of the beacon (and the IFS)
322  timeLeftInCap = GetTimeLeftInCap ();
323 
324  NS_LOG_DEBUG ("Slotted CSMA-CA: proceeding after random backoff of " << m_randomBackoffPeriodsLeft <<
325  " periods (" << (randomBackoff.GetSeconds () * symbolRate) << " symbols or " << randomBackoff.As (Time::S) << ")");
326 
327 
328 
329 
330  NS_LOG_DEBUG ("Backoff periods left in CAP: " << ((timeLeftInCap.GetSeconds () * symbolRate) / m_aUnitBackoffPeriod) << " ("
331  << (timeLeftInCap.GetSeconds () * symbolRate) << " symbols or "
332  << timeLeftInCap.As (Time::S) << ")");
333 
334 
335  if (randomBackoff > timeLeftInCap)
336  {
337  uint64_t usedBackoffs = (double)(timeLeftInCap.GetSeconds () * symbolRate) / m_aUnitBackoffPeriod;
338  m_randomBackoffPeriodsLeft -= usedBackoffs;
339  NS_LOG_DEBUG ("No time in CAP to complete backoff delay, deferring to the next CAP");
341  }
342  else
343  {
345  }
346 
347  }
348 }
349 
350 
351 Time
353 {
354  Time currentTime;
355  uint64_t capSymbols;
356  Time endCapTime;
357  uint64_t activeSlot;
358  uint64_t symbolRate;
359  Time rxBeaconTime;
360 
361 
362  // At this point, the currentTime should be aligned on a backoff period boundary
363  currentTime = Simulator::Now ();
364  symbolRate = (uint64_t) m_mac->GetPhy ()->GetDataOrSymbolRate (false); //symbols per second
365 
366 
367  if (m_coorDest)
368  { // Take Incoming frame reference
369  activeSlot = m_mac->m_incomingSuperframeDuration / 16;
370  capSymbols = activeSlot * (m_mac->m_incomingFnlCapSlot + 1);
371  endCapTime = m_mac->m_macBeaconRxTime +
372  Seconds ((double) capSymbols / symbolRate);
373  }
374  else
375  { // Take Outgoing frame reference
376  activeSlot = m_mac->m_superframeDuration / 16;
377  capSymbols = activeSlot * (m_mac->m_fnlCapSlot + 1);
378  endCapTime = m_mac->m_macBeaconTxTime +
379  Seconds ((double) capSymbols / symbolRate);
380  }
381 
382  return (endCapTime - currentTime);
383 }
384 
385 
386 void
388 {
389  NS_LOG_FUNCTION (this);
390 
391  Time timeLeftInCap;
392  uint16_t ccaSymbols;
393  uint32_t transactionSymbols;
394  Time transactionTime;
395  uint64_t symbolRate;
396 
397  ccaSymbols = 0;
399  symbolRate = (uint64_t) m_mac->GetPhy ()->GetDataOrSymbolRate (false);
400  timeLeftInCap = GetTimeLeftInCap ();
401 
402 
403  // TODO: On the 950 Mhz Band (Japanese Band)
404  // only a single CCA check is performed;
405  // the CCA check duration time is:
406  //
407  // CCA symbols = phyCCADuration * m_CW (1)
408  // other PHYs:
409  // CCA symbols = 8 * m_CW(2)
410  //
411  // note: phyCCADuration & 950Mhz band PHYs are
412  // not currently implemented in ns-3.
413  ccaSymbols += 8 * m_CW;
414 
415  // The MAC sublayer shall proceed if the remaining CSMA-CA algorithm steps
416  // can be completed before the end of the CAP.
417  // See IEEE 802.15.4-2011 (Sections 5.1.1.1 and 5.1.1.4)
418  // Transaction = 2 CCA + frame transmission (SHR+PHR+PPDU) + turnaroudtime*2 (Rx->Tx & Tx->Rx) + IFS (LIFS or SIFS) and Ack time (if ack flag true)
419 
420  transactionSymbols = ccaSymbols + m_mac->GetTxPacketSymbols ();
421 
422  if (m_mac->isTxAckReq ())
423  {
424  NS_LOG_DEBUG ("ACK duration symbols: " << m_mac->GetMacAckWaitDuration ());
425  transactionSymbols += m_mac->GetMacAckWaitDuration ();
426  }
427  else
428  {
429  //time the PHY takes to switch from Rx to Tx and Tx to Rx
430  transactionSymbols += (m_mac->GetPhy ()->aTurnaroundTime *2);
431  }
432  transactionSymbols += m_mac->GetIfsSize ();
433 
434  // Report the transaction cost
436  {
437  m_lrWpanMacTransCostCallback (transactionSymbols);
438  }
439 
440  transactionTime = Seconds ((double) transactionSymbols / symbolRate);
441  NS_LOG_DEBUG ("Total required transaction: " << transactionSymbols << " symbols (" << transactionTime.As (Time::S) << ")");
442 
443  if (transactionTime > timeLeftInCap)
444  {
445  NS_LOG_DEBUG ("Transaction of " << transactionSymbols << " symbols " <<
446  "cannot be completed in CAP, deferring transmission to the next CAP");
447 
448 
449 
450  NS_LOG_DEBUG ("Symbols left in CAP: " << (timeLeftInCap.GetSeconds () * symbolRate) <<
451  " (" << timeLeftInCap.As (Time::S) << ")");
452 
454  }
455  else
456  {
458  }
459 
460 }
461 
462 void
464 {
465  NS_LOG_FUNCTION (this);
466  m_ccaRequestRunning = true;
467  m_mac->GetPhy ()->PlmeCcaRequest ();
468 }
469 
470 void
472 {
473  NS_LOG_FUNCTION (this);
475 }
476 
477 void
479 {
480  NS_LOG_FUNCTION (this << status);
481 
482  // Only react on this event, if we are actually waiting for a CCA.
483  // If the CSMA algorithm was canceled, we could still receive this event from
484  // the PHY. In this case we ignore the event.
486  {
487  m_ccaRequestRunning = false;
488  if (status == IEEE_802_15_4_PHY_IDLE)
489  {
490  if (IsSlottedCsmaCa ())
491  {
492  m_CW--;
493  if (m_CW == 0)
494  {
495  // inform MAC channel is idle
497  {
498  NS_LOG_LOGIC ("Notifying MAC of idle channel");
500  }
501  }
502  else
503  {
504  NS_LOG_LOGIC ("Perform CCA again, m_CW = " << m_CW);
505  m_requestCcaEvent = Simulator::ScheduleNow (&LrWpanCsmaCa::RequestCCA, this); // Perform CCA again
506  }
507  }
508  else
509  {
510  // inform MAC, channel is idle
512  {
513  NS_LOG_LOGIC ("Notifying MAC of idle channel");
515  }
516  }
517  }
518  else
519  {
520  if (IsSlottedCsmaCa ())
521  {
522  m_CW = 2;
523  }
524  m_BE = std::min (static_cast<uint16_t> (m_BE + 1), static_cast<uint16_t> (m_macMaxBE));
525  m_NB++;
527  {
528  // no channel found so cannot send pkt
529  NS_LOG_DEBUG ("Channel access failure");
531  {
532  NS_LOG_LOGIC ("Notifying MAC of Channel access failure");
534  }
535  return;
536  }
537  else
538  {
539  NS_LOG_DEBUG ("Perform another backoff; m_NB = " << static_cast<uint16_t> (m_NB));
540  m_randomBackoffEvent = Simulator::ScheduleNow (&LrWpanCsmaCa::RandomBackoffDelay, this); //Perform another backoff (step 2)
541  }
542  }
543  }
544 }
545 
546 
547 void
549 {
550  NS_LOG_FUNCTION (this);
552 }
553 
554 
555 void
557 {
558  NS_LOG_FUNCTION (this);
560 }
561 
562 void
563 LrWpanCsmaCa::SetBatteryLifeExtension (bool batteryLifeExtension)
564 {
565  m_macBattLifeExt = batteryLifeExtension;
566 }
567 
568 
569 int64_t
571 {
572  NS_LOG_FUNCTION (this);
573  m_random->SetStream (stream);
574  return 1;
575 }
576 
577 uint8_t
579 {
580  return m_NB;
581 }
582 
583 bool
585 {
586  return m_macBattLifeExt;
587 }
588 
589 } //namespace ns3
#define min(a, b)
Definition: 80211b.c:42
bool IsNull(void) const
Check for null implementation.
Definition: callback.h:1386
void Cancel(void)
This method is syntactic sugar for the ns3::Simulator::Cancel method.
Definition: event-id.cc:53
This class is a helper for the LrWpanMac to manage the Csma/CA state machine according to IEEE 802....
static TypeId GetTypeId(void)
Get the type ID.
bool GetBatteryLifeExtension(void)
Get the value of the Battery Life Extension.
uint64_t m_aUnitBackoffPeriod
Number of symbols per CSMA/CA time unit, default 20 symbols.
Ptr< LrWpanMac > m_mac
The MAC instance for which this CSMA/CA implemenation is configured.
void SetBatteryLifeExtension(bool batteryLifeExtension)
Set the value of the Battery Life Extension.
void PlmeCcaConfirm(LrWpanPhyEnumeration status)
IEEE 802.15.4-2006 section 6.2.2.2 PLME-CCA.confirm status.
void RandomBackoffDelay(void)
In step 2 of the CSMA-CA, perform a random backoff in the range of 0 to 2^BE -1.
uint8_t GetMacMinBE(void) const
Get the minimum backoff exponent value.
bool m_isSlotted
Beacon-enabled slotted or nonbeacon-enabled unslotted CSMA-CA.
uint8_t m_BE
Backoff exponent.
EventId m_canProceedEvent
Scheduler event for checking if we can complete the transmission before the end of the CAP.
EventId m_randomBackoffEvent
Scheduler event for the start of the next random backoff/slot.
LrWpanCsmaCa(void)
Default constructor.
void SetMac(Ptr< LrWpanMac > mac)
Set the MAC to which this CSMA/CA implementation is attached to.
LrWpanMacStateCallback m_lrWpanMacStateCallback
The callback to inform the configured MAC of the CSMA/CA result.
void SetUnSlottedCsmaCa(void)
Configure for the use of the unslotted CSMA/CA version.
uint64_t GetUnitBackoffPeriod(void) const
Get the number of symbols forming the basic time period used by the CSMA-CA algorithm.
void Start(void)
Start CSMA-CA algorithm (step 1), initialize NB, BE for both slotted and unslotted CSMA-CA.
LrWpanMacTransCostCallback m_lrWpanMacTransCostCallback
The callback to inform the cost of a transaction in slotted CSMA-CA.
uint8_t GetMacMaxCSMABackoffs(void) const
Get the maximum number of backoffs.
EventId m_requestCcaEvent
Scheduler event when to start the CCA after a random backoff.
bool m_coorDest
Indicates whether the CSMA procedure is targeted for a message to be sent to the coordinator.
void SetLrWpanMacTransCostCallback(LrWpanMacTransCostCallback trans)
Set the callback function to report a transaction cost in slotted CSMA-CA.
bool IsUnSlottedCsmaCa(void) const
Check if the unslotted CSMA/CA version is being used.
void Cancel(void)
Cancel CSMA-CA algorithm.
void SetMacMaxBE(uint8_t macMaxBE)
Set the maximum backoff exponent value.
uint8_t m_macMaxBE
Maximum backoff exponent.
Ptr< LrWpanMac > GetMac(void) const
Get the MAC to which this CSMA/CA implementation is attached to.
void SetMacMinBE(uint8_t macMinBE)
Set the minimum backoff exponent value.
uint8_t m_CW
Contention window length (used in slotted ver only).
uint8_t m_macMinBE
Minimum backoff exponent.
bool IsSlottedCsmaCa(void) const
Check if the slotted CSMA/CA version is being used.
uint8_t GetNB(void)
Get the number of CSMA retries.
void SetUnitBackoffPeriod(uint64_t unitBackoffPeriod)
Set the number of symbols forming the basic time period used by the CSMA-CA algorithm.
bool m_macBattLifeExt
Battery Life Extension.
void CanProceed(void)
In the slotted CSMA-CA, after random backoff, determine if the remaining CSMA-CA operation can procee...
void DeferCsmaTimeout(void)
The CSMA algorithm call this function at the end of the CAP to return the MAC state back to to IDLE a...
EventId m_endCapEvent
Scheduler event for the end of the current CAP.
virtual ~LrWpanCsmaCa(void)
uint64_t m_randomBackoffPeriodsLeft
Count the number of remaining random backoff periods left to delay.
Time GetTimeLeftInCap()
Get the time left in the CAP portion of the Outgoing or Incoming superframe.
virtual void DoDispose(void)
Destructor implementation.
bool m_ccaRequestRunning
Flag indicating that the PHY is currently running a CCA.
void RequestCCA(void)
Request the Phy to perform CCA (Step 3)
void SetLrWpanMacStateCallback(LrWpanMacStateCallback macState)
Set the callback function to the MAC.
uint8_t GetMacMaxBE(void) const
Get the maximum backoff exponent value.
void SetSlottedCsmaCa(void)
Configure for the use of the slotted CSMA/CA version.
uint8_t m_NB
Number of backoffs for the current transmission.
Ptr< UniformRandomVariable > m_random
Uniform random variable stream.
void SetMacMaxCSMABackoffs(uint8_t macMaxCSMABackoffs)
Set the maximum number of backoffs.
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
Time GetTimeToNextSlot(void) const
Locates the time to the next backoff period boundary in the SUPERFRAME and returns the amount of time...
uint8_t m_macMaxCSMABackoffs
Maximum number of backoffs.
A base class which provides memory management and object aggregation.
Definition: object.h:88
Smart pointer class similar to boost::intrusive_ptr.
Definition: ptr.h:74
void SetStream(int64_t stream)
Specifies the stream number for the RngStream.
static EventId Schedule(Time const &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
Definition: simulator.h:556
static EventId ScheduleNow(FUNC f, Ts &&... args)
Schedule an event to expire Now.
Definition: simulator.h:587
static Time Now(void)
Return the current simulation virtual time.
Definition: simulator.cc:195
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:103
double GetSeconds(void) const
Get an approximation of the time stored in this instance in the indicated unit.
Definition: nstime.h:379
@ S
second
Definition: nstime.h:114
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:418
a unique identifier for an interface.
Definition: type-id.h:59
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:922
double GetValue(double min, double max)
Get the next random value, as a double in the specified range .
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:205
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:273
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
Definition: log.h:289
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
LrWpanPhyEnumeration
IEEE802.15.4-2006 PHY Emumerations Table 18 in section 6.2.3.
Definition: lr-wpan-phy.h:106
@ CHANNEL_ACCESS_FAILURE
CHANNEL_ACCESS_FAILURE.
Definition: lr-wpan-mac.h:75
@ MAC_CSMA_DEFERRED
MAC_CSMA_DEFERRED.
Definition: lr-wpan-mac.h:80
@ CHANNEL_IDLE
CHANNEL_IDLE.
Definition: lr-wpan-mac.h:76
@ IEEE_802_15_4_PHY_IDLE
Definition: lr-wpan-phy.h:111
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:45
Time Seconds(double value)
Construct a Time in the indicated unit.
Definition: nstime.h:1244
Every class exported by the ns3 library is enclosed in the ns3 namespace.
mac
Definition: third.py:99