nl::Inet::RawEndPoint

#include <src/inet/RawEndPoint.h>

Objects of this class represent raw IP network endpoints.

Summary

Nest Inet Layer encapsulates methods for interacting with IP network endpoints (SOCK_RAW sockets on Linux and BSD-derived systems) or LwIP raw protocol control blocks, as the system is configured accordingly.

Inheritance

Inherits from: nl::Inet::IPEndPointBasis

Public attributes

IPProto
IPProtocol
version of the Internet Control Message Protocol (ICMP)
IPVer
IPVersion
Version of the Internet protocol.

Public functions

Bind(IPAddressType addrType, IPAddress addr, InterfaceId intfId)
Bind the endpoint to an interface IP address.
BindIPv6LinkLocal(InterfaceId intf, IPAddress addr)
Bind the endpoint to an interface IPv6 link-local address.
BindInterface(IPAddressType addrType, InterfaceId intf)
Bind the endpoint to a network interface.
Close(void)
void
Close the endpoint.
Free(void)
void
Close the endpoint and recycle its memory.
GetBoundInterface(void)
InterfaceId
Get the bound interface on this endpoint.
Listen(void)
Prepare the endpoint to receive ICMP messages.
SendTo(IPAddress addr, Weave::System::PacketBuffer *msg, uint16_t sendFlags)
A synonym for SendTo(addr, INET_NULL_INTERFACEID, msg, sendFlags).
SendTo(IPAddress addr, InterfaceId intfId, Weave::System::PacketBuffer *msg, uint16_t sendFlags)
Send an ICMP message to the specified destination address.
SetICMPFilter(uint8_t numICMPTypes, const uint8_t *aICMPTypes)
Set the ICMP6 filter parameters in the network stack.

Public attributes

IPProto

IPProtocol IPProto

version of the Internet Control Message Protocol (ICMP)

While this field is a mutable class variable, it is an invariant of the class that it not be modified.

IPVer

IPVersion IPVer

Version of the Internet protocol.

While this field is a mutable class variable, it is an invariant of the class that it not be modified.

Public functions

Bind

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

Bind the endpoint to an interface IP address.

Binds the endpoint to the specified network interface IP address.

Details
Parameters
[in] addrType
the protocol version of the IP address
[in] addr
the IP address (must be an interface address)
[in] intfId
an optional network interface indicator
Return Values
INET_NO_ERROR
success: endpoint bound to address
INET_ERROR_INCORRECT_STATE
endpoint has been bound previously
INET_NO_MEMORY
insufficient memory for endpoint
INET_ERROR_UNKNOWN_INTERFACE
On some platforms, the optionally specified interface is not present.
INET_ERROR_WRONG_PROTOCOL_TYPE
addrType does not match IPVer.
INET_ERROR_WRONG_ADDRESS_TYPE
addrType is kIPAddressType_Any, or the type of addr is not equal to addrType.
other
another system or platform error

On LwIP, this method must not be called with the LwIP stack lock already acquired.

BindIPv6LinkLocal

INET_ERROR BindIPv6LinkLocal(
  InterfaceId intf,
  IPAddress addr
)

Bind the endpoint to an interface IPv6 link-local address.

Bind the raw endpoint to an IPv6 link-local scope address at the specified interface index.

Binds the endpoint to the IPv6 link-local address addr on the network interface indicated by intf.

Details
Parameters
[in] intf
the indicator of the network interface
[in] addr
the IP address (must be an interface address)
Return Values
INET_NO_ERROR
success: endpoint bound to address
INET_ERROR_INCORRECT_STATE
endpoint has been bound previously
INET_NO_MEMORY
insufficient memory for endpoint
INET_ERROR_WRONG_PROTOCOL_TYPE
addrType does not match IPVer.
INET_ERROR_WRONG_ADDRESS_TYPE
addr is not an IPv6 link-local address or intf is INET_NULL_INTERFACEID.
other
another system or platform error

On LwIP, this method must not be called with the LwIP stack lock already acquired.

Also sets various IPv6 socket options appropriate for transmitting packets to and from on-link destinations.

