Source for file DNS.php
Documentation is available at DNS.php
* Module written/ported by Eric Kilfoil <eric@ypass.net>
* This is the copyright notice from the PERL Net::DNS module:
* Copyright (c) 1997-2000 Michael Fuhr. All rights reserved. This
* program is free software; you can redistribute it and/or modify it
* under the same terms as Perl itself.
* The majority of this is _NOT_ my code. I simply ported it from the
* The author of the Net::DNS module is Michael Fuhr <mike@fuhr.org>
* http://www.fuhr.org/~mfuhr/perldns/
* I _DO_ maintain this code, and Miachael Fuhr has nothing to with the
* porting of this code to PHP. Any questions directly related to this
* class library should be directed to me.
* I'll be setting up a CVS repository for this class soon. The more
* emails i get concerning this, the more apt i am to do it.
* Net_DNS: A resolver library for PHP
* Copyright (c) 2002-2003 Eric Kilfoil eric@ypass.net
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
/* Include information {{{ */
require_once(" $phpdns_basedir/DNS/Header.php" );
require_once(" $phpdns_basedir/DNS/Question.php" );
require_once(" $phpdns_basedir/DNS/Packet.php" );
require_once(" $phpdns_basedir/DNS/Resolver.php" );
require_once(" $phpdns_basedir/DNS/RR.php" );
/* GLOBAL VARIABLE definitions {{{ */
// Used by the Net_DNS_Resolver object to generate an ID
$GLOBALS['_Net_DNS_packet_id'] = mt_rand(0 , 65535 );
/* Net_DNS object definition (incomplete) {{{ */
* Initializes a resolver object
* Net_DNS allows you to query a nameserver for DNS lookups. It bypasses the
* system resolver library entirely, which allows you to query any nameserver,
* set your own values for retries, timeouts, recursion, etc.
* @author Eric Kilfoil <eric@ypass.net>
/* class variable definitions {{{ */
* A default resolver object created on instantiation
* @var object Net_DNS_Resolver
var $VERSION = '1.00b2'; // This should probably be a define :(
/* class constructor - Net_DNS() {{{ */
* Initializes a resolver object
/* Net_DNS::opcodesbyname() {{{ */
* Translates opcode names to integers
* Translates the name of a DNS OPCODE into it's assigned number
* listed in RFC1035, RFC1996, or RFC2136. Valid OPCODES are:
* @param string $opcode A DNS Packet OPCODE name
* @return integer The integer value of an OPCODE
* @see Net_DNS::opcodesbyval()
'QUERY' => 0 , // RFC 1035
'IQUERY' => 1 , // RFC 1035
'STATUS' => 2 , // RFC 1035
'NS_NOTIFY_OP' => 4 , // RFC 1996
'UPDATE' => 5 , // RFC 2136
/* Net_DNS::opcodesbyval() {{{*/
* Translates opcode integers into names
* Translates the integer value of an opcode into it's name
* @param integer $opcodeval A DNS packet opcode integer
* @return string The name of the OPCODE
* @see Net_DNS::opcodesbyname()
if (! strlen($opval[$opcodeval])) {
$opval[$opcodeval] = NULL;
return($opval[$opcodeval]);
/* Net_DNS::rcodesbyname() {{{*/
* Translates rcode names to integers
* Translates the name of a DNS RCODE (result code) into it's assigned number.
* @param string $rcode A DNS Packet RCODE name
* @return integer The integer value of an RCODE
* @see Net_DNS::rcodesbyval()
'NOERROR' => 0 , // RFC 1035
'FORMERR' => 1 , // RFC 1035
'SERVFAIL' => 2 , // RFC 1035
'NXDOMAIN' => 3 , // RFC 1035
'NOTIMP' => 4 , // RFC 1035
'REFUSED' => 5 , // RFC 1035
'YXDOMAIN' => 6 , // RFC 2136
'YXRRSET' => 7 , // RFC 2136
'NXRRSET' => 8 , // RFC 2136
'NOTAUTH' => 9 , // RFC 2136
'NOTZONE' => 10 , // RFC 2136
/* Net_DNS::rcodesbyval() {{{*/
* Translates rcode integers into names
* Translates the integer value of an rcode into it's name
* @param integer $rcodeval A DNS packet rcode integer
* @return string The name of the RCODE
* @see Net_DNS::rcodesbyname()
if (! strlen($rc[$rcodeval])) {
/* Net_DNS::typesbyname() {{{*/
* Translates RR type names into integers
* Translates a Resource Record from it's name to it's integer value.
* Valid resource record types are:
* @param string $rrtype A DNS packet RR type name
* @return integer The integer value of an RR type
* @see Net_DNS::typesbyval()
if (empty ($rc[$rrtype])) {
/* Net_DNS::typesbyval() {{{*/
* Translates RR type integers into names
* Translates the integer value of an RR type into it's name
* @param integer $rrtypeval A DNS packet RR type integer
* @return string The name of the RR type
* @see Net_DNS::typesbyname()
$rrtypeval = preg_replace(array ('/\s*/',' /^0*/'), '', $rrtypeval);
if (empty ($rc[$rrtypeval])) {
/* Net_DNS::classesbyname() {{{*/
* translates a DNS class from it's name to it's integer value. Valid
* @param string $class A DNS packet class type
* @return integer The integer value of an class type
* @see Net_DNS::classesbyval()
'NONE' => 254 , // RFC 2136
if (!isset ($rc[$class])) {
/* Net_DNS::classesbyval() {{{*/
* Translates RR class integers into names
* Translates the integer value of an RR class into it's name
* @param integer $classval A DNS packet RR class integer
* @return string The name of the RR class
* @see Net_DNS::classesbyname()
$classval = preg_replace(array ('/\s*/',' /^0*/'), '', $classval);
if (empty ($rc[$classval])) {
/* not completed - Net_DNS::mx() {{{*/
/* not completed - Net_DNS::yxrrset() {{{*/
/* not completed - Net_DNS::nxrrset() {{{*/
/* not completed - Net_DNS::yxdomain() {{{*/
/* not completed - Net_DNS::nxdomain() {{{*/
/* not completed - Net_DNS::rr_add() {{{*/
/* not completed - Net_DNS::rr_del() {{{*/
* vim600: sw=4 ts=4 sts=4 cindent fdm=marker et
Documentation generated on Mon, 11 Mar 2019 14:31:29 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.
|