php_dns.h 2.8 KB

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