otTcpCircularSendBuffer

#include <tcp_ext.h>

Represents a circular send buffer for use with a TCP endpoint.

Summary

Using a circular send buffer is optional. Applications can use a TCP endpoint to send data by managing otLinkedBuffers directly. However, some applications may find it more convenient to have a circular send buffer; such applications can call otTcpCircularSendBufferWrite() to "attach" a circular send buffer to a TCP endpoint and send out data on that TCP endpoint, relying on the circular send buffer to manage the underlying otLinkedBuffers.

otTcpCircularSendBuffer is implemented on top of the otLinkedBuffer-based API provided by an otTcpEndpoint. Once attached to an otTcpEndpoint, an otTcpCircularSendBuffer performs all the work of managing otLinkedBuffers for the connection. This means that, once an otTcpCircularSendBuffer is attached to an otTcpEndpoint, the application should not call otTcpSendByReference() or otTcpSendByExtension() on that otTcpEndpoint. Instead, the application should use otTcpCircularSendBufferWrite() to add data to the send buffer.

The otTcpForwardProgress() callback is the intended way for users to learn when space becomes available in the circular send buffer. On an otTcpEndpoint to which an otTcpCircularSendBuffer is attached, the application MUST install an otTcpForwardProgress() callback and call otTcpCircularSendBufferHandleForwardProgress() on the attached otTcpCircularSendBuffer at the start of the callback function. It is recommended that the user NOT install an otTcpSendDone() callback, as all management of otLinkedBuffers is handled by the circular send buffer.

The application should not inspect the fields of this structure directly; it should only interact with it via the TCP Circular Send Buffer API functions whose signature are provided in this file.

Public attributes

mCapacity
size_t
Length of the circular send buffer.
mCapacityUsed
size_t
Number of bytes stored in the send buffer.
mDataBuffer
uint8_t *
Pointer to data in the circular send buffer.
mFirstSendLinkIndex
uint8_t
mSendLinks[2]
mStartIndex
size_t
Index of the first valid byte in the send buffer.

Public attributes

mCapacity

size_t otTcpCircularSendBuffer::mCapacity

Length of the circular send buffer.

mCapacityUsed

size_t otTcpCircularSendBuffer::mCapacityUsed

Number of bytes stored in the send buffer.

mDataBuffer

uint8_t * otTcpCircularSendBuffer::mDataBuffer

Pointer to data in the circular send buffer.

mFirstSendLinkIndex

uint8_t otTcpCircularSendBuffer::mFirstSendLinkIndex
otLinkedBuffer otTcpCircularSendBuffer::mSendLinks[2]

mStartIndex

size_t otTcpCircularSendBuffer::mStartIndex

Index of the first valid byte in the send buffer.

Resources

OpenThread API Reference topics originate from the source code, available on GitHub. For more information, or to contribute to our documentation, refer to Resources.