22 #include "ns3/queue.h"
23 #include "ns3/simulator.h"
25 #include "ns3/boolean.h"
26 #include "ns3/uinteger.h"
27 #include "ns3/pointer.h"
28 #include "ns3/channel.h"
29 #include "ns3/trace-source-accessor.h"
32 #include "ns3/llc-snap-header.h"
66 .AddConstructor<AlohaNoackNetDevice> ()
67 .AddAttribute (
"Address",
68 "The MAC address of this device.",
71 MakeMac48AddressChecker ())
72 .AddAttribute (
"Queue",
73 "packets being transmitted get queued here",
76 MakePointerChecker<Queue> ())
77 .AddAttribute (
"Mtu",
"The Maximum Transmission Unit",
81 MakeUintegerChecker<uint16_t> (1,65535))
82 .AddAttribute (
"Phy",
"The PHY layer attached to this device.",
86 MakePointerChecker<Object> ())
87 .AddTraceSource (
"MacTx",
88 "Trace source indicating a packet has arrived for transmission by this device",
90 .AddTraceSource (
"MacTxDrop",
91 "Trace source indicating a packet has been dropped by the device before transmission",
93 .AddTraceSource (
"MacPromiscRx",
94 "A packet has been received by this device, has been passed up from the physical layer "
95 "and is being forwarded up the local protocol stack. This is a promiscuous trace,",
97 .AddTraceSource (
"MacRx",
98 "A packet has been received by this device, has been passed up from the physical layer "
99 "and is being forwarded up the local protocol stack. This is a non-promiscuous trace,",
360 NS_LOG_LOGIC (
"new packet is head of queue, starting TX immediately");
367 if (
m_queue->Enqueue (packet) ==
false)
378 if (
m_queue->Enqueue (packet) ==
false)
421 if (
m_queue->IsEmpty () ==
false)
uint32_t RemoveHeader(Header &header)
Deserialize and remove the header from the internal buffer.
virtual void SetIfIndex(const uint32_t index)
smart pointer class similar to boost::intrusive_ptr
#define NS_LOG_FUNCTION(parameters)
Packet addressed to someone else.
void NotifyReceptionStart()
Notify the MAC that the PHY has started a reception.
virtual bool IsBridge(void) const
Return true if the net device is acting as a bridge.
virtual bool SendFrom(Ptr< Packet > packet, const Address &source, const Address &dest, uint16_t protocolNumber)
virtual Address GetMulticast(Ipv4Address addr) const
Make and return a MAC multicast address using the provided multicast group.
void SetGenericPhyTxStartCallback(GenericPhyTxStartCallback c)
set the callback used to instruct the lower layer to start a TX
virtual Address GetBroadcast(void) const
bool IsNull(void) const
Check for null implementation.
#define NS_ASSERT(condition)
TracedCallback< Ptr< const Packet > > m_macTxDropTrace
NS_OBJECT_ENSURE_REGISTERED(NullMessageSimulatorImpl)
Channel is IDLE, no packet is being transmitted.
virtual bool IsPointToPoint(void) const
Return true if the net device is on a point-to-point link.
TracedCallback< Ptr< const Packet > > m_macPromiscRxTrace
bool IsBroadcast(void) const
virtual void AddLinkChangeCallback(Callback< void > callback)
virtual void DoDispose(void)
This method is called by Object::Dispose or by the object's destructor, whichever comes first...
TracedCallback m_linkChangeCallbacks
List of callbacks to fire if the link changes state (up or down).
a polymophic address class
virtual Ptr< Node > GetNode(void) const
void NotifyReceptionEndOk(Ptr< Packet > p)
Notify the MAC that the PHY finished a reception successfully.
GenericPhyTxStartCallback m_phyMacTxStartCallback
static Mac48Address GetMulticast(Ipv4Address address)
virtual void SetReceiveCallback(NetDevice::ReceiveCallback cb)
Hold an unsigned integer type.
virtual uint16_t GetMtu(void) const
virtual bool IsBroadcast(void) const
void NotifyTransmissionEnd(Ptr< const Packet >)
Notify the MAC that the PHY has finished a previously started transmission.
virtual bool SetMtu(const uint16_t mtu)
#define NS_LOG_LOGIC(msg)
static Mac48Address ConvertFrom(const Address &address)
virtual void DoDispose(void)
This method is called by Object::Dispose or by the object's destructor, whichever comes first...
TracedCallback< Ptr< const Packet > > m_macRxTrace
std::ostream & operator<<(std::ostream &os, const Angles &a)
print a struct Angles to output
Ptr< Packet > Copy(void) const
virtual bool IsLinkUp(void) const
virtual bool SupportsSendFrom(void) const
TracedCallback< Ptr< const Packet > > m_macTxTrace
void SetChannel(Ptr< Channel > c)
This class doesn't talk directly with the underlying channel (a dedicated PHY class is expected to do...
static TypeId GetTypeId(void)
void StartTransmission()
start the transmission of a packet by contacting the PHY layer
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
virtual bool NeedsArp(void) const
Ptr< Object > GetPhy() const
static EventId ScheduleNow(MEM mem_ptr, OBJ obj)
Schedule an event to expire Now.
virtual void SetQueue(Ptr< Queue > queue)
set the queue which is going to be used by this device
virtual bool IsMulticast(void) const
NetDevice::PromiscReceiveCallback m_promiscRxCallback
#define NS_ASSERT_MSG(condition, message)
void NotifyReceptionEndError()
Notify the MAC that the PHY finished a reception with an error.
Describes an IPv6 address.
Ipv4 addresses are stored in host order in this class.
Ptr< Packet > m_currentPkt
void ConnectWithoutContext(const CallbackBase &callback)
Network layer to device interface.
hold objects of type ns3::Mac48Address
void SetPhy(Ptr< Object > phy)
Set the Phy object which is attached to this device.
virtual ~AlohaNoackNetDevice()
virtual bool Send(Ptr< Packet > packet, const Address &dest, uint16_t protocolNumber)
PacketType
Packet types are used as they are in Linux.
NS_LOG_COMPONENT_DEFINE("AlohaNoackNetDevice")
Packet addressed to multicast group.
a unique identifier for an interface.
virtual void SetPromiscReceiveCallback(PromiscReceiveCallback cb)
virtual uint32_t GetIfIndex(void) const
TypeId SetParent(TypeId tid)
virtual void SetNode(Ptr< Node > node)
NetDevice::ReceiveCallback m_rxCallback
void AddHeader(const Header &header)
Add header to this packet.
virtual Ptr< Channel > GetChannel(void) const
virtual Address GetAddress(void) const
virtual void SetAddress(Address address)
Set the address of this interface.