dns.h 974 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. /*
  2. * (C) Masami Komiya <mkomiya@sonare.it> 2005
  3. * Copyright 2009, Robin Getz <rgetz@blackfin.uclinux.org>
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU General Public License as
  7. * published by the Free Software Foundation; either version 2, or (at
  8. * your option) any later version.
  9. */
  10. #ifndef __DNS_H__
  11. #define __DNS_H__
  12. #define DNS_SERVICE_PORT 53
  13. #define DNS_TIMEOUT 10000UL
  14. /* http://en.wikipedia.org/wiki/List_of_DNS_record_types */
  15. enum dns_query_type {
  16. DNS_A_RECORD = 0x01,
  17. DNS_CNAME_RECORD = 0x05,
  18. DNS_MX_RECORD = 0x0f,
  19. };
  20. /*
  21. * DNS network packet
  22. */
  23. struct header {
  24. uint16_t tid; /* Transaction ID */
  25. uint16_t flags; /* Flags */
  26. uint16_t nqueries; /* Questions */
  27. uint16_t nanswers; /* Answers */
  28. uint16_t nauth; /* Authority PRs */
  29. uint16_t nother; /* Other PRs */
  30. unsigned char data[1]; /* Data, variable length */
  31. };
  32. extern void DnsStart(void); /* Begin DNS */
  33. #endif