diff --git a/src/wifi/model/mgt-headers.cc b/src/wifi/model/mgt-headers.cc index 524cd4b6c..3e5fa07d3 100644 --- a/src/wifi/model/mgt-headers.cc +++ b/src/wifi/model/mgt-headers.cc @@ -22,6 +22,7 @@ #include "mgt-headers.h" #include "ns3/address-utils.h" +#include "ns3/packet.h" #include "ns3/simulator.h" namespace ns3 @@ -1053,6 +1054,22 @@ WifiActionHeader::GetInstanceTypeId() const return GetTypeId(); } +std::pair +WifiActionHeader::Peek(Ptr pkt) +{ + WifiActionHeader actionHdr; + pkt->PeekHeader(actionHdr); + return {actionHdr.GetCategory(), actionHdr.GetAction()}; +} + +std::pair +WifiActionHeader::Remove(Ptr pkt) +{ + WifiActionHeader actionHdr; + pkt->RemoveHeader(actionHdr); + return {actionHdr.GetCategory(), actionHdr.GetAction()}; +} + std::string WifiActionHeader::CategoryValueToString(CategoryValue value) const { diff --git a/src/wifi/model/mgt-headers.h b/src/wifi/model/mgt-headers.h index fe035943d..d1866d336 100644 --- a/src/wifi/model/mgt-headers.h +++ b/src/wifi/model/mgt-headers.h @@ -51,6 +51,8 @@ namespace ns3 { +class Packet; + /** * Indicate which Information Elements cannot be included in a Per-STA Profile subelement of * a Basic Multi-Link Element (see Sec. 35.3.3.4 of 802.11be D3.1): @@ -753,6 +755,22 @@ class WifiActionHeader : public Header */ ActionValue GetAction() const; + /** + * Peek an Action header from the given packet. + * + * \param pkt the given packet + * \return the category value and the action value in the peeked Action header + */ + static std::pair Peek(Ptr pkt); + + /** + * Remove an Action header from the given packet. + * + * \param pkt the given packet + * \return the category value and the action value in the removed Action header + */ + static std::pair Remove(Ptr pkt); + /** * Register this type. * \return The TypeId.