A Discrete-Event Network Simulator
API
lr-wpan-helper.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  * Authors:
19  * Gary Pei <guangyu.pei@boeing.com>
20  * Tom Henderson <thomas.r.henderson@boeing.com>
21  */
22 #include "lr-wpan-helper.h"
23 #include <ns3/lr-wpan-csmaca.h>
24 #include <ns3/lr-wpan-error-model.h>
25 #include <ns3/lr-wpan-net-device.h>
26 #include <ns3/mobility-model.h>
27 #include <ns3/single-model-spectrum-channel.h>
28 #include <ns3/multi-model-spectrum-channel.h>
29 #include <ns3/propagation-loss-model.h>
30 #include <ns3/propagation-delay-model.h>
31 #include <ns3/log.h>
32 #include "ns3/names.h"
33 
34 namespace ns3 {
35 
36 NS_LOG_COMPONENT_DEFINE ("LrWpanHelper");
37 
44 static void
47  std::string context,
49 {
50  *stream->GetStream () << "t " << Simulator::Now ().As (Time::S) << " " << context << " " << *p << std::endl;
51 }
52 
58 static void
62 {
63  *stream->GetStream () << "t " << Simulator::Now ().As (Time::S) << " " << *p << std::endl;
64 }
65 
67 {
68  m_channel = CreateObject<SingleModelSpectrumChannel> ();
69 
70  Ptr<LogDistancePropagationLossModel> lossModel = CreateObject<LogDistancePropagationLossModel> ();
71  m_channel->AddPropagationLossModel (lossModel);
72 
73  Ptr<ConstantSpeedPropagationDelayModel> delayModel = CreateObject<ConstantSpeedPropagationDelayModel> ();
74  m_channel->SetPropagationDelayModel (delayModel);
75 }
76 
77 LrWpanHelper::LrWpanHelper (bool useMultiModelSpectrumChannel)
78 {
79  if (useMultiModelSpectrumChannel)
80  {
81  m_channel = CreateObject<MultiModelSpectrumChannel> ();
82  }
83  else
84  {
85  m_channel = CreateObject<SingleModelSpectrumChannel> ();
86  }
87  Ptr<LogDistancePropagationLossModel> lossModel = CreateObject<LogDistancePropagationLossModel> ();
88  m_channel->AddPropagationLossModel (lossModel);
89 
90  Ptr<ConstantSpeedPropagationDelayModel> delayModel = CreateObject<ConstantSpeedPropagationDelayModel> ();
91  m_channel->SetPropagationDelayModel (delayModel);
92 }
93 
95 {
96  m_channel->Dispose ();
97  m_channel = 0;
98 }
99 
100 void
102 {
105  LogComponentEnable ("LrWpanCsmaCa", LOG_LEVEL_ALL);
106  LogComponentEnable ("LrWpanErrorModel", LOG_LEVEL_ALL);
107  LogComponentEnable ("LrWpanInterferenceHelper", LOG_LEVEL_ALL);
108  LogComponentEnable ("LrWpanMac", LOG_LEVEL_ALL);
109  LogComponentEnable ("LrWpanNetDevice", LOG_LEVEL_ALL);
110  LogComponentEnable ("LrWpanPhy", LOG_LEVEL_ALL);
111  LogComponentEnable ("LrWpanSpectrumSignalParameters", LOG_LEVEL_ALL);
112  LogComponentEnable ("LrWpanSpectrumValueHelper", LOG_LEVEL_ALL);
113 }
114 
115 std::string
117 {
118  switch (e)
119  {
121  return std::string ("BUSY");
123  return std::string ("BUSY_RX");
125  return std::string ("BUSY_TX");
127  return std::string ("FORCE_TRX_OFF");
129  return std::string ("IDLE");
131  return std::string ("INVALID_PARAMETER");
133  return std::string ("RX_ON");
135  return std::string ("SUCCESS");
137  return std::string ("TRX_OFF");
139  return std::string ("TX_ON");
141  return std::string ("UNSUPPORTED_ATTRIBUTE");
143  return std::string ("READ_ONLY");
145  return std::string ("UNSPECIFIED");
146  default:
147  return std::string ("INVALID");
148  }
149 }
150 
151 std::string
153 {
154  switch (e)
155  {
156  case MAC_IDLE:
157  return std::string ("MAC_IDLE");
159  return std::string ("CHANNEL_ACCESS_FAILURE");
160  case CHANNEL_IDLE:
161  return std::string ("CHANNEL_IDLE");
162  case SET_PHY_TX_ON:
163  return std::string ("SET_PHY_TX_ON");
164  default:
165  return std::string ("INVALID");
166  }
167 }
168 
169 void
171 {
172  phy->SetMobility (m);
173 }
174 
177 {
179  for (NodeContainer::Iterator i = c.Begin (); i != c.End (); i++)
180  {
181  Ptr<Node> node = *i;
182 
183  Ptr<LrWpanNetDevice> netDevice = CreateObject<LrWpanNetDevice> ();
184  netDevice->SetChannel (m_channel);
185  node->AddDevice (netDevice);
186  netDevice->SetNode (node);
187  // \todo add the capability to change short address, extended
188  // address and panId. Right now they are hardcoded in LrWpanMac::LrWpanMac ()
189  devices.Add (netDevice);
190  }
191  return devices;
192 }
193 
194 
197 {
198  return m_channel;
199 }
200 
201 void
203 {
204  m_channel = channel;
205 }
206 
207 void
208 LrWpanHelper::SetChannel (std::string channelName)
209 {
210  Ptr<SpectrumChannel> channel = Names::Find<SpectrumChannel> (channelName);
211  m_channel = channel;
212 }
213 
214 
215 int64_t
217 {
218  int64_t currentStream = stream;
219  Ptr<NetDevice> netDevice;
220  for (NetDeviceContainer::Iterator i = c.Begin (); i != c.End (); ++i)
221  {
222  netDevice = (*i);
223  Ptr<LrWpanNetDevice> lrwpan = DynamicCast<LrWpanNetDevice> (netDevice);
224  if (lrwpan)
225  {
226  currentStream += lrwpan->AssignStreams (currentStream);
227  }
228  }
229  return (currentStream - stream);
230 }
231 
232 void
234 {
236  uint16_t id = 1;
237  uint8_t idBuf[2];
238 
239  for (NetDeviceContainer::Iterator i = c.Begin (); i != c.End (); i++)
240  {
241  Ptr<LrWpanNetDevice> device = DynamicCast<LrWpanNetDevice> (*i);
242  if (device)
243  {
244  idBuf[0] = (id >> 8) & 0xff;
245  idBuf[1] = (id >> 0) & 0xff;
247  address.CopyFrom (idBuf);
248 
249  device->GetMac ()->SetPanId (panId);
250  device->GetMac ()->SetShortAddress (address);
251  id++;
252  }
253  }
254  return;
255 }
256 
257 void
258 LrWpanHelper::AssociateToBeaconPan (NetDeviceContainer c, uint16_t panId, Mac16Address coor, uint8_t bcnOrd, uint8_t sfrmOrd)
259 {
261  uint16_t id = 1;
262  uint8_t idBuf[2];
264 
265  if (bcnOrd > 14)
266  {
267  NS_LOG_DEBUG("The Beacon Order must be an int between 0 and 14");
268  return;
269  }
270 
271 
272  if ((sfrmOrd > 14) || (sfrmOrd > bcnOrd))
273  {
274  NS_LOG_DEBUG("The Superframe Order must be an int between 0 and 14, and less or equal to Beacon Order");
275  return;
276  }
277 
278  for (NetDeviceContainer::Iterator i = c.Begin (); i != c.End (); i++)
279  {
280  Ptr<LrWpanNetDevice> device = DynamicCast<LrWpanNetDevice> (*i);
281  if (device)
282  {
283  idBuf[0] = (id >> 8) & 0xff;
284  idBuf[1] = (id >> 0) & 0xff;
285  address.CopyFrom (idBuf);
286 
287  device->GetMac ()->SetShortAddress (address);
288 
289  if (address == coor)
290  {
291  MlmeStartRequestParams params;
292  params.m_panCoor = true;
293  params.m_PanId = panId;
294  params.m_bcnOrd = bcnOrd;
295  params.m_sfrmOrd = sfrmOrd;
296 
297  Ptr<UniformRandomVariable> uniformRandomVariable = CreateObject<UniformRandomVariable> ();;
298  Time jitter = Time (MilliSeconds (uniformRandomVariable->GetInteger (0, 10)));
299 
301  device->GetMac (), params);
302  }
303  else
304  {
305  device->GetMac ()->SetPanId (panId);
306  device->GetMac ()->SetAssociatedCoor(coor);
307  }
308  id++;
309  }
310  }
311  return;
312 }
313 
319 static void
321 {
322  file->Write (Simulator::Now (), packet);
323 }
324 
325 void
326 LrWpanHelper::EnablePcapInternal (std::string prefix, Ptr<NetDevice> nd, bool promiscuous, bool explicitFilename)
327 {
328  NS_LOG_FUNCTION (this << prefix << nd << promiscuous << explicitFilename);
329  //
330  // All of the Pcap enable functions vector through here including the ones
331  // that are wandering through all of devices on perhaps all of the nodes in
332  // the system.
333  //
334 
335  // In the future, if we create different NetDevice types, we will
336  // have to switch on each type below and insert into the right
337  // NetDevice type
338  //
339  Ptr<LrWpanNetDevice> device = nd->GetObject<LrWpanNetDevice> ();
340  if (device == 0)
341  {
342  NS_LOG_INFO ("LrWpanHelper::EnablePcapInternal(): Device " << device << " not of type ns3::LrWpanNetDevice");
343  return;
344  }
345 
346  PcapHelper pcapHelper;
347 
348  std::string filename;
349  if (explicitFilename)
350  {
351  filename = prefix;
352  }
353  else
354  {
355  filename = pcapHelper.GetFilenameFromDevice (prefix, device);
356  }
357 
358  Ptr<PcapFileWrapper> file = pcapHelper.CreateFile (filename, std::ios::out,
360 
361  if (promiscuous == true)
362  {
363  device->GetMac ()->TraceConnectWithoutContext ("PromiscSniffer", MakeBoundCallback (&PcapSniffLrWpan, file));
364 
365  }
366  else
367  {
368  device->GetMac ()->TraceConnectWithoutContext ("Sniffer", MakeBoundCallback (&PcapSniffLrWpan, file));
369  }
370 }
371 
372 void
375  std::string prefix,
376  Ptr<NetDevice> nd,
377  bool explicitFilename)
378 {
379  uint32_t nodeid = nd->GetNode ()->GetId ();
380  uint32_t deviceid = nd->GetIfIndex ();
381  std::ostringstream oss;
382 
383  Ptr<LrWpanNetDevice> device = nd->GetObject<LrWpanNetDevice> ();
384  if (device == 0)
385  {
386  NS_LOG_INFO ("LrWpanHelper::EnableAsciiInternal(): Device " << device << " not of type ns3::LrWpanNetDevice");
387  return;
388  }
389 
390  //
391  // Our default trace sinks are going to use packet printing, so we have to
392  // make sure that is turned on.
393  //
395 
396  //
397  // If we are not provided an OutputStreamWrapper, we are expected to create
398  // one using the usual trace filename conventions and do a Hook*WithoutContext
399  // since there will be one file per context and therefore the context would
400  // be redundant.
401  //
402  if (stream == 0)
403  {
404  //
405  // Set up an output stream object to deal with private ofstream copy
406  // constructor and lifetime issues. Let the helper decide the actual
407  // name of the file given the prefix.
408  //
409  AsciiTraceHelper asciiTraceHelper;
410 
411  std::string filename;
412  if (explicitFilename)
413  {
414  filename = prefix;
415  }
416  else
417  {
418  filename = asciiTraceHelper.GetFilenameFromDevice (prefix, device);
419  }
420 
421  Ptr<OutputStreamWrapper> theStream = asciiTraceHelper.CreateFileStream (filename);
422 
423  // Ascii traces typically have "+", '-", "d", "r", and sometimes "t"
424  // The Mac and Phy objects have the trace sources for these
425  //
426 
427  asciiTraceHelper.HookDefaultReceiveSinkWithoutContext<LrWpanMac> (device->GetMac (), "MacRx", theStream);
428 
429  device->GetMac ()->TraceConnectWithoutContext ("MacTx", MakeBoundCallback (&AsciiLrWpanMacTransmitSinkWithoutContext, theStream));
430 
431  asciiTraceHelper.HookDefaultEnqueueSinkWithoutContext<LrWpanMac> (device->GetMac (), "MacTxEnqueue", theStream);
432  asciiTraceHelper.HookDefaultDequeueSinkWithoutContext<LrWpanMac> (device->GetMac (), "MacTxDequeue", theStream);
433  asciiTraceHelper.HookDefaultDropSinkWithoutContext<LrWpanMac> (device->GetMac (), "MacTxDrop", theStream);
434 
435  return;
436  }
437 
438  //
439  // If we are provided an OutputStreamWrapper, we are expected to use it, and
440  // to provide a context. We are free to come up with our own context if we
441  // want, and use the AsciiTraceHelper Hook*WithContext functions, but for
442  // compatibility and simplicity, we just use Config::Connect and let it deal
443  // with the context.
444  //
445  // Note that we are going to use the default trace sinks provided by the
446  // ascii trace helper. There is actually no AsciiTraceHelper in sight here,
447  // but the default trace sinks are actually publicly available static
448  // functions that are always there waiting for just such a case.
449  //
450 
451 
452  oss.str ("");
453  oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::LrWpanNetDevice/Mac/MacRx";
454  device->GetMac ()->TraceConnect ("MacRx", oss.str (), MakeBoundCallback (&AsciiTraceHelper::DefaultReceiveSinkWithContext, stream));
455 
456  oss.str ("");
457  oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::LrWpanNetDevice/Mac/MacTx";
458  device->GetMac ()->TraceConnect ("MacTx", oss.str (), MakeBoundCallback (&AsciiLrWpanMacTransmitSinkWithContext, stream));
459 
460  oss.str ("");
461  oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::LrWpanNetDevice/Mac/MacTxEnqueue";
462  device->GetMac ()->TraceConnect ("MacTxEnqueue", oss.str (), MakeBoundCallback (&AsciiTraceHelper::DefaultEnqueueSinkWithContext, stream));
463 
464  oss.str ("");
465  oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::LrWpanNetDevice/Mac/MacTxDequeue";
466  device->GetMac ()->TraceConnect ("MacTxDequeue", oss.str (), MakeBoundCallback (&AsciiTraceHelper::DefaultDequeueSinkWithContext, stream));
467 
468  oss.str ("");
469  oss << "/NodeList/" << nodeid << "/DeviceList/" << deviceid << "/$ns3::LrWpanNetDevice/Mac/MacTxDrop";
470  device->GetMac ()->TraceConnect ("MacTxDrop", oss.str (), MakeBoundCallback (&AsciiTraceHelper::DefaultDropSinkWithContext, stream));
471 
472 }
473 
474 } // namespace ns3
475 
ns3::NetDeviceContainer
holds a vector of ns3::NetDevice pointers
Definition: net-device-container.h:42
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:205
ns3::MlmeStartRequestParams::m_panCoor
bool m_panCoor
On true this device will become coordinator.
Definition: lr-wpan-mac.h:307
ns3::PcapHelper::CreateFile
Ptr< PcapFileWrapper > CreateFile(std::string filename, std::ios::openmode filemode, DataLinkType dataLinkType, uint32_t snapLen=std::numeric_limits< uint32_t >::max(), int32_t tzCorrection=0)
Create and initialize a pcap file.
Definition: trace-helper.cc:49
ns3::IEEE_802_15_4_PHY_INVALID_PARAMETER
@ IEEE_802_15_4_PHY_INVALID_PARAMETER
Definition: lr-wpan-phy.h:112
ns3::LrWpanHelper::AssociateToBeaconPan
void AssociateToBeaconPan(NetDeviceContainer c, uint16_t panId, Mac16Address coor, uint8_t bcnOrd, uint8_t sfrmOrd)
Associate the nodes to the same PAN and initiate beacon enabled mode.
Definition: lr-wpan-helper.cc:258
ns3::PcapHelper::DLT_IEEE802_15_4
@ DLT_IEEE802_15_4
Definition: trace-helper.h:59
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::LrWpanHelper::m_channel
Ptr< SpectrumChannel > m_channel
channel to be used for the devices
Definition: lr-wpan-helper.h:201
ns3::PcapHelper::GetFilenameFromDevice
std::string GetFilenameFromDevice(std::string prefix, Ptr< NetDevice > device, bool useObjectNames=true)
Let the pcap helper figure out a reasonable filename to use for a pcap file associated with a device.
Definition: trace-helper.cc:80
ns3::LrWpanHelper::SetChannel
void SetChannel(Ptr< SpectrumChannel > channel)
Set the channel associated to this helper.
Definition: lr-wpan-helper.cc:202
ns3::Mac16Address
This class can contain 16 bit addresses.
Definition: mac16-address.h:42
ns3::Packet::EnablePrinting
static void EnablePrinting(void)
Enable printing packets metadata.
Definition: packet.cc:572
ns3::PcapSniffLrWpan
static void PcapSniffLrWpan(Ptr< PcapFileWrapper > file, Ptr< const Packet > packet)
Write a packet in a PCAP file.
Definition: lr-wpan-helper.cc:320
ns3::IEEE_802_15_4_PHY_IDLE
@ IEEE_802_15_4_PHY_IDLE
Definition: lr-wpan-phy.h:111
ns3::LOG_LEVEL_ALL
@ LOG_LEVEL_ALL
Print everything.
Definition: log.h:116
third.channel
channel
Definition: third.py:92
ns3::LrWpanHelper::LrWpanHelper
LrWpanHelper(void)
Create a LrWpan helper in an empty state.
Definition: lr-wpan-helper.cc:66
ns3::LogComponentEnable
void LogComponentEnable(char const *name, enum LogLevel level)
Enable the logging output associated with that log component.
Definition: log.cc:361
ns3::LogComponentEnableAll
void LogComponentEnableAll(enum LogLevel level)
Enable the logging output for all registered log components.
Definition: log.cc:385
ns3::OutputStreamWrapper::GetStream
std::ostream * GetStream(void)
Return a pointer to an ostream previously set in the wrapper.
Definition: output-stream-wrapper.cc:58
ns3::AsciiTraceHelper::HookDefaultEnqueueSinkWithoutContext
void HookDefaultEnqueueSinkWithoutContext(Ptr< T > object, std::string traceName, Ptr< OutputStreamWrapper > stream)
Hook a trace source to the default enqueue operation trace sink that does not accept nor log a trace ...
Definition: trace-helper.h:462
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::MlmeStartRequestParams
MLME-START.request params.
Definition: lr-wpan-mac.h:289
ns3::LrWpanHelper::GetChannel
Ptr< SpectrumChannel > GetChannel(void)
Get the channel associated to this helper.
Definition: lr-wpan-helper.cc:196
ns3::Simulator::Schedule
static EventId Schedule(Time const &delay, FUNC f, Ts &&... args)
Schedule an event to expire after delay.
Definition: simulator.h:557
ns3::LrWpanHelper::EnableAsciiInternal
virtual void EnableAsciiInternal(Ptr< OutputStreamWrapper > stream, std::string prefix, Ptr< NetDevice > nd, bool explicitFilename)
Enable ascii trace output on the indicated net device.
Definition: lr-wpan-helper.cc:373
ns3::UniformRandomVariable::GetInteger
uint32_t GetInteger(uint32_t min, uint32_t max)
Get the next random value, as an unsigned integer in the specified range .
Definition: random-variable-stream.cc:193
first.devices
devices
Definition: first.py:39
ns3::MlmeStartRequestParams::m_sfrmOrd
uint8_t m_sfrmOrd
Superframe Order, indicates the length of the CAP in time slots.
Definition: lr-wpan-mac.h:306
ns3::IEEE_802_15_4_PHY_SUCCESS
@ IEEE_802_15_4_PHY_SUCCESS
Definition: lr-wpan-phy.h:114
ns3::IEEE_802_15_4_PHY_READ_ONLY
@ IEEE_802_15_4_PHY_READ_ONLY
Definition: lr-wpan-phy.h:118
ns3::IEEE_802_15_4_PHY_BUSY
@ IEEE_802_15_4_PHY_BUSY
Definition: lr-wpan-phy.h:107
ns3::IEEE_802_15_4_PHY_UNSUPPORTED_ATTRIBUTE
@ IEEE_802_15_4_PHY_UNSUPPORTED_ATTRIBUTE
Definition: lr-wpan-phy.h:117
ns3::LrWpanNetDevice::AssignStreams
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
Definition: lr-wpan-net-device.cc:531
ns3::Ptr< OutputStreamWrapper >
ns3::SET_PHY_TX_ON
@ SET_PHY_TX_ON
SET_PHY_TX_ON.
Definition: lr-wpan-mac.h:77
ns3::NetDeviceContainer::Begin
Iterator Begin(void) const
Get an iterator which refers to the first NetDevice in the container.
Definition: net-device-container.cc:46
ns3::LrWpanHelper::AddMobility
void AddMobility(Ptr< LrWpanPhy > phy, Ptr< MobilityModel > m)
Add mobility model to a physical device.
Definition: lr-wpan-helper.cc:170
ns3::IEEE_802_15_4_PHY_TRX_OFF
@ IEEE_802_15_4_PHY_TRX_OFF
Definition: lr-wpan-phy.h:115
ns3::NodeContainer::Begin
Iterator Begin(void) const
Get an iterator which refers to the first Node in the container.
Definition: node-container.cc:77
ns3::LrWpanMacState
LrWpanMacState
MAC states.
Definition: lr-wpan-mac.h:70
ns3::MlmeStartRequestParams::m_bcnOrd
uint8_t m_bcnOrd
Beacon Order, Used to calculate the beacon interval, a value of 15 indicates no periodic beacons will...
Definition: lr-wpan-mac.h:305
ns3::LrWpanMac::MlmeStartRequest
void MlmeStartRequest(MlmeStartRequestParams params)
IEEE 802.15.4-2006, section 7.1.14.1 MLME-START.request Request to allow a PAN coordinator to initiat...
Definition: lr-wpan-mac.cc:516
ns3::LrWpanHelper::Install
NetDeviceContainer Install(NodeContainer c)
Install a LrWpanNetDevice and the associated structures (e.g., channel) in the nodes.
Definition: lr-wpan-helper.cc:176
ns3::LrWpanHelper::~LrWpanHelper
virtual ~LrWpanHelper(void)
Definition: lr-wpan-helper.cc:94
ns3::MlmeStartRequestParams::m_PanId
uint16_t m_PanId
Pan Identifier used by the device.
Definition: lr-wpan-mac.h:301
NS_LOG_INFO
#define NS_LOG_INFO(msg)
Use NS_LOG to output a message of level LOG_INFO.
Definition: log.h:281
ns3::AsciiTraceHelper::CreateFileStream
Ptr< OutputStreamWrapper > CreateFileStream(std::string filename, std::ios::openmode filemode=std::ios::out)
Create and initialize an output stream object we'll use to write the traced bits.
Definition: trace-helper.cc:191
ns3::LrWpanNetDevice::SetNode
virtual void SetNode(Ptr< Node > node)
Definition: lr-wpan-net-device.cc:445
ns3::MilliSeconds
Time MilliSeconds(uint64_t value)
Construct a Time in the indicated unit.
Definition: nstime.h:1297
ns3::LrWpanPhyEnumeration
LrWpanPhyEnumeration
IEEE802.15.4-2006 PHY Emumerations Table 18 in section 6.2.3.
Definition: lr-wpan-phy.h:106
ns3::IEEE_802_15_4_PHY_TX_ON
@ IEEE_802_15_4_PHY_TX_ON
Definition: lr-wpan-phy.h:116
ns3::AsciiTraceHelper::HookDefaultReceiveSinkWithoutContext
void HookDefaultReceiveSinkWithoutContext(Ptr< T > object, std::string traceName, Ptr< OutputStreamWrapper > stream)
Hook a trace source to the default receive operation trace sink that does not accept nor log a trace ...
Definition: trace-helper.h:528
ns3::IEEE_802_15_4_PHY_RX_ON
@ IEEE_802_15_4_PHY_RX_ON
Definition: lr-wpan-phy.h:113
ns3::CHANNEL_ACCESS_FAILURE
@ CHANNEL_ACCESS_FAILURE
CHANNEL_ACCESS_FAILURE.
Definition: lr-wpan-mac.h:75
first.address
address
Definition: first.py:44
ns3::Time
Simulation virtual time values and global simulation resolution.
Definition: nstime.h:104
ns3::LrWpanHelper::LrWpanMacStatePrinter
static std::string LrWpanMacStatePrinter(LrWpanMacState e)
Transform the LrWpanMacState enumeration into a printable string.
Definition: lr-wpan-helper.cc:152
ns3::LrWpanHelper::EnableLogComponents
void EnableLogComponents(void)
Helper to enable all LrWpan log components with one statement.
Definition: lr-wpan-helper.cc:101
ns3::LrWpanHelper::LrWpanPhyEnumerationPrinter
static std::string LrWpanPhyEnumerationPrinter(LrWpanPhyEnumeration e)
Transform the LrWpanPhyEnumeration enumeration into a printable string.
Definition: lr-wpan-helper.cc:116
ns3::Node::AddDevice
uint32_t AddDevice(Ptr< NetDevice > device)
Associate a NetDevice to this node.
Definition: node.cc:130
ns3::IEEE_802_15_4_PHY_BUSY_TX
@ IEEE_802_15_4_PHY_BUSY_TX
Definition: lr-wpan-phy.h:109
ns3::PcapHelper
Manage pcap files for device models.
Definition: trace-helper.h:39
ns3::NetDeviceContainer::End
Iterator End(void) const
Get an iterator which indicates past-the-last NetDevice in the container.
Definition: net-device-container.cc:51
ns3::LrWpanNetDevice::SetChannel
void SetChannel(Ptr< SpectrumChannel > channel)
Set the channel to which the NetDevice, and therefore the PHY, should be attached to.
Definition: lr-wpan-net-device.cc:183
ns3::AsciiTraceHelper::DefaultReceiveSinkWithContext
static void DefaultReceiveSinkWithContext(Ptr< OutputStreamWrapper > file, std::string context, Ptr< const Packet > p)
Basic Receive default trace sink.
Definition: trace-helper.cc:394
ns3::NetDeviceContainer::Iterator
std::vector< Ptr< NetDevice > >::const_iterator Iterator
NetDevice container iterator.
Definition: net-device-container.h:45
ns3::AsciiTraceHelper
Manage ASCII trace files for device models.
Definition: trace-helper.h:163
ns3::LrWpanHelper::AssociateToPan
void AssociateToPan(NetDeviceContainer c, uint16_t panId)
Associate the nodes to the same PAN.
Definition: lr-wpan-helper.cc:233
ns3::NodeContainer::Iterator
std::vector< Ptr< Node > >::const_iterator Iterator
Node container iterator.
Definition: node-container.h:42
ns3::LOG_PREFIX_TIME
@ LOG_PREFIX_TIME
Prefix all trace prints with simulation time.
Definition: log.h:119
lr-wpan-helper.h
NS_LOG_DEBUG
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:273
ns3::AsciiTraceHelper::DefaultDequeueSinkWithContext
static void DefaultDequeueSinkWithContext(Ptr< OutputStreamWrapper > file, std::string context, Ptr< const Packet > p)
Basic Dequeue default trace sink.
Definition: trace-helper.cc:370
ns3::MakeBoundCallback
Callback< R > MakeBoundCallback(R(*fnPtr)(TX), ARG a1)
Make Callbacks with one bound argument.
Definition: callback.h:1703
ns3::LOG_PREFIX_FUNC
@ LOG_PREFIX_FUNC
Prefix all trace prints with function.
Definition: log.h:118
ns3::Time::S
@ S
second
Definition: nstime.h:115
ns3::LrWpanNetDevice
Network layer to device interface.
Definition: lr-wpan-net-device.h:50
ns3::MAC_IDLE
@ MAC_IDLE
MAC_IDLE.
Definition: lr-wpan-mac.h:71
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::NodeContainer
keep track of a set of node pointers.
Definition: node-container.h:39
ns3::AsciiTraceHelper::HookDefaultDropSinkWithoutContext
void HookDefaultDropSinkWithoutContext(Ptr< T > object, std::string traceName, Ptr< OutputStreamWrapper > stream)
Hook a trace source to the default drop operation trace sink that does not accept nor log a trace con...
Definition: trace-helper.h:484
ns3::IEEE_802_15_4_PHY_FORCE_TRX_OFF
@ IEEE_802_15_4_PHY_FORCE_TRX_OFF
Definition: lr-wpan-phy.h:110
ns3::NodeContainer::End
Iterator End(void) const
Get an iterator which indicates past-the-last Node in the container.
Definition: node-container.cc:82
ns3::AsciiTraceHelper::DefaultDropSinkWithContext
static void DefaultDropSinkWithContext(Ptr< OutputStreamWrapper > file, std::string context, Ptr< const Packet > p)
Basic Drop default trace sink.
Definition: trace-helper.cc:343
ns3::IEEE_802_15_4_PHY_BUSY_RX
@ IEEE_802_15_4_PHY_BUSY_RX
Definition: lr-wpan-phy.h:108
ns3::TracedValueCallback::Time
void(* Time)(Time oldValue, Time newValue)
TracedValue callback signature for Time.
Definition: nstime.h:813
ns3::AsciiTraceHelper::GetFilenameFromDevice
std::string GetFilenameFromDevice(std::string prefix, Ptr< NetDevice > device, bool useObjectNames=true)
Let the ascii trace helper figure out a reasonable filename to use for an ascii trace file associated...
Definition: trace-helper.cc:212
ns3::AsciiTraceHelper::DefaultEnqueueSinkWithContext
static void DefaultEnqueueSinkWithContext(Ptr< OutputStreamWrapper > file, std::string context, Ptr< const Packet > p)
Basic Enqueue default trace sink.
Definition: trace-helper.cc:317
ns3::IEEE_802_15_4_PHY_UNSPECIFIED
@ IEEE_802_15_4_PHY_UNSPECIFIED
Definition: lr-wpan-phy.h:119
ns3::AsciiLrWpanMacTransmitSinkWithoutContext
static void AsciiLrWpanMacTransmitSinkWithoutContext(Ptr< OutputStreamWrapper > stream, Ptr< const Packet > p)
Output an ascii line representing the Transmit event (without context)
Definition: lr-wpan-helper.cc:59
ns3::LrWpanMac
Class that implements the LR-WPAN MAC state machine.
Definition: lr-wpan-mac.h:449
ns3::LrWpanNetDevice::GetMac
Ptr< LrWpanMac > GetMac(void) const
Get the MAC used by this NetDevice.
Definition: lr-wpan-net-device.cc:192
create-module.file
file
Definition: create-module.py:634
ns3::CHANNEL_IDLE
@ CHANNEL_IDLE
CHANNEL_IDLE.
Definition: lr-wpan-mac.h:76
ns3::LrWpanHelper::EnablePcapInternal
virtual void EnablePcapInternal(std::string prefix, Ptr< NetDevice > nd, bool promiscuous, bool explicitFilename)
Enable pcap output on the indicated net device.
Definition: lr-wpan-helper.cc:326
ns3::AsciiLrWpanMacTransmitSinkWithContext
static void AsciiLrWpanMacTransmitSinkWithContext(Ptr< OutputStreamWrapper > stream, std::string context, Ptr< const Packet > p)
Output an ascii line representing the Transmit event (with context)
Definition: lr-wpan-helper.cc:45
third.phy
phy
Definition: third.py:93
ns3::LrWpanHelper::AssignStreams
int64_t AssignStreams(NetDeviceContainer c, int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model.
Definition: lr-wpan-helper.cc:216
ns3::AsciiTraceHelper::HookDefaultDequeueSinkWithoutContext
void HookDefaultDequeueSinkWithoutContext(Ptr< T > object, std::string traceName, Ptr< OutputStreamWrapper > stream)
Hook a trace source to the default dequeue operation trace sink that does not accept nor log a trace ...
Definition: trace-helper.h:506