UDP
โมดูลนี้ประกอบด้วยฟังก์ชันที่ควบคุมการสื่อสารผ่าน UDP
สรุป
การแจกแจง |
|
|---|---|
otNetifIdentifier{
|
enum กำหนดตัวระบุอินเทอร์เฟซเครือข่าย OpenThread |
Typedef |
|
|---|---|
otNetifIdentifier
|
typedefenum otNetifIdentifier
กำหนดตัวระบุอินเทอร์เฟซเครือข่าย OpenThread |
otUdpHandler)(void *aContext, const otMessage *aMessage, const otMessageInfo *aMessageInfo)
|
typedefbool(*
โค้ดเรียกกลับนี้ช่วยให้ OpenThread สามารถระบุเครื่องจัดการที่เฉพาะเจาะจงสำหรับข้อความ UDP บางรายการ |
otUdpReceive)(void *aContext, otMessage *aMessage, const otMessageInfo *aMessageInfo)
|
typedefvoid(*
โค้ดเรียกกลับนี้ช่วยให้ OpenThread แจ้งแอปพลิเคชันของข้อความ UDP ที่ได้รับได้ |
otUdpReceiver
|
typedefstruct otUdpReceiver
แสดงตัวรับ UDP |
otUdpSocket
|
typedefstruct otUdpSocket
แสดงซ็อกเก็ต UDP |
ฟังก์ชัน |
|
|---|---|
otUdpAddReceiver(otInstance *aInstance, otUdpReceiver *aUdpReceiver)
|
เพิ่มตัวรับ UDP
|
otUdpBind(otInstance *aInstance, otUdpSocket *aSocket, const otSockAddr *aSockName, otNetifIdentifier aNetif)
|
เชื่อมโยงซ็อกเก็ต UDP/IPv6
|
otUdpClose(otInstance *aInstance, otUdpSocket *aSocket)
|
ปิดซ็อกเก็ต UDP/IPv6
|
otUdpConnect(otInstance *aInstance, otUdpSocket *aSocket, const otSockAddr *aSockName)
|
เชื่อมต่อซ็อกเก็ต UDP/IPv6
|
otUdpGetSockets(otInstance *aInstance)
|
รับส่วนหัวของรายการซ็อกเก็ต UDP ที่ลิงก์
|
otUdpIsOpen(otInstance *aInstance, const otUdpSocket *aSocket)
|
bool
ตรวจสอบว่าซ็อกเก็ต UDP เปิดอยู่หรือไม่
|
otUdpNewMessage(otInstance *aInstance, const otMessageSettings *aSettings)
|
จัดสรรบัฟเฟอร์ข้อความใหม่สำหรับการส่งข้อความ UDP
|
otUdpOpen(otInstance *aInstance, otUdpSocket *aSocket, otUdpReceive aCallback, void *aContext)
|
เปิดซ็อกเก็ต UDP/IPv6
|
otUdpRemoveReceiver(otInstance *aInstance, otUdpReceiver *aUdpReceiver)
|
นำตัวรับ UDP ออก
|
otUdpSend(otInstance *aInstance, otUdpSocket *aSocket, otMessage *aMessage, const otMessageInfo *aMessageInfo)
|
ส่งข้อความ UDP/IPv6
|
otUdpSendDatagram(otInstance *aInstance, otMessage *aMessage, otMessageInfo *aMessageInfo)
|
ส่งข้อความ UDP โดยไม่มีซ็อกเก็ต
|
โครงสร้าง |
|
|---|---|
| otUdpReceiver |
แสดงตัวรับ UDP |
| otUdpSocket |
แสดงซ็อกเก็ต UDP |
การแจกแจง
otNetifIdentifier
otNetifIdentifier
กำหนดตัวระบุอินเทอร์เฟซเครือข่าย OpenThread
| พร็อพเพอร์ตี้ | |
|---|---|
OT_NETIF_BACKBONE
|
อินเทอร์เฟซ Backbone |
OT_NETIF_THREAD
|
อินเทอร์เฟซของเทรด |
OT_NETIF_UNSPECIFIED
|
อินเทอร์เฟซเครือข่ายที่ไม่ระบุ |
Typedef
otNetifIdentifier
enum otNetifIdentifier otNetifIdentifier
กำหนดตัวระบุอินเทอร์เฟซเครือข่าย OpenThread
otUdpHandler
bool(* otUdpHandler)(void *aContext, const otMessage *aMessage, const otMessageInfo *aMessageInfo)
โค้ดเรียกกลับนี้ช่วยให้ OpenThread สามารถระบุเครื่องจัดการที่เฉพาะเจาะจงสำหรับข้อความ UDP บางรายการ
| รายละเอียด | |||||
|---|---|---|---|---|---|
| แสดงผลค่า |
|
||||
otUdpReceive
void(* otUdpReceive)(void *aContext, otMessage *aMessage, const otMessageInfo *aMessageInfo)
โค้ดเรียกกลับนี้ช่วยให้ OpenThread แจ้งแอปพลิเคชันของข้อความ UDP ที่ได้รับได้
ฟังก์ชัน
otUdpAddReceiver
otError otUdpAddReceiver( otInstance *aInstance, otUdpReceiver *aUdpReceiver )
เพิ่มตัวรับ UDP
| รายละเอียด | |||||
|---|---|---|---|---|---|
| พารามิเตอร์ |
|
||||
| แสดงผลค่า |
|
||||
otUdpBind
otError otUdpBind( otInstance *aInstance, otUdpSocket *aSocket, const otSockAddr *aSockName, otNetifIdentifier aNetif )
เชื่อมโยงซ็อกเก็ต UDP/IPv6
| รายละเอียด | |||||||||
|---|---|---|---|---|---|---|---|---|---|
| พารามิเตอร์ |
|
||||||||
| แสดงผลค่า |
|
||||||||
otUdpClose
otError otUdpClose( otInstance *aInstance, otUdpSocket *aSocket )
ปิดซ็อกเก็ต UDP/IPv6
| รายละเอียด | |||||
|---|---|---|---|---|---|
| พารามิเตอร์ |
|
||||
| แสดงผลค่า |
|
||||
otUdpConnect
otError otUdpConnect( otInstance *aInstance, otUdpSocket *aSocket, const otSockAddr *aSockName )
เชื่อมต่อซ็อกเก็ต UDP/IPv6
| รายละเอียด | |||||||
|---|---|---|---|---|---|---|---|
| พารามิเตอร์ |
|
||||||
| แสดงผลค่า |
|
||||||
otUdpGetSockets
otUdpSocket * otUdpGetSockets( otInstance *aInstance )
รับส่วนหัวของรายการซ็อกเก็ต UDP ที่ลิงก์
| รายละเอียด | |||
|---|---|---|---|
| พารามิเตอร์ |
|
||
| การส่งคืน |
ตัวชี้ไปยังส่วนหัวของรายการที่เชื่อมโยงกับซ็อกเก็ต UDP
|
||
otUdpIsOpen
bool otUdpIsOpen( otInstance *aInstance, const otUdpSocket *aSocket )
ตรวจสอบว่าซ็อกเก็ต UDP เปิดอยู่หรือไม่
| รายละเอียด | |||||
|---|---|---|---|---|---|
| พารามิเตอร์ |
|
||||
| การส่งคืน |
ซ็อกเก็ต UDP เปิดอยู่หรือไม่
|
||||
otUdpNewMessage
otMessage * otUdpNewMessage( otInstance *aInstance, const otMessageSettings *aSettings )
จัดสรรบัฟเฟอร์ข้อความใหม่สำหรับการส่งข้อความ UDP
| รายละเอียด | |||||
|---|---|---|---|---|---|
| พารามิเตอร์ |
|
||||
| การส่งคืน |
ตัวชี้ไปยังบัฟเฟอร์ข้อความหรือค่า NULL หากไม่มีบัฟเฟอร์ข้อความหรือพารามิเตอร์ไม่ถูกต้อง
|
||||
otMessageFree
otUdpOpen
otError otUdpOpen( otInstance *aInstance, otUdpSocket *aSocket, otUdpReceive aCallback, void *aContext )
เปิดซ็อกเก็ต UDP/IPv6
| รายละเอียด | |||||||||
|---|---|---|---|---|---|---|---|---|---|
| พารามิเตอร์ |
|
||||||||
| แสดงผลค่า |
|
||||||||
otUdpRemoveReceiver
otError otUdpRemoveReceiver( otInstance *aInstance, otUdpReceiver *aUdpReceiver )
นำตัวรับ UDP ออก
| รายละเอียด | |||||
|---|---|---|---|---|---|
| พารามิเตอร์ |
|
||||
| แสดงผลค่า |
|
||||
otUdpSend
otError otUdpSend( otInstance *aInstance, otUdpSocket *aSocket, otMessage *aMessage, const otMessageInfo *aMessageInfo )
ส่งข้อความ UDP/IPv6
หากค่าผลลัพธ์คือ OT_ERROR_NONE, OpenThread จะเป็นเจ้าของ aMessage และผู้โทรไม่ควรอ้างอิง aMessage อีกต่อไป หากค่าที่แสดงผลไม่ใช่ OT_ERROR_NONE ผู้โทรจะยังคงเป็นเจ้าของ aMessage รวมถึงเพิ่มพื้นที่ว่าง aMessage หากไม่จำเป็นต้องใช้บัฟเฟอร์ข้อความอีก
| รายละเอียด | |||||||||
|---|---|---|---|---|---|---|---|---|---|
| พารามิเตอร์ |
|
||||||||
| รายละเอียด | |||||||
|---|---|---|---|---|---|---|---|
| แสดงผลค่า |
|
||||||
otUdpSendDatagram
otError otUdpSendDatagram( otInstance *aInstance, otMessage *aMessage, otMessageInfo *aMessageInfo )
ส่งข้อความ UDP โดยไม่มีซ็อกเก็ต
| รายละเอียด | |||||||
|---|---|---|---|---|---|---|---|
| พารามิเตอร์ |
|
||||||
| แสดงผลค่า |
|
||||||
แหล่งข้อมูล
หัวข้ออ้างอิง API ของ OpenThread จะมาจากซอร์สโค้ดซึ่งพร้อมใช้งานใน GitHub ดูข้อมูลเพิ่มเติมหรือมีส่วนร่วมในเอกสารประกอบของเราได้ที่แหล่งข้อมูล