eventdns.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /* This software is Public Domain. To view a copy of the public domain dedication,
  2. * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to
  3. * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
  4. *
  5. * I ask and expect, but do not require, that all derivative works contain an
  6. * attribution similar to:
  7. * Parts developed by Adam Langley <agl@imperialviolet.org>
  8. *
  9. * You may wish to replace the word "Parts" with something else depending on
  10. * the amount of original code.
  11. *
  12. * (Derivative works does not include programs which link against, run or include
  13. * the source verbatim in their source distributions)
  14. */
  15. #ifndef EVENTDNS_H
  16. #define EVENTDNS_H
  17. /* Error codes 0-5 are as described in RFC 1035. */
  18. #define DNS_ERR_NONE 0
  19. /* The name server was unable to interpret the query */
  20. #define DNS_ERR_FORMAT 1
  21. /* The name server was unable to process this query due to a problem with the
  22. * name server */
  23. #define DNS_ERR_SERVERFAILED 2
  24. /* The domain name does not exist */
  25. #define DNS_ERR_NOTEXIST 3
  26. /* The name server does not support the requested kind of query */
  27. #define DNS_ERR_NOTIMPL 4
  28. /* The name server refuses to reform the specified operation for policy
  29. * reasons */
  30. #define DNS_ERR_REFUSED 5
  31. /* The reply was truncated or ill-formated */
  32. #define DNS_ERR_TRUNCATED 65
  33. /* An unknown error occurred */
  34. #define DNS_ERR_UNKNOWN 66
  35. /* Communication with the server timed out */
  36. #define DNS_ERR_TIMEOUT 67
  37. #define DNS_IPv4_A 1
  38. #define DNS_QUERY_NO_SEARCH 1
  39. #define DNS_OPTION_SEARCH 1
  40. #define DNS_OPTION_NAMESERVERS 2
  41. #define DNS_OPTION_MISC 4
  42. #define DNS_OPTIONS_ALL 7
  43. typedef void (*eventdns_callback_type) (int result, char type, int count, int ttl, void *addresses, void *arg);
  44. int eventdns_nameserver_add(unsigned long int address);
  45. int eventdns_nameserver_ip_add(const char *ip_as_string);
  46. int eventdns_resolve(const char *name, int flags, eventdns_callback_type callback, void *ptr);
  47. int eventdns_resolv_conf_parse(int flags, const char *);
  48. #ifdef MS_WINDOWS
  49. int eventdns_config_windows_nameservers(void);
  50. #endif
  51. void eventdns_search_clear(void);
  52. void eventdns_search_add(const char *domain);
  53. void eventdns_search_ndots_set(const int ndots);
  54. typedef void (*eventdns_debug_log_fn_type)(const char *msg);
  55. void eventdns_set_log_fn(eventdns_debug_log_fn_type fn);
  56. #define DNS_NO_SEARCH 1
  57. #endif // !EVENTDNS_H