nl::Inet::RawEndPoint

#include <src/inet/RawEndPoint.h>

這個類別的物件代表原始 IP 網路端點。

摘要

Nest Inet Layer 會封裝與 IP 網路端點 (Linux 和 BSD 衍生系統上的 SOCK_RAW 通訊端) 或 LwIP 原始通訊協定控制模塊互動的方法,因為系統會視情況進行設定。

繼承

沿用來源: nl::Inet::IPEndPointBasis

公開屬性

IPProto
IPProtocol
網際網路控制訊息通訊協定 (ICMP) 的版本
IPVer
IPVersion
網際網路通訊協定的版本。

公用函式

Bind(IPAddressType addrType, IPAddress addr, InterfaceId intfId)
將端點繫結至介面 IP 位址。
BindIPv6LinkLocal(InterfaceId intf, IPAddress addr)
將原始端點繫結至指定介面索引的 IPv6 連結本機範圍位址。
BindInterface(IPAddressType addrType, InterfaceId intf)
將端點繫結至網路介面。
Close(void)
void
關閉端點。
Free(void)
void
關閉端點並回收其記憶體。
GetBoundInterface(void)
InterfaceId
取得這個端點的繫結介面。
Listen(void)
準備端點以接收 ICMP 訊息。
SendMsg(const IPPacketInfo *pktInfo, Weave::System::PacketBuffer *msg, uint16_t sendFlags)
將 ICMP 訊息傳送至指定目的地。
SendTo(IPAddress addr, Weave::System::PacketBuffer *msg, uint16_t sendFlags)
SendTo(addr, INET_NULL_INTERFACEID, msg, sendFlags) 的同義詞。
SendTo(IPAddress addr, InterfaceId intfId, Weave::System::PacketBuffer *msg, uint16_t sendFlags)
將 ICMP 訊息傳送至指定的目的地地址。
SetICMPFilter(uint8_t numICMPTypes, const uint8_t *aICMPTypes)
在網路堆疊中設定 ICMP6 篩選器參數。

公開屬性

IPProto

IPProtocol IPProto

網際網路控制訊息通訊協定 (ICMP) 的版本

雖然這個欄位是可變動的類別變數,但是類別不變的變數,因此並未修改。

IPVer

IPVersion IPVer

網際網路通訊協定的版本。

雖然這個欄位是可變動的類別變數,但是類別不變的變數,因此並未修改。

公用函式

繫結

INET_ERROR Bind(
  IPAddressType addrType,
  IPAddress addr,
  InterfaceId intfId
)

將端點繫結至介面 IP 位址。

將端點繫結至指定的網路介面 IP 位址。

詳細說明
參數
[in] addrType
IP 位址的通訊協定版本
[in] addr
IP 位址 (必須是介面位址)
[in] intfId
選用的網路介面指標
傳回值
INET_NO_ERROR
成功:端點繫結至位址
INET_ERROR_INCORRECT_STATE
先前已建立端點繫結
INET_NO_MEMORY
端點的記憶體不足
INET_ERROR_UNKNOWN_INTERFACE
在某些平台上,系統不會顯示選擇性指定的介面。
INET_ERROR_WRONG_PROTOCOL_TYPE
addrType不符合 IPVer
INET_ERROR_WRONG_ADDRESS_TYPE
addrTypekIPAddressType_Any,或者 addr 的類型不等於 addrType
other
其他系統或平台錯誤

在 LwIP 上,如果已經取得 LwIP 堆疊鎖定,就不得呼叫此方法。

BindIPv6LinkLocal

INET_ERROR BindIPv6LinkLocal(
  InterfaceId intf,
  IPAddress addr
)

將原始端點繫結至指定介面索引的 IPv6 連結本機範圍位址。

此外,還要設定各種適用的 IPv6 通訊端選項,以便將封包傳入及傳出連結目的地。

intf 指定的網路介面上,將端點繫結至 IPv6 連結本機位址 addr

詳細說明
參數
[in] intf
用於識別地址範圍的 InterfaceId。
[in] addr
IPv6 連結本機範圍 IPAddress 物件。
參數
[in] intf
網路介面的指標
[in] addr
IP 位址 (必須是介面位址)
傳回值
INET_NO_ERROR
成功:端點繫結至位址
INET_ERROR_INCORRECT_STATE
先前已建立端點繫結
INET_NO_MEMORY
端點的記憶體不足
INET_ERROR_WRONG_PROTOCOL_TYPE
addrType不符合 IPVer
INET_ERROR_WRONG_ADDRESS_TYPE
addr 不是 IPv6 連結本機位址,或者 intfINET_NULL_INTERFACEID
other
其他系統或平台錯誤
傳回
失敗時出現 INET_NO_ERROR,或對應失敗時對應的 OS 錯誤。參數清單無效可能會導致 INET_ERROR_WRONG_ADDRESS_TYPE。如果原始端點已繫結或正在監聽,則會傳回 INET_ERROR_INCORRECT_STATE。將端點繫結至介面 IPv6 連結本機位址。

在 LwIP 上,如果已經取得 LwIP 堆疊鎖定,就不得呼叫此方法。

BindInterface

INET_ERROR BindInterface(
  IPAddressType addrType,
  InterfaceId intf
)

將端點繫結至網路介面。

將端點繫結至指定的網路介面 IP 位址。

