24 #include "ns3/sequence-number.h"
44 typedef std::list<Ptr<const Packet> >::const_iterator
FragmentsCI;
55 m_lastSequenceControl = 0xffff;
56 m_defragmenting =
false;
81 m_defragmenting =
true;
82 m_fragments.push_back (packet);
97 m_fragments.push_back (packet);
98 m_defragmenting =
false;
100 for (FragmentsCI i = m_fragments.begin (); i != m_fragments.end (); i++)
104 m_fragments.erase (m_fragments.begin (), m_fragments.end ());
116 m_fragments.push_back (packet);
129 if ((sequenceControl >> 4) == (m_lastSequenceControl >> 4)
130 && (sequenceControl & 0x0f) == ((m_lastSequenceControl & 0x0f) + 1))
155 m_lastSequenceControl = sequenceControl;
251 ", size=" << packet->
GetSize ());
285 ", size=" << packet->
GetSize ());
314 NS_LOG_DEBUG (
"Sequence numbers have looped back. last recorded=" << originator->GetLastSequenceControl () <<
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
void AccumulateFirstFragment(Ptr< const Packet > packet)
We have received a first fragmented packet.
uint16_t m_lastSequenceControl
last sequence control
void SetForwardCallback(ForwardUpCallback callback)
Set a callback to forward the packet up.
Fragments m_fragments
fragments
#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.
uint32_t GetSize(void) const
Returns the the size in bytes of the packet (including the zero-filled initial payload).
std::map< std::pair< Mac48Address, uint8_t >, OriginatorRxStatus *, std::less< std::pair< Mac48Address, uint8_t > > >::iterator QosOriginatorsI
typedef for an interator for QosOriginators
#define NS_LOG_FUNCTION_NOARGS()
Output the name of the function.
bool IsNextFragment(uint16_t sequenceControl) const
Check if the sequence control (i.e.
void Receive(Ptr< Packet > packet, const WifiMacHeader *hdr)
Receive a packet.
Ptr< Packet > HandleFragments(Ptr< Packet > packet, const WifiMacHeader *hdr, OriginatorRxStatus *originator)
Check if the received packet is a fragment and handle it appropriately.
std::map< Mac48Address, OriginatorRxStatus *, std::less< Mac48Address > >::iterator OriginatorsI
typedef for an interator for Originators
void AccumulateFragment(Ptr< const Packet > packet)
We received a fragmented packet (not first and not last).
void AddAtEnd(Ptr< const Packet > packet)
Concatenate the input packet at the end of the current packet.
OriginatorRxStatus * Lookup(const WifiMacHeader *hdr)
Look up for OriginatorRxStatus associated with the sender address (by looking at ADDR2 field in the h...
Originators m_originatorStatus
originator status
bool IsDuplicate(const WifiMacHeader *hdr, OriginatorRxStatus *originator) const
Check if we have already received the packet from the sender before (by looking at the sequence contr...
uint16_t GetLastSequenceControl(void) const
Return the last sequence control we received.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
Generic "sequence number" class.
Ptr< Packet > AccumulateLastFragment(Ptr< const Packet > packet)
We have received a last fragment of the fragmented packets (indicated by the no more fragment field)...
void SetSequenceControl(uint16_t sequenceControl)
Set the last sequence control we received.
bool m_defragmenting
flag to indicate whether we are defragmenting
std::list< Ptr< const Packet > > Fragments
typedef for a list of fragments (i.e.
ForwardUpCallback m_callback
forward up callback
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
std::list< Ptr< const Packet > >::const_iterator FragmentsCI
typedef for a const iterator for Fragments
bool IsDeFragmenting(void) const
Check if we are de-fragmenting packets.
A class to keep track of the packet originator status.
QosOriginators m_qosOriginatorStatus
QOS originator status.