wifi: Add Per-STA Profile BSS Params Change count (de)serialization
This commit is contained in:
committed by
Stefano Avallone
parent
1acc3840ec
commit
fb5ed767be
@@ -274,7 +274,8 @@ MultiLinkElement::PerStaProfileSubelement::PerStaProfileSubelement(
|
||||
const PerStaProfileSubelement& perStaProfile)
|
||||
: m_variant(perStaProfile.m_variant),
|
||||
m_staControl(perStaProfile.m_staControl),
|
||||
m_staMacAddress(perStaProfile.m_staMacAddress)
|
||||
m_staMacAddress(perStaProfile.m_staMacAddress),
|
||||
m_bssParamsChgCnt(perStaProfile.m_bssParamsChgCnt)
|
||||
{
|
||||
// deep copy of the STA Profile field
|
||||
auto staProfileCopy = [&](auto&& frame) {
|
||||
@@ -304,6 +305,7 @@ MultiLinkElement::PerStaProfileSubelement::operator=(const PerStaProfileSubeleme
|
||||
m_variant = perStaProfile.m_variant;
|
||||
m_staControl = perStaProfile.m_staControl;
|
||||
m_staMacAddress = perStaProfile.m_staMacAddress;
|
||||
m_bssParamsChgCnt = perStaProfile.m_bssParamsChgCnt;
|
||||
|
||||
// deep copy of the STA Profile field
|
||||
auto staProfileCopy = [&](auto&& frame) {
|
||||
@@ -369,6 +371,29 @@ MultiLinkElement::PerStaProfileSubelement::GetStaMacAddress() const
|
||||
return m_staMacAddress;
|
||||
}
|
||||
|
||||
void
|
||||
MultiLinkElement::PerStaProfileSubelement::SetBssParamsChgCnt(uint8_t count)
|
||||
{
|
||||
NS_ABORT_MSG_IF(m_variant != BASIC_VARIANT,
|
||||
"Expected Basic Variant, variant:" << +static_cast<uint8_t>(m_variant));
|
||||
m_bssParamsChgCnt = count;
|
||||
m_staControl |= 0x0800;
|
||||
}
|
||||
|
||||
bool
|
||||
MultiLinkElement::PerStaProfileSubelement::HasBssParamsChgCnt() const
|
||||
{
|
||||
return (m_staControl & 0x0800) != 0;
|
||||
}
|
||||
|
||||
uint8_t
|
||||
MultiLinkElement::PerStaProfileSubelement::GetBssParamsChgCnt() const
|
||||
{
|
||||
NS_ASSERT_MSG(m_bssParamsChgCnt.has_value(), "No value set for m_bssParamsChgCnt");
|
||||
NS_ASSERT_MSG(HasBssParamsChgCnt(), "BSS Parameters Change count bit not set");
|
||||
return m_bssParamsChgCnt.value();
|
||||
}
|
||||
|
||||
void
|
||||
MultiLinkElement::PerStaProfileSubelement::SetAssocRequest(
|
||||
const std::variant<MgtAssocRequestHeader, MgtReassocRequestHeader>& assoc)
|
||||
@@ -479,6 +504,10 @@ MultiLinkElement::PerStaProfileSubelement::GetStaInfoLength() const
|
||||
{
|
||||
ret += 6;
|
||||
}
|
||||
if (HasBssParamsChgCnt())
|
||||
{
|
||||
ret += 1;
|
||||
}
|
||||
// TODO add other subfields of the STA Info field
|
||||
return ret;
|
||||
}
|
||||
@@ -536,6 +565,10 @@ MultiLinkElement::PerStaProfileSubelement::SerializeInformationField(Buffer::Ite
|
||||
{
|
||||
WriteTo(start, m_staMacAddress);
|
||||
}
|
||||
if (HasBssParamsChgCnt())
|
||||
{
|
||||
start.WriteU8(GetBssParamsChgCnt());
|
||||
}
|
||||
// TODO add other subfields of the STA Info field
|
||||
auto staProfileSerialize = [&](auto&& frame) {
|
||||
using T = std::decay_t<decltype(frame)>;
|
||||
@@ -576,6 +609,10 @@ MultiLinkElement::PerStaProfileSubelement::DeserializeInformationField(Buffer::I
|
||||
{
|
||||
ReadFrom(i, m_staMacAddress);
|
||||
}
|
||||
if (HasBssParamsChgCnt())
|
||||
{
|
||||
m_bssParamsChgCnt = i.ReadU8();
|
||||
}
|
||||
|
||||
// TODO add other subfields of the STA Info field
|
||||
uint16_t count = i.GetDistanceFrom(start);
|
||||
|
||||
@@ -348,6 +348,23 @@ class MultiLinkElement : public WifiInformationElement
|
||||
*/
|
||||
Mac48Address GetStaMacAddress() const;
|
||||
|
||||
/**
|
||||
* Set the BSS Parameters Change Count subfield in the STA Info field.
|
||||
*
|
||||
* @param count BSS Parameters Change Count
|
||||
*/
|
||||
void SetBssParamsChgCnt(uint8_t count);
|
||||
|
||||
/// @return whether the BSS Parameters Change Count subfield in STA Info field is present
|
||||
bool HasBssParamsChgCnt() const;
|
||||
|
||||
/**
|
||||
* Get BSS Parameters Change Count subfield in the STA Info field.
|
||||
*
|
||||
* @return count value
|
||||
*/
|
||||
uint8_t GetBssParamsChgCnt() const;
|
||||
|
||||
/**
|
||||
* Include the given (Re)Association Request frame body in the STA Profile field
|
||||
* of this Per-STA Profile subelement
|
||||
@@ -457,9 +474,10 @@ class MultiLinkElement : public WifiInformationElement
|
||||
*/
|
||||
uint16_t DeserProbeReqMlePerSta(ns3::Buffer::Iterator start, uint16_t length);
|
||||
|
||||
Variant m_variant; //!< Multi-Link element variant
|
||||
uint16_t m_staControl; //!< STA Control field
|
||||
Mac48Address m_staMacAddress; //!< STA MAC address
|
||||
Variant m_variant; //!< Multi-Link element variant
|
||||
uint16_t m_staControl; //!< STA Control field
|
||||
Mac48Address m_staMacAddress; //!< STA MAC address
|
||||
std::optional<uint8_t> m_bssParamsChgCnt; //!< BSS Params Change Count (Basic MLE)
|
||||
std::variant<std::monostate,
|
||||
std::unique_ptr<MgtAssocRequestHeader>,
|
||||
std::unique_ptr<MgtReassocRequestHeader>,
|
||||
|
||||
Reference in New Issue
Block a user