Loading...
Searching...
No Matches

DNS cache. More...

Detailed Description

DNS cache.

Files

file  cache.h
 DNS cache definitions.
 

Macros

#define CONFIG_DNS_CACHE_SIZE   4
 Maximum number of DNS cache entries.
 
#define CONFIG_DNS_CACHE_A   IS_USED(MODULE_IPV4)
 Handle to cache A records.
 
#define CONFIG_DNS_CACHE_AAAA   IS_USED(MODULE_IPV6)
 Handle to cache AAAA records.
 

Functions

int dns_cache_query (const char *domain_name, void *addr_out, int family)
 Get IP address for a DNS name from the DNS cache.
 
void dns_cache_add (const char *domain_name, const void *addr, int addr_len, uint32_t ttl)
 Add an IP address for a DNS name to the DNS cache.
 

Macro Definition Documentation

◆ CONFIG_DNS_CACHE_A

#define CONFIG_DNS_CACHE_A   IS_USED(MODULE_IPV4)

Handle to cache A records.

Definition at line 55 of file cache.h.

◆ CONFIG_DNS_CACHE_AAAA

#define CONFIG_DNS_CACHE_AAAA   IS_USED(MODULE_IPV6)

Handle to cache AAAA records.

Definition at line 62 of file cache.h.

◆ CONFIG_DNS_CACHE_SIZE

#define CONFIG_DNS_CACHE_SIZE   4

Maximum number of DNS cache entries.

Definition at line 48 of file cache.h.

Function Documentation

◆ dns_cache_add()

void dns_cache_add ( const char *  domain_name,
const void *  addr,
int  addr_len,
uint32_t  ttl 
)

Add an IP address for a DNS name to the DNS cache.

Parameters
[in]domain_nameDNS name to resolve into address
[in]addrbuffer containing the address
[in]addr_lenlength of the address in bytes
[in]ttllifetime of the entry in seconds

◆ dns_cache_query()

int dns_cache_query ( const char *  domain_name,
void *  addr_out,
int  family 
)

Get IP address for a DNS name from the DNS cache.

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