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 開啟。
|
類型
OUdpForwarder
void(* otUdpForwarder)(otMessage *aMessage, uint16_t aPeerPort, otIp6Address *aPeerAddr, uint16_t aSockPort, void *aContext)
此函式指標會將 UDP 封包提供給主機,主機應透過其網路堆疊傳送封包。
說明 | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
參數 |
|
函式
otUdpForward 接收
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 開啟。
說明 | |||||
---|---|---|---|---|---|
參數 |
|
||||
傳回值 |
|