nl:: Inet:: InetLayer
#include <src/inet/InetLayer.h>
This provides access to Internet services, including timers, Domain Name System (DNS) resolution, TCP network transport, UDP network transport, and raw network transport, for a single thread.
Summary
For BSD/POSIX Sockets, event readiness notification is handled via file descriptors and a traditional poll / select implementation on the platform adaptation.
For LwIP, event readiness notification is handle via events / messages and platform- and system-specific hooks for the event / message system.
Constructors and Destructors |
|
---|---|
InetLayer(void)
This is the InetLayer default constructor.
|
Public types |
|
---|---|
@5{
|
enum The current state of the InetLayer object. |
DNSResolveCompleteFunct
|
typedefDNSResolver::OnResolveCompleteFunct
|
Public attributes |
|
---|---|
State
|
enum nl::Inet::InetLayer::@5
The current state of the InetLayer object.
|
Public static attributes |
|
---|---|
sInetEventHandlerDelegate
|
Public functions |
|
---|---|
CanEnqueueDroppableEvent(void)
|
bool
|
CancelResolveHostAddress(DNSResolveCompleteFunct onComplete, void *appState)
|
void
Cancel any outstanding DNS query (for a matching completion callback and application state) that may still be active.
|
DroppableEventDequeued(void)
|
void
|
GetInterfaceFromAddr(const IPAddress & addr, InterfaceId & intfId)
|
Get the interface identifier for the specified IP address.
|
GetLinkLocalAddr(InterfaceId link, IPAddress *llAddr)
|
Get the link local IPv6 address for a specified link or interface.
|
GetPlatformData(void)
|
void *
This returns any client-specific platform data assigned to the instance, if it has been previously set.
|
HandleSelectResult(int selectRes, fd_set *readfds, fd_set *writefds, fd_set *exceptfds)
|
void
Handle I/O from a select call.
|
Init(Weave::System::Layer & aSystemLayer, void *aContext)
|
This is the InetLayer explicit initializer.
|
InitQueueLimiter(void)
|
|
MatchLocalIPv6Subnet(const IPAddress & addr)
|
bool
Check if there is a prefix match between the specified IPv6 address and any of the locally configured IPv6 addresses.
|
NewRawEndPoint(IPVersion ipVer, IPProtocol ipProto, RawEndPoint **retEndPoint)
|
Creates a new RawEndPoint object for a specific IP version and protocol.
|
NewTCPEndPoint(TCPEndPoint **retEndPoint)
|
Creates a new TCPEndPoint object.
|
NewTunEndPoint(TunEndPoint **retEndPoint)
|
Creates a new TunEndPoint object.
|
NewUDPEndPoint(UDPEndPoint **retEndPoint)
|
Creates a new UDPEndPoint object.
|
PrepareSelect(int & nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval & sleepTime)
|
void
Prepare the sets of file descriptors for
select() to work with. |
ResolveHostAddress(const char *hostName, uint16_t hostNameLen, uint8_t options, uint8_t maxAddrs, IPAddress *addrArray, DNSResolveCompleteFunct onComplete, void *appState)
|
Perform an IP address resolution of a specified hostname.
|
ResolveHostAddress(const char *hostName, uint16_t hostNameLen, uint8_t maxAddrs, IPAddress *addrArray, DNSResolveCompleteFunct onComplete, void *appState)
|
Perform an IP address resolution of a specified hostname.
|
ResolveHostAddress(const char *hostName, uint8_t maxAddrs, IPAddress *addrArray, DNSResolveCompleteFunct onComplete, void *appState)
|
Perform an IP address resolution of a specified hostname.
|
SetPlatformData(void *aPlatformData)
|
void
This sets the specified client-specific platform data to the instance for later retrieval by the client platform.
|
Shutdown(void)
|
|
SystemLayer(void) const
|
Public static functions |
|
---|---|
HandleInetLayerEvent(Weave::System::Object & aTarget, Weave::System::EventType aEventType, uintptr_t aArgument)
|
Weave::System::Error
|
IsDroppableEvent(Weave::System::EventType aType)
|
bool
|
UpdateSnapshot(nl::Weave::System::Stats::Snapshot & aSnapshot)
|
void
|
Public types
@5
@5
The current state of the InetLayer object.
Properties | |
---|---|
kState_Initialized
|
Initialized state. |
kState_NotInitialized
|
Not initialized state. |
kState_ShutdownInProgress
|
State where Shutdown has been triggered. |
DNSResolveCompleteFunct
DNSResolver::OnResolveCompleteFunct DNSResolveCompleteFunct
Public attributes
State
enum nl::Inet::InetLayer::@5 State
The current state of the InetLayer object.
[READ-ONLY] Current state.
Public static attributes
sInetEventHandlerDelegate
Weave::System::LwIPEventHandlerDelegate sInetEventHandlerDelegate
Public functions
CanEnqueueDroppableEvent
bool CanEnqueueDroppableEvent( void )
CancelResolveHostAddress
void CancelResolveHostAddress( DNSResolveCompleteFunct onComplete, void *appState )
Cancel any outstanding DNS query (for a matching completion callback and application state) that may still be active.
Details | |||||
---|---|---|---|---|---|
Parameters |
|
DroppableEventDequeued
void DroppableEventDequeued( void )
GetInterfaceFromAddr
INET_ERROR GetInterfaceFromAddr( const IPAddress & addr, InterfaceId & intfId )
Get the interface identifier for the specified IP address.
If the interface identifier cannot be derived it is set to the INET_NULL_INTERFACEID.
Details | |||||
---|---|---|---|---|---|
Parameters |
|
||||
Returns |
INET_NO_ERROR unconditionally.
|
GetLinkLocalAddr
INET_ERROR GetLinkLocalAddr( InterfaceId link, IPAddress *llAddr )
Get the link local IPv6 address for a specified link or interface.
Details | |||||||||
---|---|---|---|---|---|---|---|---|---|
Parameters |
|
||||||||
Return Values |
|
GetPlatformData
void * GetPlatformData( void )
This returns any client-specific platform data assigned to the instance, if it has been previously set.
Details | |
---|---|
Returns |
Client-specific platform data, if is has been previously set; otherwise, NULL.
|
HandleSelectResult
void HandleSelectResult( int selectRes, fd_set *readfds, fd_set *writefds, fd_set *exceptfds )
Handle I/O from a select call.
This method registers the pending I/O event in each active endpoint and then invokes the respective I/O handling functions for those endpoints.
Details | |||||||||
---|---|---|---|---|---|---|---|---|---|
Parameters |
|
InetLayer
InetLayer( void )
This is the InetLayer default constructor.
It performs some basic data member initialization; however, since InetLayer follows an explicit initializer design pattern, the InetLayer::Init method must be called successfully prior to using the object.
Init
INET_ERROR Init( Weave::System::Layer & aSystemLayer, void *aContext )
This is the InetLayer explicit initializer.
This must be called and complete successfully before the InetLayer may be used.
The caller may provide an optional context argument which will be passed back via any platform-specific hook functions. For LwIP-based adaptations, this will typically be a pointer to the event queue associated with the InetLayer instance.
Platforms may choose to assert INET_CONFIG_WILL_OVERRIDE_PLATFORM_XTOR_FUNCS in their platform-specific configuration header and enable the Platform::InetLayer::WillInit and Platform::InetLayer::DidInit hooks to effect platform-specific customizations or data extensions to InetLayer.
Details | |||||||||
---|---|---|---|---|---|---|---|---|---|
Parameters |
|
||||||||
Return Values |
|
InitQueueLimiter
INET_ERROR InitQueueLimiter( void )
MatchLocalIPv6Subnet
bool MatchLocalIPv6Subnet( const IPAddress & addr )
Check if there is a prefix match between the specified IPv6 address and any of the locally configured IPv6 addresses.
Details | |||
---|---|---|---|
Parameters |
|
||
Returns |
true if a successful match is found, otherwise false.
|
NewRawEndPoint
INET_ERROR NewRawEndPoint( IPVersion ipVer, IPProtocol ipProto, RawEndPoint **retEndPoint )
Creates a new RawEndPoint object for a specific IP version and protocol.
Details | |||||||
---|---|---|---|---|---|---|---|
Parameters |
|
||||||
Return Values |
|
NewTCPEndPoint
INET_ERROR NewTCPEndPoint( TCPEndPoint **retEndPoint )
Creates a new TCPEndPoint object.
Details | |||||||
---|---|---|---|---|---|---|---|
Parameters |
|
||||||
Return Values |
|
NewTunEndPoint
INET_ERROR NewTunEndPoint( TunEndPoint **retEndPoint )
Creates a new TunEndPoint object.
Details | |||||||
---|---|---|---|---|---|---|---|
Parameters |
|
||||||
Return Values |
|
NewUDPEndPoint
INET_ERROR NewUDPEndPoint( UDPEndPoint **retEndPoint )
Creates a new UDPEndPoint object.
Details | |||||||
---|---|---|---|---|---|---|---|
Parameters |
|
||||||
Return Values |
|
PrepareSelect
void PrepareSelect( int & nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval & sleepTime )
Prepare the sets of file descriptors for select()
to work with.
Details | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Parameters |
|
ResolveHostAddress
INET_ERROR ResolveHostAddress( const char *hostName, uint16_t hostNameLen, uint8_t options, uint8_t maxAddrs, IPAddress *addrArray, DNSResolveCompleteFunct onComplete, void *appState )
Perform an IP address resolution of a specified hostname.
Details | |||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Parameters |
|
||||||||||||||||
Return Values |
|
ResolveHostAddress
INET_ERROR ResolveHostAddress( const char *hostName, uint16_t hostNameLen, uint8_t maxAddrs, IPAddress *addrArray, DNSResolveCompleteFunct onComplete, void *appState )
Perform an IP address resolution of a specified hostname.
Details | |||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Parameters |
|
||||||||||||||||
Return Values |
|
ResolveHostAddress
INET_ERROR ResolveHostAddress( const char *hostName, uint8_t maxAddrs, IPAddress *addrArray, DNSResolveCompleteFunct onComplete, void *appState )
Perform an IP address resolution of a specified hostname.
Details | |||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Parameters |
|
||||||||||||||||
Return Values |
|
SetPlatformData
void SetPlatformData( void *aPlatformData )
This sets the specified client-specific platform data to the instance for later retrieval by the client platform.
Details | |||
---|---|---|---|
Parameters |
|
Shutdown
INET_ERROR Shutdown( void )
This is the InetLayer explicit deinitializer and should be called prior to disposing of an instantiated InetLayer instance.
Platforms may choose to assert INET_CONFIG_WILL_OVERRIDE_PLATFORM_XTOR_FUNCS in their platform-specific configuration header and enable the Platform::InetLayer::WillShutdown and Platform::InetLayer::DidShutdown hooks to effect clean-up of platform-specific customizations or data extensions to InetLayer.
Details | |
---|---|
Returns |
INET_NO_ERROR on success; otherwise, a specific error indicating the reason for shutdown failure.
|
SystemLayer
Weave::System::Layer * SystemLayer( void ) const
Public static functions
HandleInetLayerEvent
Weave::System::Error HandleInetLayerEvent( Weave::System::Object & aTarget, Weave::System::EventType aEventType, uintptr_t aArgument )
IsDroppableEvent
bool IsDroppableEvent( Weave::System::EventType aType )
UpdateSnapshot
void UpdateSnapshot( nl::Weave::System::Stats::Snapshot & aSnapshot )