A Discrete-Event Network Simulator
Home
Tutorials ▼
English
Docs ▼
Wiki
Manual
Models
Develop ▼
API
Bugs
API
wifi-ack-policy-selector.cc
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2
/*
3
* Copyright (c) 2019 Universita' degli Studi di Napoli Federico II
4
*
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License version 2 as
7
* published by the Free Software Foundation;
8
*
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
*
18
* Author: Stefano Avallone <stavallo@unina.it>
19
*/
20
21
#include "ns3/log.h"
22
#include "
wifi-ack-policy-selector.h
"
23
#include <set>
24
25
namespace
ns3
{
26
27
NS_LOG_COMPONENT_DEFINE
(
"WifiAckPolicySelector"
);
28
29
NS_OBJECT_ENSURE_REGISTERED
(WifiAckPolicySelector);
30
31
TypeId
32
WifiAckPolicySelector::GetTypeId
(
void
)
33
{
34
static
TypeId
tid =
TypeId
(
"ns3::WifiAckPolicySelector"
)
35
.
SetParent
<
Object
> ()
36
.SetGroupName(
"Wifi"
)
37
;
38
return
tid;
39
}
40
41
WifiAckPolicySelector::~WifiAckPolicySelector
()
42
{
43
NS_LOG_FUNCTION
(
this
);
44
}
45
46
void
47
WifiAckPolicySelector::DoDispose
()
48
{
49
NS_LOG_FUNCTION
(
this
);
50
m_qosTxop
= 0;
51
}
52
53
void
54
WifiAckPolicySelector::SetQosTxop
(
Ptr<QosTxop>
qosTxop)
55
{
56
NS_LOG_FUNCTION
(
this
<< qosTxop);
57
m_qosTxop
= qosTxop;
58
}
59
60
Ptr<QosTxop>
61
WifiAckPolicySelector::GetQosTxop
(
void
)
const
62
{
63
return
m_qosTxop
;
64
}
65
66
void
67
WifiAckPolicySelector::SetAckPolicy
(
Ptr<WifiPsdu>
psdu,
const
MacLowTransmissionParameters
& params)
68
{
69
NS_LOG_FUNCTION
(psdu << params);
70
71
std::set<uint8_t> tids = psdu->GetTids ();
72
NS_ASSERT
(tids.size () == 1);
73
uint8_t tid = *tids.begin ();
74
75
if
(params.
MustWaitNormalAck
() || params.
MustWaitBlockAck
())
76
{
77
// Normal Ack or Implicit Block Ack Request policy
78
psdu->SetAckPolicyForTid (tid,
WifiMacHeader::NORMAL_ACK
);
79
}
80
else
81
{
82
// Block Ack policy
83
psdu->SetAckPolicyForTid (tid,
WifiMacHeader::BLOCK_ACK
);
84
}
85
}
86
87
}
//namespace ns3
ns3::Ptr< QosTxop >
NS_LOG_FUNCTION
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
Definition:
log-macros-enabled.h:244
NS_OBJECT_ENSURE_REGISTERED
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Definition:
object-base.h:45
ns3::WifiAckPolicySelector::DoDispose
virtual void DoDispose(void)
Destructor implementation.
Definition:
wifi-ack-policy-selector.cc:47
NS_ASSERT
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
Definition:
assert.h:67
ns3::WifiAckPolicySelector::m_qosTxop
Ptr< QosTxop > m_qosTxop
the QoS Txop this selector is associated with
Definition:
wifi-ack-policy-selector.h:88
NS_LOG_COMPONENT_DEFINE
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition:
log.h:205
ns3::WifiAckPolicySelector::GetTypeId
static TypeId GetTypeId(void)
Get the type ID.
Definition:
wifi-ack-policy-selector.cc:32
ns3::MacLowTransmissionParameters::MustWaitBlockAck
bool MustWaitBlockAck(void) const
Definition:
mac-low-transmission-parameters.cc:138
ns3::WifiAckPolicySelector::~WifiAckPolicySelector
virtual ~WifiAckPolicySelector()
Definition:
wifi-ack-policy-selector.cc:41
ns3::MacLowTransmissionParameters
control how a packet is transmitted.
Definition:
mac-low-transmission-parameters.h:39
ns3::WifiAckPolicySelector::GetQosTxop
Ptr< QosTxop > GetQosTxop(void) const
Get the QoS Txop associated with this ack policy selector.
Definition:
wifi-ack-policy-selector.cc:61
wifi-ack-policy-selector.h
ns3::MacLowTransmissionParameters::MustWaitNormalAck
bool MustWaitNormalAck(void) const
Definition:
mac-low-transmission-parameters.cc:132
ns3::WifiMacHeader::NORMAL_ACK
Definition:
wifi-mac-header.h:91
ns3
Every class exported by the ns3 library is enclosed in the ns3 namespace.
ns3::WifiAckPolicySelector::SetQosTxop
void SetQosTxop(Ptr< QosTxop > qosTxop)
Set the QoS Txop associated with this ack policy selector.
Definition:
wifi-ack-policy-selector.cc:54
ns3::Object
A base class which provides memory management and object aggregation.
Definition:
object.h:87
ns3::WifiAckPolicySelector::SetAckPolicy
static void SetAckPolicy(Ptr< WifiPsdu > psdu, const MacLowTransmissionParameters ¶ms)
Set the QoS Ack Policy for the QoS Data frames contained in the given PSDU according to the given Mac...
Definition:
wifi-ack-policy-selector.cc:67
ns3::TypeId
a unique identifier for an interface.
Definition:
type-id.h:58
ns3::TypeId::SetParent
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition:
type-id.cc:923
ns3::WifiMacHeader::BLOCK_ACK
Definition:
wifi-mac-header.h:94
src
wifi
model
wifi-ack-policy-selector.cc
Generated on Sat Jan 9 2021 14:08:55 for ns-3 by
1.8.14