INET Framework for OMNeT++/OMNEST
inet::tcp::TcpLwipVirtualDataSendQueue Class Reference

Send queue that manages "virtual bytes", that is, byte counts only. More...

#include <TcpLwipVirtualDataQueues.h>

Inheritance diagram for inet::tcp::TcpLwipVirtualDataSendQueue:
inet::tcp::TcpLwipSendQueue

Public Member Functions

 TcpLwipVirtualDataSendQueue ()
 Ctor. More...
 
virtual ~TcpLwipVirtualDataSendQueue ()
 Virtual dtor. More...
 
virtual void setConnection (TcpLwipConnection *connP) override
 set connection queue, and initialise queue variables. More...
 
virtual void enqueueAppData (cPacket *msgP) override
 Called on SEND app command, it inserts in the queue the data the user wants to send. More...
 
virtual unsigned int getBytesForTcpLayer (void *bufferP, unsigned int bufferLengthP) const override
 Copy data to the buffer for send to LWIP. More...
 
virtual void dequeueTcpLayerMsg (unsigned int msgLengthP) override
 This function should remove msgLengthP bytes from TCP layer queue. More...
 
virtual unsigned long getBytesAvailable () const override
 Utility function: returns how many bytes are available in the queue. More...
 
virtual TCPSegmentcreateSegmentWithBytes (const void *tcpDataP, unsigned int tcpLengthP) override
 Called when the TCP wants to send or retransmit data, it constructs a TCP segment which contains the data from the requested sequence number range. More...
 
virtual void discardUpTo (uint32 seqNumP)
 
- Public Member Functions inherited from inet::tcp::TcpLwipSendQueue
 TcpLwipSendQueue ()
 Ctor. More...
 
virtual ~TcpLwipSendQueue ()
 Virtual dtor. More...
 

Protected Attributes

long int unsentTcpLayerBytesM
 
- Protected Attributes inherited from inet::tcp::TcpLwipSendQueue
TcpLwipConnectionconnM
 

Detailed Description

Send queue that manages "virtual bytes", that is, byte counts only.

Constructor & Destructor Documentation

inet::tcp::TcpLwipVirtualDataSendQueue::TcpLwipVirtualDataSendQueue ( )

Ctor.

34  :
36 {
37 }
long int unsentTcpLayerBytesM
Definition: TcpLwipVirtualDataQueues.h:61
inet::tcp::TcpLwipVirtualDataSendQueue::~TcpLwipVirtualDataSendQueue ( )
virtual

Virtual dtor.

40 {
41 }

Member Function Documentation

TCPSegment * inet::tcp::TcpLwipVirtualDataSendQueue::createSegmentWithBytes ( const void *  tcpDataP,
unsigned int  tcpLengthP 
)
overridevirtual

Called when the TCP wants to send or retransmit data, it constructs a TCP segment which contains the data from the requested sequence number range.

The actually returned segment may contain less then maxNumBytes bytes if the subclass wants to reproduce the original segment boundaries when retransmitting.

called from inside of send_callback() called before called the send() to IP layer

Implements inet::tcp::TcpLwipSendQueue.

79 {
80  ASSERT(tcpDataP);
81 
82  TCPSegment *tcpseg = serializer::TCPSerializer().deserialize((const unsigned char *)tcpDataP, tcpLengthP, false);
83  uint32 numBytes = tcpseg->getPayloadLength();
84 
85  char msgname[80];
86  sprintf(msgname, "%.10s%s%s%s(l=%lu)",
87  "tcpseg",
88  tcpseg->getSynBit() ? " SYN" : "",
89  tcpseg->getFinBit() ? " FIN" : "",
90  (tcpseg->getAckBit() && 0 == numBytes) ? " ACK" : "",
91  (unsigned long)numBytes);
92  tcpseg->setName(msgname);
93 
94  return tcpseg;
95 }
uint32_t uint32
Definition: Compat.h:30
void inet::tcp::TcpLwipVirtualDataSendQueue::dequeueTcpLayerMsg ( unsigned int  msgLengthP)
overridevirtual

This function should remove msgLengthP bytes from TCP layer queue.

Implements inet::tcp::TcpLwipSendQueue.

67 {
68  ASSERT(msgLengthP <= unsentTcpLayerBytesM);
69 
70  unsentTcpLayerBytesM -= msgLengthP;
71 }
long int unsentTcpLayerBytesM
Definition: TcpLwipVirtualDataQueues.h:61
void inet::tcp::TcpLwipVirtualDataSendQueue::discardUpTo ( uint32  seqNumP)
virtual
98 {
99  // nothing to do here
100 }
void inet::tcp::TcpLwipVirtualDataSendQueue::enqueueAppData ( cPacket *  msgP)
overridevirtual

Called on SEND app command, it inserts in the queue the data the user wants to send.

Implementations of this abstract class will decide what this means: copying actual bytes, just increasing the "last byte queued" variable, or storing cMessage object(s). The msg object should not be referenced after this point (sendQueue may delete it.)

Implements inet::tcp::TcpLwipSendQueue.

50 {
51  ASSERT(msgP);
52 
53  int bytes = msgP->getByteLength();
54  delete msgP;
55 
56  unsentTcpLayerBytesM += bytes;
57 }
long int unsentTcpLayerBytesM
Definition: TcpLwipVirtualDataQueues.h:61
unsigned long inet::tcp::TcpLwipVirtualDataSendQueue::getBytesAvailable ( ) const
overridevirtual

Utility function: returns how many bytes are available in the queue.

Implements inet::tcp::TcpLwipSendQueue.

74 {
75  return unsentTcpLayerBytesM;
76 }
long int unsentTcpLayerBytesM
Definition: TcpLwipVirtualDataQueues.h:61
unsigned int inet::tcp::TcpLwipVirtualDataSendQueue::getBytesForTcpLayer ( void *  bufferP,
unsigned int  bufferLengthP 
) const
overridevirtual

Copy data to the buffer for send to LWIP.

returns lengh of copied data. create msg for socket->send_data()

called before called socket->send_data()

Implements inet::tcp::TcpLwipSendQueue.

60 {
61  ASSERT(bufferP);
62 
63  return (unsentTcpLayerBytesM > bufferLengthP) ? bufferLengthP : unsentTcpLayerBytesM;
64 }
long int unsentTcpLayerBytesM
Definition: TcpLwipVirtualDataQueues.h:61
void inet::tcp::TcpLwipVirtualDataSendQueue::setConnection ( TcpLwipConnection connP)
overridevirtual

set connection queue, and initialise queue variables.

Reimplemented from inet::tcp::TcpLwipSendQueue.

44 {
47 }
long int unsentTcpLayerBytesM
Definition: TcpLwipVirtualDataQueues.h:61
virtual void setConnection(TcpLwipConnection *connP)
set connection queue, and initialise queue variables.
Definition: TcpLwipQueues.h:101

Member Data Documentation

long int inet::tcp::TcpLwipVirtualDataSendQueue::unsentTcpLayerBytesM
protected

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