UDP
המודול הזה כולל פונקציות ששולטות בתקשורת UDP.
סיכום
ספירות |
|
|---|---|
otNetifIdentifier{
|
טיפוסים בני מנייה (enum) הגדרת המזהים של ממשק הרשת של OpenThread. |
ערכי דף |
|
|---|---|
otNetifIdentifier
|
typedefenum otNetifIdentifier
הגדרת המזהים של ממשק הרשת של OpenThread. |
otUdpHandler)(void *aContext, const otMessage *aMessage, const otMessageInfo *aMessageInfo)
|
typedefbool(*
הקריאה החוזרת (callback) מאפשרת ל-OpenThread לספק handlers ספציפיים להודעות UDP מסוימות. |
otUdpReceive)(void *aContext, otMessage *aMessage, const otMessageInfo *aMessageInfo)
|
typedefvoid(*
הקריאה החוזרת (callback) הזו מאפשרת ל-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
|
הממשק של ה-Thread. |
OT_NETIF_UNSPECIFIED
|
ממשק הרשת לא צוין. |
ערכי דף
otUdpHandler
bool(* otUdpHandler)(void *aContext, const otMessage *aMessage, const otMessageInfo *aMessageInfo)
הקריאה החוזרת (callback) מאפשרת ל-OpenThread לספק handlers ספציפיים להודעות UDP מסוימות.
| פרטים | |||||
|---|---|---|---|---|---|
| ערכים מוחזרים |
|
||||
otUdpReceive
void(* otUdpReceive)(void *aContext, otMessage *aMessage, const otMessageInfo *aMessageInfo)
הקריאה החוזרת (callback) הזו מאפשרת ל-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 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. אפשר לקרוא מידע נוסף או לתרום למסמכי התיעוד שלנו בדף מקורות מידע.