16#include "ns3/assert.h"
19#include "ns3/pointer.h"
20#include "ns3/trace-source-accessor.h"
21#include "ns3/traced-callback.h"
94 TypeId(
"ns3::UanNetDevice")
99 "The channel attached to this device.",
104 "The PHY layer attached to this device.",
109 "The MAC layer attached to this device.",
115 "The Transducer attached to this device.",
119 .AddTraceSource(
"Rx",
120 "Received payload from the MAC layer.",
122 "ns3::UanNetDevice::RxTxTracedCallback")
123 .AddTraceSource(
"Tx",
124 "Send payload to the MAC layer.",
126 "ns3::UanNetDevice::RxTxTracedCallback");
158 m_mac->AttachPhy(phy);
186 m_phy->SetChannel(channel);
230 return m_mac->GetAddress();
237 NS_LOG_WARN(
"UanNetDevice: MTU is not implemented");
263 return m_mac->GetBroadcast();
275 return m_mac->GetBroadcast();
281 return m_mac->GetBroadcast();
303 return m_mac->Enqueue(packet, protocolNumber, udest);
406 m_phy->SetSleepMode(sleep);
412 m_mac->SetTxModeIndex(txModeIndex);
418 return m_mac->GetTxModeIndex();
a polymophic address class
uint32_t CopyTo(uint8_t buffer[MAX_SIZE]) const
Copy the address bytes into a buffer.
Ipv4 addresses are stored in host order in this class.
Describes an IPv6 address.
A class used for addressing MAC8 MAC's.
static Mac8Address ConvertFrom(const Address &address)
Convert a generic address to a Mac8Address.
Network layer to device interface.
void Initialize()
Invoke DoInitialize on all Objects aggregated to this one.
virtual void DoInitialize()
Initialize() implementation.
virtual void DoDispose()
Destructor implementation.
AttributeValue implementation for Pointer.
Smart pointer class similar to boost::intrusive_ptr.
void ConnectWithoutContext(const CallbackBase &callback)
Append a Callback to the chain (without a context).
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
bool SupportsSendFrom() const override
bool SetMtu(const uint16_t mtu) override
Ptr< UanTransducer > GetTransducer() const
Get the transducer associated with this device.
void SetTxModeIndex(uint32_t txModeIndex)
Set the Tx mode index (Modulation type).
bool IsPointToPoint() const override
Return true if the net device is on a point-to-point link.
Address GetAddress() const override
UanNetDevice()
Default constructor.
uint32_t m_ifIndex
The interface index of this device.
void AddLinkChangeCallback(Callback< void > callback) override
uint32_t GetTxModeIndex()
Get the Tx mode index (Modulation type).
bool IsLinkUp() const override
void DoDispose() override
Destructor implementation.
void DoInitialize() override
Initialize() implementation.
void SetReceiveCallback(NetDevice::ReceiveCallback cb) override
void SetPromiscReceiveCallback(PromiscReceiveCallback cb) override
void Clear()
Clear all pointer references.
bool IsBridge() const override
Return true if the net device is acting as a bridge.
~UanNetDevice() override
Dummy destructor, DoDispose.
TracedCallback< Ptr< const Packet >, Mac8Address > m_txLogger
Trace source triggered when sending to the MAC layer.
void SetMac(Ptr< UanMac > mac)
Set the MAC layer for this device.
Ptr< Node > m_node
The node hosting this device.
bool IsBroadcast() const override
uint32_t GetIfIndex() const override
Ptr< UanPhy > m_phy
The PHY layer attached to this device.
bool IsMulticast() const override
Ptr< Node > GetNode() const override
void SetAddress(Address address) override
Set the address of this interface.
void SetSleepMode(bool sleep)
Set the Phy SLEEP mode.
bool m_cleared
Flag when we've been cleared.
virtual void ForwardUp(Ptr< Packet > pkt, uint16_t protocolNumber, const Mac8Address &src)
Forward the packet to a higher level, set with SetReceiveCallback.
Ptr< UanTransducer > m_trans
The Transducer attached to this device.
bool SendFrom(Ptr< Packet > packet, const Address &source, const Address &dest, uint16_t protocolNumber) override
bool m_linkup
The link state, true if up.
void SetChannel(Ptr< UanChannel > channel)
Attach a channel.
Address GetMulticast(Ipv4Address multicastGroup) const override
Make and return a MAC multicast address using the provided multicast group.
void SetNode(Ptr< Node > node) override
Ptr< UanMac > GetMac() const
Get the MAC used by this device.
void SetIfIndex(const uint32_t index) override
TracedCallback m_linkChanges
Callback to invoke when the link state changes to UP.
Ptr< UanChannel > m_channel
The channel attached to this device.
Ptr< Channel > GetChannel() const override
bool Send(Ptr< Packet > packet, const Address &dest, uint16_t protocolNumber) override
Ptr< UanChannel > DoGetChannel() const
TracedCallback< Ptr< const Packet >, Mac8Address > m_rxLogger
Trace source triggered when forwarding up received payload from the MAC layer.
uint16_t GetMtu() const override
Address GetBroadcast() const override
void SetTransducer(Ptr< UanTransducer > trans)
Set the transdcuer used by this device.
uint16_t m_mtu
The device MTU value, in bytes.
bool NeedsArp() const override
Ptr< UanPhy > GetPhy() const
Get the Phy used by this device.
ReceiveCallback m_forwardUp
The receive callback.
Ptr< UanMac > m_mac
The MAC layer attached to this device.
static TypeId GetTypeId()
Register this type.
void SetPhy(Ptr< UanPhy > phy)
Set the Phy layer for this device.
virtual void Clear()=0
Clears all pointer references.
virtual void SetChannel(Ptr< UanChannel > chan)=0
Attach this transducer to a channel.
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
Ptr< const AttributeAccessor > MakePointerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method.
Ptr< AttributeChecker > MakePointerChecker()
Create a PointerChecker for a type.
#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_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.
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
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...