lwIP  2.0.2
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


#define DNS_PORT_ALLOWED(port)   ((port) >= 1024)
#define DNS_MAX_RETRIES   4
#define DNS_MAX_TTL   604800


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


#define DNS_MAX_RETRIES   4

DNS maximum number of retries when asking for a name, before "timeout".


#define DNS_MAX_TTL   604800

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


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

Limits the source port to be >= 1024 by default



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).