nl:: Weave:: Profiles:: WeaveTunnel:: WeaveTunnelConnectionMgr
#include <src/lib/profiles/weave-tunneling/WeaveTunnelConnectionMgr.h>
This class encapsulates all the Weave tunnel connection states and the associated management logic and functions.
Summary
An instance of this class would be used to manage the tunnel over each interface through which the Weave tunnel to the Service would exist.
Constructors and Destructors |
|
---|---|
WeaveTunnelConnectionMgr(void)
|
Public types |
|
---|---|
ConnectPolicyCallback)(void *const appState, ReconnectParam &reconnectParam, uint32_t &delayMsec)
|
typedefvoid(*
Callback to fetch the interval of time to wait before the next tunnel reconnect. |
TunnelConnNotifyReasons{
|
enum |
TunnelConnNotifyReasons
|
typedef |
TunnelConnectionState{
|
enum |
TunnelConnectionState
|
typedef |
Public attributes |
|
---|---|
mServiceConnDelayPolicyCallback
|
Public functions |
|
---|---|
Init(WeaveTunnelAgent *tunAgent, TunnelType tunType, SrcInterfaceType srcIntfType, const char *connIntfName)
|
Initialize the WeaveTunnelConnectionMgr.
|
ServiceTunnelClose(WEAVE_ERROR err)
|
void
Close the Service tunnel.
|
SetInterfaceName(const char *intfName)
|
void
Set InterfaceName for Tunnel connection.
|
SetInterfaceType(const SrcInterfaceType srcIntfType)
|
void
Set SrcInterfaceType for Tunnel connection.
|
Shutdown(void)
|
void
Shutdown the WeaveTunnelConnectionMgr.
|
StopAndReconnectTunnelConn(ReconnectParam & reconnParam)
|
void
Stop Service tunnel connection and attempt to reconnect again.
|
TryConnectingNow(void)
|
Attempt to establish a connection to the Service.
|
Public static functions |
|
---|---|
DefaultReconnectPolicyCallback(void *const appstate, ReconnectParam & reconnectParam, uint32_t & delayMsec)
|
void
The default policy implementation for fetching the next time to connect to the Service.
|
HandleServiceConnectionClosed(WeaveConnection *con, WEAVE_ERROR conErr)
|
void
Handler invoked when Service TCP connection is closed.
|
HandleServiceConnectionComplete(WeaveConnection *con, WEAVE_ERROR conErr)
|
void
Handler invoked when Service TCP connection is completed.
|
RecvdFromService(WeaveConnection *con, const WeaveMessageInfo *msgInfo, PacketBuffer *message)
|
void
Handler to receive tunneled IPv6 packets from the Service TCP connection and forward to the Tunnel EndPoint interface after decapsulating the raw IPv6 packet from inside the tunnel header.
|
ServiceMgrStatusHandler(void *appState, WEAVE_ERROR err, StatusReport *report)
|
void
Handler invoked if the Service Manager failed to establish the TCP connection to the Service.
|
Public types
ConnectPolicyCallback
void(* ConnectPolicyCallback)(void *const appState, ReconnectParam &reconnectParam, uint32_t &delayMsec)
Callback to fetch the interval of time to wait before the next tunnel reconnect.
Details | |||||||
---|---|---|---|---|---|---|---|
Parameters |
|
TunnelConnNotifyReasons
TunnelConnNotifyReasons
TunnelConnNotifyReasons
enum nl::Weave::Profiles::WeaveTunnel::WeaveTunnelConnectionMgr::TunnelConnNotifyReasons TunnelConnNotifyReasons
TunnelConnectionState
TunnelConnectionState
TunnelConnectionState
enum nl::Weave::Profiles::WeaveTunnel::WeaveTunnelConnectionMgr::TunnelConnectionState TunnelConnectionState
Public attributes
mServiceConnDelayPolicyCallback
ConnectPolicyCallback mServiceConnDelayPolicyCallback
Public functions
Init
WEAVE_ERROR Init( WeaveTunnelAgent *tunAgent, TunnelType tunType, SrcInterfaceType srcIntfType, const char *connIntfName )
Initialize the WeaveTunnelConnectionMgr.
ServiceTunnelClose
void ServiceTunnelClose( WEAVE_ERROR err )
Close the Service tunnel.
Details | |||
---|---|---|---|
Parameters |
|
SetInterfaceName
void SetInterfaceName( const char *intfName )
Set InterfaceName for Tunnel connection.
Details | |||
---|---|---|---|
Parameters |
|
SetInterfaceType
void SetInterfaceType( const SrcInterfaceType srcIntfType )
Set SrcInterfaceType for Tunnel connection.
Details | |||
---|---|---|---|
Parameters |
|
StopAndReconnectTunnelConn
void StopAndReconnectTunnelConn( ReconnectParam & reconnParam )
Stop Service tunnel connection and attempt to reconnect again.
Details | |||
---|---|---|---|
Parameters |
|
TryConnectingNow
WEAVE_ERROR TryConnectingNow( void )
Attempt to establish a connection to the Service.
Try to establish a connecttion to the Service either using ServiceManager or directly.
WeaveTunnelConnectionMgr
WeaveTunnelConnectionMgr( void )
Public static functions
DefaultReconnectPolicyCallback
void DefaultReconnectPolicyCallback( void *const appstate, ReconnectParam & reconnectParam, uint32_t & delayMsec )
The default policy implementation for fetching the next time to connect to the Service.
This policy picks a random timeslot (with millisecond resolution) over an increasing window, following a fibonacci sequence upto WEAVE_CONFIG_TUNNELING_RECONNECT_MAX_FIBONACCI_INDEX.
Details | |||||||
---|---|---|---|---|---|---|---|
Parameters |
|
HandleServiceConnectionClosed
void HandleServiceConnectionClosed( WeaveConnection *con, WEAVE_ERROR conErr )
Handler invoked when Service TCP connection is closed.
The device tries to re-establish the connection to the Service if the mServiceConKeepAlive is set to true.
The device, subsequently, tries to re-establish the connection to the Service.
Details | |||||
---|---|---|---|---|---|
Parameters |
|
HandleServiceConnectionComplete
void HandleServiceConnectionComplete( WeaveConnection *con, WEAVE_ERROR conErr )
Handler invoked when Service TCP connection is completed.
The device proceeds to initiate Tunnel control commands to the Service from this function.
The device proceeds to initiate Tunnel control commands to the Service from this function.
Details | |||||
---|---|---|---|---|---|
Parameters |
|
RecvdFromService
void RecvdFromService( WeaveConnection *con, const WeaveMessageInfo *msgInfo, PacketBuffer *message )
Handler to receive tunneled IPv6 packets from the Service TCP connection and forward to the Tunnel EndPoint interface after decapsulating the raw IPv6 packet from inside the tunnel header.
Details | |||||||
---|---|---|---|---|---|---|---|
Parameters |
|
ServiceMgrStatusHandler
void ServiceMgrStatusHandler( void *appState, WEAVE_ERROR err, StatusReport *report )
Handler invoked if the Service Manager failed to establish the TCP connection to the Service.