wifi: Implement ADDBA Extension element

This commit is contained in:
Stefano Avallone
2023-08-01 16:07:19 +02:00
parent ab862982ab
commit 5ba5c56a37
3 changed files with 126 additions and 0 deletions

View File

@@ -12,6 +12,7 @@ set(source_files
helper/wifi-mac-helper.cc
helper/wifi-radio-energy-model-helper.cc
helper/yans-wifi-helper.cc
model/addba-extension.cc
model/adhoc-wifi-mac.cc
model/ampdu-subframe-header.cc
model/ampdu-tag.cc
@@ -164,6 +165,7 @@ set(header_files
helper/wifi-mac-helper.h
helper/wifi-radio-energy-model-helper.h
helper/yans-wifi-helper.h
model/addba-extension.h
model/adhoc-wifi-mac.h
model/ampdu-subframe-header.h
model/ampdu-tag.h

View File

@@ -0,0 +1,61 @@
/*
* Copyright (c) 2023 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 "addba-extension.h"
namespace ns3
{
void
AddbaExtension::Print(std::ostream& os) const
{
os << "extBufferSize=" << +m_extParamSet.extBufferSize;
}
WifiInformationElementId
AddbaExtension::ElementId() const
{
return IE_ADDBA_EXTENSION;
}
uint16_t
AddbaExtension::GetInformationFieldSize() const
{
return 1U; // ADDBA Extended Parameter Set field
}
void
AddbaExtension::SerializeInformationField(Buffer::Iterator start) const
{
uint8_t extParamSet = m_extParamSet.noFragment | (m_extParamSet.heFragmentOp << 1) |
(m_extParamSet.extBufferSize << 5);
start.WriteU8(extParamSet);
}
uint16_t
AddbaExtension::DeserializeInformationField(Buffer::Iterator start, uint16_t length)
{
auto extParamSet = start.ReadU8();
m_extParamSet.noFragment = extParamSet & 0x01;
m_extParamSet.heFragmentOp = (extParamSet >> 1) & 0x03;
m_extParamSet.extBufferSize = (extParamSet >> 5) & 0x07;
return 1;
}
} // namespace ns3

View File

@@ -0,0 +1,63 @@
/*
* Copyright (c) 2023 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 ADDBA_EXTENSION_H
#define ADDBA_EXTENSION_H
#include "wifi-information-element.h"
namespace ns3
{
/**
* \ingroup wifi
*
* The IEEE 802.11 ADDBA Extension Element (Sec. 9.4.2.139 of 802.11-2020)
*/
class AddbaExtension : public WifiInformationElement
{
public:
AddbaExtension() = default;
/**
* ADDBA Extended Parameter Set
*/
struct ExtParamSet
{
uint8_t noFragment : 1; //!< reserved when transmitted by HE STA to HE STA
uint8_t heFragmentOp : 2; //!< indicates level of HE dynamic fragmentation (unsupported)
uint8_t : 2; //!< reserved
uint8_t extBufferSize : 3; //!< extended buffer size
};
// Implementations of pure virtual methods of WifiInformationElement
WifiInformationElementId ElementId() const override;
void Print(std::ostream& os) const override;
ExtParamSet m_extParamSet{}; //!< ADDBA Extended Parameter Set field
private:
uint16_t GetInformationFieldSize() const override;
void SerializeInformationField(Buffer::Iterator start) const override;
uint16_t DeserializeInformationField(Buffer::Iterator start, uint16_t length) override;
};
} // namespace ns3
#endif /* ADDBA_EXTENSION_H */