Nut/OS  5.0.5
API Reference
DNS

Domain name service protocol. More...

Collaboration diagram for DNS:

Data Structures

struct  DNSHEADER
struct  DNSQUESTION
struct  DNSRESOURCE

Functions

void NutDnsConfig2 (const uint8_t *hostname, const uint8_t *domain, uint32_t pdnsip, uint32_t sdnsip)
 Set DNS configuration.
void DumpDnsHeader (FILE *stream, DNSHEADER *doh)
void DumpDnsQuestion (FILE *stream, DNSQUESTION *doq)
void DumpDnsResource (FILE *stream, DNSRESOURCE *dor)
void NutDnsConfig (const uint8_t *hostname, const uint8_t *domain, uint32_t dnsip)
 Sets DNS configuration.
void NutDnsGetConfig2 (char **hostname, char **domain, uint32_t *pdnsip, uint32_t *sdnsip)
uint32_t NutDnsGetResource (const uint8_t *hostname, const uint16_t type)
 Retrieves IP-address corresponding to a host name.
uint32_t NutDnsGetHostByName (const uint8_t *hostname)
uint8_t NutDnsGetResourceAll (const uint8_t *hostname, const uint16_t type, uint32_t *ip_all)
 Retrieves all IP-address corresponding to a host name.
uint8_t NutDnsGetHostsByName (const uint8_t *hostname, uint32_t *ip_all)
uint32_t NutDnsGetMxByDomain (const uint8_t *hostname)

Variables

DNSCONFIG confdns
DNSCONFIG confdns

Detailed Description

Domain name service protocol.


Function Documentation

void NutDnsConfig2 ( const uint8_t hostname,
const uint8_t domain,
uint32_t  pdnsip,
uint32_t  sdnsip 
)

Set DNS configuration.

Parameters:
hostnameDNS name of the local host.
domainName of the domain of the local host.
pdnsipIP address of the primary DNS server.
sdnsipIP address of the secondary DNS server.

References DNSCONFIG::doc_domain, DNSCONFIG::doc_hostname, DNSCONFIG::doc_ip1, DNSCONFIG::doc_ip2, free(), and strdup().

Referenced by main(), NutDhcpIfConfig(), and NutDnsConfig().

Here is the call graph for this function:

void DumpDnsHeader ( FILE stream,
DNSHEADER doh 
)

References DNSHEADER::doh_addrr, DNSHEADER::doh_answers, DNSHEADER::doh_authrr, DNSHEADER::doh_flags, DNSHEADER::doh_id, DNSHEADER::doh_quests, and fprintf().

Here is the call graph for this function:

void DumpDnsQuestion ( FILE stream,
DNSQUESTION doq 
)

References DNSQUESTION::doq_class, DNSQUESTION::doq_name, DNSQUESTION::doq_type, and fprintf().

Here is the call graph for this function:

void DumpDnsResource ( FILE stream,
DNSRESOURCE dor 
)

References DNSRESOURCE::dor_class, DNSRESOURCE::dor_data, DNSRESOURCE::dor_len, DNSRESOURCE::dor_name, DNSRESOURCE::dor_ttl, DNSRESOURCE::dor_type, fprintf(), and fputc().

Here is the call graph for this function:

void NutDnsConfig ( const uint8_t hostname,
const uint8_t domain,
uint32_t  dnsip 
)

Sets DNS configuration.

Deprecated:
New applications should use NutDnsConfig2().
Parameters:
hostnameDNS name of the local host.
domainName of the domain of the local host.
dnsipIP address of the DNS server.

References NutDnsConfig2().

Here is the call graph for this function:

void NutDnsGetConfig2 ( char **  hostname,
char **  domain,
uint32_t pdnsip,
uint32_t sdnsip 
)
uint32_t NutDnsGetResource ( const uint8_t hostname,
const uint16_t  type 
)

Retrieves IP-address corresponding to a host name.

This is a very simple implementation, which will not return any other resource information than the IP address.

Parameters:
hostnameFully qualified domain name of the host.
typeRequest type.
Returns:
IP address, which is zero, if the name could not be resolved.

References DNSCONFIG::doc_ip1, DNSCONFIG::doc_ip2, DNSHEADER::doh_answers, DNSHEADER::doh_id, DNSHEADER::doh_quests, DNSRESOURCE::dor_data, DNSRESOURCE::dor_len, DNSRESOURCE::dor_type, free(), malloc(), NutUdpCreateSocket(), NutUdpDestroySocket(), NutUdpReceiveFrom(), and NutUdpSendTo().

Referenced by NutDnsGetHostByName(), and NutDnsGetMxByDomain().

Here is the call graph for this function:

uint32_t NutDnsGetHostByName ( const uint8_t hostname)

References NutDnsGetResource().

Referenced by main().

Here is the call graph for this function:

uint8_t NutDnsGetResourceAll ( const uint8_t hostname,
const uint16_t  type,
uint32_t ip_all 
)

Retrieves all IP-address corresponding to a host name.

This is a very simple implementation, which will not return any other resource information than the IP address.

Parameters:
hostnameFully qualified domain name of the host.
typeRequest type.
ip_allArray of IP Addresses.
Returns:
Number of IP address, which is zero, if the name could not be resolved.

References DNSCONFIG::doc_ip1, DNSCONFIG::doc_ip2, DNSHEADER::doh_answers, DNSHEADER::doh_id, DNSHEADER::doh_quests, DNSRESOURCE::dor_data, DNSRESOURCE::dor_len, DNSRESOURCE::dor_type, NutHeapAlloc, NutHeapFree, NutUdpCreateSocket(), NutUdpDestroySocket(), NutUdpReceiveFrom(), and NutUdpSendTo().

Referenced by NutDnsGetHostsByName().

Here is the call graph for this function:

uint8_t NutDnsGetHostsByName ( const uint8_t hostname,
uint32_t ip_all 
)

References NutDnsGetResourceAll().

Here is the call graph for this function:

uint32_t NutDnsGetMxByDomain ( const uint8_t hostname)

References NutDnsGetResource().

Here is the call graph for this function:


Variable Documentation