dns.h 792 B

123456789101112131415161718192021222324252627282930313233343536
  1. /*
  2. * (C) Masami Komiya <mkomiya@sonare.it> 2005
  3. * Copyright 2009, Robin Getz <rgetz@blackfin.uclinux.org>
  4. *
  5. * SPDX-License-Identifier: GPL-2.0+
  6. */
  7. #ifndef __DNS_H__
  8. #define __DNS_H__
  9. #define DNS_SERVICE_PORT 53
  10. #define DNS_TIMEOUT 10000UL
  11. /* http://en.wikipedia.org/wiki/List_of_DNS_record_types */
  12. enum dns_query_type {
  13. DNS_A_RECORD = 0x01,
  14. DNS_CNAME_RECORD = 0x05,
  15. DNS_MX_RECORD = 0x0f,
  16. };
  17. /*
  18. * DNS network packet
  19. */
  20. struct header {
  21. uint16_t tid; /* Transaction ID */
  22. uint16_t flags; /* Flags */
  23. uint16_t nqueries; /* Questions */
  24. uint16_t nanswers; /* Answers */
  25. uint16_t nauth; /* Authority PRs */
  26. uint16_t nother; /* Other PRs */
  27. unsigned char data[1]; /* Data, variable length */
  28. } __attribute__((packed));
  29. void dns_start(void); /* Begin DNS */
  30. #endif