nl::Inet::TunEndPoint

#include <src/inet/TunEndPoint.h>

Objects of this class represent tunnel interfaces.

Summary

Nest Inet Layer encapsulates methods for interacting on both POSIX systems and LwIP systems with an IP-in-IP tunneling mechanism for supporting the Weave tunnel agent.

Inheritance

Inherits from: nl::Inet::EndPointBasis

Public types

@11 enum
Basic dynamic state of the underlying tunnel.
OnPacketReceivedFunct)(TunEndPoint *endPoint, Weave::System::PacketBuffer *message) typedef
void(*
Type of packet receive event handler.
OnReceiveErrorFunct)(TunEndPoint *endPoint, INET_ERROR err) typedef
void(*
Type of error event handler.
RouteOp{
  kRouteTunIntf_Add = 0,
  kRouteTunIntf_Del = 1
}
enum
Operation when setting route to tunnel interface.
RouteOp typedef
Operation when setting route to tunnel interface.

Public attributes

OnPacketReceived
The endpoint's packet receive event handler delegate.
OnReceiveError
mAppState
void *
Pointer to application-specific state object.
mState
enum nl::Inet::TunEndPoint::@11
Basic dynamic state of the underlying tunnel.

Public functions

Free(void)
void
Close the tunnel and release handle on the object.
GetTunnelInterfaceId(void)
InterfaceId
Get the tunnel interface identifier.
Init(InetLayer *inetLayer)
void
Initialize the Tunnel EndPoint object.
InterfaceDown(void)
Deactivate the tunnel interface.
InterfaceUp(void)
Activate the tunnel interface.
IsInterfaceUp(void) const
bool
Extract the activation state of the tunnel interface.
Open(void)
Open a tunnel pseudo interface and create a handle to it.
Open(const char *intfName)
Send(Weave::System::PacketBuffer *message)
Send an IPv6 packet to the tun device to be sent out.

Public types

@11

 @11

Basic dynamic state of the underlying tunnel.

Objects are initialized in the "open" state, proceed to the "closed" state when they are ready to be recycled.

OnPacketReceivedFunct

void(* OnPacketReceivedFunct)(TunEndPoint *endPoint, Weave::System::PacketBuffer *message)

Type of packet receive event handler.

Type of delegate to a higher layer to act upon receipt of an IPv6 packet from the tunnel.

Details
Parameters
[in] endPoint
A pointer to the TunEndPoint object.
[in] message
A pointer to the Weave::System::PacketBuffer message object.

OnReceiveErrorFunct

void(* OnReceiveErrorFunct)(TunEndPoint *endPoint, INET_ERROR err)

Type of error event handler.

Type of delegate to a higher layer to act upon error processing an IPv6 packet from the tunnel.

Details
Parameters
[in] endPoint
The TunEndPoint object.
[in] err
Error code reported.

RouteOp

 RouteOp

Operation when setting route to tunnel interface.

Values of this enumerated type are used when setting a route for the encapsulated tunnel.

Properties
kRouteTunIntf_Add

Add route for a prefix.

kRouteTunIntf_Del

Remove route for a prefix.

RouteOp

enum nl::Inet::TunEndPoint::RouteOp RouteOp

Operation when setting route to tunnel interface.

Values of this enumerated type are used when setting a route for the encapsulated tunnel.

Public attributes

OnPacketReceived

OnPacketReceivedFunct OnPacketReceived

The endpoint's packet receive event handler delegate.

OnReceiveError

OnReceiveErrorFunct OnReceiveError

mAppState

void * mAppState

Pointer to application-specific state object.

mState

enum nl::Inet::TunEndPoint::@11 mState

Basic dynamic state of the underlying tunnel.

Objects are initialized in the "open" state, proceed to the "closed" state when they are ready to be recycled.

Public functions

Free

void Free(
  void
)

Close the tunnel and release handle on the object.

Close the tunnel pseudo interface device and decrement the reference count of the InetLayer object.

GetTunnelInterfaceId

InterfaceId GetTunnelInterfaceId(
  void
)

Get the tunnel interface identifier.

Details
Returns
The tunnel interface identifier.

Init

void Init(
  InetLayer *inetLayer
)

Initialize the Tunnel EndPoint object.

Details
Parameters
[in] inetLayer
A pointer to the Inet layer object that created the Tunnel EndPoint.

InterfaceDown

INET_ERROR InterfaceDown(
  void
)

Deactivate the tunnel interface.

Details
Return Values
INET_NO_ERROR
success: tunnel interface is deactivated.
other
another system or platform error

InterfaceUp

INET_ERROR InterfaceUp(
  void
)

Activate the tunnel interface.

Details
Return Values
INET_NO_ERROR
success: tunnel interface is activated.
other
another system or platform error

IsInterfaceUp

bool IsInterfaceUp(
  void
) const 

Extract the activation state of the tunnel interface.

Details
Returns
true if the tunnel interface is active, otherwise false.

Open

INET_ERROR Open(
  void
)

Open a tunnel pseudo interface and create a handle to it.

Details
Returns
INET_NO_ERROR on success, else a corresponding INET mapped OS error.

Open

INET_ERROR Open(
  const char *intfName
)

Send

INET_ERROR Send(
  Weave::System::PacketBuffer *message
)

Send an IPv6 packet to the tun device to be sent out.

Details
Parameters
[in] message
the IPv6 packet to send.
Return Values
INET_NO_ERROR
success: packet encapsulated and queued to send
INET_ERROR_NOT_SUPPORTED
packet not IP version 6
INET_ERROR_BAD_ARGS
message is a NULL pointer