23 #include "ns3/channel.h"
24 #include "ns3/llc-snap-header.h"
27 #include "ns3/object-map.h"
28 #include "ns3/object-vector.h"
29 #include "ns3/socket.h"
30 #include "ns3/wifi-phy.h"
45 TypeId(
"ns3::WaveNetDevice")
50 "The MAC-level Maximum Transmission Unit",
54 .AddAttribute(
"Channel",
55 "The channel attached to this device",
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.",
74 MakePointerChecker<ChannelScheduler>())
75 .AddAttribute(
"ChannelManager",
76 "The channel manager attached to this device.",
80 MakePointerChecker<ChannelManager>())
81 .AddAttribute(
"ChannelCoordinator",
82 "The channel coordinator attached to this device.",
86 MakePointerChecker<ChannelCoordinator>())
89 "The VSA manager attached to this device.",
92 MakePointerChecker<VsaManager>());
97 : m_txProfile(nullptr)
193 NS_FATAL_ERROR(
"The channel " << channelNumber <<
" is not a valid WAVE channel number");
197 NS_FATAL_ERROR(
"The MAC entity for channel " << channelNumber <<
" already exists.");
209 NS_FATAL_ERROR(
"there is no available MAC entity for channel " << channelNumber);
214 std::map<uint32_t, Ptr<OcbWifiMac>>
239 const std::vector<Ptr<WifiPhy>>&
261 NS_LOG_DEBUG(
"vendor specific information shall not be null");
266 NS_LOG_DEBUG(
"when organization identifier is not set, management ID "
267 "shall be in range from 0 to 15");
335 NS_LOG_DEBUG(
"IP-based packets shall not be transmitted on the CCH");
341 NS_LOG_DEBUG(
"High layer does not want to control tx parameters.");
348 if (!((*i)->IsModeSupported(txprofile.
dataRate)))
351 <<
" is not supported by current PHY device");
403 NS_LOG_DEBUG(
"IP-based packets shall not be transmitted on the CCH");
415 NS_LOG_DEBUG(
"High layer does not want to control tx parameters.");
422 if (!((*i)->IsModeSupported(txInfo.
dataRate)))
447 mac->NotifyTx(packet);
448 mac->Enqueue(packet, realTo);
457 if (newAddress == oldAddress)
593 NS_LOG_WARN(
"WaveNetDevice is linkup forever, so this callback will be never called");
644 NS_LOG_DEBUG(
"there is no tx profile registered for transmission");
649 NS_LOG_DEBUG(
"there is no channel access assigned for channel "
656 NS_LOG_DEBUG(
"High layer does not want to control tx parameters.");
676 mac->NotifyTx(packet);
677 mac->Enqueue(packet, realTo);
701 NS_LOG_DEBUG(
"this is no a valid WAVE channel for channel " << channelNumber);
706 NS_LOG_DEBUG(
"this is no available WAVE entity for channel " << channelNumber);
751 mac->NotifyPromiscRx(copy);
772 i->second->SetPromisc();
779 return (
GetMac(
CCH))->SupportsSendFrom();
a polymophic address class
bool IsNull() const
Check for null implementation.
static bool IsWaveChannel(uint32_t channelNumber)
This tag will be used to support higher layer control DataRate and TxPwr_Level for transmission.
Ipv4 addresses are stored in host order in this class.
Describes an IPv6 address.
static Mac48Address GetMulticast(Ipv4Address address)
static Mac48Address ConvertFrom(const Address &address)
static Mac48Address GetBroadcast()
Network layer to device interface.
PacketType
Packet types are used as they are in Linux.
@ PACKET_HOST
Packet addressed to us.
@ PACKET_OTHERHOST
Packet addressed to someone else.
@ PACKET_BROADCAST
Packet addressed to all.
@ PACKET_MULTICAST
Packet addressed to multicast group.
void Initialize()
Invoke DoInitialize on all Objects aggregated to this one.
virtual void DoInitialize()
Initialize() implementation.
void Dispose()
Dispose of this Object.
uint32_t RemoveHeader(Header &header)
Deserialize and remove the header from the internal buffer.
void AddHeader(const Header &header)
Add header to this packet.
Ptr< Packet > Copy() const
performs a COW copy of the packet.
void AddPacketTag(const Tag &tag) const
Add a packet tag.
bool ReplacePacketTag(Tag &tag)
Replace the value of a packet tag.
Hold objects of type Ptr<T>.
indicates whether the socket has a priority set.
void SetPriority(uint8_t priority)
Set the tag's priority.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Hold an unsigned integer type.
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
~WaveNetDevice() override
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
std::string GetUniqueName() const
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,...
ObjectPtrContainerValue ObjectMapValue
ObjectMapValue is an alias for ObjectPtrContainerValue.
Ptr< const AttributeAccessor > MakeObjectMapAccessor(U T::*memberVariable)
MakeAccessorHelper implementation for ObjectVector.
ObjectPtrContainerValue ObjectVectorValue
ObjectVectorValue is an alias for ObjectPtrContainerValue.
Ptr< const AttributeAccessor > MakeObjectVectorAccessor(U T::*memberVariable)
MakeAccessorHelper implementation for ObjectVector.
Ptr< const AttributeAccessor > MakePointerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
#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.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
AcIndex
This enumeration defines the Access Categories as an enumeration with values corresponding to the AC ...
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...
static const uint16_t LLC_SNAP_HEADER_LENGTH
The length in octets of the LLC/SNAP header.
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
uint32_t channelNumber
channel number
uint8_t managementId
management ID
uint32_t channelNumber
channel number
OrganizationIdentifier oi
OI.