Loading...
Searching...
No Matches
DNS defines

Generic DNS values. More...

Detailed Description

Generic DNS values.

Modules

 DNS cache
 DNS cache.
 
 DNS message parser and composer
 Parsing and composition of DNS messages.
 

Files

file  dns.h
 Generic DNS values.
 

Functions

static int dns_query (const char *domain_name, void *addr_out, int family)
 Get IP address for DNS name.
 

DNS defines

#define DNS_TYPE_A   (1)
 
#define DNS_TYPE_AAAA   (28)
 
#define DNS_CLASS_IN   (1)
 

Field lengths

#define RR_TYPE_LENGTH   (2U)
 
#define RR_CLASS_LENGTH   (2U)
 
#define RR_TTL_LENGTH   (4U)
 
#define RR_RDLENGTH_LENGTH   (2U)
 

Macro Definition Documentation

◆ DNS_CLASS_IN

#define DNS_CLASS_IN   (1)

Definition at line 38 of file dns.h.

◆ DNS_TYPE_A

#define DNS_TYPE_A   (1)

Definition at line 36 of file dns.h.

◆ DNS_TYPE_AAAA

#define DNS_TYPE_AAAA   (28)

Definition at line 37 of file dns.h.

◆ RR_CLASS_LENGTH

#define RR_CLASS_LENGTH   (2U)

Definition at line 46 of file dns.h.

◆ RR_RDLENGTH_LENGTH

#define RR_RDLENGTH_LENGTH   (2U)

Definition at line 48 of file dns.h.

◆ RR_TTL_LENGTH

#define RR_TTL_LENGTH   (4U)

Definition at line 47 of file dns.h.

◆ RR_TYPE_LENGTH

#define RR_TYPE_LENGTH   (2U)

Definition at line 45 of file dns.h.

Function Documentation

◆ dns_query()

static int dns_query ( const char *  domain_name,
void *  addr_out,
int  family 
)
inlinestatic

Get IP address for DNS name.

This function will synchronously try to resolve a DNS A or AAAA record by contacting the DNS server specified in the global variable sock_dns_server.

By supplying AF_INET, AF_INET6 or AF_UNSPEC in family requesting of A records (IPv4), AAAA records (IPv6) or both can be selected.

This function will return the first DNS record it receives. IF both A and AAAA are requested, AAAA will be preferred.

Note
addr_out needs to provide space for any possible result! (4byte when family==AF_INET, 16byte otherwise)
Parameters
[in]domain_nameDNS name to resolve into address
[out]addr_outbuffer to write result into
[in]familyEither AF_INET, AF_INET6 or AF_UNSPEC
Returns
the size of the resolved address on success
< 0 otherwise

Definition at line 73 of file dns.h.