A Discrete-Event Network Simulator
API
ns3::PendingData Class Reference

class for managing I/O between applications and TCP More...

#include "pending-data.h"

+ Collaboration diagram for ns3::PendingData:

Public Member Functions

 PendingData ()
 
 PendingData (uint32_t s, uint8_t *d=NULL, uint32_t msg=0, uint32_t resp=0)
 Constructor. More...
 
 PendingData (const std::string &s)
 Constructor from string. More...
 
 PendingData (const PendingData &o)
 Copy constructor. More...
 
virtual ~PendingData ()
 
virtual void Add (uint32_t s, const uint8_t *d=0)
 Add some data to end. More...
 
virtual void Add (Ptr< Packet > p)
 Add some data to end. More...
 
virtual void Clear ()
 Remove all associated data. More...
 
PendingDataCopy () const
 Create a copy of self. More...
 
virtual Ptr< PacketCopyFromOffset (uint32_t s, uint32_t o)
 Copy data starting from a give offset. More...
 
virtual Ptr< PacketCopyFromSeq (uint32_t s, const SequenceNumber32 &f, const SequenceNumber32 &o)
 Copy data starting from a give offset. More...
 
PendingDataCopyS (uint32_t s)
 Create a copy of self with new size. More...
 
PendingDataCopySD (uint32_t s, uint8_t *d)
 Create a copy of self with new size, new data. More...
 
virtual uint32_t OffsetFromSeq (const SequenceNumber32 &seqFront, const SequenceNumber32 &seqOffset)
 Subtracts seqFront from seqOffset after enforcing seqFront is less than seqOffset. More...
 
virtual uint32_t RemoveToSeq (const SequenceNumber32 &seqFront, const SequenceNumber32 &seqOffset)
 Permits object to clear any pending data between seqFront and seqOffset - 1). More...
 
uint32_t Size () const
 Returns the size of the pending data. More...
 
virtual uint32_t SizeFromOffset (uint32_t offset)
 
virtual uint32_t SizeFromSeq (const SequenceNumber32 &seqFront, const SequenceNumber32 &seqOffset)
 This method returns the number of bytes in the PendingData buffer beyond the sequence number specified by seqOffset. More...
 

Public Attributes

std::vector< Ptr< Packet > > data
 Corresponding data (may be null) More...
 
uint32_t msgSize
 Total size of message. More...
 
uint32_t responseSize
 Size of response requested. More...
 
uint32_t size
 Number of data bytes. More...
 

Detailed Description

class for managing I/O between applications and TCP

Definition at line 41 of file pending-data.h.

Constructor & Destructor Documentation

◆ PendingData() [1/4]

ns3::PendingData::PendingData ( )

Definition at line 42 of file pending-data.cc.

References NS_LOG_FUNCTION.

Referenced by Copy(), CopyS(), and CopySD().

+ Here is the caller graph for this function:

◆ PendingData() [2/4]

ns3::PendingData::PendingData ( uint32_t  s,
uint8_t *  d = NULL,
uint32_t  msg = 0,
uint32_t  resp = 0 
)

Constructor.

Parameters
ssize
ddata
msgmessage size
respresponse size

Definition at line 48 of file pending-data.cc.

References data, NS_LOG_FUNCTION, and size.

◆ PendingData() [3/4]

ns3::PendingData::PendingData ( const std::string &  s)

Constructor from string.

Parameters
sstring

Definition at line 58 of file pending-data.cc.

References data, NS_LOG_FUNCTION, and size.

◆ PendingData() [4/4]

ns3::PendingData::PendingData ( const PendingData o)

Copy constructor.

Parameters
oobject to copy

Definition at line 66 of file pending-data.cc.

References NS_LOG_FUNCTION, and Size().

+ Here is the call graph for this function:

◆ ~PendingData()

ns3::PendingData::~PendingData ( )
virtual

Definition at line 73 of file pending-data.cc.

References NS_LOG_FUNCTION.

Member Function Documentation

◆ Add() [1/2]

void ns3::PendingData::Add ( uint32_t  s,
const uint8_t *  d = 0 
)
virtual

Add some data to end.

Parameters
sthe data size.
dthe data to store.

Definition at line 103 of file pending-data.cc.

References data, NS_LOG_FUNCTION, and size.

◆ Add() [2/2]

void ns3::PendingData::Add ( Ptr< Packet p)
virtual

Add some data to end.

Parameters
ppacket containing the data.

Definition at line 110 of file pending-data.cc.

References data, ns3::Packet::GetSize(), NS_LOG_FUNCTION, and size.

+ Here is the call graph for this function:

◆ Clear()

void ns3::PendingData::Clear ( void  )
virtual

Remove all associated data.

Definition at line 96 of file pending-data.cc.

References data, NS_LOG_FUNCTION, and size.

Referenced by RemoveToSeq().

+ Here is the caller graph for this function:

◆ Copy()

PendingData * ns3::PendingData::Copy ( void  ) const

Create a copy of self.

Returns
copy of pending data

Definition at line 78 of file pending-data.cc.

References NS_LOG_FUNCTION, and PendingData().

+ Here is the call graph for this function:

◆ CopyFromOffset()

Ptr< Packet > ns3::PendingData::CopyFromOffset ( uint32_t  s,
uint32_t  o 
)
virtual

Copy data starting from a give offset.

Parameters
ssize of data to copy
ooffset
Returns
a packet containing the requested data

Definition at line 142 of file pending-data.cc.

