A Discrete-Event Network Simulator
API
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ns3::TcpTxBuffer Class Reference

class for keeping the data sent by the application to the TCP socket, i.e. More...

#include <tcp-tx-buffer.h>

+ Inheritance diagram for ns3::TcpTxBuffer:
+ Collaboration diagram for ns3::TcpTxBuffer:

Public Member Functions

 TcpTxBuffer (uint32_t n=0)
 Constructor. More...
 
virtual ~TcpTxBuffer (void)
 
bool Add (Ptr< Packet > p)
 Append a data packet to the end of the buffer. More...
 
uint32_t Available (void) const
 Returns the available capacity in this Tx window. More...
 
Ptr< PacketCopyFromSequence (uint32_t numBytes, const SequenceNumber32 &seq)
 Copy data of size numBytes into a packet, data from the range [seq, seq+numBytes) More...
 
void DiscardUpTo (const SequenceNumber32 &seq)
 Discard data up to but not including this sequence number. More...
 
SequenceNumber32 HeadSequence (void) const
 Returns the first byte's sequence number. More...
 
uint32_t MaxBufferSize (void) const
 Returns the Tx window size. More...
 
void SetHeadSequence (const SequenceNumber32 &seq)
 Set the m_firstByteSeq to seq. More...
 
void SetMaxBufferSize (uint32_t n)
 Set the Tx window size. More...
 
uint32_t Size (void) const
 Returns total number of bytes in this Tx buffer. More...
 
uint32_t SizeFromSequence (const SequenceNumber32 &seq) const
 Returns the number of bytes from the buffer in the range [seq, tailSequence) More...
 
SequenceNumber32 TailSequence (void) const
 Returns the last byte's sequence number + 1. 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...
 
