21 #include "ns3/assert.h"
22 #include "ns3/packet.h"
24 #include "ns3/simulator.h"
26 #include "ns3/uinteger.h"
27 #include "ns3/pointer.h"
40 #undef NS_LOG_APPEND_CONTEXT
41 #define NS_LOG_APPEND_CONTEXT if (m_low != 0) { std::clog << "[mac=" << m_low->GetAddress () << "] "; }
132 .AddAttribute (
"Queue",
"The WifiMacQueue object",
135 MakePointerChecker<WifiMacQueue> ())
147 m_queue = CreateObject<WifiMacQueue> ();
258 packet, fullPacketSize);
259 m_queue->Enqueue (packet, hdr);
469 Low ()->StartTransmission (fragment, &hdr, params,
656 NS_LOG_DEBUG (
"a transmission that did not require an ACK just finished");
void NotifyInternalCollision(void)
Notify the DCF that internal collision has occurred.
virtual uint32_t GetMaxCw(void) const
Return the maximum congestion window size.
smart pointer class similar to boost::intrusive_ptr
uint32_t GetFragmentOffset(void)
Calculate the offset for the current fragment.
#define NS_LOG_FUNCTION(parameters)
TypeId AddConstructor(void)
virtual void DoNotifyInternalCollision(void)
Called by DcfManager to notify a DcfState subclass that an 'internal' collision occured, that is, that the backoff timer of a higher priority DcfState expired at the same time and that access was granted to this higher priority DcfState.
void SetTxFailedCallback(TxFailed callback)
uint32_t GetCwMin(void) const
Return the minimum congestion window size.
virtual void MissedAck(void)
ns3::MacLow did not receive an expected ACK within AckTimeout.
virtual void SetMaxCw(uint32_t maxCw)
Set the maximum congestion window size.
void StartNext(void)
Start transmission for the next fragment.
void RequestAccess(DcfState *state)
TransmissionListener(DcaTxop *txop)
Create a TransmissionListener for the given DcaTxop.
bool IsNull(void) const
Check for null implementation.
#define NS_ASSERT(condition)
virtual int64_t AssignStreams(int64_t stream)=0
Assign a fixed random variable stream number to the random variables used by this model...
NS_OBJECT_ENSURE_REGISTERED(NullMessageSimulatorImpl)
uint32_t GetSize(void) const
Ptr< MacLow > Low(void)
Return the MacLow associated with this DcaTxop.
virtual uint32_t GetAifsn(void) const
Return the number of slots that make up an AIFS.
void SetAifsn(uint32_t aifsn)
void ResetCw(void)
Update the value of the CW variable to take into account a transmission success or a transmission abo...
int64_t AssignStreams(int64_t stream)
Assign a fixed random variable stream number to the random variables used by this model...
listen to events coming from ns3::MacLow.
represent a single transmission modeA WifiMode is implemented by a single integer which is used to lo...
virtual void GotCts(double snr, WifiMode txMode)
static TypeId GetTypeId(void)
control how a packet is transmitted.
void SetTxOkCallback(TxOk callback)
Handles sequence numbering of IEEE 802.11 data frames.
Ptr< Packet > GetFragmentPacket(WifiMacHeader *hdr)
Get the next fragment from the packet with appropriate Wifi header for the fragment.
virtual void GotAck(double snr, WifiMode txMode)
Ptr< Packet > CreateFragment(uint32_t start, uint32_t length) const
Create a new packet which contains a fragment of the original packet.
void Queue(Ptr< const Packet > packet, const WifiMacHeader &hdr)
void SetLow(Ptr< MacLow > low)
Set MacLow associated with this DcaTxop.
bool NeedFragmentation(void)
Check if the current packet should be fragmented.
Ptr< WifiMacQueue > m_queue
void Cancel(void)
Cancel the transmission.
NS_LOG_COMPONENT_DEFINE("DcaTxop")
void GotCts(double snr, WifiMode txMode)
Event handler when a CTS is received.
void NotifyChannelSwitching(void)
When a channel switching occurs, enqueued packets are removed.
void MissedCts(void)
Event handler when a CTS timeout has occurred.
Manage a set of ns3::DcfStateHandle a set of independent ns3::DcfState, each of which represents a si...
bool IsLastFragment(void)
Check if the curren fragment is the last fragment.
keep track of the state needed for a single DCF function.
bool IsAccessRequested(void) const
Ptr< WifiRemoteStationManager > m_stationManager
virtual void DoNotifyChannelSwitching(void)
Called by DcfManager to notify a DcfState subclass that a channel switching occured.
uint32_t GetCwMax(void) const
Return the maximum congestion window size.
bool NeedRts(Ptr< const Packet > packet, const WifiMacHeader *header)
Check if the current packet should be sent with a RTS protection.
void SetCwMin(uint32_t minCw)
Set the minimum congestion window size.
virtual void SetAifsn(uint32_t aifsn)
void SetWifiRemoteStationManager(Ptr< WifiRemoteStationManager > remoteManager)
Set WifiRemoteStationsManager this DcaTxop is associated to.
void StartBackoffNow(uint32_t nSlots)
uint16_t GetNextSequenceNumberfor(const WifiMacHeader *hdr)
Return the next sequence number for the given header.
void DoInitialize()
This method is called only once by Object::Initialize.
bool NeedsAccess(void) const
Check if the DCF requires access.
WifiMacHeader m_currentHdr
void EnableAck(void)
Wait ACKTimeout for an ACK.
virtual void EndTxNoAck(void)
Invoked upon the end of the transmission of a frame that does not require an ACK (e.g., broadcast and multicast frames).
Ptr< WifiMacQueue > GetQueue() const
Return the packet queue associated with this DcaTxop.
virtual void Cancel(void)
Invoked if this transmission was canceled one way or another.
bool NeedRtsRetransmission(void)
Check if RTS should be re-transmitted if CTS was missed.
void DisableRts(void)
Do not send rts and wait for cts before sending data.
friend class TransmissionListener
Ptr< const Packet > m_currentPacket
virtual void MissedCts(void)
ns3::MacLow did not receive an expected CTS within CtsTimeout.
Listener for MacLow events.
void SetCwMax(uint32_t maxCw)
Set the maximum congestion window size.
virtual void SetMinCw(uint32_t minCw)
Set the minimum congestion window size.
void GotAck(double snr, WifiMode txMode)
Event handler when an ACK is received.
virtual void DoNotifyCollision(void)
Called by DcfManager to notify a DcfState subclass that a normal collision occured, that is, that the medium was busy when access was requested.
static TypeId GetTypeId(void)
virtual ~TransmissionListener()
void EnableRts(void)
Send a RTS, and wait CTSTimeout for a CTS.
uint32_t GetCw(void) const
uint32_t GetAifsn(void) const
Return the number of slots that make up an AIFS.
void SetManager(DcfManager *manager)
Set DcfManager this DcaTxop is associated to.
#define NS_LOG_DEBUG(msg)
uint32_t GetNextFragmentSize(void)
Calculate the size of the next fragment.
virtual void StartNext(void)
Invoked when ns3::MacLow wants to start a new transmission as configured by MacLowTransmissionParamet...
virtual void DoDispose(void)
This method is called by Object::Dispose or by the object's destructor, whichever comes first...
void EnableNextData(uint32_t size)
void NotifyCollision(void)
Notify the DCF that collision has occurred.
void DisableOverrideDurationId(void)
Do not force the duration/id field of the packet: its value is automatically calculated by the MacLow...
void StartAccessIfNeeded(void)
Request access from DCF manager if needed.
void NextFragment(void)
Continue to the next fragment.
void DisableNextData(void)
Do not attempt to send data burst after current transmission.
TransmissionListener * m_transmissionListener
virtual void DoNotifyAccessGranted(void)
Called by DcfManager to notify a DcfState subclass that access to the medium is granted and can start...
void RestartAccessIfNeeded(void)
Restart access request if needed.
virtual uint32_t GetNext(uint32_t min, uint32_t max)=0
Get integer between min and max (including min and max).
void UpdateFailedCw(void)
Update the value of the CW variable to take into account a transmission failure.
void MissedAck(void)
Event handler when an ACK is received.
handle packet fragmentation and retransmissions.
void DisableAck(void)
Do not wait for Ack after data transmission.
bool NeedDataRetransmission(void)
Check if DATA should be re-transmitted if ACK was missed.
virtual uint32_t GetMinCw(void) const
Return the minimum congestion window size.
uint32_t GetFragmentSize(void)
Calculate the size of the current fragment.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
void NotifyAccessGranted(void)
Notify the DCF that access has been granted.
virtual void DoInitialize(void)
This method is called only once by Object::Initialize.
Implements the IEEE 802.11 MAC trailer.
void EndTxNoAck(void)
Event handler when a transmission that does not require an ACK has completed.
virtual uint32_t GetSerializedSize(void) const
TxFailed m_txFailedCallback