nl::Inet::AsyncDNSResolverSockets

#include <src/inet/AsyncDNSResolverSockets.h>

This is an internal class to InetLayer that provides helper APIs for Asynchronous Domain Name System (DNS) resolution in InetLayer.

Summary

There is no public interface available for the application layer.

Public functions

Cancel(DNSResolver & resolver)
Cancel an outstanding DNS query that may still be active.
EnqueueRequest(DNSResolver & resolver)
Enqueue a DNSResolver object for asynchronous IP address resolution of a specified hostname.
Init(InetLayer *inet)
The explicit initializer for the AsynchronousDNSResolverSockets class.
PrepareDNSResolver(DNSResolver & resolver, const char *hostName, uint16_t hostNameLen, uint8_t options, uint8_t maxAddrs, IPAddress *addrArray, DNSResolver::OnResolveCompleteFunct onComplete, void *appState)
This method prepares a DNSResolver object prior to asynchronous resolution.
Shutdown(void)
This is the explicit deinitializer of the AsyncDNSResolverSockets class and it takes care of shutting the threads down and destroying the mutex and semaphore variables.

Public functions

Cancel

INET_ERROR Cancel(
  DNSResolver & resolver
)

Cancel an outstanding DNS query that may still be active.

Details
Parameters
[in] resolver
A reference to the DNSResolver object.

EnqueueRequest

INET_ERROR EnqueueRequest(
  DNSResolver & resolver
)

Enqueue a DNSResolver object for asynchronous IP address resolution of a specified hostname.

Details
Parameters
[in] resolver
A reference to the DNSResolver object.
Return Values
INET_NO_ERROR
if a DNS request is queued successfully.
INET_ERROR_NO_MEMORY
if the Inet layer resolver pool is full.
other
appropriate POSIX network or OS error.

Init

INET_ERROR Init(
  InetLayer *inet
)

The explicit initializer for the AsynchronousDNSResolverSockets class.

This initializes the mutex and semaphore variables and creates the threads for handling the asynchronous DNS resolution.

Details
Parameters
[in] aInet
A pointer to the InetLayer object.
Return Values
INET_NO_ERROR
if initialization is successful.
other
appropriate POSIX network or OS error.

PrepareDNSResolver

INET_ERROR PrepareDNSResolver(
  DNSResolver & resolver,
  const char *hostName,
  uint16_t hostNameLen,
  uint8_t options,
  uint8_t maxAddrs,
  IPAddress *addrArray,
  DNSResolver::OnResolveCompleteFunct onComplete,
  void *appState
)

This method prepares a DNSResolver object prior to asynchronous resolution.

Details
Parameters
[in] resolver
A reference to an allocated DNSResolver object.
[in] hostName
A pointer to a C string representing the host name to be queried.
[in] hostNameLen
The string length of host name.
[in] options
An integer value controlling how host name address resolution is performed. Values are from the #DNSOptions enumeration.
[in] maxAddrs
The maximum number of addresses to store in the DNS table.
[in] addrArray
A pointer to the DNS table.
[in] onComplete
A pointer to the callback function when a DNS request is complete.
[in] appState
A pointer to the application state to be passed to onComplete when a DNS request is complete.
Return Values
INET_NO_ERROR
if a DNS request is handled successfully.

Shutdown

INET_ERROR Shutdown(
  void
)

This is the explicit deinitializer of the AsyncDNSResolverSockets class and it takes care of shutting the threads down and destroying the mutex and semaphore variables.

Details
Return Values
INET_NO_ERROR
if shutdown is successful.
other
appropriate POSIX network or OS error.