UDP
โมดูลนี้มีฟังก์ชันที่ควบคุมการสื่อสาร UDP
สรุป
คําอธิบาย |
|
---|---|
otNetifIdentifier{
|
enum การแจงนับนี้จะระบุตัวระบุอินเทอร์เฟซเครือข่าย OpenThread |
พิมพ์ดีด |
|
---|---|
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 Socket ที่ลิงก์
|
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
|
อินเทอร์เฟซเครือข่ายที่ไม่ได้ระบุ |
พิมพ์ดีด
otNetifIdentifier
enum otNetifIdentifier otNetifIdentifier
การแจงนับนี้จะระบุตัวระบุอินเทอร์เฟซเครือข่าย OpenThread
otUdpHandler
bool(* otUdpHandler)(void *aContext, const otMessage *aMessage, const otMessageInfo *aMessageInfo)
โค้ดเรียกกลับนี้ทําให้ OpenThread ระบุเครื่องจัดการที่เจาะจงสําหรับข้อความ UDP บางข้อความได้
รายละเอียด | |||||
---|---|---|---|---|---|
แสดงผลค่า |
|
รับ UUppReceive
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
รายละเอียด | |||||||||
---|---|---|---|---|---|---|---|---|---|
พารามิเตอร์ |
|
||||||||
แสดงผลค่า |
|
ปิด UdpClose
otError otUdpClose( otInstance *aInstance, otUdpSocket *aSocket )
ปิดซ็อกเก็ต UDP/IPv6
รายละเอียด | |||||
---|---|---|---|---|---|
พารามิเตอร์ |
|
||||
แสดงผลค่า |
|
OTUDConnect
otError otUdpConnect( otInstance *aInstance, otUdpSocket *aSocket, const otSockAddr *aSockName )
เชื่อมต่อซ็อกเก็ต UDP/IPv6
รายละเอียด | |||||||
---|---|---|---|---|---|---|---|
พารามิเตอร์ |
|
||||||
แสดงผลค่า |
|
OTUdpGetSockets
otUdpSocket * otUdpGetSockets( otInstance *aInstance )
ฟังก์ชันนี้จะได้รับส่วนหัวของรายการ UDP Socket ที่ลิงก์
รายละเอียด | |||
---|---|---|---|
พารามิเตอร์ |
|
||
ส่งคืน |
ตัวชี้ไปยังส่วนหัวของรายการที่ลิงก์ UDP Socket
|
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 โดยไม่มีซ็อกเก็ต
รายละเอียด | |||||||
---|---|---|---|---|---|---|---|
พารามิเตอร์ |
|
||||||
แสดงผลค่า |
|
ทรัพยากร
หัวข้อการอ้างอิง OpenThread API มาจากซอร์สโค้ดซึ่งมีอยู่ใน GitHub โปรดดูข้อมูลเพิ่มเติมในหรือไปที่เอกสารประกอบที่แหล่งข้อมูล