dns_client.h File Reference

DNS client (Domain Name System) More...

#include "core/net.h"
#include "core/socket.h"
#include "core/udp.h"
#include "dns/dns_cache.h"

Go to the source code of this file.

Macros

#define DNS_CLIENT_SUPPORT   ENABLED
 
#define DNS_CLIENT_MAX_RETRIES   3
 
#define DNS_CLIENT_INIT_TIMEOUT   1000
 
#define DNS_CLIENT_MAX_TIMEOUT   5000
 
#define DNS_MIN_LIFETIME   1000
 
#define DNS_MAX_LIFETIME   3600000
 

Functions

error_t dnsResolve (NetInterface *interface, const char_t *name, HostType type, IpAddr *ipAddr)
 Resolve a host name using DNS. More...
 
error_t dnsSendQuery (DnsCacheEntry *entry)
 Send a DNS query message. More...
 
void dnsProcessResponse (NetInterface *interface, const IpPseudoHeader *pseudoHeader, const UdpHeader *udpHeader, const NetBuffer *buffer, size_t offset, const NetRxAncillary *ancillary, void *param)
 Process incoming DNS response message. More...
 
void dnsSelectNextServer (DnsCacheEntry *entry)
 Select the next DNS server. More...
 

Detailed Description

DNS client (Domain Name System)

License

SPDX-License-Identifier: GPL-2.0-or-later

Copyright (C) 2010-2024 Oryx Embedded SARL. All rights reserved.

This file is part of CycloneTCP Open.

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

Author
Oryx Embedded SARL (www.oryx-embedded.com)
Version
2.4.4

Definition in file dns_client.h.

Macro Definition Documentation

◆ DNS_CLIENT_INIT_TIMEOUT

#define DNS_CLIENT_INIT_TIMEOUT   1000

Definition at line 56 of file dns_client.h.

◆ DNS_CLIENT_MAX_RETRIES

#define DNS_CLIENT_MAX_RETRIES   3

Definition at line 49 of file dns_client.h.

◆ DNS_CLIENT_MAX_TIMEOUT

#define DNS_CLIENT_MAX_TIMEOUT   5000

Definition at line 63 of file dns_client.h.

◆ DNS_CLIENT_SUPPORT

#define DNS_CLIENT_SUPPORT   ENABLED

Definition at line 42 of file dns_client.h.

◆ DNS_MAX_LIFETIME

#define DNS_MAX_LIFETIME   3600000

Definition at line 77 of file dns_client.h.

◆ DNS_MIN_LIFETIME

#define DNS_MIN_LIFETIME   1000

Definition at line 70 of file dns_client.h.

Function Documentation

◆ dnsProcessResponse()

void dnsProcessResponse ( NetInterface interface,
const IpPseudoHeader pseudoHeader,
const UdpHeader udpHeader,
const NetBuffer buffer,
size_t  offset,
const NetRxAncillary ancillary,
void *  param 
)

Process incoming DNS response message.

Parameters
[in]interfaceUnderlying network interface
[in]pseudoHeaderUDP pseudo header
[in]udpHeaderUDP header
[in]bufferMulti-part buffer containing the incoming DNS message
[in]offsetOffset to the first byte of the DNS message
[in]ancillaryAdditional options passed to the stack along with the packet
[in]paramCallback function parameter (not used)

Definition at line 383 of file dns_client.c.

◆ dnsResolve()

error_t dnsResolve ( NetInterface interface,
const char_t name,
HostType  type,
IpAddr ipAddr 
)

Resolve a host name using DNS.

Parameters
[in]interfaceUnderlying network interface
[in]nameName of the host to be resolved
[in]typeHost type (IPv4 or IPv6)
[out]ipAddrIP address corresponding to the specified host name

Definition at line 54 of file dns_client.c.

◆ dnsSelectNextServer()

void dnsSelectNextServer ( DnsCacheEntry entry)

Select the next DNS server.

Parameters
[in]entryPointer to a valid DNS cache entry

Definition at line 589 of file dns_client.c.

◆ dnsSendQuery()

error_t dnsSendQuery ( DnsCacheEntry entry)

Send a DNS query message.

Parameters
[in]entryPointer to a valid DNS cache entry
Returns
Error code

Definition at line 218 of file dns_client.c.