Skip to content

Commit 8ce8d73

Browse files
author
Visweswaran
committed
PHP language binding for the getdns API
1 parent 65202bf commit 8ce8d73

File tree

231 files changed

+28270
-2
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

231 files changed

+28270
-2
lines changed

LICENSE

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
Copyright (c) 2015, Verisign, Inc., NLnet Labs
2+
All rights reserved.
3+
4+
Redistribution and use in source and binary forms, with or without
5+
modification, are permitted provided that the following conditions are met:
6+
* Redistributions of source code must retain the above copyright
7+
notice, this list of conditions and the following disclaimer.
8+
* Redistributions in binary form must reproduce the above copyright
9+
notice, this list of conditions and the following disclaimer in the
10+
documentation and/or other materials provided with the distribution.
11+
* Neither the names of the copyright holders nor the
12+
names of its contributors may be used to endorse or promote products
13+
derived from this software without specific prior written permission.
14+
15+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18+
DISCLAIMED. IN NO EVENT SHALL Verisign, Inc. BE LIABLE FOR ANY
19+
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22+
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

README.md

+81-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,81 @@
1-
# getdns-php-bindings
2-
A PHP language binding for the getdns API
1+
getdns-php
2+
==========
3+
4+
A PHP language binding for the getdns API, version 0.1.0.
5+
This implementation is licensed under the New BSD License (BSD-new).
6+
7+
NOTE: THIS IS AN ALPHA RELEASE!
8+
9+
Dependencies:
10+
11+
* libgetdns 0.1.7
12+
* libgetdns_ext_event 0.1.7
13+
* getdns library header files
14+
15+
The configure script will confirm that the dependencies have been met,
16+
but it will not check version numbers.
17+
18+
To build:
19+
20+
$ phpize
21+
$ ./configure --enable-getdns
22+
$ make
23+
$ sudo make install
24+
25+
To clean:
26+
27+
$ make clean
28+
$ phpize --clean
29+
30+
Note that the following getdns library functions are not
31+
implemented in this extension:
32+
33+
* getdns_context_create_with_memory_functions()
34+
* getdns_context_create_with_extended_memory_functions()
35+
* getdns_context_set_memory_functions()
36+
* getdns_context_set_extended_memory_functions()
37+
* getdns_dict_create_with_memory_functions()
38+
* getdns_dict_create_with_extended_memory_functions()
39+
* getdns_list_create_with_memory_functions()
40+
* getdns_list_create_with_extended_memory_functions()
41+
* getdns_pretty_snprint_dict()
42+
* getdns_pretty_snprint_list()
43+
* getdns_snprint_json_dict()
44+
* getdns_snprint_json_list()
45+
46+
Each makes assumptions about memory management functions
47+
that aren't directly applicable to PHP.
48+
49+
## Documentation
50+
51+
Documentation is written in the DocBook format preferred
52+
by the PHP community. XML input files can be found in the
53+
doc-in directory.
54+
55+
Documentation intended for human consumption is provided in
56+
HTML format and can be found in the doc-out directory. The
57+
documentation root can be found at
58+
doc-out/php-chunked-xhtml/index.html. Note that a small
59+
number of asynchronous event management functions remain
60+
undocumented.
61+
62+
## Regression Tests
63+
64+
An incomplete suite of regression tests (written in
65+
[phpt](http://qa.php.net/write-test.php) format) is included
66+
with the extension. Test cases can be found in the tests
67+
directory. All of the tests can be executing by running
68+
"make test" after building the extension as described
69+
above.
70+
71+
## To Do
72+
73+
* Complete the documentation.
74+
* Complete test case development.
75+
* Test and confirm asnynchronous function operation. Limited
76+
testing of `php_getdns_address()` has been done. While the code
77+
"works", asynch operation needs to be confirmed.
78+
* Finish wrapper functions for the following library functions:
79+
* `getdns_context_set_eventloop()`
80+
* A whole bunch of other things not yet listed here. Remember, this
81+
is an ALPHA release.

config.m4

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
PHP_ARG_ENABLE(getdns,
2+
[whether to enable the "getdns" extension],
3+
[ --enable-getdns Enable getdns support])
4+
5+
if test "$PHP_GETDNS" != "no"; then
6+
AC_MSG_CHECKING(for libgetdns in default path)
7+
for i in /usr/local /usr; do
8+
if test -r $i/lib/libgetdns.so; then
9+
GETDNS_DIR=$i
10+
AC_MSG_RESULT(found libgetdns.so in $i)
11+
fi
12+
done
13+
14+
if test -z "$GETDNS_DIR"; then
15+
AC_MSG_RESULT(not found)
16+
AC_MSG_ERROR(Please install the libgetdns library)
17+
fi
18+
19+
AC_MSG_CHECKING(for libgetdns_ext_event in default path)
20+
for i in /usr/local /usr; do
21+
if test -r $i/lib/libgetdns_ext_event.so; then
22+
GETDNS_EVENT_DIR=$i
23+
AC_MSG_RESULT(found libgetdns_ext_event.so in $i)
24+
fi
25+
done
26+
27+
if test -z "$GETDNS_EVENT_DIR"; then
28+
AC_MSG_RESULT(not found)
29+
AC_MSG_ERROR(Please install the libgetdns_ext_event library)
30+
fi
31+
32+
AC_MSG_CHECKING([getdns header files])
33+
GETDNS_INC_DIR="/usr/local/include/getdns"
34+
INC_FILES="$GETDNS_INC_DIR/getdns.h $GETDNS_INC_DIR/getdns_extra.h $GETDNS_INC_DIR/getdns_libevent.h"
35+
for i in $INC_FILES; do
36+
if test ! -f $i; then
37+
AC_MSG_ERROR([getdns header files not found in $GETDNS_INC_DIR])
38+
fi
39+
done
40+
AC_MSG_RESULT($GETDNS_INC_DIR)
41+
42+
PHP_CHECK_LIBRARY(getdns, getdns_context_create,
43+
[
44+
AC_DEFINE(HAVE_LIBGETDNS, 1, [ ])
45+
],
46+
[
47+
AC_MSG_ERROR([Invalid libgetdns.])
48+
],
49+
[
50+
-L$GETDNS_DIR/lib -lgetdns -lgetdns_ext_event
51+
]
52+
)
53+
54+
PHP_SUBST(GETDNS_SHARED_LIBADD)
55+
PHP_ADD_LIBRARY_WITH_PATH(getdns, $GETDNS_DIR/lib, GETDNS_SHARED_LIBADD)
56+
PHP_ADD_LIBRARY_WITH_PATH(getdns_ext_event, $GETDNS_DIR/lib, GETDNS_SHARED_LIBADD)
57+
PHP_ADD_INCLUDE($GETDNS_INC_DIR)
58+
AC_DEFINE(HAVE_GETDNS, 1, [whether the getdns extension is enabled])
59+
PHP_NEW_EXTENSION(getdns, phpgetdns.c, $ext_shared)
60+
fi

doc-in/book.developer.xml

+89
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V5.0//EN"
3+
"{PATH_TO_DOCBASE}/docbook/docbook-xml/docbook.dtd" [
4+
5+
<!-- $Revision$ -->
6+
<!-- We use xhtml entities all over the place -->
7+
<!ENTITY % xhtml-lat1 SYSTEM "{PATH_TO_DOCBASE}/entities/ISO/xhtml1-lat1.ent">
8+
<!ENTITY % xhtml-symbol SYSTEM "{PATH_TO_DOCBASE}/entities/ISO/xhtml1-symbol.ent">
9+
<!ENTITY % xhtml-special SYSTEM "{PATH_TO_DOCBASE}/entities/ISO/xhtml1-special.ent">
10+
<!ENTITY % isopub SYSTEM "{PATH_TO_DOCBASE}/entities/ISO/isopub.ent">
11+
%xhtml-lat1;
12+
%xhtml-symbol;
13+
%xhtml-special;
14+
%isopub;
15+
16+
<!-- Fallback to English definitions and snippets (in case of missing translation) -->
17+
<!ENTITY % language-defs.default SYSTEM "{PATH_TO_DOC}/language-defs.ent">
18+
<!ENTITY % language-snippets.default SYSTEM "{PATH_TO_DOC}/language-snippets.ent">
19+
<!ENTITY % extensions.default SYSTEM "{PATH_TO_DOC}/extensions.ent">
20+
21+
%language-defs.default;
22+
%extensions.default;
23+
%language-snippets.default;
24+
25+
<!-- All global entities for the XML files -->
26+
<!ENTITY % global.entities SYSTEM "{PATH_TO_DOCBASE}/entities/global.ent">
27+
28+
<!-- These are language independent -->
29+
<!ENTITY % frontpage.entities SYSTEM "{PATH_TO_DOC}/contributors.ent">
30+
<!ENTITY % file.entities SYSTEM "{PATH_TO_DOCBASE}/entities/file-entities.ent">
31+
32+
<!-- Include all external DTD parts defined previously -->
33+
%global.entities;
34+
%file.entities;
35+
%frontpage.entities;
36+
]>
37+
38+
<book xml:id="book.getdns" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:lang="en">
39+
<title>PHP Language Bindings for the getdns API</title>
40+
<titleabbrev>Getdns</titleabbrev>
41+
42+
<preface xml:id="intro.getdns">
43+
&reftitle.intro;
44+
<para>
45+
This extension provides PHP language bindings for the functions and constants
46+
exposed by the <link xlink:href="http://getdnsapi.net/">getdns API and library</link>.
47+
getdns is a modern, asynchronous DNS API that simplifies access to advanced DNS
48+
features, including DNSSEC. This extension is built on top of the getdns
49+
implementation developed as a joint project between
50+
<link xlink:href="http://labs.verisigninc.com/en_US/innovation/verisign-labs/index.xhtml">Verisign Labs</link>
51+
and <link xlink:href="http://nlnetlabs.nl/">NLnet Labs</link>.
52+
</para>
53+
<para>
54+
Additional information about the API and the functions that implement it can be found
55+
on the <link xlink:href="http://getdnsapi.net/spec.html">getdns web site</link>.
56+
</para>
57+
<para>
58+
NOTE: THIS IS AN ALPHA RELEASE! This implementation is licensed under the New BSD License (BSD-new).
59+
</para>
60+
</preface>
61+
62+
&reference.getdns.setup;
63+
&reference.getdns.constants;
64+
&reference.getdns.examples;
65+
&reference.getdns.reference;
66+
67+
</book>
68+
69+
<!-- Keep this comment at the end of the file
70+
Local variables:
71+
mode: sgml
72+
sgml-omittag:t
73+
sgml-shorttag:t
74+
sgml-minimize-attributes:nil
75+
sgml-always-quote-attributes:t
76+
sgml-indent-step:1
77+
sgml-indent-data:t
78+
indent-tabs-mode:nil
79+
sgml-parent-document:nil
80+
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
81+
sgml-exposed-tags:nil
82+
sgml-local-catalogs:nil
83+
sgml-local-ecat-files:nil
84+
End:
85+
vim600: syn=xml fen fdm=syntax fdl=2 si
86+
vim: et tw=78 syn=sgml
87+
vi: ts=1 sw=1
88+
-->
89+

doc-in/book.xml

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- $Revision$ -->
3+
4+
<book xml:id="book.getdns" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
5+
<title>getdns</title>
6+
<titleabbrev>getdns</titleabbrev>
7+
8+
<preface xml:id="intro.getdns">
9+
&reftitle.intro;
10+
<para>
11+
This extension provides PHP language bindings for the functions and constants
12+
exposed by the <link xlink:href="http://getdnsapi.net/">getdns API and library</link>.
13+
getdns is a modern, asynchronous DNS API that simplifies access to advanced DNS
14+
features, including DNSSEC. This extension is built on top of the getdns
15+
implementation developed as a joint project between
16+
<link xlink:href="http://labs.verisigninc.com/en_US/innovation/verisign-labs/index.xhtml">Verisign Labs</link>
17+
and <link xlink:href="http://nlnetlabs.nl/">NLnet Labs</link>.
18+
</para>
19+
<para>
20+
Additional information about the API and the functions that implement it can be found
21+
on the <link xlink:href="http://getdnsapi.net/spec.html">getdns web site</link>.
22+
</para>
23+
<para>
24+
NOTE: THIS IS AN ALPHA RELEASE! This implementation is licensed under the New BSD License (BSD-new).
25+
</para>
26+
</preface>
27+
28+
&reference.getdns.setup;
29+
&reference.getdns.constants;
30+
&reference.getdns.reference;
31+
32+
</book>
33+
34+
<!-- Keep this comment at the end of the file
35+
Local variables:
36+
mode: sgml
37+
sgml-omittag:t
38+
sgml-shorttag:t
39+
sgml-minimize-attributes:nil
40+
sgml-always-quote-attributes:t
41+
sgml-indent-step:1
42+
sgml-indent-data:t
43+
indent-tabs-mode:nil
44+
sgml-parent-document:nil
45+
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
46+
sgml-exposed-tags:nil
47+
sgml-local-catalogs:nil
48+
sgml-local-ecat-files:nil
49+
End:
50+
vim600: syn=xml fen fdm=syntax fdl=2 si
51+
vim: et tw=78 syn=sgml
52+
vi: ts=1 sw=1
53+
-->

doc-in/configure.xml

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- $Revision$ -->
3+
4+
<section xml:id="getdns.installation" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
5+
&reftitle.install;
6+
7+
<para>
8+
&pecl.info;
9+
<link xlink:href="&url.pecl.package;getdns">&url.pecl.package;getdns</link>
10+
</para>
11+
12+
13+
</section>
14+
15+
16+
<!-- Keep this comment at the end of the file
17+
Local variables:
18+
mode: sgml
19+
sgml-omittag:t
20+
sgml-shorttag:t
21+
sgml-minimize-attributes:nil
22+
sgml-always-quote-attributes:t
23+
sgml-indent-step:1
24+
sgml-indent-data:t
25+
indent-tabs-mode:nil
26+
sgml-parent-document:nil
27+
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
28+
sgml-exposed-tags:nil
29+
sgml-local-catalogs:nil
30+
sgml-local-ecat-files:nil
31+
End:
32+
vim600: syn=xml fen fdm=syntax fdl=2 si
33+
vim: et tw=78 syn=sgml
34+
vi: ts=1 sw=1
35+
-->

0 commit comments

Comments
 (0)