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