Net_DNS
[ class tree: Net_DNS ] [ index: Net_DNS ] [ all elements ]

Class: Net_DNS_Resolver

Source Location: /Net_DNS-1.0.7/Net/DNS/Resolver.php

Class Overview


A DNS Resolver library


Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 29]
A DNS Resolver library

Resolver library. Builds a DNS query packet, sends the packet to the server and parses the reponse.



[ Top ]


Class Variables

$answerfrom =

[line 137]

The origin of the packet.

This contains a string containing the IP address of the name server from which the answer was given.

  • Access: public

Type:   string


[ Top ]

$answersize =

[line 147]

The size of the answer packet.

This contains a integer containing the size of the DNS packet the server responded with.

  • Access: public

Type:   string


[ Top ]

$confpath =

[line 178]

A array of directories to search for the user's resolver config

Type:   string


[ Top ]

$debug =

[line 188]

debugging flag

If set to true (non-zero), debugging code will be displayed as the resolver makes the request.

  • Access: public

Type:   boolean


[ Top ]

$defnames =

[line 116]

Unknown

Type:   mixed


[ Top ]

$dnsrch =

[line 120]

Unknown

Type:   mixed


[ Top ]

$domain =

[line 52]

The domain in which the resolver client host resides.
  • Access: public

Type:   string


[ Top ]

$dotfile =  '.resolv.conf'

[line 171]

The name of the user defined resolv.conf

The resolver will attempt to look in both the current directory as well as the user's home directory for a user defined resolver configuration file


Type:   string


[ Top ]

$errorstring =

[line 127]

Contains the value of the last error returned by the resolver.
  • Access: public

Type:   string


[ Top ]

$igntc =

[line 101]

Ignore TC (truncated) bit

If the server responds with the TC bit set on a response, and $igntc is set to 0, the resolver will automatically retransmit the request using virtual circuits (TCP).

  • Access: public

Type:   boolean


[ Top ]

$nameservers =

[line 38]

An array of all nameservers to query
  • Access: public

Type:   array


[ Top ]

$parsedfiles = array()

[line 241]

An array of config files that have been read/parsed already and is used to ensure the usable config files are searched for only once.

Type:   array


[ Top ]

$port =

[line 45]

The UDP port to use for the query (default = 53)
  • Access: public

Type:   integer


[ Top ]

$recurse =

[line 112]

Recursion Desired

Sets the value of the RD (recursion desired) bit in the header. If the RD bit is set to 0, the server will not perform recursion on the request.

  • Access: public

Type:   boolean


[ Top ]

$resolv_conf =  '/etc/resolv.conf'

[line 160]

The location of the system resolv.conf file.

Type:   string


[ Top ]

$retrans =

[line 69]

The number of seconds between retransmission of unaswered queries
  • Access: public

Type:   integer


[ Top ]

$retry =

[line 76]

The number of times unanswered requests should be retried
  • Access: public

Type:   integer


[ Top ]

$searchlist =

[line 62]

The searchlist to apply to unqualified hosts

An array of strings containg domains to apply to unqualified hosts passed to the resolver.

  • Access: public

Type:   array


[ Top ]

$stayopen =

[line 90]

Unknown

Type:   mixed


[ Top ]

$tcp_timeout =

[line 154]

The number of seconds after which a TCP connection should timeout
  • Access: public

Type:   integer


[ Top ]

$useEnhancedSockets =  true

[line 198]

use the (currently) experimental PHP socket library

If set to true (non-zero), the Resolver will attempt to use the much more effecient PHP sockets extension (if available).

  • Access: public

Type:   boolean


[ Top ]

$usevc =

[line 86]

Whether or not to use TCP (Virtual Circuits) instead of UDP

If set to 0, UDP will be used unless TCP is required. TCP is required for questions or responses greater than 512 bytes.

  • Access: public

Type:   boolean


[ Top ]



Method Detail

Net_DNS_Resolver (Constructor)   [line 260]

Net_DNS_Resolver Net_DNS_Resolver( [ $defaults = array()])

Initializes the Resolver Object

Parameters:

   $defaults     

[ Top ]

axfr   [line 1200]

object Net_DNS_Packet axfr( string $dname, [string $class = 'IN'], [boolean $old = false])

Performs an AXFR query (zone transfer)

Requests a zone transfer from the nameservers. Note that zone transfers will ALWAYS use TCP regardless of the setting of the Net_DNS_Resolver::$usevc flag. If $old is set to true, Net_DNS requires a nameserver that supports the many-answers style transfer format. Large zone transfers will not function properly. Setting $old to true is _NOT_ recommended and should only be used for backwards compatibility.

  • Access: public

Parameters:

string   $dname     The domain (zone) to transfer
string   $class     The class in which to look for the zone.
boolean   $old     Requires 'old' style many-answer format to function.

[ Top ]

axfr_next   [line 1320]

object Net_DNS_RR axfr_next( )

Requests the next RR from a existing transfer started with axfr_start

[ Top ]

axfr_old   [line 1177]

object Net_DNS_Packet axfr_old( string $dname, [string $class = 'IN'])

Performs an AXFR query (zone transfer) (OLD BUGGY STYLE)

This is deprecated and should not be used!

  • Access: public

Parameters:

string   $dname     The domain (zone) to transfer
string   $class     The class in which to look for the zone.

[ Top ]

axfr_start   [line 1243]

object Net_DNS_Packet axfr_start( $dname, [ $class = 'IN'], string $packet, string $packet_data)

Sends a packet via TCP to the list of name servers.

Parameters:

string   $packet     A packet object to send to the NS list
string   $packet_data     The data in the packet as returned by the Net_DNS_Packet::data() method
   $dname     
   $class     

