php_dns.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. +----------------------------------------------------------------------+
  3. | Copyright (c) The PHP Group |
  4. +----------------------------------------------------------------------+
  5. | This source file is subject to version 3.01 of the PHP license, |
  6. | that is bundled with this package in the file LICENSE, and is |
  7. | available through the world-wide-web at the following url: |
  8. | https://www.php.net/license/3_01.txt |
  9. | If you did not receive a copy of the PHP license and are unable to |
  10. | obtain it through the world-wide-web, please send a note to |
  11. | license@php.net so we can mail you a copy immediately. |
  12. +----------------------------------------------------------------------+
  13. | Authors: The typical suspects |
  14. | Marcus Boerger <helly@php.net> |
  15. | Pollita <pollita@php.net> |
  16. +----------------------------------------------------------------------+
  17. */
  18. #ifndef PHP_DNS_H
  19. #define PHP_DNS_H
  20. #if defined(HAVE_DNS_SEARCH)
  21. #define php_dns_search(res, dname, class, type, answer, anslen) \
  22. ((int)dns_search(res, dname, class, type, (char *) answer, anslen, (struct sockaddr *)&from, &fromsize))
  23. #define php_dns_free_handle(res) \
  24. dns_free(res)
  25. #define php_dns_errno(handle) h_errno
  26. #elif defined(HAVE_RES_NSEARCH)
  27. #define php_dns_search(res, dname, class, type, answer, anslen) \
  28. res_nsearch(res, dname, class, type, answer, anslen);
  29. #if HAVE_RES_NDESTROY
  30. #define php_dns_free_handle(res) \
  31. res_ndestroy(res); \
  32. php_dns_free_res(res)
  33. #else
  34. #define php_dns_free_handle(res) \
  35. res_nclose(res); \
  36. php_dns_free_res(res)
  37. #endif
  38. #define php_dns_errno(handle) handle->res_h_errno
  39. #elif defined(HAVE_RES_SEARCH)
  40. #define php_dns_search(res, dname, class, type, answer, anslen) \
  41. res_search(dname, class, type, answer, anslen)
  42. #define php_dns_free_handle(res) /* noop */
  43. #define php_dns_errno(handle) h_errno
  44. #endif
  45. #if defined(HAVE_DNS_SEARCH) || defined(HAVE_RES_NSEARCH) || defined(HAVE_RES_SEARCH)
  46. #define HAVE_DNS_SEARCH_FUNC 1
  47. #endif
  48. #if HAVE_DNS_SEARCH_FUNC && HAVE_DN_EXPAND && HAVE_DN_SKIPNAME
  49. #define HAVE_FULL_DNS_FUNCS 1
  50. #endif
  51. #if defined(PHP_WIN32) || HAVE_DNS_SEARCH_FUNC
  52. # if defined(PHP_WIN32) || HAVE_FULL_DNS_FUNCS
  53. PHP_MINIT_FUNCTION(dns);
  54. # endif
  55. #endif /* defined(PHP_WIN32) || HAVE_DNS_SEARCH_FUNC */
  56. #ifndef INT16SZ
  57. #define INT16SZ 2
  58. #endif
  59. #ifndef INT32SZ
  60. #define INT32SZ 4
  61. #endif
  62. #endif /* PHP_DNS_H */