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

Receive queue that manages "data stream", that is, actual bytes. More...

#include <TcpLwipByteStreamQueues.h>

Inheritance diagram for inet::tcp::TcpLwipByteStreamReceiveQueue:
inet::tcp::TcpLwipReceiveQueue

Public Member Functions

 TcpLwipByteStreamReceiveQueue ()
 Ctor. More...
 
virtual ~TcpLwipByteStreamReceiveQueue ()
 Virtual dtor. More...
 
virtual void setConnection (TcpLwipConnection *connP) override
 Add a connection queue. More...
 
virtual void notifyAboutIncomingSegmentProcessing (TCPSegment *tcpsegP, uint32 seqNo, const void *bufferP, size_t bufferLengthP) override
 Called when a TCP segment arrives, it should extract the payload from the segment and store it in the receive queue. More...
 
virtual void enqueueTcpLayerData (void *dataP, unsigned int dataLengthP) override
 The method called when data received from LWIP The method should set status of the data in queue to received called after socket->read_data() successfull. More...
 
virtual unsigned long getExtractableBytesUpTo () const
 
virtual cPacket * extractBytesUpTo () override
 Should create a packet to be passed up to the app, up to (but NOT including) the given sequence no (usually rcv_nxt). More...
 
virtual uint32 getAmountOfBufferedBytes () const override
 Returns the number of bytes (out-of-order-segments) currently buffered in queue. More...
 
virtual uint32 getQueueLength () const override
 Returns the number of blocks currently buffered in queue. More...
 
virtual void getQueueStatus () const override
 Shows current queue status. More...
 
virtual void notifyAboutSending (const TCPSegment *tcpsegP) override
 notify the queue about output messages More...
 
- Public Member Functions inherited from inet::tcp::TcpLwipReceiveQueue
 TcpLwipReceiveQueue ()
 Ctor. More...
 
virtual ~TcpLwipReceiveQueue ()
 Virtual dtor. More...
 

Protected Attributes

ByteArrayBuffer byteArrayBufferM
 store bytes More...
 
- Protected Attributes inherited from inet::tcp::TcpLwipReceiveQueue
TcpLwipConnectionconnM
 

Detailed Description

Receive queue that manages "data stream", that is, actual bytes.

Constructor & Destructor Documentation

inet::tcp::TcpLwipByteStreamReceiveQueue::TcpLwipByteStreamReceiveQueue ( )

Ctor.

106 {
107 }
inet::tcp::TcpLwipByteStreamReceiveQueue::~TcpLwipByteStreamReceiveQueue ( )
virtual

Virtual dtor.

110 {
111  // nothing to do here
112 }

Member Function Documentation

void inet::tcp::TcpLwipByteStreamReceiveQueue::enqueueTcpLayerData ( void *  dataP,
unsigned int  dataLengthP 
)
overridevirtual

The method called when data received from LWIP The method should set status of the data in queue to received called after socket->read_data() successfull.

Implements inet::tcp::TcpLwipReceiveQueue.

129 {
130  byteArrayBufferM.push(dataP, dataLengthP);
131 }
ByteArrayBuffer byteArrayBufferM
store bytes
Definition: TcpLwipByteStreamQueues.h:111
virtual void push(const ByteArray &byteArrayP)
Push data to end of buffer.
Definition: ByteArrayBuffer.cc:40
cPacket * inet::tcp::TcpLwipByteStreamReceiveQueue::extractBytesUpTo ( )
overridevirtual

Should create a packet to be passed up to the app, up to (but NOT including) the given sequence no (usually rcv_nxt).

It should return nullptr if there's no more data to be passed up – this method is called several times until it returns nullptr.

called after socket->read_data() successfull

Implements inet::tcp::TcpLwipReceiveQueue.

