UDP 转发
此模块包含用于 UDP 转发功能的函数。
摘要
启用 udp-forward 功能 (OPENTHREAD_CONFIG_UDP_FORWARD_ENABLE
) 后,才能使用此模块中的函数。
类型定义符 |
|
---|---|
otUdpForwarder)(otMessage *aMessage, uint16_t aPeerPort, otIp6Address *aPeerAddr, uint16_t aSockPort, void *aContext)
|
typedefvoid(*
此函数指针会将 UDP 数据包传送到主机,主机应通过自己的网络堆栈发送该数据包。 |
函数 |
|
---|---|
otUdpForwardReceive(otInstance *aInstance, otMessage *aMessage, uint16_t aPeerPort, const otIp6Address *aPeerAddr, uint16_t aSockPort)
|
void
处理从主机收到的 UDP 数据包。
|
otUdpForwardSetForwarder(otInstance *aInstance, otUdpForwarder aForwarder, void *aContext)
|
void
设置 UDP 向前回调,向主机传送 UDP 数据包。
|
otUdpIsPortInUse(otInstance *aInstance, uint16_t port)
|
bool
确定指定的 UDP 端口是否只由 OpenThread API 打开。
|
类型定义符
otUdpForwarder
void(* otUdpForwarder)(otMessage *aMessage, uint16_t aPeerPort, otIp6Address *aPeerAddr, uint16_t aSockPort, void *aContext)
此函数指针会将 UDP 数据包传送到主机,主机应通过自己的网络堆栈发送该数据包。
详情 | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
参数 |
|
函数
otUdpForwardReceive
void otUdpForwardReceive( otInstance *aInstance, otMessage *aMessage, uint16_t aPeerPort, const otIp6Address *aPeerAddr, uint16_t aSockPort )
处理从主机收到的 UDP 数据包。
无论呼叫成功还是失败,消息都会释放。
详情 | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
参数 |
|
otUdpForwardSetForwarder
void otUdpForwardSetForwarder( otInstance *aInstance, otUdpForwarder aForwarder, void *aContext )
设置 UDP 向前回调,向主机传送 UDP 数据包。
详情 | |||||||
---|---|---|---|---|---|---|---|
参数 |
|
otUdpIsPortInUse
bool otUdpIsPortInUse( otInstance *aInstance, uint16_t port )
确定指定的 UDP 端口是否只由 OpenThread API 打开。
详情 | |||||
---|---|---|---|---|---|
参数 |
|
||||
返回值 |
|
资源
OpenThread API 参考主题源自源代码,可在 GitHub 上找到。 如需了解详情或为我们的文档做贡献,请参阅资源。