21 #include "ns3/trace-source-accessor.h"
22 #include "ns3/traced-callback.h"
23 #include "ns3/pointer.h"
25 #include "ns3/assert.h"
95 .AddAttribute (
"Channel",
"The channel attached to this device.",
98 MakePointerChecker<UanChannel> ())
99 .AddAttribute (
"Phy",
"The PHY layer attached to this device.",
102 MakePointerChecker<UanPhy> ())
103 .AddAttribute (
"Mac",
"The MAC layer attached to this device.",
106 MakePointerChecker<UanMac> ())
107 .AddAttribute (
"Transducer",
"The Transducer attached to this device.",
111 MakePointerChecker<UanTransducer> ())
112 .AddTraceSource (
"Rx",
"Received payload from the MAC layer.",
114 "ns3::UanNetDevice::RxTxTracedCallback")
115 .AddTraceSource (
"Tx",
"Send payload to the MAC layer.",
117 "ns3::UanNetDevice::RxTxTracedCallback")
151 m_mac->AttachPhy (phy);
181 m_phy->SetChannel (channel);
225 return m_mac->GetAddress ();
232 NS_LOG_WARN (
"UanNetDevice: MTU is not implemented");
258 return m_mac->GetBroadcast ();
271 return m_mac->GetBroadcast ();
278 return m_mac->GetBroadcast ();
295 return m_mac->Enqueue (packet, dest, protocolNumber);
397 m_phy->SetSleepMode (sleep);
virtual bool SetMtu(const uint16_t mtu)
virtual bool SendFrom(Ptr< Packet > packet, const Address &source, const Address &dest, uint16_t protocolNumber)
void SetSleepMode(bool sleep)
Set the Phy SLEEP mode.
Ptr< UanMac > GetMac(void) const
Get the MAC used by this device.
virtual void SetReceiveCallback(NetDevice::ReceiveCallback cb)
Smart pointer class similar to boost::intrusive_ptr.
void SetMac(Ptr< UanMac > mac)
Set the MAC layer for this device.
virtual void SetAddress(Address address)
Set the address of this interface.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
bool m_linkup
The link state, true if up.
virtual void DoDispose()
Destructor implementation.
void SetChannel(Ptr< UanChannel > channel)
Attach a channel.
virtual Address GetMulticast(Ipv4Address multicastGroup) const
Make and return a MAC multicast address using the provided multicast group.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
virtual void DoDispose(void)
Destructor implementation.
#define NS_FATAL_ERROR(msg)
Fatal error handling.
virtual bool IsPointToPoint(void) const
Return true if the net device is on a point-to-point link.
virtual bool IsMulticast(void) const
virtual bool IsLinkUp(void) const
virtual bool Send(Ptr< Packet > packet, const Address &dest, uint16_t protocolNumber)
virtual uint16_t GetMtu(void) const
virtual Ptr< Channel > GetChannel(void) const
Ptr< Node > m_node
The node hosting this device.
Ptr< UanTransducer > m_trans
The Transducer attached to this device.
virtual Address GetBroadcast(void) const
a polymophic address class
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source.
Ptr< UanTransducer > GetTransducer(void) const
Get the transducer associated with this device.
ReceiveCallback m_forwardUp
The receive callback.
uint16_t m_mtu
The device MTU value, in bytes.
virtual void AddLinkChangeCallback(Callback< void > callback)
Ptr< const AttributeAccessor > MakePointerAccessor(T1 a1)
Create an AttributeAccessor for a class data member, or a lone class get functor or set method...
virtual uint32_t GetIfIndex(void) const
A class used for addressing UAN MAC's.
static UanAddress ConvertFrom(const Address &address)
Convert a generic address to a UanAddress.
virtual void ForwardUp(Ptr< Packet > pkt, const UanAddress &src)
Forward the packet to a higher level, set with SetReceiveCallback.
TracedCallback m_linkChanges
Callback to invoke when the link state changes to UP.
Ptr< UanPhy > m_phy
The PHY layer attached to this device.
virtual Ptr< Node > GetNode(void) const
TracedCallback< Ptr< const Packet >, UanAddress > m_rxLogger
Trace source triggered when forwarding up received payload from the MAC layer.
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
UanNetDevice()
Default constructor.
virtual bool IsBroadcast(void) const
Ptr< UanMac > m_mac
The MAC layer attached to this device.
static TypeId GetTypeId(void)
Register this type.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Hold objects of type Ptr.
virtual bool SupportsSendFrom(void) const
TracedCallback< Ptr< const Packet >, UanAddress > m_txLogger
Trace source triggered when sending to the MAC layer.
Ptr< UanPhy > GetPhy(void) const
Get the Phy used by this device.
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
virtual Address GetAddress(void) const
virtual void SetPromiscReceiveCallback(PromiscReceiveCallback cb)
void SetPhy(Ptr< UanPhy > phy)
Set the Phy layer for this device.
Describes an IPv6 address.
Ipv4 addresses are stored in host order in this class.
void ConnectWithoutContext(const CallbackBase &callback)
Append a Callback to the chain (without a context).
bool m_cleared
Flag when we've been cleared.
Network layer to device interface.
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
virtual bool IsBridge(void) const
Return true if the net device is acting as a bridge.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
Ptr< UanChannel > m_channel
The channel attached to this device.
virtual void SetNode(Ptr< Node > node)
void SetTransducer(Ptr< UanTransducer > trans)
Set the transdcuer used by this device.
virtual ~UanNetDevice()
Dummy destructor, DoDispose.
virtual bool NeedsArp(void) const
Ptr< UanChannel > DoGetChannel(void) const
uint32_t m_ifIndex
The interface index of this device.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
void Clear(void)
Clear all pointer references.
virtual void SetIfIndex(const uint32_t index)