詳細說明
參數
[in] addrType
IP 位址的通訊協定版本
[in] intf
網路介面的指標。
傳回值
INET_NO_ERROR
成功:端點繫結至位址
INET_NO_MEMORY
端點的記憶體不足
INET_ERROR_NOT_IMPLEMENTED
系統實作程序未完成
INET_ERROR_UNKNOWN_INTERFACE
部分平台不會顯示該介面。
other
其他系統或平台錯誤

在 LwIP 上,如果已經取得 LwIP 堆疊鎖定,就不得呼叫此方法。

關閉

void Close(
  void
)

關閉端點。

如果設為 mState != kState_Closed,則會關閉端點,並從符合通訊事件資格的端點組合中移除端點。

在 LwIP 系統中,如果已取得 LwIP 堆疊鎖定,就不能呼叫此方法。

免費

void Free(
  void
)

關閉端點並回收其記憶體。

叫用 Close 方法,然後叫用 InetLayerBasis::Release 方法,將物件傳回其記憶體集區。

在 LwIP 系統中,如果已取得 LwIP 堆疊鎖定,就不能呼叫此方法。

GetBoundInterface

InterfaceId GetBoundInterface(
  void
)

取得這個端點的繫結介面。

詳細說明
傳回
InterfaceId 繫結介面 ID。

聆聽

INET_ERROR Listen(
  void
)

準備端點以接收 ICMP 訊息。

如果 mState 已經為 kState_Listening,則系統不會執行任何作業,否則將 mState 設為 kState_Listening,且根據平台的語意,將準備好接收 ICMPv6 訊息。

詳細說明
傳回值
INET_NO_ERROR
一律傳回。

在 LwIP 上,如果已取得 LwIP 堆疊鎖定,就不得呼叫此方法

SendMsg

INET_ERROR SendMsg(
  const IPPacketInfo *pktInfo,
  Weave::System::PacketBuffer *msg,
  uint16_t sendFlags
)

將 ICMP 訊息傳送至指定目的地。

 Send the ICMP message \c msg using the destination information given in \c addr.

 Where (sendFlags & kSendFlag_RetainBuffer) != 0, calls
 Weave::System::PacketBuffer::Free on behalf of the caller, otherwise this
 method deep-copies \c msg into a fresh object, and queues that for
 transmission, leaving the original \c msg available after return.

詳細說明
參數
[in] pktInfo
訊息的目的地資訊
[in] msg
包含 UDP 訊息的封包緩衝區
[in] sendFlags
選用的傳輸選項旗標
傳回值
INET_NO_ERROR
成功:msg 已排入傳輸佇列。
INET_ERROR_NOT_SUPPORTED
系統不支援要求的作業。
INET_ERROR_WRONG_ADDRESS_TYPE
目的地位址和繫結介面位址沒有相符的通訊協定版本或位址類型。
INET_ERROR_MESSAGE_TOO_LONG
msg 不包含完整的 ICMP 訊息。
INET_ERROR_OUTBOUND_MESSAGE_TRUNCATED
在某些平台上,只有 msg 的部分內容已排入傳送佇列。
other
其他系統或平台錯誤

SendTo

INET_ERROR SendTo(
  IPAddress addr,
  Weave::System::PacketBuffer *msg,
  uint16_t sendFlags
)

SendTo(addr, INET_NULL_INTERFACEID, msg, sendFlags) 的同義詞。

SendTo

INET_ERROR SendTo(
  IPAddress addr,
  InterfaceId intfId,
  Weave::System::PacketBuffer *msg,
  uint16_t sendFlags
)

將 ICMP 訊息傳送至指定的目的地地址。

 Send the ICMP message in \c msg to the destination given in \c addr.

 Where (sendFlags & kSendFlag_RetainBuffer) != 0, calls
 Weave::System::PacketBuffer::Free on behalf of the caller, otherwise this
 method deep-copies \c msg into a fresh object, and queues that for
 transmission, leaving the original \c msg available after return.

詳細說明
參數
[in] addr
目的地 IP 位址
[in] intfId
選用的網路介面指標
[in] msg
包含 UDP 訊息的封包緩衝區
[in] sendFlags
選用的傳輸選項旗標
傳回值
INET_NO_ERROR
成功:msg 已排入傳輸佇列。
INET_ERROR_NOT_SUPPORTED
系統不支援要求的作業。
INET_ERROR_WRONG_ADDRESS_TYPE
目的地位址和繫結介面位址沒有相符的通訊協定版本或位址類型。
INET_ERROR_MESSAGE_TOO_LONG
msg 不包含完整的 ICMP 訊息。
INET_ERROR_OUTBOUND_MESSAGE_TRUNCATED
在某些平台上,只有 msg 的部分內容已排入傳送佇列。
other
其他系統或平台錯誤

SetICMPFilter

INET_ERROR SetICMPFilter(
  uint8_t numICMPTypes,
  const uint8_t *aICMPTypes
)

在網路堆疊中設定 ICMP6 篩選器參數。

aICMPTypes 中程式碼的 ICMPv6 篩選參數套用至系統網路堆疊中的基礎端點。

詳細說明
參數
[in] numICMPTypes
aICMPTypes 的陣列長度
[in] aICMPTypes
ICMPv6 類型代碼的組合。
傳回值
INET_NO_ERROR
成功:已設定篩選器參數
INET_ERROR_NOT_IMPLEMENTED
系統不會執行
INET_ERROR_WRONG_ADDRESS_TYPE
端點非 IPv6 類型
INET_ERROR_WRONG_PROTOCOL_TYPE
端點類型不是 ICMP6
other
其他系統或平台錯誤