dns_client.c
Go to the documentation of this file.
1 /**
2  * @file dns_client.c
3  * @brief DNS client (Domain Name System)
4  *
5  * @section License
6  *
7  * SPDX-License-Identifier: GPL-2.0-or-later
8  *
9  * Copyright (C) 2010-2019 Oryx Embedded SARL. All rights reserved.
10  *
11  * This file is part of CycloneTCP Open.
12  *
13  * This program is free software; you can redistribute it and/or
14  * modify it under the terms of the GNU General Public License
15  * as published by the Free Software Foundation; either version 2
16  * of the License, or (at your option) any later version.
17  *
18  * This program is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program; if not, write to the Free Software Foundation,
25  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26  *
27  * @author Oryx Embedded SARL (www.oryx-embedded.com)
28  * @version 1.9.6
29  **/
30 
31 //Switch to the appropriate trace level
32 #define TRACE_LEVEL DNS_TRACE_LEVEL
33 
34 //Dependencies
35 #include "core/net.h"
36 #include "dns/dns_cache.h"
37 #include "dns/dns_client.h"
38 #include "dns/dns_common.h"
39 #include "dns/dns_debug.h"
40 #include "debug.h"
41 
42 //Check TCP/IP stack configuration
43 #if (DNS_CLIENT_SUPPORT == ENABLED)
44 
45 
46 /**
47  * @brief Resolve a host name using DNS
48  * @param[in] interface Underlying network interface
49  * @param[in] name Name of the host to be resolved
50  * @param[in] type Host type (IPv4 or IPv6)
51  * @param[out] ipAddr IP address corresponding to the specified host name
52  **/
53 
56 {
57  error_t error;
58  DnsCacheEntry *entry;
59 
60 #if (NET_RTOS_SUPPORT == ENABLED)
61  systime_t delay;
62 
63  //Debug message
64  TRACE_INFO("Resolving host name %s (DNS resolver)...\r\n", name);
65 #endif
66 
67  //Get exclusive access
69 
70  //Search the DNS cache for the specified host name
71  entry = dnsFindEntry(interface, name, type, HOST_NAME_RESOLVER_DNS);
72 
73  //Check whether a matching entry has been found
74  if(entry)
75  {
76  //Host name already resolved?
77  if(entry->state == DNS_STATE_RESOLVED ||
78  entry->state == DNS_STATE_PERMANENT)
79  {
80  //Return the corresponding IP address
81  *ipAddr = entry->ipAddr;
82  //Successful host name resolution
83  error = NO_ERROR;
84  }
85  else
86  {
87  //Host name resolution is in progress...
88  error = ERROR_IN_PROGRESS;
89  }
90  }
91  else
92  {
93  //If no entry exists, then create a new one
94  entry = dnsCreateEntry();
95 
96  //Record the host name whose IP address is unknown
97  strcpy(entry->name, name);
98 
99  //Initialize DNS cache entry
100  entry->type = type;
102  entry->interface = interface;
103  //Select primary DNS server
104  entry->dnsServerNum = 0;
105 
106  //Get an ephemeral port number
107  entry->port = udpGetDynamicPort();
108 
109  //An identifier is used by the DNS client to match replies
110  //with corresponding requests
111  entry->id = (uint16_t) netGetRand();
112 
113  //Callback function to be called when a DNS response is received
114  error = udpAttachRxCallback(interface, entry->port, dnsProcessResponse,
115  NULL);
116 
117  //Check status code
118  if(!error)
119  {
120  //Initialize retransmission counter
122  //Send DNS query
123  error = dnsSendQuery(entry);
124 
125  //DNS message successfully sent?
126  if(!error)
127  {
128  //Save the time at which the query message was sent
129  entry->timestamp = osGetSystemTime();
130  //Set timeout value
133  //Decrement retransmission counter
134  entry->retransmitCount--;
135 
136  //Switch state
137  entry->state = DNS_STATE_IN_PROGRESS;
138  //Host name resolution is in progress
139  error = ERROR_IN_PROGRESS;
140  }
141  else
142  {
143  //Unregister callback function
144  udpDetachRxCallback(interface, entry->port);
145  }
146  }
147  }
148 
149  //Release exclusive access
151 
152 #if (NET_RTOS_SUPPORT == ENABLED)
153  //Set default polling interval
155 
156  //Wait the host name resolution to complete
157  while(error == ERROR_IN_PROGRESS)
158  {
159  //Wait until the next polling period
160  osDelayTask(delay);
161 
162  //Get exclusive access
164 
165  //Search the DNS cache for the specified host name
166  entry = dnsFindEntry(interface, name, type, HOST_NAME_RESOLVER_DNS);
167 
168  //Check whether a matching entry has been found
169  if(entry)
170  {
171  //Host name successfully resolved?
172  if(entry->state == DNS_STATE_RESOLVED)
173  {
174  //Return the corresponding IP address
175  *ipAddr = entry->ipAddr;
176  //Successful host name resolution
177  error = NO_ERROR;
178  }
179  }
180  else
181  {
182  //Host name resolution failed
183  error = ERROR_FAILURE;
184  }
185 
186  //Release exclusive access
188 
189  //Backoff support for less aggressive polling
190  delay = MIN(delay * 2, DNS_CACHE_MAX_POLLING_INTERVAL);
191  }
192 
193  //Check status code
194  if(error)
195  {
196  //Failed to resolve host name
197  TRACE_INFO("Host name resolution failed!\r\n");
198  }
199  else
200  {
201  //Successful host name resolution
202  TRACE_INFO("Host name resolved to %s...\r\n", ipAddrToString(ipAddr, NULL));
203  }
204 #endif
205 
206  //Return status code
207  return error;
208 }
209 
210 
211 /**
212  * @brief Send a DNS query message
213  * @param[in] entry Pointer to a valid DNS cache entry
214  * @return Error code
215  **/
216 
218 {
219  error_t error;
220  size_t length;
221  size_t offset;
222  NetBuffer *buffer;
224  DnsQuestion *dnsQuestion;
226 
227 #if (IPV4_SUPPORT == ENABLED)
228  //An IPv4 address is expected?
229  if(entry->type == HOST_TYPE_IPV4)
230  {
231  //Point to the IPv4 context
232  Ipv4Context *ipv4Context = &entry->interface->ipv4Context;
233 
234  //Out of range index?
236  return ERROR_NO_DNS_SERVER;
237 
238  //Select the relevant DNS server
239  destIpAddr.length = sizeof(Ipv4Addr);
240  destIpAddr.ipv4Addr = ipv4Context->dnsServerList[entry->dnsServerNum];
241 
242  //Make sure the IP address is valid
243  if(destIpAddr.ipv4Addr == IPV4_UNSPECIFIED_ADDR)
244  return ERROR_NO_DNS_SERVER;
245  }
246  else
247 #endif
248 #if (IPV6_SUPPORT == ENABLED)
249  //An IPv6 address is expected?
250  if(entry->type == HOST_TYPE_IPV6)
251  {
252  //Point to the IPv6 context
253  Ipv6Context *ipv6Context = &entry->interface->ipv6Context;
254 
255  //Out of range index?
257  return ERROR_NO_DNS_SERVER;
258 
259  //Select the relevant DNS server
260  destIpAddr.length = sizeof(Ipv6Addr);
261  destIpAddr.ipv6Addr = ipv6Context->dnsServerList[entry->dnsServerNum];
262 
263  //Make sure the IP address is valid
265  return ERROR_NO_DNS_SERVER;
266  }
267  else
268 #endif
269  //Invalid host type?
270  {
271  //Report an error
273  }
274 
275  //Allocate a memory buffer to hold the DNS query message
276  buffer = udpAllocBuffer(DNS_MESSAGE_MAX_SIZE, &offset);
277  //Failed to allocate buffer?
278  if(buffer == NULL)
279  return ERROR_OUT_OF_MEMORY;
280 
281  //Point to the DNS header
282  message = netBufferAt(buffer, offset);
283 
284  //Format DNS query message
285  message->id = htons(entry->id);
286  message->qr = 0;
287  message->opcode = DNS_OPCODE_QUERY;
288  message->aa = 0;
289  message->tc = 0;
290  message->rd = 1;
291  message->ra = 0;
292  message->z = 0;
293  message->rcode = DNS_RCODE_NO_ERROR;
294 
295  //The DNS query contains one question
296  message->qdcount = HTONS(1);
297  message->ancount = 0;
298  message->nscount = 0;
299  message->arcount = 0;
300 
301  //Length of the DNS query message
302  length = sizeof(DnsHeader);
303 
304  //Encode the host name using the DNS name notation
305  length += dnsEncodeName(entry->name, message->questions);
306 
307  //Point to the corresponding question structure
308  dnsQuestion = DNS_GET_QUESTION(message, length);
309 
310 #if (IPV4_SUPPORT == ENABLED)
311  //An IPv4 address is expected?
312  if(entry->type == HOST_TYPE_IPV4)
313  {
314  //Fill in question structure
315  dnsQuestion->qtype = HTONS(DNS_RR_TYPE_A);
316  dnsQuestion->qclass = HTONS(DNS_RR_CLASS_IN);
317  }
318 #endif
319 #if (IPV6_SUPPORT == ENABLED)
320  //An IPv6 address is expected?
321  if(entry->type == HOST_TYPE_IPV6)
322  {
323  //Fill in question structure
324  dnsQuestion->qtype = HTONS(DNS_RR_TYPE_AAAA);
325  dnsQuestion->qclass = HTONS(DNS_RR_CLASS_IN);
326  }
327 #endif
328 
329  //Update the length of the DNS query message
330  length += sizeof(DnsQuestion);
331 
332  //Adjust the length of the multi-part buffer
333  netBufferSetLength(buffer, offset + length);
334 
335  //Debug message
336  TRACE_INFO("Sending DNS message (%" PRIuSIZE " bytes)...\r\n", length);
337  //Dump message
339 
340  //Send DNS query message
341  error = udpSendDatagramEx(entry->interface, NULL, entry->port,
342  &destIpAddr, DNS_PORT, buffer, offset, 0);
343 
344  //Free previously allocated memory
345  netBufferFree(buffer);
346  //Return status code
347  return error;
348 }
349 
350 
351 /**
352  * @brief Process incoming DNS response message
353  * @param[in] interface Underlying network interface
354  * @param[in] pseudoHeader UDP pseudo header
355  * @param[in] udpHeader UDP header
356  * @param[in] buffer Multi-part buffer containing the incoming DNS message
357  * @param[in] offset Offset to the first byte of the DNS message
358  * @param[in] param Callback function parameter (not used)
359  **/
360 
361 void dnsProcessResponse(NetInterface *interface, const IpPseudoHeader *pseudoHeader,
362  const UdpHeader *udpHeader, const NetBuffer *buffer, size_t offset, void *param)
363 {
364  uint_t i;
365  uint_t j;
366  size_t pos;
367  size_t length;
369  DnsQuestion *question;
370  DnsResourceRecord *record;
371  DnsCacheEntry *entry;
372 
373  //Retrieve the length of the DNS message
374  length = netBufferGetLength(buffer) - offset;
375 
376  //Ensure the DNS message is valid
377  if(length < sizeof(DnsHeader))
378  return;
380  return;
381 
382  //Point to the DNS message header
383  message = netBufferAt(buffer, offset);
384  //Sanity check
385  if(message == NULL)
386  return;
387 
388  //Debug message
389  TRACE_INFO("DNS message received (%" PRIuSIZE " bytes)...\r\n", length);
390  //Dump message
392 
393  //Check message type
394  if(!message->qr)
395  return;
396 
397  //The DNS message shall contain one question
398  if(ntohs(message->qdcount) != 1)
399  return;
400 
401  //Loop through DNS cache entries
402  for(i = 0; i < DNS_CACHE_SIZE; i++)
403  {
404  //Point to the current entry
405  entry = &dnsCache[i];
406 
407  //DNS name resolution in progress?
408  if(entry->state == DNS_STATE_IN_PROGRESS &&
410  {
411  //Check destination port number
412  if(entry->port == ntohs(udpHeader->destPort))
413  {
414  //Compare identifier against the expected one
415  if(ntohs(message->id) != entry->id)
416  break;
417 
418  //Point to the first question
419  pos = sizeof(DnsHeader);
420  //Parse domain name
421  pos = dnsParseName(message, length, pos, NULL, 0);
422 
423  //Invalid name?
424  if(!pos)
425  break;
426  //Malformed DNS message?
427  if((pos + sizeof(DnsQuestion)) > length)
428  break;
429 
430  //Compare domain name
431  if(dnsCompareName(message, length, sizeof(DnsHeader), entry->name, 0))
432  break;
433 
434  //Point to the corresponding entry
435  question = DNS_GET_QUESTION(message, pos);
436 
437  //Check the class of the query
438  if(ntohs(question->qclass) != DNS_RR_CLASS_IN)
439  break;
440 
441  //Check the type of the query
442  if(entry->type == HOST_TYPE_IPV4 && ntohs(question->qtype) != DNS_RR_TYPE_A)
443  break;
444  if(entry->type == HOST_TYPE_IPV6 && ntohs(question->qtype) != DNS_RR_TYPE_AAAA)
445  break;
446 
447  //Check return code
448  if(message->rcode != DNS_RCODE_NO_ERROR)
449  {
450  //The entry should be deleted since name resolution has failed
451  dnsDeleteEntry(entry);
452  //Exit immediately
453  break;
454  }
455 
456  //Point to the first answer
457  pos += sizeof(DnsQuestion);
458 
459  //Parse answer resource records
460  for(j = 0; j < ntohs(message->ancount); j++)
461  {
462  //Parse domain name
463  pos = dnsParseName(message, length, pos, NULL, 0);
464  //Invalid name?
465  if(!pos)
466  break;
467 
468  //Point to the associated resource record
469  record = DNS_GET_RESOURCE_RECORD(message, pos);
470  //Point to the resource data
471  pos += sizeof(DnsResourceRecord);
472 
473  //Make sure the resource record is valid
474  if(pos > length)
475  break;
476  if((pos + ntohs(record->rdlength)) > length)
477  break;
478 
479 #if (IPV4_SUPPORT == ENABLED)
480  //IPv4 address expected?
481  if(entry->type == HOST_TYPE_IPV4)
482  {
483  //A resource record found?
484  if(ntohs(record->rtype) == DNS_RR_TYPE_A &&
485  ntohs(record->rdlength) == sizeof(Ipv4Addr))
486  {
487  //Copy the IPv4 address
488  entry->ipAddr.length = sizeof(Ipv4Addr);
489  ipv4CopyAddr(&entry->ipAddr.ipv4Addr, record->rdata);
490 
491  //Save current time
492  entry->timestamp = osGetSystemTime();
493  //Save TTL value
494  entry->timeout = ntohl(record->ttl) * 1000;
495 
496  //Limit the lifetime of the DNS cache entries
497  if(entry->timeout >= DNS_MAX_LIFETIME)
498  entry->timeout = DNS_MAX_LIFETIME;
499  if(entry->timeout <= DNS_MIN_LIFETIME)
500  entry->timeout = DNS_MIN_LIFETIME;
501 
502  //Unregister UDP callback function
503  udpDetachRxCallback(interface, entry->port);
504  //Host name successfully resolved
505  entry->state = DNS_STATE_RESOLVED;
506  //Exit immediately
507  break;
508  }
509  }
510 #endif
511 #if (IPV6_SUPPORT == ENABLED)
512  //IPv6 address expected?
513  if(entry->type == HOST_TYPE_IPV6)
514  {
515  //AAAA resource record found?
516  if(ntohs(record->rtype) == DNS_RR_TYPE_AAAA &&
517  ntohs(record->rdlength) == sizeof(Ipv6Addr))
518  {
519  //Copy the IPv6 address
520  entry->ipAddr.length = sizeof(Ipv6Addr);
521  ipv6CopyAddr(&entry->ipAddr.ipv6Addr, record->rdata);
522 
523  //Save current time
524  entry->timestamp = osGetSystemTime();
525  //Save TTL value
526  entry->timeout = ntohl(record->ttl) * 1000;
527 
528  //Limit the lifetime of the DNS cache entries
529  if(entry->timeout >= DNS_MAX_LIFETIME)
530  entry->timeout = DNS_MAX_LIFETIME;
531  if(entry->timeout <= DNS_MIN_LIFETIME)
532  entry->timeout = DNS_MIN_LIFETIME;
533 
534  //Unregister UDP callback function
535  udpDetachRxCallback(interface, entry->port);
536  //Host name successfully resolved
537  entry->state = DNS_STATE_RESOLVED;
538  //Exit immediately
539  break;
540  }
541  }
542 #endif
543  //Point to the next resource record
544  pos += ntohs(record->rdlength);
545  }
546 
547  //We are done
548  break;
549  }
550  }
551  }
552 }
553 
554 #endif
error_t udpSendDatagramEx(NetInterface *interface, const IpAddr *srcIpAddr, uint16_t srcPort, const IpAddr *destIpAddr, uint16_t destPort, NetBuffer *buffer, size_t offset, uint_t flags)
Send a UDP datagram (raw interface)
Definition: udp.c:463
error_t dnsSendQuery(DnsCacheEntry *entry)
Send a DNS query message.
Definition: dns_client.c:217
#define htons(value)
Definition: cpu_endian.h:392
HostType
Host types.
Definition: socket.h:171
#define DNS_MAX_LIFETIME
Definition: dns_client.h:77
uint8_t length
Definition: dtls_misc.h:149
HostType type
IPv4 or IPv6 host?
Definition: dns_cache.h:99
Ipv4Addr dnsServerList[IPV4_DNS_SERVER_LIST_SIZE]
DNS servers.
Definition: ipv4.h:345
IP network address.
Definition: ip.h:71
#define DNS_MIN_LIFETIME
Definition: dns_client.h:70
Structure describing a buffer that spans multiple chunks.
Definition: net_mem.h:88
__start_packed struct @146 DnsHeader
DNS message header.
systime_t timeout
Retransmission timeout.
Definition: dns_cache.h:108
char_t * ipAddrToString(const IpAddr *ipAddr, char_t *str)
Convert a binary IP address to a string representation.
Definition: ip.c:726
size_t dnsParseName(const DnsHeader *message, size_t length, size_t pos, char_t *dest, uint_t level)
Decode a domain name that uses the DNS name encoding.
Definition: dns_common.c:130
HostnameResolver protocol
Name resolution protocol.
Definition: dns_cache.h:100
#define ipv6CompAddr(ipAddr1, ipAddr2)
Definition: ipv6.h:121
Internet.
Definition: dns_common.h:110
#define DNS_CLIENT_MAX_RETRIES
Definition: dns_client.h:49
char_t name[]
IpAddr ipAddr
IP address.
Definition: dns_cache.h:106
uint32_t Ipv4Addr
IPv4 network address.
Definition: ipv4.h:239
IPv6 context.
Definition: ipv6.h:462
IPv4 context.
Definition: ipv4.h:338
__start_packed struct @148 DnsResourceRecord
Resource record format.
IP pseudo header.
Definition: ip.h:90
uint16_t id
Identifier used to match queries and responses.
Definition: dns_cache.h:104
uint16_t port
Port number used by the resolver.
Definition: dns_cache.h:103
uint_t dnsServerNum
This parameter selects between the primary and secondary DNS server.
Definition: dns_cache.h:102
void dnsProcessResponse(NetInterface *interface, const IpPseudoHeader *pseudoHeader, const UdpHeader *udpHeader, const NetBuffer *buffer, size_t offset, void *param)
Process incoming DNS response message.
Definition: dns_client.c:361
Invalid parameter.
Definition: error.h:47
error_t dnsResolve(NetInterface *interface, const char_t *name, HostType type, IpAddr *ipAddr)
Resolve a host name using DNS.
Definition: dns_client.c:54
char_t type
error_t
Error codes.
Definition: error.h:42
#define DNS_GET_QUESTION(message, offset)
Definition: dns_common.h:63
char_t name[DNS_MAX_NAME_LEN+1]
Domain name.
Definition: dns_cache.h:105
systime_t timestamp
Time stamp to manage entry lifetime.
Definition: dns_cache.h:107
#define DNS_GET_RESOURCE_RECORD(message, offset)
Definition: dns_common.h:64
void * netBufferAt(const NetBuffer *buffer, size_t offset)
Returns a pointer to the data at the specified position.
Definition: net_mem.c:413
Generic error code.
Definition: error.h:45
Ipv6Addr dnsServerList[IPV6_DNS_SERVER_LIST_SIZE]
DNS servers.
Definition: ipv6.h:472
#define IPV4_DNS_SERVER_LIST_SIZE
Definition: ipv4.h:70
error_t udpDetachRxCallback(NetInterface *interface, uint16_t port)
Unregister user callback.
Definition: udp.c:811
#define NetInterface
Definition: net.h:36
error_t udpAttachRxCallback(NetInterface *interface, uint16_t port, UdpRxCallback callback, void *param)
Register user callback.
Definition: udp.c:764
void netBufferFree(NetBuffer *buffer)
Dispose a multi-part buffer.
Definition: net_mem.c:282
DNS cache entry.
Definition: dns_cache.h:96
Host address.
Definition: dns_common.h:123
DnsCacheEntry * dnsCreateEntry(void)
Create a new entry in the DNS cache.
Definition: dns_cache.c:101
OsMutex netMutex
Definition: net.c:75
systime_t maxTimeout
Maximum retransmission timeout.
Definition: dns_cache.h:109
const Ipv6Addr IPV6_UNSPECIFIED_ADDR
Definition: ipv6.c:67
__start_packed struct @179 Ipv6Addr
IPv6 network address.
__start_packed struct @122 UdpHeader
UDP header.
#define IPV6_DNS_SERVER_LIST_SIZE
Definition: ipv6.h:94
#define TRACE_INFO(...)
Definition: debug.h:94
#define DNS_PORT
Definition: dns_common.h:57
size_t netBufferGetLength(const NetBuffer *buffer)
Get the actual length of a multi-part buffer.
Definition: net_mem.c:297
void dnsDumpMessage(const DnsHeader *message, size_t length)
Dump DNS message for debugging purpose.
Definition: dns_debug.c:52
#define MIN(a, b)
Definition: os_port.h:62
NetBuffer * udpAllocBuffer(size_t length, size_t *offset)
Allocate a buffer to hold a UDP packet.
Definition: udp.c:697
size_t length
Definition: ip.h:73
uint32_t netGetRand(void)
Get a random value.
Definition: net.c:1810
uint16_t udpGetDynamicPort(void)
Get an ephemeral port number.
Definition: udp.c:89
size_t dnsEncodeName(const char_t *src, uint8_t *dest)
Encode a domain name using the DNS name notation.
Definition: dns_common.c:56
DNS client (Domain Name System)
#define DNS_CACHE_INIT_POLLING_INTERVAL
Definition: dns_cache.h:61
#define ntohs(value)
Definition: cpu_endian.h:398
char char_t
Definition: compiler_port.h:43
DnsCacheEntry * dnsFindEntry(NetInterface *interface, const char_t *name, HostType type, HostnameResolver protocol)
Search the DNS cache for a given domain name.
Definition: dns_cache.c:183
Ipv4Addr ipv4Addr
Definition: ip.h:77
DNS cache management.
#define ipv6CopyAddr(destIpAddr, srcIpAddr)
Definition: ipv6.h:117
#define HTONS(value)
Definition: cpu_endian.h:390
NetInterface * interface
Underlying network interface.
Definition: dns_cache.h:101
void osAcquireMutex(OsMutex *mutex)
Acquire ownership of the specified mutex object.
#define DNS_CACHE_SIZE
Definition: dns_cache.h:47
void osReleaseMutex(OsMutex *mutex)
Release ownership of the specified mutex object.
#define DNS_MESSAGE_MAX_SIZE
Definition: dns_common.h:45
error_t netBufferSetLength(NetBuffer *buffer, size_t length)
Adjust the length of a multi-part buffer.
Definition: net_mem.c:320
#define DNS_CLIENT_INIT_TIMEOUT
Definition: dns_client.h:56
uint8_t message[]
Definition: chap.h:152
#define DNS_CLIENT_MAX_TIMEOUT
Definition: dns_client.h:63
void dnsDeleteEntry(DnsCacheEntry *entry)
Delete the specified DNS cache entry.
Definition: dns_cache.c:150
#define ipv4CopyAddr(destIpAddr, srcIpAddr)
Definition: ipv4.h:142
void osDelayTask(systime_t delay)
Delay routine.
DnsCacheEntry dnsCache[DNS_CACHE_SIZE]
Definition: dns_cache.c:51
DnsState state
Entry state.
Definition: dns_cache.h:98
__start_packed struct @147 DnsQuestion
Question format.
Ipv6Addr ipv6Addr
Definition: ip.h:80
uint_t retransmitCount
Retransmission counter.
Definition: dns_cache.h:110
#define PRIuSIZE
Definition: compiler_port.h:78
unsigned int uint_t
Definition: compiler_port.h:45
TCP/IP stack core.
IPv6 address.
Definition: dns_common.h:133
Data logging functions for debugging purpose (DNS)
Common DNS routines.
int_t dnsCompareName(const DnsHeader *message, size_t length, size_t pos, const char_t *name, uint_t level)
Compare domain names.
Definition: dns_common.c:240
#define DNS_CACHE_MAX_POLLING_INTERVAL
Definition: dns_cache.h:68
uint32_t systime_t
Definition: compiler_port.h:46
uint8_t ipAddr[4]
Definition: mib_common.h:187
#define ntohl(value)
Definition: cpu_endian.h:399
Success.
Definition: error.h:44
Debugging facilities.
#define IPV4_UNSPECIFIED_ADDR
Definition: ipv4.h:104
systime_t osGetSystemTime(void)
Retrieve system time.
Ipv4Addr destIpAddr
Definition: ipcp.h:78