SimpleRefCountoperator= (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...
 

Private Types

typedef std::list< Ptr< Packet >
>::iterator 
BufIterator
 container for data stored in the buffer More...
 

Private Attributes

std::list< Ptr< Packet > > m_data
 Corresponding data (may be null) More...
 
TracedValue< SequenceNumber32m_firstByteSeq
 Sequence number of the first byte in data (SND.UNA) More...
 
uint32_t m_maxBuffer
 Max number of data bytes in buffer (SND.WND) More...
 
uint32_t m_size
 Number of data bytes. 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...
 

Detailed Description

class for keeping the data sent by the application to the TCP socket, i.e.

the sending buffer.

Definition at line 40 of file tcp-tx-buffer.h.

Member Typedef Documentation

typedef std::list<Ptr<Packet> >::iterator ns3::TcpTxBuffer::BufIterator
private

container for data stored in the buffer

Definition at line 132 of file tcp-tx-buffer.h.

Constructor & Destructor Documentation

ns3::TcpTxBuffer::TcpTxBuffer ( uint32_t  n = 0)

Constructor.

Parameters
ninitial Sequence number to be transmitted

Definition at line 55 of file tcp-tx-buffer.cc.

ns3::TcpTxBuffer::~TcpTxBuffer ( void  )
virtual

Definition at line 60 of file tcp-tx-buffer.cc.

Member Function Documentation

bool ns3::TcpTxBuffer::Add ( Ptr< Packet p)

Append a data packet to the end of the buffer.

Parameters
pThe packet to be appended to the Tx buffer
Returns
Boolean to indicate success

Definition at line 101 of file tcp-tx-buffer.cc.

References Available(), ns3::Packet::GetSize(), m_data, m_firstByteSeq, m_size, NS_LOG_FUNCTION, and NS_LOG_LOGIC.

Referenced by ns3::TcpSocketBase::Send().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uint32_t ns3::TcpTxBuffer::Available ( void  ) const

Returns the available capacity in this Tx window.

Returns
available capacity in this Tx window

Definition at line 95 of file tcp-tx-buffer.cc.

References m_maxBuffer, and m_size.

Referenced by Add(), and ns3::TcpSocketBase::GetTxAvailable().

+ Here is the caller graph for this function:

Ptr< Packet > ns3::TcpTxBuffer::CopyFromSequence ( uint32_t  numBytes,
const SequenceNumber32 seq 
)

Copy data of size numBytes into a packet, data from the range [seq, seq+numBytes)

Parameters
numBytesnumber of bytes to copy
seqstart sequence number to extract
Returns
a packet

Definition at line 133 of file tcp-tx-buffer.cc.

References ns3::Packet::AddAtEnd(), ns3::Packet::CreateFragment(), ns3::TracedValue< T >::Get(), ns3::Packet::GetSize(), m_data, m_firstByteSeq, NS_ASSERT, NS_LOG_FUNCTION, NS_LOG_LOGIC, s, and SizeFromSequence().

Referenced by ns3::TcpSocketBase::PersistTimeout(), and ns3::TcpSocketBase::SendDataPacket().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ns3::TcpTxBuffer::DiscardUpTo ( const SequenceNumber32 seq)

Discard data up to but not including this sequence number.

Parameters
seqThe sequence number of the head byte

Definition at line 208 of file tcp-tx-buffer.cc.

References ns3::TracedValue< T >::Get(), m_data, m_firstByteSeq, m_maxBuffer, m_size, NS_ASSERT, NS_LOG_FUNCTION, and NS_LOG_LOGIC.

Referenced by ns3::TcpSocketBase::NewAck().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

TypeId ns3::TcpTxBuffer::GetTypeId ( void  )
static

Get the type ID.

Returns
the object TypeId

Definition at line 36 of file tcp-tx-buffer.cc.

References m_firstByteSeq, ns3::MakeTraceSourceAccessor(), and ns3::TypeId::SetParent().

+ Here is the call graph for this function:

uint32_t ns3::TcpTxBuffer::MaxBufferSize ( void  ) const

Returns the Tx window size.

Returns
the Tx window size (in bytes)

Definition at line 83 of file tcp-tx-buffer.cc.

References m_maxBuffer.

Referenced by ns3::TcpSocketBase::GetSndBufSize().

+ Here is the caller graph for this function:

void ns3::TcpTxBuffer::SetHeadSequence ( const SequenceNumber32 seq)

Set the m_firstByteSeq to seq.

Supposed to be called only when the connection is just set up and we did not send any data out yet.

Parameters
seqThe sequence number of the head byte

Definition at line 201 of file tcp-tx-buffer.cc.

References m_firstByteSeq, and NS_LOG_FUNCTION.

Referenced by ns3::TcpSocketBase::ProcessSynRcvd(), and ns3::TcpSocketBase::ProcessSynSent().

+ Here is the caller graph for this function:

void ns3::TcpTxBuffer::SetMaxBufferSize ( uint32_t  n)

Set the Tx window size.

Parameters
nTx window size (in bytes)

Definition at line 89 of file tcp-tx-buffer.cc.

References m_maxBuffer.

Referenced by ns3::TcpSocketBase::SetSndBufSize().

+ Here is the caller graph for this function:

uint32_t ns3::TcpTxBuffer::Size ( void  ) const

Returns total number of bytes in this Tx buffer.

Returns
total number of bytes in this Tx buffer

Definition at line 77 of file tcp-tx-buffer.cc.

References m_size.

Referenced by ns3::TcpSocketBase::DoRetransmit(), ns3::TcpSocketBase::NewAck(), ns3::TcpSocketBase::ProcessWait(), ns3::TcpSocketBase::Send(), ns3::TcpSocketBase::SendPendingData(), and ns3::TcpSocketBase::ShutdownSend().

+ Here is the caller graph for this function:

uint32_t ns3::TcpTxBuffer::SizeFromSequence ( const SequenceNumber32 seq) const

Returns the number of bytes from the buffer in the range [seq, tailSequence)

Parameters
seqinitial sequence number
Returns
the number of bytes from the buffer in the range

Definition at line 121 of file tcp-tx-buffer.cc.

References m_firstByteSeq, m_size, NS_LOG_FUNCTION, and NS_LOG_LOGIC.

Referenced by ns3::TcpSocketBase::Close(), CopyFromSequence(), ns3::TcpNewReno::DupAck(), ns3::TcpSocketBase::SendDataPacket(), and ns3::TcpSocketBase::SendPendingData().

+ Here is the caller graph for this function:

SequenceNumber32 ns3::TcpTxBuffer::TailSequence ( void  ) const

Returns the last byte's sequence number + 1.

Returns
the last byte's sequence number + 1

Definition at line 71 of file tcp-tx-buffer.cc.

References m_firstByteSeq, and m_size.

Member Data Documentation

std::list<Ptr<Packet> > ns3::TcpTxBuffer::m_data
private

Corresponding data (may be null)

Definition at line 137 of file tcp-tx-buffer.h.

Referenced by Add(), CopyFromSequence(), and DiscardUpTo().

TracedValue<SequenceNumber32> ns3::TcpTxBuffer::m_firstByteSeq
private

Sequence number of the first byte in data (SND.UNA)

Definition at line 134 of file tcp-tx-buffer.h.

Referenced by Add(), CopyFromSequence(), DiscardUpTo(), GetTypeId(), HeadSequence(), SetHeadSequence(), SizeFromSequence(), and TailSequence().

uint32_t ns3::TcpTxBuffer::m_maxBuffer
private

Max number of data bytes in buffer (SND.WND)

Definition at line 136 of file tcp-tx-buffer.h.

Referenced by Available(), DiscardUpTo(), MaxBufferSize(), and SetMaxBufferSize().

uint32_t ns3::TcpTxBuffer::m_size
private

Number of data bytes.

Definition at line 135 of file tcp-tx-buffer.h.

Referenced by Add(), Available(), DiscardUpTo(), Size(), SizeFromSequence(), and TailSequence().


The documentation for this class was generated from the following files: