class for managing I/O between applications and TCP More...
#include "pending-data.h"
Public Member Functions | |
PendingData () | |
PendingData (const PendingData &o) | |
Copy constructor. More... | |
PendingData (const std::string &s) | |
Constructor from string. More... | |
PendingData (uint32_t s, uint8_t *d=NULL, uint32_t msg=0, uint32_t resp=0) | |
Constructor. More... | |
virtual | ~PendingData () |
virtual void | Add (Ptr< Packet > p) |
Add some data to end. More... | |
virtual void | Add (uint32_t s, const uint8_t *d=0) |
Add some data to end. More... | |
virtual void | Clear () |
Remove all associated data. More... | |
PendingData * | Copy () const |
Create a copy of self. More... | |
virtual Ptr< Packet > | CopyFromOffset (uint32_t s, uint32_t o) |
Copy data starting from a give offset. More... | |
virtual Ptr< Packet > | CopyFromSeq (uint32_t s, const SequenceNumber32 &f, const SequenceNumber32 &o) |
Copy data starting from a give offset. More... | |
PendingData * | CopyS (uint32_t s) |
Create a copy of self with new size. More... | |
PendingData * | CopySD (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... | |
class for managing I/O between applications and TCP
Definition at line 41 of file pending-data.h.
ns3::PendingData::PendingData | ( | ) |
Definition at line 42 of file pending-data.cc.
References NS_LOG_FUNCTION.
Referenced by Copy(), CopyS(), and CopySD().
ns3::PendingData::PendingData | ( | uint32_t | s, |
uint8_t * | d = NULL , |
||
uint32_t | msg = 0 , |
||
uint32_t | resp = 0 |
||
) |
Constructor.
s | size |
d | data |
msg | message size |
resp | response size |
Definition at line 48 of file pending-data.cc.
References data, NS_LOG_FUNCTION, and size.
ns3::PendingData::PendingData | ( | const std::string & | s | ) |
Constructor from string.
s | string |
Definition at line 58 of file pending-data.cc.
References data, NS_LOG_FUNCTION, and size.
ns3::PendingData::PendingData | ( | const PendingData & | o | ) |
Copy constructor.
o | object to copy |
Definition at line 66 of file pending-data.cc.
References NS_LOG_FUNCTION, and Size().
|
virtual |
Definition at line 73 of file pending-data.cc.
References NS_LOG_FUNCTION.
Add some data to end.
p | packet containing the data. |
Definition at line 110 of file pending-data.cc.
References data, ns3::Packet::GetSize(), NS_LOG_FUNCTION, and size.
|
virtual |
Add some data to end.
s | the data size. |
d | the data to store. |
Definition at line 103 of file pending-data.cc.
References data, NS_LOG_FUNCTION, and size.
|
virtual |
Remove all associated data.
Definition at line 96 of file pending-data.cc.
References data, NS_LOG_FUNCTION, and size.
Referenced by RemoveToSeq().
PendingData * ns3::PendingData::Copy | ( | void | ) | const |
Create a copy of self.
Definition at line 78 of file pending-data.cc.
References PendingData(), and NS_LOG_FUNCTION.
Copy data starting from a give offset.
s | size of data to copy |
o | offset |
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().
|
virtual |
Copy data starting from a give offset.
s | size of data to copy |
f | Front sequence |
o | Offset sequence |
Definition at line 213 of file pending-data.cc.
References CopyFromOffset(), f(), NS_LOG_FUNCTION, and OffsetFromSeq().
PendingData * ns3::PendingData::CopyS | ( | uint32_t | s | ) |
Create a copy of self with new size.
Assumes no associated data
s | new size |
Definition at line 84 of file pending-data.cc.
References PendingData(), msgSize, NS_LOG_FUNCTION, and responseSize.
PendingData * ns3::PendingData::CopySD | ( | uint32_t | s, |
uint8_t * | d | ||
) |
Create a copy of self with new size, new data.
Assumes no associated data
s | new size |
d | new data |
Definition at line 90 of file pending-data.cc.
References PendingData(), msgSize, NS_LOG_FUNCTION, and responseSize.
|
virtual |
Subtracts seqFront from seqOffset after enforcing seqFront is less than seqOffset.
seqFront | sequence number to be subtracted from seqOffset |
seqOffset | higher sequence number |
Definition at line 132 of file pending-data.cc.
References NS_LOG_FUNCTION.
Referenced by CopyFromSeq(), RemoveToSeq(), and SizeFromSeq().
|
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.
seqFront | sequence number to start to try to remove from |
seqOffset | first sequence number in buffer that should be retained |
Definition at line 220 of file pending-data.cc.
References Clear(), data, NS_ASSERT_MSG, NS_LOG_FUNCTION, OffsetFromSeq(), and size.
|
inline |
Returns the size of the pending data.
Definition at line 69 of file pending-data.h.
References size.
Referenced by PendingData().
|
virtual |
offset | offset (from zero) |
Definition at line 124 of file pending-data.cc.
References NS_LOG_FUNCTION, and size.
Referenced by CopyFromOffset(), and SizeFromSeq().
|
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.
seqFront | sequence number of assumed first byte in the PendingData |
seqOffset | sequence number of offset |
Definition at line 117 of file pending-data.cc.
References NS_LOG_FUNCTION, OffsetFromSeq(), and SizeFromOffset().
Corresponding data (may be null)
Definition at line 176 of file pending-data.h.
Referenced by PendingData(), Add(), Clear(), CopyFromOffset(), and RemoveToSeq().
uint32_t ns3::PendingData::msgSize |
Total size of message.
Definition at line 178 of file pending-data.h.
uint32_t ns3::PendingData::responseSize |
Size of response requested.
Definition at line 179 of file pending-data.h.
uint32_t ns3::PendingData::size |
Number of data bytes.
Definition at line 175 of file pending-data.h.
Referenced by PendingData(), Add(), Clear(), RemoveToSeq(), Size(), and SizeFromOffset().