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 19 #ifndef PHP_DNS_H 20 #define PHP_DNS_H 21 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, (char *) answer, anslen, (struct sockaddr *)&from, &fromsize)) 25 #define php_dns_free_handle(res) \ 26 dns_free(res) 27 #define php_dns_errno(handle) h_errno 28 29 #elif defined(HAVE_RES_NSEARCH) 30 #define php_dns_search(res, dname, class, type, answer, anslen) \ 31 res_nsearch(res, dname, class, type, answer, anslen); 32 #if HAVE_RES_NDESTROY 33 #define php_dns_free_handle(res) \ 34 res_ndestroy(res); \ 35 php_dns_free_res(res) 36 #else 37 #define php_dns_free_handle(res) \ 38 res_nclose(res); \ 39 php_dns_free_res(res) 40 #endif 41 #define php_dns_errno(handle) handle->res_h_errno 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 #define php_dns_errno(handle) h_errno 48 49 #endif 50 51 #if defined(HAVE_DNS_SEARCH) || defined(HAVE_RES_NSEARCH) || defined(HAVE_RES_SEARCH) 52 #define HAVE_DNS_SEARCH_FUNC 1 53 #endif 54 55 #if HAVE_DNS_SEARCH_FUNC && HAVE_DN_EXPAND && HAVE_DN_SKIPNAME 56 #define HAVE_FULL_DNS_FUNCS 1 57 #endif 58 59 #if defined(PHP_WIN32) || HAVE_DNS_SEARCH_FUNC 60 # if defined(PHP_WIN32) || HAVE_FULL_DNS_FUNCS 61 PHP_MINIT_FUNCTION(dns); 62 # endif 63 #endif /* defined(PHP_WIN32) || HAVE_DNS_SEARCH_FUNC */ 64 65 #ifndef INT16SZ 66 #define INT16SZ 2 67 #endif 68 69 #ifndef INT32SZ 70 #define INT32SZ 4 71 #endif 72 73 #endif /* PHP_DNS_H */ 74