25 #include "ns3/packet.h" 
   26 #include "ns3/fatal-error.h" 
   42     .SetGroupName (
"Internet")
 
   44     .AddTraceSource (
"UnackSequence",
 
   45                      "First unacknowledged sequence number (SND.UNA)",
 
   47                      "ns3::SequenceNumber32TracedValueCallback")
 
   60   : m_firstByteSeq (n), m_size (0), m_maxBuffer (32768), m_data (0)
 
  120   NS_LOG_LOGIC (
"Rejected. Not enough room to buffer packet.");
 
  132                 ", returns " << lastSeq - seq);
 
  133   return lastSeq - seq;
 
  143       return Create<Packet> (); 
 
  147       return Create<Packet> (s);
 
  153   uint32_t pktSize = 0;
 
  154   bool beginFound = 
false;
 
  161       pktSize = (*i)->GetSize ();
 
  164           if (count + pktSize > offset)
 
  166               NS_LOG_LOGIC (
"First byte found in packet #" << pktCount << 
" at buffer offset " << count
 
  167                                                            << 
", packet len=" << pktSize);
 
  169               uint32_t packetOffset = offset - count;
 
  170               uint32_t fragmentLength = count + pktSize - offset;
 
  171               if (fragmentLength >= s)
 
  173                   return (*i)->CreateFragment (packetOffset, s);
 
  182       else if (count + pktSize >= offset + s)
 
  184           NS_LOG_LOGIC (
"Last byte found in packet #" << pktCount << 
" at buffer offset " << count
 
  185                                                       << 
", packet len=" << pktSize);
 
  186           uint32_t fragmentLength = offset + s - count;
 
  194           NS_LOG_LOGIC (
"Appending to output the packet #" << pktCount << 
" of offset " << count << 
" len=" << pktSize);
 
  216                                      << 
", numPkts=" << 
m_data.size ());
 
  225   while (i != 
m_data.end ())
 
  227       if (offset > (*i)->GetSize ())
 
  229           pktSize = (*i)->GetSize ();
 
  234           NS_LOG_LOGIC (
"Removed one packet of size " << pktSize << 
", offset=" << offset);
 
  238           pktSize = (*i)->GetSize () - offset;
 
  239           *i = (*i)->CreateFragment (offset, pktSize);
 
  242           NS_LOG_LOGIC (
"Fragmented one packet by size " << offset << 
", new size=" << pktSize);
 
  252                         <<
" numPkts="<< 
m_data.size ());
 
uint32_t Size(void) const 
Returns total number of bytes in this Tx buffer. 
 
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by "...
 
void DiscardUpTo(const SequenceNumber32 &seq)
Discard data up to but not including this sequence number. 
 
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system. 
 
uint32_t SizeFromSequence(const SequenceNumber32 &seq) const 
Returns the number of bytes from the buffer in the range [seq, tailSequence) 
 
SequenceNumber32 HeadSequence(void) const 
Returns the first byte's sequence number. 
 
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file...
 
uint32_t MaxBufferSize(void) const 
Returns the Tx window size. 
 
#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). 
 
T Get(void) const 
Get the underlying value. 
 
Ptr< const TraceSourceAccessor > MakeTraceSourceAccessor(T a)
Create a TraceSourceAccessor which will control access to the underlying trace source. 
 
Ptr< Packet > CreateFragment(uint32_t start, uint32_t length) const 
Create a new packet which contains a fragment of the original packet. 
 
void AddAtEnd(Ptr< const Packet > packet)
Concatenate the input packet at the end of the current packet. 
 
TracedValue< SequenceNumber32 > m_firstByteSeq
Sequence number of the first byte in data (SND.UNA) 
 
uint32_t m_size
Number of data bytes. 
 
class for keeping the data sent by the application to the TCP socket, i.e. 
 
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC. 
 
void SetMaxBufferSize(uint32_t n)
Set the Tx window size. 
 
uint32_t Available(void) const 
Returns the available capacity in this Tx window. 
 
Every class exported by the ns3 library is enclosed in the ns3 namespace. 
 
bool Add(Ptr< Packet > p)
Append a data packet to the end of the buffer. 
 
static TypeId GetTypeId(void)
Get the type ID. 
 
uint32_t m_maxBuffer
Max number of data bytes in buffer (SND.WND) 
 
A base class which provides memory management and object aggregation. 
 
TcpTxBuffer(uint32_t n=0)
Constructor. 
 
virtual ~TcpTxBuffer(void)
 
a unique identifier for an interface. 
 
TypeId SetParent(TypeId tid)
Set the parent TypeId. 
 
std::list< Ptr< Packet > >::iterator BufIterator
container for data stored in the buffer 
 
SequenceNumber< uint32_t, int32_t > SequenceNumber32
32 bit Sequence number. 
 
SequenceNumber32 TailSequence(void) const 
Returns the last byte's sequence number + 1. 
 
std::list< Ptr< Packet > > m_data
Corresponding data (may be null) 
 
void SetHeadSequence(const SequenceNumber32 &seq)
Set the m_firstByteSeq to seq. 
 
Ptr< Packet > CopyFromSequence(uint32_t numBytes, const SequenceNumber32 &seq)
Copy data of size numBytes into a packet, data from the range [seq, seq+numBytes) ...