wifi: Add a LinkEntity subclass for STA wifi MAC

This commit is contained in:
Stefano Avallone
2022-06-22 14:45:48 +02:00
committed by Stefano Avallone
parent 9e0c00d443
commit 1817f20215
2 changed files with 43 additions and 0 deletions

View File

@@ -27,6 +27,8 @@
#include "ns3/random-variable-stream.h"
#include "ns3/simulator.h"
#include "ns3/string.h"
#include "channel-access-manager.h"
#include "frame-exchange-manager.h"
#include "qos-txop.h"
#include "sta-wifi-mac.h"
#include "wifi-phy.h"
@@ -134,6 +136,23 @@ StaWifiMac::~StaWifiMac ()
NS_LOG_FUNCTION (this);
}
StaWifiMac::StaLinkEntity::~StaLinkEntity ()
{
NS_LOG_FUNCTION_NOARGS ();
}
std::unique_ptr<WifiMac::LinkEntity>
StaWifiMac::CreateLinkEntity (void) const
{
return std::make_unique<StaLinkEntity> ();
}
StaWifiMac::StaLinkEntity&
StaWifiMac::GetLink (uint8_t linkId) const
{
return static_cast<StaLinkEntity&> (WifiMac::GetLink (linkId));
}
int64_t
StaWifiMac::AssignStreams (int64_t stream)
{

View File

@@ -218,6 +218,29 @@ public:
*/
int64_t AssignStreams (int64_t stream);
protected:
/**
* Structure holding information specific to a single link. Here, the meaning of
* "link" is that of the 11be amendment which introduced multi-link devices. For
* previous amendments, only one link can be created.
*/
struct StaLinkEntity : public WifiMac::LinkEntity
{
/// Destructor (a virtual method is needed to make this struct polymorphic)
virtual ~StaLinkEntity ();
std::optional<uint8_t> apLinkId; //!< ID (as set by the AP) of the link we have
//!< setup or are setting up
};
/**
* Get a reference to the link associated with the given ID.
*
* \param linkId the given link ID
* \return a reference to the link associated with the given ID
*/
StaLinkEntity& GetLink (uint8_t linkId) const;
private:
/**
* The current MAC state of the STA.
@@ -256,6 +279,7 @@ private:
bool CheckSupportedRates (std::variant<MgtBeaconHeader, MgtProbeResponseHeader> frame, uint8_t linkId);
void Receive (Ptr<WifiMpdu> mpdu, uint8_t linkId) override;
std::unique_ptr<LinkEntity> CreateLinkEntity (void) const override;
/**
* Process the Beacon frame received on the given link.