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
|
Thread インターフェース。 |
OT_NETIF_UNSPECIFIED
|
未指定のネットワーク インターフェース。 |
Typedef
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 で入手できるソースコードに由来しています。 詳細について、またはドキュメントへの投稿については、リソースをご覧ください。