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 21 #ifndef PHP_DNS_H 22 #define PHP_DNS_H 23 24 #if defined(HAVE_DNS_SEARCH) 25 #define php_dns_search(res, dname, class, type, answer, anslen) \ 26 ((int)dns_search(res, dname, class, type, answer, anslen, (struct sockaddr *)&from, &fromsize)) 27 #define php_dns_free_handle(res) \ 28 dns_free(res) 29 30 #elif defined(HAVE_RES_NSEARCH) 31 #define php_dns_search(res, dname, class, type, answer, anslen) \ 32 res_nsearch(res, dname, class, type, answer, anslen); 33 #if HAVE_RES_NDESTROY 34 #define php_dns_free_handle(res) \ 35 res_ndestroy(res); \ 36 php_dns_free_res(res) 37 #else 38 #define php_dns_free_handle(res) \ 39 res_nclose(res); \ 40 php_dns_free_res(res) 41 #endif 42 43 #elif defined(HAVE_RES_SEARCH) 44 #define php_dns_search(res, dname, class, type, answer, anslen) \ 45 res_search(dname, class, type, answer, anslen) 46 #define php_dns_free_handle(res) /* noop */ 47 48 #endif 49 50 #if defined(HAVE_DNS_SEARCH) || defined(HAVE_RES_NSEARCH) || defined(HAVE_RES_SEARCH) 51 #define HAVE_DNS_SEARCH_FUNC 1 52 #endif 53 54 #if HAVE_DNS_SEARCH_FUNC && HAVE_DN_EXPAND && HAVE_DN_SKIPNAME 55 #define HAVE_FULL_DNS_FUNCS 1 56 #endif 57 58 PHP_FUNCTION(gethostbyaddr); 59 PHP_FUNCTION(gethostbyname); 60 PHP_FUNCTION(gethostbynamel); 61 62 #ifdef HAVE_GETHOSTNAME 63 PHP_FUNCTION(gethostname); 64 #endif 65 66 #if defined(PHP_WIN32) || HAVE_DNS_SEARCH_FUNC 67 PHP_FUNCTION(dns_check_record); 68 69 # if defined(PHP_WIN32) || HAVE_FULL_DNS_FUNCS 70 PHP_FUNCTION(dns_get_mx); 71 PHP_FUNCTION(dns_get_record); 72 PHP_MINIT_FUNCTION(dns); 73 # endif 74 75 #endif /* defined(PHP_WIN32) || HAVE_DNS_SEARCH_FUNC */ 76 77 #ifndef INT16SZ 78 #define INT16SZ 2 79 #endif 80 81 #ifndef INT32SZ 82 #define INT32SZ 4 83 #endif 84 85 #endif /* PHP_DNS_H */ 86