lwIP  2.1.0
Lightweight IP stack
dns.c File Reference
#include "lwip/opt.h"
#include "lwip/def.h"
#include "lwip/udp.h"
#include "lwip/mem.h"
#include "lwip/memp.h"
#include "lwip/dns.h"
#include "lwip/prot/dns.h"
#include <string.h>

Data Structures

struct  dns_query
 
struct  dns_answer
 
struct  dns_table_entry
 
struct  dns_req_entry
 

Macros

#define DNS_RAND_TXID   LWIP_RAND
 
#define DNS_PORT_ALLOWED(port)   ((port) >= 1024)
 
#define DNS_MAX_TTL   604800
 

Functions

void dns_init (void)
 
void dns_setserver (u8_t numdns, const ip_addr_t *dnsserver)
 
const ip_addr_tdns_getserver (u8_t numdns)
 
void dns_tmr (void)
 
err_t dns_gethostbyname (const char *hostname, ip_addr_t *addr, dns_found_callback found, void *callback_arg)
 
err_t dns_gethostbyname_addrtype (const char *hostname, ip_addr_t *addr, dns_found_callback found, void *callback_arg, u8_t dns_addrtype)
 

Detailed Description

DNS - host name to IP address resolver.

Macro Definition Documentation

◆ DNS_MAX_TTL

#define DNS_MAX_TTL   604800

DNS resource record max. TTL (one week as default)

◆ DNS_PORT_ALLOWED

#define DNS_PORT_ALLOWED (   port)    ((port) >= 1024)

Limits the source port to be >= 1024 by default

◆ DNS_RAND_TXID

#define DNS_RAND_TXID   LWIP_RAND

Random generator function to create random TXIDs and source ports for queries

Function Documentation

◆ dns_init()

void dns_init ( void  )

Initialize the resolver: set up the UDP pcb and configure the default server (if DNS_SERVER_ADDRESS is set).

◆ dns_tmr()

void dns_tmr ( void  )

The DNS resolver client timer - handle retries and timeouts and should be called every DNS_TMR_INTERVAL milliseconds (every second by default).