[ Top ]

cname_addr   [line 515]

void cname_addr( $names, $packet)


Parameters:

   $names     
   $packet     

[ Top ]

make_query_packet   [line 1132]

void make_query_packet( $packetORname, [ $type = ''], [ $class = ''])

Unknown

Parameters:

   $packetORname     
   $type     
   $class     

[ Top ]

nameservers   [line 474]

void nameservers( [ $nsa = array()])

Gets or sets the nameservers to be queried.

Returns the current nameservers if an array of new nameservers is not given as the argument OR sets the nameservers to the given nameservers.

Nameservers not specified by ip address must be able to be resolved by the default settings of a new Net_DNS_Resolver.

  • Access: public

Parameters:

   $nsa     

[ Top ]

nextid   [line 454]

void nextid( )

Returns the next request Id to be used for the DNS packet header

[ Top ]

printhex   [line 721]

void printhex( $data)

Prints packet data as hex code.

Parameters:

   $data     

[ Top ]

query   [line 670]

mixed query( string $name, [string $type = 'A'], [string $class = 'IN'])

Queries nameservers for an answer

Queries the nameservers listed in the resolver configuration for an answer to a question packet.


Parameters:

string   $name     The name (LHS) of a resource record to query.
string   $type     The type of record to query.
string   $class     The class of record to query.

[ Top ]

rawQuery   [line 626]

mixed rawQuery( string $name, [string $type = 'A'], [string $class = 'IN'])

Queries nameservers for an answer

Queries the nameservers listed in the resolver configuration for an answer to a question packet.


Parameters:

string   $name     The name (LHS) of a resource record to query.
string   $type     The type of record to query.
string   $class     The class of record to query.

[ Top ]

read_config   [line 342]

void read_config( string $file)

Reads and parses a resolver configuration file

Parameters:

string   $file     The name of the file to open and parse

[ Top ]

read_env   [line 392]

void read_env( )

Examines the environment for resolver config information

[ Top ]

read_tcp   [line 1387]

void read_tcp( $sock, $nbytes, [ $debug = 0])

Unknown - not ported yet

Parameters:

   $sock     
   $nbytes     
   $debug     

[ Top ]

res_init   [line 303]

void res_init( )

Initalizes the resolver library

res_init() searches for resolver library configuration files and initializes the various properties of the resolver object.


[ Top ]

search   [line 550]

mixed search( string $name, [string $type = 'A'], [string $class = 'IN'])

Searches nameservers for an answer

Goes through the search list and attempts to resolve name based on the information in the search list.


Parameters:

string   $name     The name (LHS) of a resource record to query.
string   $type     The type of record to query.
string   $class     The class of record to query.

[ Top ]

send   [line 696]

object Net_DNS_Packet send( string $packetORname, [string $qtype = ''], [string $qclass = ''])

Sends a packet to a nameserver

Determines the appropriate communication method (UDP or TCP) and sends a DNS packet to a nameserver. Use of the this function directly is discouraged. $packetORname should always be a properly formatted binary DNS packet. However, it is possible to send a query here and bypass Net_DNS_Resolver::query()

  • Return: An answer packet object

Parameters:

string   $packetORname     A binary DNS packet stream or a hostname to query
string   $qtype     This should not be used
string   $qclass     This should not be used

[ Top ]

send_tcp   [line 757]

object Net_DNS_Packet send_tcp( string $packet, string $packet_data)

Sends a packet via TCP to the list of name servers.

Parameters:

string   $packet     A packet object to send to the NS list
string   $packet_data     The data in the packet as returned by the Net_DNS_Packet::data() method

[ Top ]

send_udp   [line 1112]

object Net_DNS_Packet send_udp( object Net_DNS_Packet $packet, string $packet_data)

Sends a packet via UDP to the list of name servers.

This function sends a packet to a nameserver. send_udp calls either Net_DNS_Resolver::send_udp_no_sock_lib() or Net_DNS_Resolver::send_udp_with_sock_lib() depending on whether or not the sockets extension is compiled into PHP. Note that using the sockets extension is MUCH more efficient.


Parameters:

object Net_DNS_Packet   $packet     A packet object to send to the NS list
string   $packet_data     The data in the packet as returned by the Net_DNS_Packet::data() method

[ Top ]

send_udp_no_sock_lib   [line 863]

object Net_DNS_Packet send_udp_no_sock_lib( string $packet, string $packet_data)

Sends a packet via UDP to the list of name servers.

This function sends a packet to a nameserver. It is called by send_udp if the sockets PHP extension is not compiled into PHP.


Parameters:

string   $packet     A packet object to send to the NS list
string   $packet_data     The data in the packet as returned by the Net_DNS_Packet::data() method

[ Top ]

send_udp_with_sock_lib   [line 981]

object Net_DNS_Packet send_udp_with_sock_lib( string $packet, string $packet_data)

Sends a packet via UDP to the list of name servers.

This function sends a packet to a nameserver. It is called by send_udp if the sockets PHP extension is compiled into PHP.


Parameters:

string   $packet     A packet object to send to the NS list
string   $packet_data     The data in the packet as returned by the Net_DNS_Packet::data() method

[ Top ]

set_nameservers   [line 382]

void set_nameservers( $nameservers)


Parameters:

   $nameservers     

[ Top ]

string   [line 428]

void string( )

Builds a string containing the current state of the resolver

Builds formatted string containing the state of the resolver library suited for display.

  • Access: public

[ Top ]


Documentation generated on Wed, 03 Nov 2010 11:00:08 +0000 by phpDocumentor 1.4.3. PEAR Logo Copyright © PHP Group 2004.