A Discrete-Event Network Simulator
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"
23 #include <set>
24 
25 namespace ns3 {
26 
27 NS_LOG_COMPONENT_DEFINE ("WifiAckPolicySelector");
28 
29 NS_OBJECT_ENSURE_REGISTERED (WifiAckPolicySelector);
30 
31 TypeId
33 {
34  static TypeId tid = TypeId ("ns3::WifiAckPolicySelector")
35  .SetParent<Object> ()
36  .SetGroupName("Wifi")
37  ;
38  return tid;
39 }
40 
42 {
43  NS_LOG_FUNCTION (this);
44 }
45 
46 void
48 {
49  NS_LOG_FUNCTION (this);
50  m_qosTxop = 0;
51 }
52 
53 void
55 {
56  NS_LOG_FUNCTION (this << qosTxop);
57  m_qosTxop = qosTxop;
58 }
59 
62 {
63  return m_qosTxop;
64 }
65 
66 void
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
#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:45
virtual void DoDispose(void)
Destructor implementation.
#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
Ptr< QosTxop > m_qosTxop
the QoS Txop this selector is associated with
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:205
static TypeId GetTypeId(void)
Get the type ID.
control how a packet is transmitted.
Ptr< QosTxop > GetQosTxop(void) const
Get the QoS Txop associated with this ack policy selector.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
void SetQosTxop(Ptr< QosTxop > qosTxop)
Set the QoS Txop associated with this ack policy selector.
A base class which provides memory management and object aggregation.
Definition: object.h:87
static void SetAckPolicy(Ptr< WifiPsdu > psdu, const MacLowTransmissionParameters &params)
Set the QoS Ack Policy for the QoS Data frames contained in the given PSDU according to the given Mac...
a unique identifier for an interface.
Definition: type-id.h:58
TypeId SetParent(TypeId tid)
Set the parent TypeId.
Definition: type-id.cc:923