139 {
140  ASSERT(connM);
141 
142  RawPacket *dataMsg = nullptr;
143  uint64 bytesInQueue = byteArrayBufferM.getLength();
144 
145  if (bytesInQueue) {
146  dataMsg = new RawPacket("DATA");
147  dataMsg->setKind(TCP_I_DATA);
148  unsigned int extractBytes = bytesInQueue;
149  char *data = new char[extractBytes];
150  unsigned int extractedBytes = byteArrayBufferM.popBytesToBuffer(data, extractBytes);
151  dataMsg->setByteLength(extractedBytes);
152  dataMsg->getByteArray().assignBuffer(data, extractedBytes);
153  }
154 
155  return dataMsg;
156 }
virtual uint64 getLength() const
Returns length of stored data.
Definition: ByteArrayBuffer.h:55
ByteArrayBuffer byteArrayBufferM
store bytes
Definition: TcpLwipByteStreamQueues.h:111
TcpLwipConnection * connM
Definition: TcpLwipQueues.h:216
virtual unsigned int popBytesToBuffer(void *bufferP, unsigned int bufferLengthP)
Move bytes to an external buffer.
Definition: ByteArrayBuffer.cc:73
uint64_t uint64
Definition: Compat.h:28
Definition: TCPCommand_m.h:98
uint32 inet::tcp::TcpLwipByteStreamReceiveQueue::getAmountOfBufferedBytes ( ) const
overridevirtual

Returns the number of bytes (out-of-order-segments) currently buffered in queue.

Implements inet::tcp::TcpLwipReceiveQueue.

159 {
160  return byteArrayBufferM.getLength();
161 }
virtual uint64 getLength() const
Returns length of stored data.
Definition: ByteArrayBuffer.h:55
ByteArrayBuffer byteArrayBufferM
store bytes
Definition: TcpLwipByteStreamQueues.h:111
unsigned long inet::tcp::TcpLwipByteStreamReceiveQueue::getExtractableBytesUpTo ( ) const
virtual
134 {
135  return byteArrayBufferM.getLength();
136 }
virtual uint64 getLength() const
Returns length of stored data.
Definition: ByteArrayBuffer.h:55
ByteArrayBuffer byteArrayBufferM
store bytes
Definition: TcpLwipByteStreamQueues.h:111
uint32 inet::tcp::TcpLwipByteStreamReceiveQueue::getQueueLength ( ) const
overridevirtual

Returns the number of blocks currently buffered in queue.

Implements inet::tcp::TcpLwipReceiveQueue.

164 {
165  return byteArrayBufferM.getLength();
166 }
virtual uint64 getLength() const
Returns length of stored data.
Definition: ByteArrayBuffer.h:55
ByteArrayBuffer byteArrayBufferM
store bytes
Definition: TcpLwipByteStreamQueues.h:111
void inet::tcp::TcpLwipByteStreamReceiveQueue::getQueueStatus ( ) const
overridevirtual

Shows current queue status.

Implements inet::tcp::TcpLwipReceiveQueue.

169 {
170  // TODO
171 }
void inet::tcp::TcpLwipByteStreamReceiveQueue::notifyAboutIncomingSegmentProcessing ( TCPSegment tcpsegP,
uint32  seqNo,
const void *  bufferP,
size_t  bufferLengthP 
)
overridevirtual

Called when a TCP segment arrives, it should extract the payload from the segment and store it in the receive queue.

The segment object should not be deleted. //FIXME revise this comment

Implements inet::tcp::TcpLwipReceiveQueue.

123 {
124  ASSERT(tcpsegP);
125  ASSERT(bufferP);
126 }
void inet::tcp::TcpLwipByteStreamReceiveQueue::notifyAboutSending ( const TCPSegment tcpsegP)
overridevirtual

notify the queue about output messages

called when connM send out a packet. for read AckNo, if have

Implements inet::tcp::TcpLwipReceiveQueue.

174 {
175  // nothing to do
176 }
void inet::tcp::TcpLwipByteStreamReceiveQueue::setConnection ( TcpLwipConnection connP)
overridevirtual

Add a connection queue.

Reimplemented from inet::tcp::TcpLwipReceiveQueue.

115 {
116  ASSERT(connP);
117 
120 }
ByteArrayBuffer byteArrayBufferM
store bytes
Definition: TcpLwipByteStreamQueues.h:111
virtual void setConnection(TcpLwipConnection *connP)
Add a connection queue.
Definition: TcpLwipQueues.h:164
virtual void clear()
Clear buffer.
Definition: ByteArrayBuffer.cc:102

Member Data Documentation

ByteArrayBuffer inet::tcp::TcpLwipByteStreamReceiveQueue::byteArrayBufferM
protected

store bytes


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