RF24Ethernet - TCP/IP over RF24Network v2.0.1
TMRh20 - Pushing the practical limits of RF24 modules
Loading...
Searching...
No Matches
DNSClient Class Reference

#include <Dns.h>

Public Member Functions

void begin (const IPAddress &aDNSServer)
int inet_aton (const char *aIPAddrString, IPAddress &aResult)
int getHostByName (const char *aHostname, IPAddress &aResult)

Protected Member Functions

uint16_t BuildRequest (const char *aName)
uint16_t ProcessResponse (uint16_t aTimeout, IPAddress &aAddress)

Protected Attributes

IPAddress iDNSServer
uint16_t iRequestId
RF24UDP iUdp

Detailed Description

Definition at line 12 of file Dns.h.

Member Function Documentation

◆ begin()

void DNSClient::begin ( const IPAddress & aDNSServer)

Definition at line 45 of file Dns.cpp.

References iDNSServer, and iRequestId.

Referenced by RF24UDP::beginPacket(), and RF24Client::connect().

◆ inet_aton()

int DNSClient::inet_aton ( const char * aIPAddrString,
IPAddress & aResult )

Convert a numeric IP address string into a four-byte IP address.

Parameters
aIPAddrStringIP address to convert
aResultIPAddress structure to store the returned IP address
Returns
1 if aIPAddrString was successfully converted to an IP address, else error code

Definition at line 51 of file Dns.cpp.

Referenced by getHostByName().

◆ getHostByName()

int DNSClient::getHostByName ( const char * aHostname,
IPAddress & aResult )

Resolve the given hostname to an IP address.

Parameters
aHostnameName to be resolved
aResultIPAddress structure to store the returned IP address
Returns
1 if aIPAddrString was successfully converted to an IP address, else error code

Definition at line 110 of file Dns.cpp.

References BuildRequest(), DNS_PORT, iDNSServer, IF_RF24ETHERNET_DEBUG_DNS, inet_aton(), INVALID_SERVER, iUdp, ProcessResponse(), and TIMED_OUT.

Referenced by RF24UDP::beginPacket(), and RF24Client::connect().

◆ BuildRequest()

uint16_t DNSClient::BuildRequest ( const char * aName)
protected

Definition at line 168 of file Dns.cpp.

References CLASS_IN, iRequestId, iUdp, OPCODE_STANDARD_QUERY, QUERY_FLAG, RECURSION_DESIRED_FLAG, and TYPE_A.

Referenced by getHostByName().

◆ ProcessResponse()

uint16_t DNSClient::ProcessResponse ( uint16_t aTimeout,
IPAddress & aAddress )
protected

Member Data Documentation

◆ iDNSServer

IPAddress DNSClient::iDNSServer
protected

Definition at line 39 of file Dns.h.

Referenced by begin(), getHostByName(), and ProcessResponse().

◆ iRequestId

uint16_t DNSClient::iRequestId
protected

Definition at line 40 of file Dns.h.

Referenced by begin(), BuildRequest(), and ProcessResponse().

◆ iUdp

RF24UDP DNSClient::iUdp
protected

Definition at line 41 of file Dns.h.

Referenced by BuildRequest(), getHostByName(), and ProcessResponse().