25 #include "ns3/event-id.h"
26 #include "ns3/mac8-address.h"
27 #include "ns3/nstime.h"
28 #include "ns3/random-variable-stream.h"
29 #include "ns3/trace-source-accessor.h"
30 #include "ns3/traced-callback.h"
43 class UanHeaderRcCtsGlobal;
66 uint32_t maxPkts = 0);
190 void Clear()
override;
a polymophic address class
An identifier for simulation events.
A class used for addressing MAC8 MAC's.
Stores reservation info for use in scheduling data channel by reservation channel MAC.
uint32_t GetNoFrames() const
Get the number of frames in this Reservation.
uint32_t GetLength() const
Get the total length of the Reservation.
~Reservation()
Destructor.
std::list< std::pair< Ptr< Packet >, Mac8Address > > m_pktList
Queued packets for each address.
bool m_transmitted
Has this reservation been transmitted.
const std::list< std::pair< Ptr< Packet >, Mac8Address > > & GetPktList() const
Get the list of packets.
Reservation()
Default constructor.
Time GetTimestamp(uint8_t n) const
Get the timestamp for the n'th RTS.
uint8_t GetFrameNo() const
Get the frame number.
void IncrementRetry()
Increment the retry count.
uint8_t m_frameNo
Frame number.
void SetFrameNo(uint8_t fn)
Set the frame number.
bool IsTransmitted() const
uint8_t m_retryNo
Number of retries.
uint8_t GetRetryNo() const
Get the retry number.
uint32_t m_length
Total length of queued packets.
void SetTransmitted(bool t=true)
Set the reservation transmitted state.
void AddTimestamp(Time t)
Set the time of the latest RTS sent.
std::vector< Time > m_timestamp
Timestamps for each retry.
Simulation virtual time values and global simulation resolution.
Forward calls to a chain of Callback.
a unique identifier for an interface.
Virtual base class for all UAN MAC protocols.
Non-gateway node MAC for reservation channel MAC protocol.
void Clear() override
Clears all pointer references.
void SendPacket(Ptr< Packet > pkt, uint32_t rate)
Send on packet on the PHY.
void ReceiveOkFromPhy(Ptr< Packet > pkt, double sinr, UanTxMode mode)
PHY receive ok Callback.
void ScheduleData(const UanHeaderRcCts &ctsh, const UanHeaderRcCtsGlobal &ctsg, uint32_t ctsBytes)
Schedule Packet sends.
double m_retryRate
Number of retry attempts per second (of RTS/GWPING.
@ TYPE_GWPING
Gateway ping.
void SetForwardUpCb(Callback< void, Ptr< Packet >, uint16_t, const Mac8Address & > cb) override
Set the callback to forward packets up to higher layers.
UanHeaderRcRts CreateRtsHeader(const Reservation &res)
Create the RTS header from a Reservation.
EventId m_startAgain
(Unused).
void BlockRtsing()
Callback to block RST.
TracedCallback< Ptr< const Packet >, uint32_t > m_dequeueLogger
A was passed down to the PHY from the MAC.
uint32_t m_queueLimit
Maximum packets to queue at MAC.
void AttachPhy(Ptr< UanPhy > phy) override
Attach PHY layer to this MAC.
void RtsTimeout()
Retry RTS.
EventId m_rtsEvent
The RTS event.
uint8_t m_frameNo
Current frame number.
Ptr< ExponentialRandomVariable > m_ev
Provides exponential random variables.
int64_t AssignStreams(int64_t stream) override
Assign a fixed random variable stream number to the random variables used by this model.
Ptr< UanPhy > m_phy
PHY layer attached to this MAC.
void DoDispose() override
Destructor implementation.
double m_minRetryRate
Smallest allowed RTS retry rate.
std::list< std::pair< Ptr< Packet >, Mac8Address > > m_pktQueue
Pending packets.
double m_retryStep
Retry rate increment.
uint32_t m_ctsSizeN
Size of UanHeaderRcCts.
Callback< void, Ptr< Packet >, uint16_t, const Mac8Address & > m_forwardUpCb
The callback to forward a packet up to higher layer.
UanMacRc()
Default constructor.
void AssociateTimeout()
Periodically retry association.
~UanMacRc() override
Dummy destructor, DoDispose.
void Associate()
Associate with a gateway by sending the first GWPING.
static uint32_t m_cntrlSends
Global count of calls to Associate, AssociateTimeout, SendRts, and RtsTimeout.
bool IsPhy1Ok()
Check that PHY is ok: not CTS or ACK not to my address.
void SendRts()
Send RTS packet.
uint32_t m_ctsSizeG
Size of UanHeaderCommon and UanHeaderRcCtsGlobal.
Time m_learnedProp
Propagation delay to gateway.
TracedCallback< Ptr< const Packet >, UanTxMode > m_rxLogger
A packet was destined for and received at this MAC layer.
uint32_t m_currentRate
Rate number corresponding to data rate of current cycle.
void ProcessAck(Ptr< Packet > ack)
Process a received ACK.
bool Enqueue(Ptr< Packet > pkt, uint16_t protocolNumber, const Address &dest) override
Enqueue packet to be transmitted.
bool m_rtsBlocked
RTS blocked while processing ACK.
std::list< Reservation > m_resList
List of scheduled reservations.
TracedCallback< Ptr< const Packet >, uint32_t > m_enqueueLogger
A packet arrived at the MAC for transmission.
Time m_sifs
Spacing between frames to account for timing error and processing delay.
Mac8Address m_assocAddr
Next hop address.
bool m_cleared
Flag when we've been cleared.
uint32_t m_maxFrames
Maximum number of frames to include in a single RTS.
@ IDLE
Finished scheduling packet sends.
@ GWPSENT
Associated with gateway.
@ UNASSOCIATED
Initial state.
uint32_t m_numRates
Number of rates per Phy layer.
static TypeId GetTypeId()
Register this type.
void(* QueueTracedCallback)(Ptr< const Packet > packet, uint32_t proto)
TracedCallback signature for dequeue of a packet.
Abstraction of packet modulation information.
Every class exported by the ns3 library is enclosed in the ns3 namespace.