23 #include "ns3/assert.h"
24 #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 () << "] "; }
149 .AddAttribute (
"BlockAckThreshold",
"If number of packets in this queue reaches this value,\
150 block ack mechanism is used. If this value is 0, block ack is never used.",
154 MakeUintegerChecker<uint8_t> (0, 64))
155 .AddAttribute (
"BlockAckInactivityTimeout",
"Represents max time (blocks of 1024 micro seconds) allowed for block ack\
156 inactivity. If this value isn't equal to 0 a timer start after that a\
157 block ack setup is completed and will be reset every time that a block\
158 ack frame is received. If this value is 0, block ack inactivity timeout won't be used.",
161 MakeUintegerChecker<uint16_t> ())
162 .AddAttribute (
"Queue",
"The WifiMacQueue object",
165 MakePointerChecker<WifiMacQueue> ())
180 m_queue = CreateObject<WifiMacQueue> ();
438 m_low->StartTransmission (fragment, &hdr, params,
451 Ptr<Packet> currentAggregatedPacket = Create<Packet> ();
455 bool aggregated =
false;
456 bool isAmsdu =
false;
460 while (peekedPacket != 0)
462 aggregated =
m_aggregator->Aggregate (peekedPacket, currentAggregatedPacket,
468 m_queue->Remove (peekedPacket);
482 currentAggregatedPacket = 0;
565 packet, fullPacketSize);
566 m_queue->Enqueue (packet, hdr);
753 NS_LOG_DEBUG (
"a transmission that did not require an ACK just finished");
875 packet, fullPacketSize);
876 m_queue->PushFront (packet, hdr);
884 NS_LOG_DEBUG (
"received ADDBA response from " << recipient);
885 uint8_t tid = respHdr->
GetTid ();
890 NS_LOG_DEBUG (
"block ack agreement established with " << recipient);
906 NS_LOG_DEBUG (
"received DELBA frame from=" << recipient);
1051 uint16_t
timeout,
bool immediateBAck)
1053 NS_LOG_FUNCTION (
this << dest << static_cast<uint32_t> (tid) << startSeq << timeout << immediateBAck);
1074 reqHdr.SetImmediateBlockAck ();
1078 reqHdr.SetDelayedBlockAck ();
1080 reqHdr.SetTid (tid);
1084 reqHdr.SetBufferSize (0);
1085 reqHdr.SetTimeout (timeout);
1086 reqHdr.SetStartingSequence (startSeq);
1115 NS_LOG_FUNCTION (
this << addr << static_cast<uint32_t> (tid) << byOriginator);
uint32_t RemoveHeader(Header &header)
void SetUnblockDestinationCallback(Callback< void, Mac48Address, uint8_t > callback)
virtual void SetMaxCw(uint32_t maxCw)
TransmissionListener * m_transmissionListener
Ptr< const Packet > m_currentPacket
smart pointer class similar to boost::intrusive_ptr
#define NS_LOG_FUNCTION(parameters)
TypeId AddConstructor(void)
TxFailed m_txFailedCallback
void SetBlockAckInactivityTimeout(uint16_t timeout)
uint32_t GetCwMin(void) const
uint32_t GetFragmentSize(void)
void NotifyGotBlockAck(const CtrlBAckResponseHeader *blockAck, Mac48Address recipient)
uint16_t m_blockAckInactivityTimeout
void CreateAgreement(const MgtAddBaRequestHeader *reqHdr, Mac48Address recipient)
void VerifyBlockAck(void)
void GotBlockAck(const CtrlBAckResponseHeader *blockAck, Mac48Address recipient)
void NotifyCollision(void)
void SetTypeOfStation(enum TypeOfStation type)
void EnableBasicBlockAck(void)
void StorePacket(Ptr< const Packet > packet, const WifiMacHeader &hdr, Time tStamp)
bool NeedDataRetransmission(void)
void RequestAccess(DcfState *state)
virtual void EndTxNoAck(void)
void SetTxFailedCallback(TxFailed callback)
void GotAck(double snr, WifiMode txMode)
BlockAckEventListener(EdcaTxopN *txop)
virtual void MissedBlockAck(void)
#define NS_ASSERT(condition)
virtual int64_t AssignStreams(int64_t stream)=0
#define NS_LOG_COMPONENT_DEFINE(name)
uint8_t m_blockAckThreshold
void SetWifiRemoteStationManager(Ptr< WifiRemoteStationManager > remoteManager)
bool HasBar(struct Bar &bar)
uint32_t GetSize(void) const
bool IsBroadcast(void) const
void SetBlockAckType(enum BlockAckType bAckType)
WifiMacHeader m_currentHdr
void SetAifsn(uint32_t aifsn)
virtual void Cancel(void)
bool HasPackets(void) const
virtual void BlockAckInactivityTimeout(Mac48Address address, uint8_t tid)
friend class TransmissionListener
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 MissedAck(void)
void SetTxOkCallback(TxOk callback)
BlockAckManager * m_baManager
control how a packet is transmitted.The ns3::MacLow::StartTransmission method expects an instance of ...
bool NeedRtsRetransmission(void)
#define NS_FATAL_ERROR(msg)
fatal error handling
virtual void DoNotifyChannelSwitching(void)
virtual uint32_t GetAifsn(void) const
virtual void DoNotifyCollision(void)
enum TypeOfStation GetTypeOfStation(void) const
void SetLow(Ptr< MacLow > low)
Ptr< Packet > CreateFragment(uint32_t start, uint32_t length) const
Ptr< WifiRemoteStationManager > m_stationManager
void GotDelBaFrame(const MgtDelBaHeader *delBaHdr, Mac48Address recipient)
void SetQueue(Ptr< WifiMacQueue > queue)
void NotifyAccessGranted(void)
void NotifyInternalCollision(void)
void UpdateAgreement(const MgtAddBaResponseHeader *respHdr, Mac48Address recipient)
virtual void SetMinCw(uint32_t minCw)
void SendAddBaRequest(Mac48Address recipient, uint8_t tid, uint16_t startSeq, uint16_t timeout, bool immediateBAck)
void SendDelbaFrame(Mac48Address addr, uint8_t tid, bool byOriginator)
virtual void GotAck(double snr, WifiMode txMode)
Hold an unsigned integer type.
void SetBlockAckThreshold(uint8_t threshold)
void NotifyAgreementUnsuccessful(Mac48Address recipient, uint8_t tid)
NS_OBJECT_ENSURE_REGISTERED(AntennaModel)
Manage a set of ns3::DcfStateHandle a set of independent ns3::DcfState, each of which represents a si...
keep track of the state needed for a single DCF function.Multiple instances of a DcfState can be regi...
Callback< R > MakeCallback(R(T::*memPtr)(void), OBJ objPtr)
void NotifyChannelSwitching(void)
void SetTxMiddle(MacTxMiddle *txMiddle)
bool IsAccessRequested(void) const
void SetBlockDestinationCallback(Callback< void, Mac48Address, uint8_t > callback)
int64_t AssignStreams(int64_t stream)
Ptr< Packet > GetFragmentPacket(WifiMacHeader *hdr)
virtual void StartNext(void)
Time m_currentPacketTimestamp
uint32_t GetCwMax(void) const
void SetCwMin(uint32_t minCw)
virtual void GotCts(double snr, WifiMode txMode)
Ptr< Packet > Copy(void) const
uint32_t PeekHeader(Header &header) const
virtual uint32_t GetMinCw(void) const
void MissedBlockAck(void)
void StartBackoffNow(uint32_t nSlots)
bool NeedFragmentation(void) const
void EnableCompressedBlockAck(void)
virtual void MissedCts(void)
uint16_t GetNextSequenceNumberfor(const WifiMacHeader *hdr)
Ptr< MsduAggregator > GetMsduAggregator(void) const
hold objects of type Ptr<T>
listen for block ack events.
void SetAccessCategory(enum AcIndex ac)
Mac48Address MapDestAddressForAggregation(const WifiMacHeader &hdr)
bool ExistsAgreementInState(Mac48Address recipient, uint8_t tid, enum OriginatorBlockAckAgreement::State state) const
bool SetupBlockAckIfNeeded()
virtual ~TransmissionListener()
Ptr< const Packet > GetNextPacket(WifiMacHeader &hdr)
void SetManager(DcfManager *manager)
void Queue(Ptr< const Packet > packet, const WifiMacHeader &hdr)
void SetMsduAggregator(Ptr< MsduAggregator > aggr)
void SetBlockAckInactivityCallback(Callback< void, Mac48Address, uint8_t, bool > callback)
void SetMaxPacketDelay(Time maxDelay)
void PushFront(Ptr< const Packet > packet, const WifiMacHeader &hdr)
bool SwitchToBlockAckIfNeeded(Mac48Address recipient, uint8_t tid, uint16_t startingSeq)
enum BlockAckType m_blockAckType
void SetCwMax(uint32_t maxCw)
virtual void DoNotifyAccessGranted(void)
static TypeId GetTypeId(void)
BlockAckEventListener * m_blockAckListener
static TypeId GetTypeId(void)
uint32_t GetNextFragmentSize(void)
void CompleteConfig(void)
uint32_t GetCw(void) const
uint32_t GetAifsn(void) const
void Unblock(Mac48Address dest, uint8_t tid)
void RestartAccessIfNeeded(void)
void SetBlockAckThreshold(uint8_t nPackets)
QosBlockedDestinations * m_qosBlockedDestinations
#define NS_LOG_DEBUG(msg)
virtual ~BlockAckEventListener()
uint8_t GetBlockAckThreshold(void) const
bool IsSuccess(void) const
void SetTxMiddle(MacTxMiddle *txMiddle)
void GotCts(double snr, WifiMode txMode)
void EnableNextData(uint32_t size)
void DisableOverrideDurationId(void)
bool IsLastFragment(void) const
void Block(Mac48Address dest, uint8_t tid)
void DisableNextData(void)
virtual uint32_t GetMaxCw(void) const
Ptr< WifiMacQueue > m_queue
void StartAccessIfNeeded(void)
virtual uint32_t GetNext(uint32_t min, uint32_t max)=0
void SendBlockAckRequest(const struct Bar &bar)
void UpdateFailedCw(void)
Ptr< MsduAggregator > m_aggregator
Manages all block ack agreements for an originator station.
bool ExistsAgreement(Mac48Address recipient, uint8_t tid) const
virtual void DoNotifyInternalCollision(void)
TransmissionListener(EdcaTxopN *txop)
Ptr< WifiMacQueue > GetQueue() const
uint16_t GetNextSeqNumberByTidAndAddress(uint8_t tid, Mac48Address addr) const
a unique identifier for an interface.
bool NeedsAccess(void) const
TypeId SetParent(TypeId tid)
uint32_t GetFragmentOffset(void)
void NotifyMpduTransmission(Mac48Address recipient, uint8_t tid, uint16_t nextSeqNumber)
void AddHeader(const Header &header)
virtual void DoInitialize(void)
void GotAddBaResponse(const MgtAddBaResponseHeader *respHdr, Mac48Address recipient)
void TearDownBlockAck(Mac48Address recipient, uint8_t tid)
virtual void SetAifsn(uint32_t aifsn)
TypeOfStation m_typeOfStation
Mac48Address MapSrcAddressForAggregation(const WifiMacHeader &hdr)
virtual uint32_t GetSerializedSize(void) const
virtual void GotBlockAck(const CtrlBAckResponseHeader *blockAck, Mac48Address source)