22 #include "ns3/wifi-phy.h" 23 #include "ns3/llc-snap-header.h" 24 #include "ns3/channel.h" 26 #include "ns3/socket.h" 27 #include "ns3/object-map.h" 28 #include "ns3/object-vector.h" 43 .SetGroupName (
"Wave")
45 .AddAttribute (
"Mtu",
"The MAC-level Maximum Transmission Unit",
50 .AddAttribute (
"Channel",
"The channel attached to this device",
53 MakePointerChecker<Channel> ())
54 .AddAttribute (
"PhyEntities",
"The PHY entities attached to this device.",
57 MakeObjectVectorChecker<WifiPhy> ())
58 .AddAttribute (
"MacEntities",
"The MAC layer attached to this device.",
61 MakeObjectMapChecker<OcbWifiMac> ())
62 .AddAttribute (
"ChannelScheduler",
"The channel scheduler attached to this device.",
66 MakePointerChecker<ChannelScheduler> ())
67 .AddAttribute (
"ChannelManager",
"The channel manager attached to this device.",
71 MakePointerChecker<ChannelManager> ())
72 .AddAttribute (
"ChannelCoordinator",
"The channel coordinator attached to this device.",
76 MakePointerChecker<ChannelCoordinator> ())
77 .AddAttribute (
"VsaManager",
"The VSA manager attached to this device.",
81 MakePointerChecker<VsaManager> ())
182 NS_FATAL_ERROR (
"The channel " << channelNumber <<
" is not a valid WAVE channel number");
186 NS_FATAL_ERROR (
"The MAC entity for channel " << channelNumber <<
" already exists.");
197 NS_FATAL_ERROR (
"there is no available MAC entity for channel " << channelNumber);
202 std::map<uint32_t, Ptr<OcbWifiMac> >
226 std::vector<Ptr<WifiPhy> >
246 if (vsaInfo.
vsc == 0)
248 NS_LOG_DEBUG (
"vendor specific information shall not be null");
253 NS_LOG_DEBUG (
"when organization identifier is not set, management ID " 254 "shall be in range from 0 to 15");
323 NS_LOG_DEBUG (
"IP-based packets shall not be transmitted on the CCH");
329 NS_LOG_DEBUG (
"High layer does not want to control tx parameters.");
336 if (!((*i)->IsModeSupported (txprofile.
dataRate)))
386 NS_LOG_DEBUG (
"IP-based packets shall not be transmitted on the CCH");
398 NS_LOG_DEBUG (
"High layer does not want to control tx parameters.");
405 if ( !((*i)->IsModeSupported (txInfo.
dataRate)))
430 mac->NotifyTx (packet);
431 mac->Enqueue (packet, realTo);
440 if (newAddress == oldAddress)
561 NS_LOG_WARN (
"WaveNetDevice is linkup forever, so this callback will be never called");
604 NS_LOG_DEBUG (
"there is no tx profile registered for transmission");
615 NS_LOG_DEBUG (
"High layer does not want to control tx parameters.");
634 mac->NotifyTx (packet);
635 mac->Enqueue (packet, realTo);
658 NS_LOG_DEBUG (
"this is no a valid WAVE channel for channel " << channelNumber);
663 NS_LOG_DEBUG (
"this is no available WAVE entity for channel " << channelNumber);
699 mac->NotifyRx (copy);
708 mac->NotifyPromiscRx (copy);
726 i->second->SetPromisc ();
733 return (
GetMac (
CCH))->SupportsSendFrom ();
uint32_t RemoveHeader(Header &header)
Deserialize and remove the header from the internal buffer.
void Dispose(void)
Dispose of this Object.
bool StopVsa(uint32_t channelNumber)
virtual void DoInitialize(void)
Initialize() implementation.
bool IsBroadcast(void) const
uint32_t m_ifIndex
IF index.
static const uint16_t IPv4_PROT_NUMBER
IP v4 Protocol number.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
void ForwardUp(Ptr< const Packet > packet, Mac48Address from, Mac48Address to)
Receive a packet from the lower layer and pass the packet up the stack.
virtual bool IsPointToPoint(void) const
Return true if the net device is on a point-to-point link.
virtual Address GetBroadcast(void) const
Packet addressed to someone else.
bool StartSch(const SchInfo &schInfo)
This class mimics the TXVECTOR which is to be passed to the PHY in order to define the parameters whi...
void SetWaveVsaCallback(WaveVsaCallback vsaCallback)
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
void SetChannelWidth(uint16_t channelWidth)
Sets the selected channelWidth (in MHz)
WifiMode dataRate
data rate
AcIndex
This enumeration defines the Access Categories as an enumeration with values corresponding to the AC ...
virtual bool IsMulticast(void) const
virtual Address GetMulticast(Ipv4Address multicastGroup) const
Make and return a MAC multicast address using the provided multicast group.
uint32_t priority
priority
WifiMode dataRate
data rate
Ptr< ChannelCoordinator > m_channelCoordinator
the channel coordinator
virtual bool SupportsSendFrom(void) const
Ptr< const AttributeAccessor > MakeObjectVectorAccessor(U T::*memberVariable)
MakeAccessorHelper implementation for ObjectVector.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
bool SendX(Ptr< Packet > packet, const Address &dest, uint32_t protocol, const TxInfo &txInfo)
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
static bool IsWaveChannel(uint32_t channelNumber)
virtual bool SendFrom(Ptr< Packet > packet, const Address &source, const Address &dest, uint16_t protocolNumber)
std::map< uint32_t, Ptr< OcbWifiMac > >::const_iterator MacEntitiesI
MacEntities iterator typedef.
virtual bool NeedsArp(void) const
This class holds together multiple, ns3::WifiPhy, and ns3::OcbWifiMac (including ns3::WifiRemoteStati...
#define NS_FATAL_ERROR(msg)
Report a fatal error with a message and terminate.
Ptr< ChannelScheduler > GetChannelScheduler(void) const
virtual void SetAddress(Address address)
Set the address of this interface.
void DoDispose(void) override
Destructor implementation.
represent a single transmission modeA WifiMode is implemented by a single integer which is used to lo...
virtual bool IsBridge(void) const
Return true if the net device is acting as a bridge.
uint32_t txPowerLevel
transmit power level
virtual void SetReceiveCallback(NetDevice::ReceiveCallback cb)
This tag will be used to support higher layer control DataRate and TxPwr_Level for transmission...
uint32_t channelNumber
channel number
bool IsAvailableChannel(uint32_t channelNumber) const
a polymophic address class
virtual Ptr< Channel > GetChannel(void) const =0
Return the Channel this WifiPhy is connected to.
static const uint16_t IPv6_PROT_NUMBER
IP v6 Protocol number.
virtual Address GetAddress(void) const
uint8_t managementId
management ID
std::map< uint32_t, Ptr< OcbWifiMac > > GetMacs(void) const
Ptr< const AttributeAccessor > MakePointerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
static Mac48Address GetMulticast(Ipv4Address address)
bool DeleteTxProfile(uint32_t channelNumber)
Ptr< ChannelManager > m_channelManager
the channel manager
virtual ~WaveNetDevice(void)
Hold an unsigned integer type.
void SetChannelScheduler(Ptr< ChannelScheduler > channelScheduler)
Ptr< ChannelScheduler > m_channelScheduler
the channel scheduler
void SetChannelManager(Ptr< ChannelManager > channelManager)
void ChangeAddress(Address newAddress)
bool ReplacePacketTag(Tag &tag)
Replace the value of a packet tag.
WifiPreamble preamble
preamble
indicates whether the socket has a priority set.
uint32_t channelNumber
channel number
NetDevice::ReceiveCallback m_forwardUp
forward up receive callback
Ptr< VsaManager > GetVsaManager(void) const
virtual void DoDispose(void)
Destructor implementation.
static Mac48Address GetBroadcast(void)
Ptr< VsaManager > m_vsaManager
the VSA manager
virtual bool IsBroadcast(void) const
virtual uint32_t GetIfIndex(void) const
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...
std::string GetUniqueName(void) const
virtual bool IsLinkUp(void) const
uint32_t txPowerLevel
transmit power level
static Mac48Address ConvertFrom(const Address &address)
virtual void SetIfIndex(const uint32_t index)
bool StopSch(uint32_t channelNumber)
static const uint16_t LLC_SNAP_HEADER_LENGTH
The length in octects of the LLC/SNAP header.
TxProfile * m_txProfile
transmit profile
Ptr< WifiPhy > GetPhy(void) const
Ptr< ChannelCoordinator > GetChannelCoordinator(void) const
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Hold objects of type Ptr<T>.
void SetPreambleType(WifiPreamble preamble)
Sets the preamble type.
uint32_t channelNumber
channel number
virtual void DoInitialize(void)
Initialize() implementation.
virtual Ptr< Channel > GetChannel(void) const
uint32_t channelNumber
channel number
Ptr< Packet > Copy(void) const
performs a COW copy of the packet.
static const uint16_t MAX_MSDU_SIZE
This value conforms to the 802.11 specification.
void SetTxPowerLevel(uint8_t powerlevel)
Sets the selected transmission power level.
void SetMode(WifiMode mode)
Sets the selected payload transmission mode.
void AddPhy(Ptr< WifiPhy > phy)
Describes an IPv6 address.
bool StartVsa(const VsaInfo &vsaInfo)
Ipv4 addresses are stored in host order in this class.
Ptr< WifiMac > GetMac(void) const
TracedCallback< Address, Address > m_addressChange
virtual void AddLinkChangeCallback(Callback< void > callback)
Network layer to device interface.
void AddPacketTag(const Tag &tag) const
Add a packet tag.
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
static TypeId GetTypeId(void)
Get the type ID.
void SetVsaManager(Ptr< VsaManager > vsaManager)
NetDevice::PromiscReceiveCallback m_promiscRx
promiscious receive callback
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
PhyEntities m_phyEntities
Phy entities.
OrganizationIdentifier oi
OI.
std::vector< Ptr< WifiPhy > >::const_iterator PhyEntitiesI
PhyEntities iterator typedef.
virtual void SetPromiscReceiveCallback(PromiscReceiveCallback cb)
void AddMac(uint32_t channelNumber, Ptr< OcbWifiMac > mac)
virtual bool SetMtu(const uint16_t mtu)
Ptr< const AttributeAccessor > MakeObjectMapAccessor(U T::*memberVariable)
MakeAccessorHelper implementation for ObjectVector.
std::vector< Ptr< WifiPhy > > GetPhys(void) const
MacEntities m_macEntities
MAC entities.
PacketType
Packet types are used as they are in Linux.
Ptr< ChannelManager > GetChannelManager(void) const
Container for a set of ns3::Object pointers.
void SetChannelCoordinator(Ptr< ChannelCoordinator > channelCoordinator)
bool IsNull(void) const
Check for null implementation.
void SetPriority(uint8_t priority)
Set the tag's priority.
Packet addressed to multicast group.
Ptr< const AttributeAccessor > MakeUintegerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
virtual uint16_t GetMtu(void) const
bool RegisterTxProfile(const TxProfile &txprofile)
Callback< R, Ts... > MakeCallback(R(T::*memPtr)(Ts...), OBJ objPtr)
Build Callbacks for class method members which take varying numbers of arguments and potentially retu...
void CancelTx(uint32_t channelNumber, enum AcIndex ac)
void Initialize(void)
Invoke DoInitialize on all Objects aggregated to this one.
virtual bool Send(Ptr< Packet > packet, const Address &dest, uint16_t protocolNumber)
void AddHeader(const Header &header)
Add header to this packet.
WifiPreamble preamble
preamble