wifi: Add the WifiProtectionManager base class
This commit is contained in:
62
src/wifi/model/wifi-protection-manager.cc
Normal file
62
src/wifi/model/wifi-protection-manager.cc
Normal file
@@ -0,0 +1,62 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2020 Universita' degli Studi di Napoli Federico II
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation;
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Author: Stefano Avallone <stavallo@unina.it>
|
||||
*/
|
||||
|
||||
#include "ns3/log.h"
|
||||
#include "wifi-protection-manager.h"
|
||||
#include "regular-wifi-mac.h"
|
||||
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
NS_LOG_COMPONENT_DEFINE ("WifiProtectionManager");
|
||||
|
||||
NS_OBJECT_ENSURE_REGISTERED (WifiProtectionManager);
|
||||
|
||||
TypeId
|
||||
WifiProtectionManager::GetTypeId (void)
|
||||
{
|
||||
static TypeId tid = TypeId ("ns3::WifiProtectionManager")
|
||||
.SetParent<Object> ()
|
||||
.SetGroupName ("Wifi")
|
||||
;
|
||||
return tid;
|
||||
}
|
||||
|
||||
WifiProtectionManager::~WifiProtectionManager ()
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
}
|
||||
|
||||
void
|
||||
WifiProtectionManager::DoDispose (void)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
m_mac = 0;
|
||||
Object::DoDispose ();
|
||||
}
|
||||
|
||||
void
|
||||
WifiProtectionManager::SetWifiMac (Ptr<RegularWifiMac> mac)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << mac);
|
||||
m_mac = mac;
|
||||
}
|
||||
|
||||
} //namespace ns3
|
||||
94
src/wifi/model/wifi-protection-manager.h
Normal file
94
src/wifi/model/wifi-protection-manager.h
Normal file
@@ -0,0 +1,94 @@
|
||||
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
|
||||
/*
|
||||
* Copyright (c) 2020 Universita' degli Studi di Napoli Federico II
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation;
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Author: Stefano Avallone <stavallo@unina.it>
|
||||
*/
|
||||
|
||||
#ifndef WIFI_PROTECTION_MANAGER_H
|
||||
#define WIFI_PROTECTION_MANAGER_H
|
||||
|
||||
#include "wifi-protection.h"
|
||||
#include <memory>
|
||||
#include "ns3/object.h"
|
||||
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
class WifiTxParameters;
|
||||
class WifiMacQueueItem;
|
||||
class RegularWifiMac;
|
||||
|
||||
/**
|
||||
* \ingroup wifi
|
||||
*
|
||||
* WifiProtectionManager is an abstract base class. Each subclass defines a logic
|
||||
* to select the protection method for a given frame.
|
||||
*/
|
||||
class WifiProtectionManager : public Object
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* \brief Get the type ID.
|
||||
* \return the object TypeId
|
||||
*/
|
||||
static TypeId GetTypeId (void);
|
||||
virtual ~WifiProtectionManager ();
|
||||
|
||||
/**
|
||||
* Set the MAC which is using this Protection Manager
|
||||
*
|
||||
* \param mac a pointer to the MAC
|
||||
*/
|
||||
void SetWifiMac (Ptr<RegularWifiMac> mac);
|
||||
|
||||
/**
|
||||
* Determine the protection method to use if the given MPDU is added to the current
|
||||
* frame. Return a null pointer if the protection method is unchanged or the new
|
||||
* protection method otherwise.
|
||||
*
|
||||
* \param mpdu the MPDU to be added to the current frame
|
||||
* \param txParams the current TX parameters for the current frame
|
||||
* \return a null pointer if the protection method is unchanged or the new
|
||||
* protection method otherwise
|
||||
*/
|
||||
virtual std::unique_ptr<WifiProtection> TryAddMpdu (Ptr<const WifiMacQueueItem> mpdu,
|
||||
const WifiTxParameters& txParams) = 0;
|
||||
|
||||
/**
|
||||
* Determine the protection method to use if the given MSDU is aggregated to the
|
||||
* current frame. Return a null pointer if the protection method is unchanged or
|
||||
* the new protection method otherwise.
|
||||
*
|
||||
* \param msdu the MSDU to be aggregated to the current frame
|
||||
* \param txParams the current TX parameters for the current frame
|
||||
* \return a null pointer if the protection method is unchanged or the new
|
||||
* protection method otherwise
|
||||
*/
|
||||
virtual std::unique_ptr<WifiProtection> TryAggregateMsdu (Ptr<const WifiMacQueueItem> msdu,
|
||||
const WifiTxParameters& txParams) = 0;
|
||||
|
||||
protected:
|
||||
virtual void DoDispose (void);
|
||||
|
||||
Ptr<RegularWifiMac> m_mac; //!< MAC which is using this Protection Manager
|
||||
};
|
||||
|
||||
|
||||
|
||||
} //namespace ns3
|
||||
|
||||
#endif /* WIFI_PROTECTION_MANAGER_H */
|
||||
@@ -28,6 +28,7 @@ def build(bld):
|
||||
'model/wifi-protection.cc',
|
||||
'model/wifi-acknowledgment.cc',
|
||||
'model/wifi-tx-parameters.cc',
|
||||
'model/wifi-protection-manager.cc',
|
||||
'model/mac-low.cc',
|
||||
'model/mac-low-transmission-parameters.cc',
|
||||
'model/wifi-mac-queue.cc',
|
||||
@@ -202,6 +203,7 @@ def build(bld):
|
||||
'model/wifi-protection.h',
|
||||
'model/wifi-acknowledgment.h',
|
||||
'model/wifi-tx-parameters.h',
|
||||
'model/wifi-protection-manager.h',
|
||||
'model/mac-low.h',
|
||||
'model/mac-low-transmission-parameters.h',
|
||||
'model/originator-block-ack-agreement.h',
|
||||
|
||||
Reference in New Issue
Block a user