16#include "ns3/mac8-address.h"
17#include "ns3/nstime.h"
18#include "ns3/random-variable-stream.h"
19#include "ns3/simulator.h"
78 void Clear()
override;
a polymophic address class
An identifier for simulation events.
A class used for addressing MAC8 MAC's.
Smart pointer class similar to boost::intrusive_ptr.
Simulation virtual time values and global simulation resolution.
Forward calls to a chain of Callback.
a unique identifier for an interface.
CW-MAC protocol, similar in idea to the 802.11 DCF with constant backoff window.
bool m_txOngoing
Tx is ongoing.
Time m_sendTime
Time to send next packet.
TracedCallback< Ptr< const Packet >, UanTxMode > m_rxLogger
A packet destined for this MAC was received.
void NotifyCcaStart() override
Called when UanPhy begins sensing channel is busy.
void Clear() override
Clears all pointer references.
Ptr< Packet > m_pktTx
Next packet to send.
void SaveTimer()
Cancel SendEvent and save remaining delay.
TracedCallback< Ptr< const Packet >, uint16_t > m_dequeueLogger
A packet was passed down to the PHY from the MAC.
void NotifyRxEndError() override
Called when UanPhy finishes receiving packet in error.
bool m_cleared
Flag when we've been cleared.
void EndTx()
End TX state.
void SendPacket()
Send packet on PHY.
void NotifyCcaEnd() override
Called when UanPhy stops sensing channel is busy.
virtual void SetSlotTime(Time duration)
Set the slot time duration.
virtual uint32_t GetCw()
Get the contention window size.
static TypeId GetTypeId()
Register this type.
UanMacCw()
Default constructor.
State m_state
Current state.
Ptr< UniformRandomVariable > m_rv
Provides uniform random variable for contention window.
bool Enqueue(Ptr< Packet > pkt, uint16_t protocolNumber, const Address &dest) override
Enqueue packet to be transmitted.
void NotifyRxEndOk() override
Called when UanPhy finishes receiving packet without error.
void DoDispose() override
Destructor implementation.
virtual void SetCw(uint32_t cw)
Set the contention window size.
Time m_slotTime
Slot time duration.
~UanMacCw() override
Dummy destructor, DoDispose.
void NotifyTxStart(Time duration) override
Called when transmission starts from Phy object.
EventId m_sendEvent
Scheduled SendPacket event.
void PhyRxPacketError(Ptr< Packet > packet, double sinr)
Packet received at lower layer in error.
Callback< void, Ptr< Packet >, uint16_t, const Mac8Address & > m_forwardUpCb
Forwarding up callback.
void NotifyRxStart() override
Called when UanPhy begins receiving packet.
void PhyRxPacketGood(Ptr< Packet > packet, double sinr, UanTxMode mode)
Receive packet from lower layer (passed to PHY as callback).
State
Enum defining possible Phy states.
@ RUNNING
Delay timer running.
TracedCallback< Ptr< const Packet >, uint16_t > m_enqueueLogger
A packet arrived at the MAC for transmission.
void NotifyTxEnd() override
Function called when Phy object finishes transmitting packet.
Time m_savedDelayS
Remaining delay until next send.
virtual Time GetSlotTime()
Get the slot time duration.
void StartTimer()
Schedule SendPacket after delay.
Ptr< UanPhy > m_phy
PHY layer attached to this MAC.
uint32_t m_cw
Contention window size.
void(* QueueTracedCallback)(Ptr< const Packet > packet, uint16_t proto)
TracedCallback signature for enqueue/dequeue of a packet.
void AttachPhy(Ptr< UanPhy > phy) override
Attach PHY layer to this MAC.
void SetForwardUpCb(Callback< void, Ptr< Packet >, uint16_t, const Mac8Address & > cb) override
Set the callback to forward packets up to higher layers.
uint16_t m_pktTxProt
Next packet protocol number (usage varies by MAC).
int64_t AssignStreams(int64_t stream) override
Assign a fixed random variable stream number to the random variables used by this model.
Virtual base class for all UAN MAC protocols.
Interface for PHY event listener.
Abstraction of packet modulation information.
Every class exported by the ns3 library is enclosed in the ns3 namespace.