UDP
این ماژول شامل توابعی است که ارتباطات UDP را کنترل می کند.
خلاصه
| شمارش ها | |
|---|---|
| otNetifIdentifier { | enum  شناسه های رابط شبکه OpenThread را تعریف می کند.  | 
| Typedefs | |
|---|---|
| otNetifIdentifier | typedef enum otNetifIdentifier شناسه های رابط شبکه OpenThread را تعریف می کند. | 
| otUdpHandler )(void *aContext, const otMessage *aMessage, const otMessageInfo *aMessageInfo) | typedef bool(* این تماس به OpenThread اجازه میدهد تا کنترلکنندههای خاصی را برای پیامهای UDP خاص ارائه کند. | 
| otUdpReceive )(void *aContext, otMessage *aMessage, const otMessageInfo *aMessageInfo) | typedef void(* این فراخوانی به OpenThread اجازه می دهد تا برنامه را از یک پیام UDP دریافتی مطلع کند. | 
| otUdpReceiver | typedef struct otUdpReceiver یک گیرنده UDP را نشان می دهد. | 
| otUdpSocket | typedef struct 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
Typedefs
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 بدون سوکت ارسال می کند.
| جزئیات | |||||||
|---|---|---|---|---|---|---|---|
| مولفه های | 
 | ||||||
| ارزش های بازگشتی | 
 | 
منابع
موضوعات مرجع OpenThread API از کد منبع موجود در GitHub سرچشمه می گیرند. برای اطلاعات بیشتر، یا مشارکت در اسناد ما، به منابع مراجعه کنید.