References ns3::Packet::AddAtEnd(), ns3::Packet::CreateFragment(), data, ns3::Packet::GetSize(), min, NS_ASSERT, NS_LOG_FUNCTION, and SizeFromOffset().

Referenced by CopyFromSeq().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ CopyFromSeq()

Ptr< Packet > ns3::PendingData::CopyFromSeq ( uint32_t  s,
const SequenceNumber32 f,
const SequenceNumber32 o 
)
virtual

Copy data starting from a give offset.

Parameters
ssize of data to copy
fFront sequence
oOffset sequence
See also
PendingData::OffsetFromSeq()
Returns
a packet containing the requested data

Definition at line 213 of file pending-data.cc.

References CopyFromOffset(), f(), NS_LOG_FUNCTION, and OffsetFromSeq().

+ Here is the call graph for this function:

◆ CopyS()

PendingData * ns3::PendingData::CopyS ( uint32_t  s)

Create a copy of self with new size.

Assumes no associated data

Parameters
snew size
Returns
copy of pending data

Definition at line 84 of file pending-data.cc.

References msgSize, NS_LOG_FUNCTION, PendingData(), and responseSize.

+ Here is the call graph for this function:

◆ CopySD()

PendingData * ns3::PendingData::CopySD ( uint32_t  s,
uint8_t *  d 
)

Create a copy of self with new size, new data.

Assumes no associated data

Parameters
snew size
dnew data
Returns
copy of pending data

Definition at line 90 of file pending-data.cc.

References msgSize, NS_LOG_FUNCTION, PendingData(), and responseSize.

+ Here is the call graph for this function:

◆ OffsetFromSeq()

uint32_t ns3::PendingData::OffsetFromSeq ( const SequenceNumber32 seqFront,
const SequenceNumber32 seqOffset 
)
virtual

Subtracts seqFront from seqOffset after enforcing seqFront is less than seqOffset.

Parameters
seqFrontsequence number to be subtracted from seqOffset
seqOffsethigher sequence number
Returns
seqOffset-seqFront

Definition at line 132 of file pending-data.cc.

References NS_LOG_FUNCTION.

Referenced by CopyFromSeq(), RemoveToSeq(), and SizeFromSeq().

+ Here is the caller graph for this function:

◆ RemoveToSeq()

uint32_t ns3::PendingData::RemoveToSeq ( const SequenceNumber32 seqFront,
const SequenceNumber32 seqOffset 
)
virtual

Permits object to clear any pending data between seqFront and seqOffset - 1).

Callers should check the return value to determine whether any data was removed from the front.

Parameters
seqFrontsequence number to start to try to remove from
seqOffsetfirst sequence number in buffer that should be retained
Returns
number of bytes from the front that were removed from the buffer

Definition at line 220 of file pending-data.cc.

References Clear(), data, NS_ASSERT_MSG, NS_LOG_FUNCTION, OffsetFromSeq(), and size.

+ Here is the call graph for this function:

◆ Size()

uint32_t ns3::PendingData::Size ( void  ) const
inline

Returns the size of the pending data.

Returns
size of pending data

Definition at line 69 of file pending-data.h.

References size.

Referenced by PendingData().

+ Here is the caller graph for this function:

◆ SizeFromOffset()

uint32_t ns3::PendingData::SizeFromOffset ( uint32_t  offset)
virtual
Returns
number of bytes in the data buffer beyond the offset specified
Parameters
offsetoffset (from zero)
Todo:
should this return zero, or error out?

Definition at line 124 of file pending-data.cc.

References NS_LOG_FUNCTION, and size.

Referenced by CopyFromOffset(), and SizeFromSeq().

+ Here is the caller graph for this function:

◆ SizeFromSeq()

uint32_t ns3::PendingData::SizeFromSeq ( const SequenceNumber32 seqFront,
const SequenceNumber32 seqOffset 
)
virtual

This method returns the number of bytes in the PendingData buffer beyond the sequence number specified by seqOffset.

The variables seqFront and seqOffset correspond to a sequence number space in use by the user. What is significant in this method is the difference between them; i.e. the quantity (seqOffset - seqFront). This difference is subtracted from Size(), yielding the number of bytes beyond seqOffset, from the user perspective, in the PendingData buffer.

If the first number specified is not a sequence number that corresponds to the first data byte in the PendingData buffer, the computation returned will be in error.

Returns
number of bytes
Parameters
seqFrontsequence number of assumed first byte in the PendingData
seqOffsetsequence number of offset

Definition at line 117 of file pending-data.cc.

References NS_LOG_FUNCTION, OffsetFromSeq(), and SizeFromOffset().

+ Here is the call graph for this function:

Member Data Documentation

◆ data

std::vector<Ptr<Packet> > ns3::PendingData::data

Corresponding data (may be null)

Definition at line 176 of file pending-data.h.

Referenced by Add(), Clear(), CopyFromOffset(), PendingData(), and RemoveToSeq().

◆ msgSize

uint32_t ns3::PendingData::msgSize

Total size of message.

Definition at line 178 of file pending-data.h.

Referenced by CopyS(), and CopySD().

◆ responseSize

uint32_t ns3::PendingData::responseSize

Size of response requested.

Definition at line 179 of file pending-data.h.

Referenced by CopyS(), and CopySD().

◆ size

uint32_t ns3::PendingData::size

Number of data bytes.

Definition at line 175 of file pending-data.h.

Referenced by Add(), Clear(), PendingData(), RemoveToSeq(), Size(), and SizeFromOffset().


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