otTcpCircularSendBuffer

#include <tcp_ext.h>

表示用于 TCP 端点的环形发送缓冲区。

摘要

使用循环发送缓冲区是可选的。应用可以通过直接管理 otLinkedBuffers 来使用 TCP 端点发送数据。不过,有些应用可能会发现使用循环发送缓冲区更方便;此类应用可以调用 otTcpCircularSendBufferWrite() 以将循环发送缓冲区“附加”到 TCP 端点,并在该 TCP 端点上发送数据,从而依靠循环发送缓冲区来管理底层 otLinkedBuffers。

otTcpCircularSendBuffer 是在 otTcpEndpoint 提供的基于 otLinkedBuffer 的 API 之上实现的。附加到 otTcpEndpoint 后,otTcpCircularSendBuffer 会执行管理连接的 otLinkedBuffers 的所有工作。这意味着,将 otTcpCircularSendBuffer 附加到 otTcpEndpoint 后,应用不应对该 otTcpEndpoint 调用 otTcpSendByReference()otTcpSendByExtension()。相反,应用应使用 otTcpCircularSendBufferWrite() 将数据添加到发送缓冲区。

otTcpForwardProgress() 回调旨在让用户了解环形发送缓冲区中何时有可用空间。在附加了 otTcpCircularSendBufferotTcpEndpoint 上,应用必须在回调函数开始时安装 otTcpForwardProgress() 回调,并在附加的 otTcpCircularSendBuffer建议用户不要安装 otTcpSendDone() 回调,因为所有 otLinkedBuffers 管理工作都是由循环发送缓冲区处理的。

应用不应直接检查此结构的字段,而应仅通过 TCP Circular Send Buffer API 函数(在此文件中提供了其签名)与其交互。

公共属性

mCapacity
size_t
循环发送缓冲区的长度。
mCapacityUsed
size_t
发送缓冲区中存储的字节数。
mDataBuffer
uint8_t *
指向环形发送缓冲区中数据的指针。
mFirstSendLinkIndex
uint8_t
mSendLinks[2]
mStartIndex
size_t
发送缓冲区中第一个有效字节的索引。

公共属性

mCapacity

size_t otTcpCircularSendBuffer::mCapacity

循环发送缓冲区的长度。

mCapacityUsed

size_t otTcpCircularSendBuffer::mCapacityUsed

发送缓冲区中存储的字节数。

mDataBuffer

uint8_t * otTcpCircularSendBuffer::mDataBuffer

指向环形发送缓冲区中数据的指针。

mFirstSendLinkIndex

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

mStartIndex

size_t otTcpCircularSendBuffer::mStartIndex

发送缓冲区中第一个有效字节的索引。

资源

OpenThread API 参考文档源自 GitHub 上提供的源代码。如需了解详情,或者为我们的文档做贡献,请参阅资源