A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
wifi-ack-manager.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2020 Universita' degli Studi di Napoli Federico II
3 *
4 * SPDX-License-Identifier: GPL-2.0-only
5 *
6 * Author: Stefano Avallone <stavallo@unina.it>
7 */
8
9#include "wifi-ack-manager.h"
10
11#include "wifi-mac.h"
12#include "wifi-psdu.h"
13
14#include "ns3/log.h"
15
16namespace ns3
17{
18
19NS_LOG_COMPONENT_DEFINE("WifiAckManager");
20
21NS_OBJECT_ENSURE_REGISTERED(WifiAckManager);
22
23TypeId
25{
26 static TypeId tid = TypeId("ns3::WifiAckManager").SetParent<Object>().SetGroupName("Wifi");
27 return tid;
28}
29
31 : m_linkId(0)
32{
33 NS_LOG_FUNCTION(this);
34}
35
40
41void
43{
44 NS_LOG_FUNCTION(this);
45 m_mac = nullptr;
47}
48
49void
51{
52 NS_LOG_FUNCTION(this << mac);
53 m_mac = mac;
54}
55
58{
59 return m_mac->GetWifiRemoteStationManager(m_linkId);
60}
61
62void
64{
65 NS_LOG_FUNCTION(this << +linkId);
66 m_linkId = linkId;
67}
68
69void
71{
72 NS_LOG_FUNCTION(*item << acknowledgment);
73
74 WifiMacHeader& hdr = item->GetHeader();
75 if (!hdr.IsQosData())
76 {
77 return;
78 }
79 NS_ASSERT(acknowledgment);
80
81 hdr.SetQosAckPolicy(acknowledgment->GetQosAckPolicy(hdr.GetAddr1(), hdr.GetQosTid()));
82}
83
84void
86{
87 NS_LOG_FUNCTION(*psdu << acknowledgment);
88
89 if (psdu->GetNMpdus() == 1)
90 {
91 SetQosAckPolicy(*psdu->begin(), acknowledgment);
92 return;
93 }
94
95 NS_ASSERT(acknowledgment);
96
97 for (const auto& tid : psdu->GetTids())
98 {
99 psdu->SetAckPolicyForTid(tid, acknowledgment->GetQosAckPolicy(psdu->GetAddr1(), tid));
100 }
101}
102
103} // namespace ns3
A base class which provides memory management and object aggregation.
Definition object.h:78
virtual void DoDispose()
Destructor implementation.
Definition object.cc:433
Smart pointer class similar to boost::intrusive_ptr.
a unique identifier for an interface.
Definition type-id.h:48
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition type-id.cc:1001
uint8_t m_linkId
ID of the link this Acknowledgment Manager is operating on.
static void SetQosAckPolicy(Ptr< WifiMpdu > item, const WifiAcknowledgment *acknowledgment)
Set the QoS Ack policy for the given MPDU, which must be a QoS data frame.
Ptr< WifiMac > m_mac
MAC which is using this Acknowledgment Manager.
Ptr< WifiRemoteStationManager > GetWifiRemoteStationManager() const
void DoDispose() override
Destructor implementation.
void SetLinkId(uint8_t linkId)
Set the ID of the link this Acknowledgment Manager is associated with.
void SetWifiMac(Ptr< WifiMac > mac)
Set the MAC which is using this Acknowledgment Manager.
static TypeId GetTypeId()
Get the type ID.
Implements the IEEE 802.11 MAC header.
uint8_t GetQosTid() const
Return the Traffic ID of a QoS header.
void SetQosAckPolicy(QosAckPolicy policy)
Set the QoS Ack policy in the QoS control field.
Mac48Address GetAddr1() const
Return the address in the Address 1 field.
bool IsQosData() const
Return true if the Type is DATA and Subtype is one of the possible values for QoS Data.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
Definition assert.h:55
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition log.h:191
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition object-base.h:35
Every class exported by the ns3 library is enclosed in the ns3 namespace.
WifiAcknowledgment is an abstract base struct.
WifiMacHeader::QosAckPolicy GetQosAckPolicy(Mac48Address receiver, uint8_t tid) const
Get the QoS Ack policy to use for the MPDUs addressed to the given receiver and belonging to the give...