Details
Parameters
[in] intf
An InterfaceId to identify the scope of the address.
[in] addr
An IPv6 link-local scope IPAddress object.
Returns
INET_NO_ERROR on success, or a mapped OS error on failure. An invalid parameter list can result in INET_ERROR_WRONG_ADDRESS_TYPE. If the raw endpoint is already bound or is listening, then returns INET_ERROR_INCORRECT_STATE.

BindInterface

INET_ERROR BindInterface(
  IPAddressType addrType,
  InterfaceId intf
)

Bind the endpoint to a network interface.

Binds the endpoint to the specified network interface IP address.

Details
Parameters
[in] addrType
the protocol version of the IP address.
[in] intf
indicator of the network interface.
Return Values
INET_NO_ERROR
success: endpoint bound to address
INET_NO_MEMORY
insufficient memory for endpoint
INET_ERROR_NOT_IMPLEMENTED
system implementation not complete.
INET_ERROR_UNKNOWN_INTERFACE
On some platforms, the interface is not present.
other
another system or platform error

On LwIP, this method must not be called with the LwIP stack lock already acquired.

Close

void Close(
  void
)

Close the endpoint.

If mState != kState_Closed, then closes the endpoint, removing it from the set of endpoints eligible for communication events.

On LwIP systems, this method must not be called with the LwIP stack lock already acquired.

Free

void Free(
  void
)

Close the endpoint and recycle its memory.

Invokes the Close method, then invokes the InetLayerBasis::Release method to return the object to its memory pool.

On LwIP systems, this method must not be called with the LwIP stack lock already acquired.

GetBoundInterface

InterfaceId GetBoundInterface(
  void
)

Get the bound interface on this endpoint.

Details
Returns
InterfaceId The bound interface id.

Listen

INET_ERROR Listen(
  void
)

Prepare the endpoint to receive ICMP messages.

If mState is already kState_Listening, then no operation is performed, otherwise the mState is set to kState_Listening and the endpoint is prepared to received ICMPv6 messages, according to the semantics of the platform.

Details
Return Values
INET_NO_ERROR
always returned.

On LwIP, this method must not be called with the LwIP stack lock already acquired

SendTo

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

A synonym for SendTo(addr, INET_NULL_INTERFACEID, msg, sendFlags).

SendTo

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

Send an ICMP message to the specified destination address.

 If possible, then this method sends the ICMP message \c msg to the
 destination \c addr with the transmit option flags encoded
 in \c sendFlags.

 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.

Details
Parameters
[in] addr
the destination IP address
[in] intfId
an optional network interface indicator
[in] msg
the packet buffer containing the UDP message
[in] sendFlags
optional transmit option flags
Return Values
INET_NO_ERROR
success: msg is queued for transmit.
INET_ERROR_NOT_IMPLEMENTED
system implementation not complete.
INET_ERROR_WRONG_ADDRESS_TYPE
the destination address and the bound interface address do not have matching protocol versions or address type.
INET_ERROR_MESSAGE_TOO_LONG
msg does not contain the whole ICMP message.
INET_ERROR_OUTBOUND_MESSAGE_TRUNCATED
On some platforms, only a truncated portion of msg was queued for transmit.
other
another system or platform error

SetICMPFilter

INET_ERROR SetICMPFilter(
  uint8_t numICMPTypes,
  const uint8_t *aICMPTypes
)

Set the ICMP6 filter parameters in the network stack.

Apply the ICMPv6 filtering parameters for the codes in aICMPTypes to the underlying endpoint in the system networking stack.

Details
Parameters
[in] numICMPTypes
length of array at aICMPTypes
[in] aICMPTypes
the set of ICMPv6 type codes to filter.
Return Values
INET_NO_ERROR
success: filter parameters set
INET_ERROR_NOT_IMPLEMENTED
system does not implement
INET_ERROR_WRONG_ADDRESS_TYPE
endpoint not IPv6 type
INET_ERROR_WRONG_PROTOCOL_TYPE
endpoint not ICMP6 type
other
another system or platform error