wifi: Add convenient methods to peek and remove Action headers
This commit is contained in:
committed by
Stefano Avallone
parent
03e648c231
commit
e41dfba58f
@@ -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::CategoryValue, WifiActionHeader::ActionValue>
|
||||
WifiActionHeader::Peek(Ptr<const Packet> pkt)
|
||||
{
|
||||
WifiActionHeader actionHdr;
|
||||
pkt->PeekHeader(actionHdr);
|
||||
return {actionHdr.GetCategory(), actionHdr.GetAction()};
|
||||
}
|
||||
|
||||
std::pair<WifiActionHeader::CategoryValue, WifiActionHeader::ActionValue>
|
||||
WifiActionHeader::Remove(Ptr<Packet> pkt)
|
||||
{
|
||||
WifiActionHeader actionHdr;
|
||||
pkt->RemoveHeader(actionHdr);
|
||||
return {actionHdr.GetCategory(), actionHdr.GetAction()};
|
||||
}
|
||||
|
||||
std::string
|
||||
WifiActionHeader::CategoryValueToString(CategoryValue value) const
|
||||
{
|
||||
|
||||
@@ -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<CategoryValue, ActionValue> Peek(Ptr<const Packet> 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<CategoryValue, ActionValue> Remove(Ptr<Packet> pkt);
|
||||
|
||||
/**
|
||||
* Register this type.
|
||||
* \return The TypeId.
|
||||
|
||||
Reference in New Issue
Block a user