14#include "ns3/packet.h" 
   15#include "ns3/sequence-number.h" 
   36    typedef std::list<Ptr<const Packet>>::const_iterator 
FragmentsCI;
 
 
  167    const auto& hdr = mpdu->GetOriginal()->GetHeader();
 
  168    const auto source = hdr.GetAddr2();
 
  169    const auto dest = hdr.GetAddr1();
 
  170    if (hdr.IsQosData() && !dest.IsGroup())
 
  173        const auto key = std::make_pair(source, hdr.GetQosTid());
 
  177    else if (hdr.IsQosData() && dest.IsGroup())
 
  180        const auto groupAddress =
 
  181            hdr.IsQosAmsdu() ? mpdu->begin()->second.GetDestinationAddr() : hdr.GetAddr1();
 
  182        const auto key = std::make_pair(groupAddress, hdr.GetQosTid());
 
 
  216                                                        << 
", size=" << packet->GetSize());
 
  232                                                             << 
", size=" << hdr.
GetSize());
 
  250                                                          << 
", size=" << packet->GetSize());
 
 
  267    const auto& hdr = mpdu->GetOriginal()->GetHeader();
 
  270    auto& originator = 
Lookup(mpdu);
 
  283        NS_LOG_DEBUG(
"Sequence numbers have looped back. last recorded=" 
  284                     << originator.GetLastSequenceControl()
 
  285                     << 
" currently seen=" << hdr.GetSequenceControl());
 
  290        NS_LOG_DEBUG(
"duplicate from=" << hdr.GetAddr2() << 
", seq=" << hdr.GetSequenceNumber()
 
  291                                       << 
", frag=" << +hdr.GetFragmentNumber());
 
  299    NS_LOG_DEBUG(
"forwarding data from=" << hdr.GetAddr2() << 
", seq=" << hdr.GetSequenceNumber()
 
  300                                         << 
", frag=" << +hdr.GetFragmentNumber());
 
  301    originator.SetSequenceControl(hdr.GetSequenceControl());
 
  302    if (aggregate == mpdu->GetPacket())
 
 
void SetForwardCallback(ForwardUpCallback callback)
Set a callback to forward the packet up.
bool IsDuplicate(const WifiMacHeader &hdr, const OriginatorRxStatus &originator) const
Check if we have already received the packet from the sender before (by looking at the sequence contr...
Originators m_originatorStatus
originator status
OriginatorRxStatus & Lookup(Ptr< const WifiMpdu > mpdu)
Look up for OriginatorRxStatus associated with the sender address (by looking at ADDR2 field in the h...
Ptr< const Packet > HandleFragments(Ptr< const Packet > packet, const WifiMacHeader &hdr, OriginatorRxStatus &originator)
Check if the received packet is a fragment and handle it appropriately.
void Receive(Ptr< const WifiMpdu > mpdu, uint8_t linkId)
Receive an MPDU on the given link.
QosOriginators m_qosOriginatorStatus
QOS originator status.
ForwardUpCallback m_callback
forward up callback
A class to keep track of the packet originator status.
void AccumulateFragment(Ptr< const Packet > packet)
We received a fragmented packet (not first and not last).
Ptr< Packet > AccumulateLastFragment(Ptr< const Packet > packet)
We have received a last fragment of the fragmented packets (indicated by the no more fragment field).
Fragments m_fragments
fragments
uint16_t m_lastSequenceControl
last sequence control
void SetSequenceControl(uint16_t sequenceControl)
Set the last sequence control we received.
bool IsDeFragmenting() const
Check if we are de-fragmenting packets.
std::list< Ptr< constPacket > >::const_iterator FragmentsCI
typedef for a const iterator for Fragments
std::list< Ptr< const Packet > > Fragments
typedef for a list of fragments (i.e.
void AccumulateFirstFragment(Ptr< const Packet > packet)
We have received a first fragmented packet.
bool m_defragmenting
flag to indicate whether we are defragmenting
bool IsNextFragment(uint16_t sequenceControl) const
Check if the sequence control (i.e.
uint16_t GetLastSequenceControl() const
Return the last sequence control we received.
Smart pointer class similar to boost::intrusive_ptr.
Generic "sequence number" class.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
Ptr< T > Create(Ts &&... args)
Create class instances by constructors with varying numbers of arguments and return them by Ptr.
SequenceNumber< uint16_t, int16_t > SequenceNumber16
16 bit Sequence number.
Every class exported by the ns3 library is enclosed in the ns3 namespace.