class for the reordering buffer that keeps the data from lower layer, i.e. More...
#include <tcp-rx-buffer.h>
Public Types | |
typedef std::map < SequenceNumber32, Ptr < Packet > >::iterator | BufIterator |
container for data stored in the buffer More... | |
Public Member Functions | |
TcpRxBuffer (uint32_t n=0) | |
Constructor. More... | |
virtual | ~TcpRxBuffer () |
bool | Add (Ptr< Packet > p, TcpHeader const &tcph) |
Insert a packet into the buffer and update the availBytes counter to reflect the number of bytes ready to send to the application. More... | |
uint32_t | Available () const |
Get the actual number of bytes available to be read. More... | |
Ptr< Packet > | Extract (uint32_t maxSize) |
Extract data from the head of the buffer as indicated by nextRxSeq. More... | |
bool | Finished (void) |
Check if the buffer did receive all the data (and the connection is closed) More... | |
void | IncNextRxSequence (void) |
Increment the Next Sequence number. More... | |
uint32_t | MaxBufferSize (void) const |
Get the Maximum buffer size. More... | |
SequenceNumber32 | MaxRxSequence (void) const |
Get the lowest sequence number that this TcpRxBuffer cannot accept. More... | |
SequenceNumber32 | NextRxSequence (void) const |
Get Next Rx Sequence number. More... | |
void | SetFinSequence (const SequenceNumber32 &s) |
Set the FIN Sequence number (i.e., the one closing the connection) More... | |
void | SetMaxBufferSize (uint32_t s) |
Set the Maximum buffer size. More... | |
void | SetNextRxSequence (const SequenceNumber32 &s) |
Set the Next Sequence number. More... | |
uint32_t | Size (void) const |
Get the actual buffer occupancy. More... | |
Public Member Functions inherited from ns3::Object | |
Object () | |
virtual | ~Object () |
void | AggregateObject (Ptr< Object > other) |
void | Dispose (void) |
Run the DoDispose methods of this object and all the objects aggregated to it. More... | |
AggregateIterator | GetAggregateIterator (void) const |
virtual TypeId | GetInstanceTypeId (void) const |
template<typename T > | |
Ptr< T > | GetObject (void) const |
template<typename T > | |
Ptr< T > | GetObject (TypeId tid) const |
void | Initialize (void) |
This method calls the virtual DoInitialize method on all the objects aggregated to this object. More... | |
Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter > | |
SimpleRefCount () | |
Constructor. More... | |
SimpleRefCount (const SimpleRefCount &o) | |
Copy constructor. More... | |
uint32_t | GetReferenceCount (void) const |
Get the reference count of the object. More... | |
SimpleRefCount & | operator= (const SimpleRefCount &o) |
Assignment. More... | |
void | Ref (void) const |
Increment the reference count. More... | |
void | Unref (void) const |
Decrement the reference count. More... | |
Public Member Functions inherited from ns3::ObjectBase | |
virtual | ~ObjectBase () |
Virtual destructor. More... | |
void | GetAttribute (std::string name, AttributeValue &value) const |
bool | GetAttributeFailSafe (std::string name, AttributeValue &attribute) const |
void | SetAttribute (std::string name, const AttributeValue &value) |
bool | SetAttributeFailSafe (std::string name, const AttributeValue &value) |
bool | TraceConnect (std::string name, std::string context, const CallbackBase &cb) |
bool | TraceConnectWithoutContext (std::string name, const CallbackBase &cb) |
bool | TraceDisconnect (std::string name, std::string context, const CallbackBase &cb) |
bool | TraceDisconnectWithoutContext (std::string name, const CallbackBase &cb) |
Static Public Member Functions | |
static TypeId | GetTypeId (void) |
Get the type ID. More... | |
Static Public Member Functions inherited from ns3::Object | |
static TypeId | GetTypeId (void) |
Register this type. More... | |
Static Public Member Functions inherited from ns3::SimpleRefCount< Object, ObjectBase, ObjectDeleter > | |
static void | Cleanup (void) |
Noop. More... | |
Static Public Member Functions inherited from ns3::ObjectBase | |
static TypeId | GetTypeId (void) |
Get the type ID. More... | |
Public Attributes | |
uint32_t | m_availBytes |
Number of bytes available to read, i.e. More... | |
std::map< SequenceNumber32, Ptr< Packet > > | m_data |
Corresponding data (may be null) More... | |
SequenceNumber32 | m_finSeq |
Seqnum of the FIN packet. More... | |
bool | m_gotFin |
Did I received FIN packet? More... | |
uint32_t | m_maxBuffer |
Upper bound of the number of data bytes in buffer (RCV.WND) More... | |
TracedValue< SequenceNumber32 > | m_nextRxSeq |
Seqnum of the first missing byte in data (RCV.NXT) More... | |
uint32_t | m_size |
Number of total data bytes in the buffer, not necessarily contiguous. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from ns3::Object | |
Object (const Object &o) | |
virtual void | DoDispose (void) |
This method is called by Object::Dispose or by the object's destructor, whichever comes first. More... | |
virtual void | DoInitialize (void) |
This method is called only once by Object::Initialize. More... | |
virtual void | NotifyNewAggregate (void) |
This method is invoked whenever two sets of objects are aggregated together. More... | |
Protected Member Functions inherited from ns3::ObjectBase | |
void | ConstructSelf (const AttributeConstructionList &attributes) |
virtual void | NotifyConstructionCompleted (void) |
This method is invoked once all member attributes have been initialized. More... | |
class for the reordering buffer that keeps the data from lower layer, i.e.
TcpL4Protocol, sent to the application
Definition at line 40 of file tcp-rx-buffer.h.
typedef std::map<SequenceNumber32, Ptr<Packet> >::iterator ns3::TcpRxBuffer::BufIterator |
container for data stored in the buffer
Definition at line 129 of file tcp-rx-buffer.h.
ns3::TcpRxBuffer::TcpRxBuffer | ( | uint32_t | n = 0 | ) |
Constructor.
n | initial Sequence number to be received |
Definition at line 50 of file tcp-rx-buffer.cc.
|
virtual |
Definition at line 55 of file tcp-rx-buffer.cc.
Insert a packet into the buffer and update the availBytes counter to reflect the number of bytes ready to send to the application.
This function handles overlap by triming the head of the inputted packet and removing data from the buffer that overlaps the tail of the inputted packet
p | packet |
tcph | packet's TCP header |
Definition at line 137 of file tcp-rx-buffer.cc.
References ns3::Packet::CreateFragment(), ns3::TcpHeader::GetSequenceNumber(), ns3::Packet::GetSize(), m_availBytes, m_data, m_finSeq, m_gotFin, m_maxBuffer, m_nextRxSeq, m_size, NS_ASSERT, NS_LOG_FUNCTION, NS_LOG_LOGIC, and visualizer.core::start().
Referenced by ns3::TcpSocketBase::ReceivedData().
uint32_t ns3::TcpRxBuffer::Available | ( | ) | const |
Get the actual number of bytes available to be read.
Definition at line 90 of file tcp-rx-buffer.cc.
References m_availBytes.
Referenced by ns3::TcpSocketBase::GetRxAvailable(), and ns3::TcpSocketBase::ReceivedData().
Extract data from the head of the buffer as indicated by nextRxSeq.
The extracted data is going to be forwarded to the application.
maxSize | maximum number of bytes to extract |
Definition at line 220 of file tcp-rx-buffer.cc.
References m_availBytes, m_data, m_nextRxSeq, m_size, NS_ASSERT, NS_LOG_FUNCTION, and NS_LOG_LOGIC.
Referenced by ns3::TcpSocketBase::Recv().
bool ns3::TcpRxBuffer::Finished | ( | void | ) |
Check if the buffer did receive all the data (and the connection is closed)
Definition at line 131 of file tcp-rx-buffer.cc.
References m_finSeq, m_gotFin, and m_nextRxSeq.
Referenced by ns3::TcpSocketBase::PeerClose(), ns3::TcpSocketBase::ProcessEstablished(), ns3::TcpSocketBase::ProcessWait(), and ns3::TcpSocketBase::ReceivedData().
|
static |
Get the type ID.
Definition at line 31 of file tcp-rx-buffer.cc.
References m_nextRxSeq, ns3::MakeTraceSourceAccessor(), and ns3::TypeId::SetParent().
void ns3::TcpRxBuffer::IncNextRxSequence | ( | void | ) |
Increment the Next Sequence number.
Definition at line 96 of file tcp-rx-buffer.cc.
References m_nextRxSeq, m_size, NS_ASSERT, and NS_LOG_FUNCTION.
uint32_t ns3::TcpRxBuffer::MaxBufferSize | ( | void | ) | const |
Get the Maximum buffer size.
Definition at line 72 of file tcp-rx-buffer.cc.
References m_maxBuffer.
Referenced by ns3::TcpSocketBase::AdvertisedWindowSize(), and ns3::TcpSocketBase::GetRcvBufSize().
SequenceNumber32 ns3::TcpRxBuffer::MaxRxSequence | ( | void | ) | const |
Get the lowest sequence number that this TcpRxBuffer cannot accept.
Definition at line 107 of file tcp-rx-buffer.cc.
References m_data, m_finSeq, m_gotFin, m_maxBuffer, and m_nextRxSeq.
Referenced by ns3::TcpSocketBase::DoForwardUp(), ns3::TcpSocketBase::OutOfRange(), and ns3::TcpSocketBase::PeerClose().
SequenceNumber32 ns3::TcpRxBuffer::NextRxSequence | ( | void | ) | const |
Get Next Rx Sequence number.
Definition at line 60 of file tcp-rx-buffer.cc.
References m_nextRxSeq.
Referenced by ns3::TcpSocketBase::DoForwardUp(), ns3::TcpSocketBase::OutOfRange(), ns3::TcpSocketBase::PeerClose(), ns3::TcpSocketBase::PersistTimeout(), ns3::TcpSocketBase::ProcessClosing(), ns3::TcpSocketBase::ProcessLastAck(), ns3::TcpSocketBase::ProcessSynRcvd(), ns3::TcpSocketBase::ReceivedData(), ns3::TcpSocketBase::SendDataPacket(), and ns3::TcpSocketBase::SendEmptyPacket().
void ns3::TcpRxBuffer::SetFinSequence | ( | const SequenceNumber32 & | s | ) |
Set the FIN Sequence number (i.e., the one closing the connection)
s | the Sequence number |
Definition at line 121 of file tcp-rx-buffer.cc.
References m_finSeq, m_gotFin, m_nextRxSeq, NS_LOG_FUNCTION, and s.
Referenced by ns3::TcpSocketBase::PeerClose(), and ns3::TcpSocketBase::ProcessWait().
void ns3::TcpRxBuffer::SetMaxBufferSize | ( | uint32_t | s | ) |
Set the Maximum buffer size.
s | the Maximum buffer size |
Definition at line 78 of file tcp-rx-buffer.cc.
References m_maxBuffer, and s.
Referenced by ns3::TcpSocketBase::SetRcvBufSize().
void ns3::TcpRxBuffer::SetNextRxSequence | ( | const SequenceNumber32 & | s | ) |
Set the Next Sequence number.
s | the Sequence number |
Definition at line 66 of file tcp-rx-buffer.cc.
References m_nextRxSeq, and s.
Referenced by ns3::TcpSocketBase::CompleteFork(), ns3::TcpSocketBase::ProcessSynRcvd(), and ns3::TcpSocketBase::ProcessSynSent().
uint32_t ns3::TcpRxBuffer::Size | ( | void | ) | const |
Get the actual buffer occupancy.
Definition at line 84 of file tcp-rx-buffer.cc.
References m_size.
Referenced by ns3::TcpSocketBase::AdvertisedWindowSize(), ns3::TcpSocketBase::Close(), ns3::TcpSocketBase::ReceivedData(), and ns3::TcpSocketBase::Recv().
uint32_t ns3::TcpRxBuffer::m_availBytes |
Number of bytes available to read, i.e.
contiguous block at head
Definition at line 135 of file tcp-rx-buffer.h.
Referenced by Add(), Available(), and Extract().
std::map<SequenceNumber32, Ptr<Packet> > ns3::TcpRxBuffer::m_data |
Corresponding data (may be null)
Definition at line 136 of file tcp-rx-buffer.h.
Referenced by Add(), Extract(), and MaxRxSequence().
SequenceNumber32 ns3::TcpRxBuffer::m_finSeq |
Seqnum of the FIN packet.
Definition at line 131 of file tcp-rx-buffer.h.
Referenced by Add(), Finished(), MaxRxSequence(), and SetFinSequence().
bool ns3::TcpRxBuffer::m_gotFin |
Did I received FIN packet?
Definition at line 132 of file tcp-rx-buffer.h.
Referenced by Add(), Finished(), MaxRxSequence(), and SetFinSequence().
uint32_t ns3::TcpRxBuffer::m_maxBuffer |
Upper bound of the number of data bytes in buffer (RCV.WND)
Definition at line 134 of file tcp-rx-buffer.h.
Referenced by Add(), MaxBufferSize(), MaxRxSequence(), and SetMaxBufferSize().
TracedValue<SequenceNumber32> ns3::TcpRxBuffer::m_nextRxSeq |
Seqnum of the first missing byte in data (RCV.NXT)
Definition at line 130 of file tcp-rx-buffer.h.
Referenced by Add(), Extract(), Finished(), GetTypeId(), IncNextRxSequence(), MaxRxSequence(), NextRxSequence(), SetFinSequence(), and SetNextRxSequence().
uint32_t ns3::TcpRxBuffer::m_size |
Number of total data bytes in the buffer, not necessarily contiguous.
Definition at line 133 of file tcp-rx-buffer.h.
Referenced by Add(), Extract(), IncNextRxSequence(), and Size().