lwIP  2.0.2
Lightweight IP stack
dns.h File Reference
#include "lwip/opt.h"
#include "lwip/ip_addr.h"

Macros

#define DNS_TMR_INTERVAL   1000
 

Typedefs

typedef void(* dns_found_callback) (const char *name, const ip_addr_t *ipaddr, void *callback_arg)
 

Functions

void dns_init (void)
 
void dns_tmr (void)
 
void dns_setserver (u8_t numdns, const ip_addr_t *dnsserver)
 
const ip_addr_tdns_getserver (u8_t numdns)
 
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 API

Macro Definition Documentation

◆ DNS_TMR_INTERVAL

#define DNS_TMR_INTERVAL   1000

lwip DNS resolver header file.

Author: Jim Pettinato April 2007

ported from uIP resolv.c Copyright (c) 2002-2003, Adam Dunkels.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.DNS timer period

Typedef Documentation

◆ dns_found_callback

typedef void(* dns_found_callback) (const char *name, const ip_addr_t *ipaddr, void *callback_arg)

Callback which is invoked when a hostname is found. A function of this type must be implemented by the application using the DNS resolver.

Parameters
namepointer to the name that was looked up.
ipaddrpointer to an ip_addr_t containing the IP address of the hostname, or NULL if the name could not be found (or on any other error).
callback_arga user-specified callback argument passed to dns_gethostbyname

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