mikroSDK Reference Manual
dns_client.h
Go to the documentation of this file.
1
31#ifndef _DNS_CLIENT_H
32#define _DNS_CLIENT_H
33
34//Dependencies
35#include "core/net.h"
36#include "core/socket.h"
37#include "core/udp.h"
38#include "dns/dns_cache.h"
39
40//DNS client support
41#ifndef DNS_CLIENT_SUPPORT
42 #define DNS_CLIENT_SUPPORT ENABLED
43#elif (DNS_CLIENT_SUPPORT != ENABLED && DNS_CLIENT_SUPPORT != DISABLED)
44 #error DNS_CLIENT_SUPPORT parameter is not valid
45#endif
46
47//Maximum number of retransmissions of DNS queries
48#ifndef DNS_CLIENT_MAX_RETRIES
49 #define DNS_CLIENT_MAX_RETRIES 3
50#elif (DNS_CLIENT_MAX_RETRIES < 1)
51 #error DNS_CLIENT_MAX_RETRIES parameter is not valid
52#endif
53
54//Initial retransmission timeout
55#ifndef DNS_CLIENT_INIT_TIMEOUT
56 #define DNS_CLIENT_INIT_TIMEOUT 1000
57#elif (DNS_CLIENT_INIT_TIMEOUT < 1000)
58 #error DNS_CLIENT_INIT_TIMEOUT parameter is not valid
59#endif
60
61//Maximum retransmission timeout
62#ifndef DNS_CLIENT_MAX_TIMEOUT
63 #define DNS_CLIENT_MAX_TIMEOUT 5000
64#elif (DNS_CLIENT_MAX_TIMEOUT < 1000)
65 #error DNS_CLIENT_MAX_TIMEOUT parameter is not valid
66#endif
67
68//Minimum cache lifetime for DNS entries
69#ifndef DNS_MIN_LIFETIME
70 #define DNS_MIN_LIFETIME 1000
71#elif (DNS_MIN_LIFETIME < 0)
72 #error DNS_MIN_LIFETIME parameter is not valid
73#endif
74
75//Maximum cache lifetime for DNS entries
76#ifndef DNS_MAX_LIFETIME
77 #define DNS_MAX_LIFETIME 3600000
78#elif (DNS_MAX_LIFETIME < 1000 || DNS_MAX_LIFETIME < DNS_MIN_LIFETIME)
79 #error DNS_MAX_LIFETIME parameter is not valid
80#endif
81
82//C++ guard
83#ifdef __cplusplus
84extern "C" {
85#endif
86
87//DNS related functions
88error_t dnsResolve(NetInterface *interface, const char_t *name,
89 HostType type, IpAddr *ipAddr);
90
91error_t dnsSendQuery(DnsCacheEntry *entry);
92
93void dnsProcessResponse(NetInterface *interface,
94 const IpPseudoHeader *pseudoHeader, const UdpHeader *udpHeader,
95 const NetBuffer *buffer, size_t offset, const NetRxAncillary *ancillary,
96 void *param);
97
98void dnsSelectNextServer(DnsCacheEntry *entry);
99
100//C++ guard
101#ifdef __cplusplus
102}
103#endif
104
105#endif
DNS cache management.
error_t
Error codes.
Definition error.h:43
TCP/IP stack core.
Socket API.
HostType
Host types.
Definition socket.h:202
DNS cache entry.
Definition dns_cache.h:97
IP network address.
Definition ip.h:72
IP pseudo header.
Definition ip.h:91
Structure describing a buffer that spans multiple chunks.
Definition net_mem.h:89
UDP (User Datagram Protocol)