A Discrete-Event Network Simulator
API
wave-net-device.cc
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2005,2006 INRIA
3  * This program is free software; you can redistribute it and/or modify
4  * it under the terms of the GNU General Public License version 2 as
5  * published by the Free Software Foundation;
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software
14  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15  *
16  * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
17  * Junling Bu <linlinjavaer@gmail.com>
18  */
19 #include "wave-net-device.h"
20 
21 #include "higher-tx-tag.h"
22 
23 #include "ns3/channel.h"
24 #include "ns3/llc-snap-header.h"
25 #include "ns3/log.h"
26 #include "ns3/node.h"
27 #include "ns3/object-map.h"
28 #include "ns3/object-vector.h"
29 #include "ns3/socket.h"
30 #include "ns3/wifi-phy.h"
31 
32 #include <algorithm>
33 
34 namespace ns3
35 {
36 
37 NS_LOG_COMPONENT_DEFINE("WaveNetDevice");
38 
39 NS_OBJECT_ENSURE_REGISTERED(WaveNetDevice);
40 
41 TypeId
43 {
44  static TypeId tid =
45  TypeId("ns3::WaveNetDevice")
47  .SetGroupName("Wave")
48  .AddConstructor<WaveNetDevice>()
49  .AddAttribute("Mtu",
50  "The MAC-level Maximum Transmission Unit",
53  MakeUintegerChecker<uint16_t>(1, MAX_MSDU_SIZE - LLC_SNAP_HEADER_LENGTH))
54  .AddAttribute("Channel",
55  "The channel attached to this device",
56  PointerValue(),
58  MakePointerChecker<Channel>())
59  .AddAttribute("PhyEntities",
60  "The PHY entities attached to this device.",
63  MakeObjectVectorChecker<WifiPhy>())
64  .AddAttribute("MacEntities",
65  "The MAC layer attached to this device.",
68  MakeObjectMapChecker<OcbWifiMac>())
69  .AddAttribute("ChannelScheduler",
70  "The channel scheduler attached to this device.",
71  PointerValue(),
74  MakePointerChecker<ChannelScheduler>())
75  .AddAttribute("ChannelManager",
76  "The channel manager attached to this device.",
77  PointerValue(),
80  MakePointerChecker<ChannelManager>())
81  .AddAttribute("ChannelCoordinator",
82  "The channel coordinator attached to this device.",
83  PointerValue(),
86  MakePointerChecker<ChannelCoordinator>())
87  .AddAttribute(
88  "VsaManager",
89  "The VSA manager attached to this device.",
90  PointerValue(),
92  MakePointerChecker<VsaManager>());
93  return tid;
94 }
95 
97  : m_txProfile(nullptr)
98 {
99  NS_LOG_FUNCTION(this);
100 }
101 
103 {
104  NS_LOG_FUNCTION(this);
105 }
106 
107 void
109 {
110  NS_LOG_FUNCTION(this);
111  if (m_txProfile != nullptr)
112  {
113  delete m_txProfile;
114  m_txProfile = nullptr;
115  }
116  for (PhyEntitiesI i = m_phyEntities.begin(); i != m_phyEntities.end(); ++i)
117  {
118  Ptr<WifiPhy> phy = (*i);
119  phy->Dispose();
120  }
121  m_phyEntities.clear();
122  for (MacEntitiesI i = m_macEntities.begin(); i != m_macEntities.end(); ++i)
123  {
124  Ptr<OcbWifiMac> mac = i->second;
125  Ptr<WifiRemoteStationManager> stationManager = mac->GetWifiRemoteStationManager();
126  stationManager->Dispose();
127  mac->Dispose();
128  }
129  m_macEntities.clear();
130  m_phyEntities.clear();
132  m_channelManager->Dispose();
133  m_channelScheduler->Dispose();
134  m_vsaManager->Dispose();
135  m_channelCoordinator = nullptr;
136  m_channelManager = nullptr;
137  m_channelScheduler = nullptr;
138  m_vsaManager = nullptr;
139  // chain up.
141 }
142 
143 void
145 {
146  NS_LOG_FUNCTION(this);
147  if (m_phyEntities.empty())
148  {
149  NS_FATAL_ERROR("there is no PHY entity in this WAVE device");
150  }
151  for (PhyEntitiesI i = m_phyEntities.begin(); i != m_phyEntities.end(); ++i)
152  {
153  Ptr<WifiPhy> phy = (*i);
154  phy->Initialize();
155  }
156  if (m_macEntities.empty())
157  {
158  NS_FATAL_ERROR("there is no MAC entity in this WAVE device");
159  }
160  for (MacEntitiesI i = m_macEntities.begin(); i != m_macEntities.end(); ++i)
161  {
162  Ptr<OcbWifiMac> mac = i->second;
163  mac->SetForwardUpCallback(MakeCallback(&WaveNetDevice::ForwardUp, this));
164  // Make each MAC entity in sleep mode.
165  mac->Suspend();
166  mac->Initialize();
167 
168  Ptr<WifiRemoteStationManager> stationManager = mac->GetWifiRemoteStationManager();
169  // Currently PHY is not attached to MAC and will be dynamically attached and unattached to
170  // MAC latter, however WifiRemoteStationManager in the MAC shall know something in the PHY
171  // such as supported data rates. Since these information can be treated as same when same
172  // PHY devices are added, here we force all of WifiRemoteStationManagers in multiple MAC
173  // entities only associate with single PHY device even there may be multiple PHY entities.
174  // This approach may be strange but can work fine.
175  stationManager->SetupPhy(m_phyEntities[0]);
176  stationManager->Initialize();
177  }
178  m_channelScheduler->SetWaveNetDevice(this);
179  m_vsaManager->SetWaveNetDevice(this);
180  m_channelScheduler->Initialize();
182  m_channelManager->Initialize();
183  m_vsaManager->Initialize();
185 }
186 
187 void
188 WaveNetDevice::AddMac(uint32_t channelNumber, Ptr<OcbWifiMac> mac)
189 {
190  NS_LOG_FUNCTION(this << channelNumber << mac);
191  if (!ChannelManager::IsWaveChannel(channelNumber))
192  {
193  NS_FATAL_ERROR("The channel " << channelNumber << " is not a valid WAVE channel number");
194  }
195  if (m_macEntities.find(channelNumber) != m_macEntities.end())
196  {
197  NS_FATAL_ERROR("The MAC entity for channel " << channelNumber << " already exists.");
198  }
199  m_macEntities.insert(std::make_pair(channelNumber, mac));
200 }
201 
203 WaveNetDevice::GetMac(uint32_t channelNumber) const
204 {
205  NS_LOG_FUNCTION(this << channelNumber);
206  MacEntitiesI i = m_macEntities.find(channelNumber);
207  if (i == m_macEntities.end())
208  {
209  NS_FATAL_ERROR("there is no available MAC entity for channel " << channelNumber);
210  }
211  return i->second;
212 }
213 
214 std::map<uint32_t, Ptr<OcbWifiMac>>
216 {
217  NS_LOG_FUNCTION(this);
218  return m_macEntities;
219 }
220 
221 void
223 {
224  NS_LOG_FUNCTION(this << phy);
225  if (std::find(m_phyEntities.begin(), m_phyEntities.end(), phy) != m_phyEntities.end())
226  {
227  NS_FATAL_ERROR("This PHY entity is already inserted");
228  }
229  m_phyEntities.push_back(phy);
230 }
231 
233 WaveNetDevice::GetPhy(uint8_t index) const
234 {
235  NS_LOG_FUNCTION(this << +index);
236  return m_phyEntities.at(index);
237 }
238 
239 const std::vector<Ptr<WifiPhy>>&
241 {
242  NS_LOG_FUNCTION(this);
243  return m_phyEntities;
244 }
245 
246 bool
248 {
249  NS_LOG_FUNCTION(this << &vsaInfo);
250  if (!IsAvailableChannel(vsaInfo.channelNumber))
251  {
252  return false;
253  }
254  if (!m_channelScheduler->IsChannelAccessAssigned(vsaInfo.channelNumber))
255  {
256  NS_LOG_DEBUG("there is no channel access assigned for channel " << vsaInfo.channelNumber);
257  return false;
258  }
259  if (!vsaInfo.vsc)
260  {
261  NS_LOG_DEBUG("vendor specific information shall not be null");
262  return false;
263  }
264  if (vsaInfo.oi.IsNull() && vsaInfo.managementId >= 16)
265  {
266  NS_LOG_DEBUG("when organization identifier is not set, management ID "
267  "shall be in range from 0 to 15");
268  return false;
269  }
270 
271  m_vsaManager->SendVsa(vsaInfo);
272  return true;
273 }
274 
275 bool
276 WaveNetDevice::StopVsa(uint32_t channelNumber)
277 {
278  NS_LOG_FUNCTION(this << channelNumber);
279  if (!IsAvailableChannel(channelNumber))
280  {
281  return false;
282  }
283  m_vsaManager->RemoveByChannel(channelNumber);
284  return true;
285 }
286 
287 void
289 {
290  NS_LOG_FUNCTION(this);
291  m_vsaManager->SetWaveVsaCallback(vsaCallback);
292 }
293 
294 bool
296 {
297  NS_LOG_FUNCTION(this << &schInfo);
298  if (!IsAvailableChannel(schInfo.channelNumber))
299  {
300  return false;
301  }
302  return m_channelScheduler->StartSch(schInfo);
303 }
304 
305 bool
306 WaveNetDevice::StopSch(uint32_t channelNumber)
307 {
308  NS_LOG_FUNCTION(this << channelNumber);
309  if (!IsAvailableChannel(channelNumber))
310  {
311  return false;
312  }
313  return m_channelScheduler->StopSch(channelNumber);
314 }
315 
316 bool
318 {
319  NS_LOG_FUNCTION(this << &txprofile);
320  if (m_txProfile != nullptr)
321  {
322  return false;
323  }
324  if (!IsAvailableChannel(txprofile.channelNumber))
325  {
326  return false;
327  }
328  if (txprofile.txPowerLevel > 8)
329  {
330  return false;
331  }
332  // IP-based packets is not allowed to send in the CCH.
333  if (txprofile.channelNumber == CCH)
334  {
335  NS_LOG_DEBUG("IP-based packets shall not be transmitted on the CCH");
336  return false;
337  }
338  if (txprofile.dataRate == WifiMode() || txprofile.txPowerLevel == 8)
339  {
340  // let MAC layer itself determine tx parameters.
341  NS_LOG_DEBUG("High layer does not want to control tx parameters.");
342  }
343  else
344  {
345  // if current PHY devices do not support data rate of the tx profile
346  for (PhyEntitiesI i = m_phyEntities.begin(); i != m_phyEntities.end(); ++i)
347  {
348  if (!((*i)->IsModeSupported(txprofile.dataRate)))
349  {
350  NS_LOG_DEBUG("This data rate " << txprofile.dataRate.GetUniqueName()
351  << " is not supported by current PHY device");
352  return false;
353  }
354  }
355  }
356 
357  m_txProfile = new TxProfile();
358  *m_txProfile = txprofile;
359  return true;
360 }
361 
362 bool
363 WaveNetDevice::DeleteTxProfile(uint32_t channelNumber)
364 {
365  NS_LOG_FUNCTION(this << channelNumber);
366  if (!IsAvailableChannel(channelNumber))
367  {
368  return false;
369  }
370  if (m_txProfile == nullptr)
371  {
372  return false;
373  }
374  if (m_txProfile->channelNumber != channelNumber)
375  {
376  return false;
377  }
378 
379  delete m_txProfile;
380  m_txProfile = nullptr;
381  return true;
382 }
383 
384 bool
386  const Address& dest,
387  uint32_t protocol,
388  const TxInfo& txInfo)
389 {
390  NS_LOG_FUNCTION(this << packet << dest << protocol << &txInfo);
391  if (!IsAvailableChannel(txInfo.channelNumber))
392  {
393  return false;
394  }
395  if (!m_channelScheduler->IsChannelAccessAssigned(txInfo.channelNumber))
396  {
397  NS_LOG_DEBUG("there is no channel access assigned for channel " << txInfo.channelNumber);
398  return false;
399  }
400  if ((txInfo.channelNumber == CCH) &&
401  (protocol == IPv4_PROT_NUMBER || protocol == IPv6_PROT_NUMBER))
402  {
403  NS_LOG_DEBUG("IP-based packets shall not be transmitted on the CCH");
404  return false;
405  }
406  if ((txInfo.priority > 7) || txInfo.txPowerLevel > 8)
407  {
408  NS_LOG_DEBUG("invalid transmit parameters.");
409  return false;
410  }
411 
412  if ((txInfo.dataRate == WifiMode()) || (txInfo.txPowerLevel == 8))
413  {
414  // let MAC layer itself determine tx parameters.
415  NS_LOG_DEBUG("High layer does not want to control tx parameters.");
416  }
417  else
418  {
419  // if current PHY devices do not support data rate of the tx profile
420  for (PhyEntitiesI i = m_phyEntities.begin(); i != m_phyEntities.end(); ++i)
421  {
422  if (!((*i)->IsModeSupported(txInfo.dataRate)))
423  {
424  return false;
425  }
426  }
427  WifiTxVector txVector;
428  txVector.SetChannelWidth(10);
429  txVector.SetTxPowerLevel(txInfo.txPowerLevel);
430  txVector.SetMode(txInfo.dataRate);
431  txVector.SetPreambleType(txInfo.preamble);
432  HigherLayerTxVectorTag tag = HigherLayerTxVectorTag(txVector, false);
433  packet->AddPacketTag(tag);
434  }
435 
436  LlcSnapHeader llc;
437  llc.SetType(protocol);
438  packet->AddHeader(llc);
439 
440  // according to channel number and priority,
441  // route the packet to a proper queue.
442  SocketPriorityTag prio;
443  prio.SetPriority(txInfo.priority);
444  packet->ReplacePacketTag(prio);
447  mac->NotifyTx(packet);
448  mac->Enqueue(packet, realTo);
449  return true;
450 }
451 
452 void
454 {
455  NS_LOG_FUNCTION(this << newAddress);
456  Address oldAddress = GetAddress();
457  if (newAddress == oldAddress)
458  {
459  return;
460  }
461  SetAddress(newAddress);
462  // Since MAC address is changed, the MAC layer including multiple MAC entities should be reset
463  // and internal MAC queues will be flushed.
464  for (MacEntitiesI i = m_macEntities.begin(); i != m_macEntities.end(); ++i)
465  {
466  i->second->Reset();
467  }
468  m_addressChange(oldAddress, newAddress);
469 }
470 
471 void
472 WaveNetDevice::CancelTx(uint32_t channelNumber, AcIndex ac)
473 {
474  if (IsAvailableChannel(channelNumber))
475  {
476  return;
477  }
478  Ptr<OcbWifiMac> mac = GetMac(channelNumber);
479  mac->CancleTx(ac);
480 }
481 
482 void
484 {
485  m_channelManager = channelManager;
486 }
487 
490 {
491  return m_channelManager;
492 }
493 
494 void
496 {
497  m_channelScheduler = channelScheduler;
498 }
499 
502 {
503  return m_channelScheduler;
504 }
505 
506 void
508 {
509  m_channelCoordinator = channelCoordinator;
510 }
511 
514 {
515  return m_channelCoordinator;
516 }
517 
518 void
520 {
521  m_vsaManager = vsaManager;
522 }
523 
526 {
527  return m_vsaManager;
528 }
529 
530 void
531 WaveNetDevice::SetIfIndex(const uint32_t index)
532 {
533  m_ifIndex = index;
534 }
535 
536 uint32_t
538 {
539  return m_ifIndex;
540 }
541 
544 {
545  NS_ASSERT(!m_phyEntities.empty());
546  return GetPhy(0)->GetChannel();
547 }
548 
549 void
551 {
552  for (MacEntitiesI i = m_macEntities.begin(); i != m_macEntities.end(); ++i)
553  {
554  i->second->SetAddress(Mac48Address::ConvertFrom(address));
555  }
556 }
557 
558 Address
560 {
561  return (GetMac(CCH))->GetAddress();
562 }
563 
564 bool
565 WaveNetDevice::SetMtu(const uint16_t mtu)
566 {
568  {
569  return false;
570  }
571  m_mtu = mtu;
572  return true;
573 }
574 
575 uint16_t
577 {
578  return m_mtu;
579 }
580 
581 bool
583 {
584  // Different from WifiNetDevice::IsLinkUp, a WaveNetDevice device
585  // is always link up so the m_linkup variable is true forever.
586  // Even the device is in channel switch state, packets can still be queued.
587  return true;
588 }
589 
590 void
592 {
593  NS_LOG_WARN("WaveNetDevice is linkup forever, so this callback will be never called");
594 }
595 
596 bool
598 {
599  return true;
600 }
601 
602 Address
604 {
606 }
607 
608 bool
610 {
611  return true;
612 }
613 
614 Address
616 {
617  return Mac48Address::GetMulticast(multicastGroup);
618 }
619 
620 Address
622 {
623  return Mac48Address::GetMulticast(addr);
624 }
625 
626 bool
628 {
629  return false;
630 }
631 
632 bool
634 {
635  return false;
636 }
637 
638 bool
639 WaveNetDevice::Send(Ptr<Packet> packet, const Address& dest, uint16_t protocol)
640 {
641  NS_LOG_FUNCTION(this << packet << dest << protocol);
642  if (m_txProfile == nullptr)
643  {
644  NS_LOG_DEBUG("there is no tx profile registered for transmission");
645  return false;
646  }
647  if (!m_channelScheduler->IsChannelAccessAssigned(m_txProfile->channelNumber))
648  {
649  NS_LOG_DEBUG("there is no channel access assigned for channel "
651  return false;
652  }
654  {
655  // let MAC layer itself determine tx parameters.
656  NS_LOG_DEBUG("High layer does not want to control tx parameters.");
657  }
658  else
659  {
660  WifiTxVector txVector;
662  txVector.SetMode(m_txProfile->dataRate);
665  packet->AddPacketTag(tag);
666  }
667 
668  LlcSnapHeader llc;
669  llc.SetType(protocol);
670  packet->AddHeader(llc);
671 
672  // qos tag is already inserted into the packet by high layer or with default value 7 if high
673  // layer forget it.
676  mac->NotifyTx(packet);
677  mac->Enqueue(packet, realTo);
678  return true;
679 }
680 
681 bool
683 {
684  // Whether NeedsArp or not?
685  // For IP-based packets , yes; For WSMP packets, no;
686  // so return true always.
687  return true;
688 }
689 
690 void
692 {
693  m_forwardUp = cb;
694 }
695 
696 bool
697 WaveNetDevice::IsAvailableChannel(uint32_t channelNumber) const
698 {
699  if (!ChannelManager::IsWaveChannel(channelNumber))
700  {
701  NS_LOG_DEBUG("this is no a valid WAVE channel for channel " << channelNumber);
702  return false;
703  }
704  if (m_macEntities.find(channelNumber) == m_macEntities.end())
705  {
706  NS_LOG_DEBUG("this is no available WAVE entity for channel " << channelNumber);
707  return false;
708  }
709  return true;
710 }
711 
712 void
714 {
715  NS_LOG_FUNCTION(this << packet << from << to);
716  Ptr<Packet> copy = packet->Copy();
717  LlcSnapHeader llc;
718  copy->RemoveHeader(llc);
720  if (to.IsBroadcast())
721  {
723  }
724  else if (to.IsGroup())
725  {
727  }
728  else if (to == GetAddress())
729  {
731  }
732  else
733  {
735  }
736 
738  {
739  // currently we cannot know from which MAC entity the packet is received,
740  // so we use the MAC entity for CCH as it receives this packet.
742  mac->NotifyRx(copy);
743  m_forwardUp(this, copy, llc.GetType(), from);
744  }
745 
746  if (!m_promiscRx.IsNull())
747  {
748  // currently we cannot know from which MAC entity the packet is received,
749  // so we use the MAC entity for CCH as it receives this packet.
751  mac->NotifyPromiscRx(copy);
752  m_promiscRx(this, copy, llc.GetType(), from, to, type);
753  }
754 }
755 
756 bool
758  const Address& source,
759  const Address& dest,
760  uint16_t protocol)
761 {
762  NS_LOG_FUNCTION(this << packet << source << dest << protocol);
763  return false;
764 }
765 
766 void
768 {
769  m_promiscRx = cb;
770  for (MacEntitiesI i = m_macEntities.begin(); i != m_macEntities.end(); ++i)
771  {
772  i->second->SetPromisc();
773  }
774 }
775 
776 bool
778 {
779  return (GetMac(CCH))->SupportsSendFrom();
780 }
781 
782 } // namespace ns3
#define CCH
a polymophic address class
Definition: address.h:100
Callback template class.
Definition: callback.h:443
bool IsNull() const
Check for null implementation.
Definition: callback.h:572
static bool IsWaveChannel(uint32_t channelNumber)
This tag will be used to support higher layer control DataRate and TxPwr_Level for transmission.
Definition: higher-tx-tag.h:48
Ipv4 addresses are stored in host order in this class.
Definition: ipv4-address.h:43
Describes an IPv6 address.
Definition: ipv6-address.h:50
Header for the LLC/SNAP encapsulation.
uint16_t GetType()
Return the Ethertype.
void SetType(uint16_t type)
Set the Ethertype.
an EUI-48 address
Definition: mac48-address.h:46
static Mac48Address GetMulticast(Ipv4Address address)
bool IsGroup() const
static Mac48Address ConvertFrom(const Address &address)
static Mac48Address GetBroadcast()
bool IsBroadcast() const
Network layer to device interface.
Definition: net-device.h:98
PacketType
Packet types are used as they are in Linux.
Definition: net-device.h:300
@ PACKET_HOST
Packet addressed to us.
Definition: net-device.h:301
@ PACKET_OTHERHOST
Packet addressed to someone else.
Definition: net-device.h:307
@ PACKET_BROADCAST
Packet addressed to all.
Definition: net-device.h:303
@ PACKET_MULTICAST
Packet addressed to multicast group.
Definition: net-device.h:305
void Initialize()
Invoke DoInitialize on all Objects aggregated to this one.
Definition: object.cc:186
virtual void DoInitialize()
Initialize() implementation.
Definition: object.cc:360
void Dispose()
Dispose of this Object.
Definition: object.cc:219
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
Ptr< Packet > Copy() const
performs a COW copy of the packet.
Definition: packet.cc:131
void AddPacketTag(const Tag &tag) const
Add a packet tag.
Definition: packet.cc:979
bool ReplacePacketTag(Tag &tag)
Replace the value of a packet tag.
Definition: packet.cc:994
Hold objects of type Ptr<T>.
Definition: pointer.h:37
indicates whether the socket has a priority set.
Definition: socket.h:1316
void SetPriority(uint8_t priority)
Set the tag's priority.
Definition: socket.cc:852
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
This class holds together multiple, ns3::WifiPhy, and ns3::OcbWifiMac (including ns3::WifiRemoteStati...
bool Send(Ptr< Packet > packet, const Address &dest, uint16_t protocolNumber) override
void AddPhy(Ptr< WifiPhy > phy)
bool IsPointToPoint() const override
Return true if the net device is on a point-to-point link.
void SetChannelCoordinator(Ptr< ChannelCoordinator > channelCoordinator)
bool StartSch(const SchInfo &schInfo)
void ChangeAddress(Address newAddress)
bool IsBridge() const override
Return true if the net device is acting as a bridge.
bool DeleteTxProfile(uint32_t channelNumber)
void AddMac(uint32_t channelNumber, Ptr< OcbWifiMac > mac)
bool IsLinkUp() const override
Address GetAddress() const override
void DoDispose() override
Destructor implementation.
NetDevice::ReceiveCallback m_forwardUp
forward up receive callback
void SetAddress(Address address) override
Set the address of this interface.
void SetChannelScheduler(Ptr< ChannelScheduler > channelScheduler)
Ptr< VsaManager > m_vsaManager
the VSA manager
Address GetBroadcast() const override
PhyEntities m_phyEntities
Phy entities.
Ptr< ChannelScheduler > m_channelScheduler
the channel scheduler
std::map< uint32_t, Ptr< OcbWifiMac > >::const_iterator MacEntitiesI
MacEntities iterator typedef.
static const uint16_t MAX_MSDU_SIZE
This value conforms to the 802.11 specification.
void SetVsaManager(Ptr< VsaManager > vsaManager)
uint32_t m_ifIndex
IF index.
void SetPromiscReceiveCallback(PromiscReceiveCallback cb) override
MacEntities m_macEntities
MAC entities.
Ptr< ChannelScheduler > GetChannelScheduler() const
void ForwardUp(Ptr< const Packet > packet, Mac48Address from, Mac48Address to)
Receive a packet from the lower layer and pass the packet up the stack.
static TypeId GetTypeId()
Get the type ID.
void SetReceiveCallback(NetDevice::ReceiveCallback cb) override
bool StopVsa(uint32_t channelNumber)
uint16_t GetMtu() const override
const std::vector< Ptr< WifiPhy > > & GetPhys() const override
bool SetMtu(const uint16_t mtu) override
static const uint16_t IPv6_PROT_NUMBER
IP v6 Protocol number.
std::map< uint32_t, Ptr< OcbWifiMac > > GetMacs() const
bool NeedsArp() const override
void DoInitialize() override
Initialize() implementation.
bool SendX(Ptr< Packet > packet, const Address &dest, uint32_t protocol, const TxInfo &txInfo)
bool RegisterTxProfile(const TxProfile &txprofile)
TracedCallback< Address, Address > m_addressChange
NetDevice::PromiscReceiveCallback m_promiscRx
promiscious receive callback
bool IsMulticast() const override
void CancelTx(uint32_t channelNumber, AcIndex ac)
uint32_t GetIfIndex() const override
bool IsBroadcast() const override
Ptr< ChannelCoordinator > m_channelCoordinator
the channel coordinator
bool SendFrom(Ptr< Packet > packet, const Address &source, const Address &dest, uint16_t protocolNumber) override
void AddLinkChangeCallback(Callback< void > callback) override
Ptr< ChannelCoordinator > GetChannelCoordinator() const
bool IsAvailableChannel(uint32_t channelNumber) const
void SetWaveVsaCallback(WaveVsaCallback vsaCallback)
std::vector< Ptr< WifiPhy > >::const_iterator PhyEntitiesI
PhyEntities iterator typedef.
Address GetMulticast(Ipv4Address multicastGroup) const override
Make and return a MAC multicast address using the provided multicast group.
TxProfile * m_txProfile
transmit profile
Ptr< VsaManager > GetVsaManager() const
void SetChannelManager(Ptr< ChannelManager > channelManager)
Ptr< Channel > GetChannel() const override
bool SupportsSendFrom() const override
Ptr< ChannelManager > GetChannelManager() const
bool StartVsa(const VsaInfo &vsaInfo)
Ptr< ChannelManager > m_channelManager
the channel manager
static const uint16_t IPv4_PROT_NUMBER
IP v4 Protocol number.
bool StopSch(uint32_t channelNumber)
void SetIfIndex(const uint32_t index) override
represent a single transmission mode
Definition: wifi-mode.h:50
std::string GetUniqueName() const
Definition: wifi-mode.cc:148
Ptr< WifiMac > GetMac() const
void DoDispose() override
Destructor implementation.
Ptr< WifiPhy > GetPhy() const
virtual Ptr< Channel > GetChannel() const =0
Return the Channel this WifiPhy is connected to.
virtual void SetupPhy(const Ptr< WifiPhy > phy)
Set up PHY associated with this device since it is the object that knows the full set of transmit rat...
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
void SetTxPowerLevel(uint8_t powerlevel)
Sets the selected transmission power level.
void SetChannelWidth(uint16_t channelWidth)
Sets the selected channelWidth (in MHz)
void SetMode(WifiMode mode)
Sets the selected payload transmission mode.
void SetPreambleType(WifiPreamble preamble)
Sets the preamble type.
#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
ObjectPtrContainerValue ObjectMapValue
ObjectMapValue is an alias for ObjectPtrContainerValue.
Definition: object-map.h:40
Ptr< const AttributeAccessor > MakeObjectMapAccessor(U T::*memberVariable)
MakeAccessorHelper implementation for ObjectVector.
Definition: object-map.h:76
ObjectPtrContainerValue ObjectVectorValue
ObjectVectorValue is an alias for ObjectPtrContainerValue.
Definition: object-vector.h:40
Ptr< const AttributeAccessor > MakeObjectVectorAccessor(U T::*memberVariable)
MakeAccessorHelper implementation for ObjectVector.
Definition: object-vector.h:76
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 > 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_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Definition: fatal-error.h:179
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:202
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Definition: log.h:268
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
Definition: log.h:261
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition: object-base.h:46
AcIndex
This enumeration defines the Access Categories as an enumeration with values corresponding to the AC ...
Definition: qos-utils.h:72
address
Definition: first.py:40
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Callback< R, Args... > MakeCallback(R(T::*memPtr)(Args...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
Definition: callback.h:707
static const uint16_t LLC_SNAP_HEADER_LENGTH
The length in octets of the LLC/SNAP header.
mac
Definition: third.py:85
phy
Definition: third.py:82
uint32_t channelNumber
channel number
uint32_t txPowerLevel
transmit power level
uint32_t priority
priority
WifiMode dataRate
data rate
WifiPreamble preamble
preamble
uint32_t channelNumber
channel number
uint32_t txPowerLevel
transmit power level
WifiMode dataRate
data rate
WifiPreamble preamble
preamble
bool adaptable
adaptable
uint32_t channelNumber
channel number
uint8_t managementId
management ID
Definition: vsa-manager.h:67
uint32_t channelNumber
channel number
Definition: vsa-manager.h:69
Ptr< Packet > vsc
VSC.
Definition: vsa-manager.h:68
OrganizationIdentifier oi
OI.
Definition: vsa-manager.h:66