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

Class: Net_DNS_Resolver

Source Location: /qp_plugins/basic_antispam_plugin/Net/DNS/Resolver.php

Class Net_DNS_Resolver

Property Summary
string   $answerfrom   The origin of the packet.
string   $answersize   The size of the answer packet.
string   $confpath   A array of directories to search for the user's resolver config
boolean   $debug   debugging flag
mixed   $defnames   Unknown
mixed   $dnsrch   Unknown
string   $domain   The domain in which the resolver client host resides.
string   $dotfile   The name of the user defined resolv.conf
string   $errorstring   Contains the value of the last error returned by the resolver.
boolean   $igntc   Ignore TC (truncated) bit
array   $nameservers   An array of all nameservers to query
array   $parsedfiles   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.
integer   $port   The UDP port to use for the query (default = 53)
boolean   $recurse   Recursion Desired
string   $resolv_conf   The location of the system resolv.conf file.
integer   $retrans   The number of seconds between retransmission of unaswered queries
integer   $retry   The number of times unanswered requests should be retried
array   $searchlist   The searchlist to apply to unqualified hosts
mixed   $stayopen   Unknown
integer   $tcp_timeout   The number of seconds after which a TCP connection should timeout
boolean   $useEnhancedSockets   use the (currently) experimental PHP socket library
boolean   $usevc   Whether or not to use TCP (Virtual Circuits) instead of UDP

[ Top ]
Method Summary
Net_DNS_Resolver   Net_DNS_Resolver()   Initializes the Resolver Object
object Net_DNS_Packet   axfr()   Performs an AXFR query (zone transfer)
object Net_DNS_RR   axfr_next()   Requests the next RR from a existing transfer started with axfr_start
object Net_DNS_Packet   axfr_old()   Performs an AXFR query (zone transfer) (OLD BUGGY STYLE)
object Net_DNS_Packet   axfr_start()   Sends a packet via TCP to the list of name servers.
void   cname_addr()  
void   make_query_packet()   Unknown
void   nameservers()   Gets or sets the nameservers to be queried.
void   nextid()   Returns the next request Id to be used for the DNS packet header
void   printhex()   Prints packet data as hex code.
mixed   query()   Queries nameservers for an answer
mixed   rawQuery()   Queries nameservers for an answer
void   read_config()   Reads and parses a resolver configuration file
void   read_env()   Examines the environment for resolver config information
void   read_tcp()   Unknown - not ported yet
void   res_init()   Initalizes the resolver library
mixed   search()   Searches nameservers for an answer
object Net_DNS_Packet   send()   Sends a packet to a nameserver
object Net_DNS_Packet   send_tcp()   Sends a packet via TCP to the list of name servers.
object Net_DNS_Packet   send_udp()   Sends a packet via UDP to the list of name servers.
object Net_DNS_Packet   send_udp_no_sock_lib()   Sends a packet via UDP to the list of name servers.
object Net_DNS_Packet   send_udp_with_sock_lib()   Sends a packet via UDP to the list of name servers.
void   set_nameservers()  
void   string()   Builds a string containing the current state of the resolver

[ Top ]
Properties
string   $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.

API Tags:
Access:  public


[ Top ]
string   $answersize [line 147]

The size of the answer packet.

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

API Tags:
Access:  public


[ Top ]
string   $confpath [line 178]

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

API Tags:
See:  Net_DNS_Resolver::$dotfile


[ Top ]
boolean   $debug [line 188]

debugging flag

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

API Tags:
Access:  public


[ Top ]
mixed   $defnames [line 116]

Unknown


[ Top ]
mixed   $dnsrch [line 120]

Unknown


[ Top ]
string   $domain [line 52]

The domain in which the resolver client host resides.

API Tags:
Access:  public


[ Top ]
string   $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

API Tags:
See:  Net_DNS_Resolver::$confpath


[ Top ]
string   $errorstring [line 127]

Contains the value of the last error returned by the resolver.

API Tags:
Access:  public


[ Top ]
boolean   $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).

API Tags:
Access:  public


[ Top ]
array   $nameservers [line 38]

An array of all nameservers to query

API Tags:
Access:  public


[ Top ]
array   $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.

API Tags:
See:  Net_DNS_Resolver::read_config()
Access:  public


[ Top ]
integer   $port [line 45]

The UDP port to use for the query (default = 53)

API Tags:
Access:  public


[ Top ]
boolean   $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.

API Tags:
Access:  public


[ Top ]
string   $resolv_conf = '/etc/resolv.conf' [line 160]

The location of the system resolv.conf file.


[ Top ]
integer   $retrans [line 69]

The number of seconds between retransmission of unaswered queries

API Tags:
Access:  public


[ Top ]
integer   $retry [line 76]

The number of times unanswered requests should be retried

API Tags:
Access:  public


[ Top ]
array   $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.

API Tags:
Access:  public


[ Top ]
mixed   $stayopen [line 90]

Unknown


[ Top ]
integer   $tcp_timeout [line 154]

The number of seconds after which a TCP connection should timeout

API Tags:
Access:  public


[ Top ]
boolean   $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).

API Tags:
Access:  public


[ Top ]
boolean   $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.

API Tags:
Access:  public


[ Top ]
Methods
Constructor Net_DNS_Resolver  [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.

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.

API Tags:
Access:  public


[ Top ]
axfr_next  [line 1320]

  object Net_DNS_RR axfr_next( )

Requests the next RR from a existing transfer started with axfr_start


API Tags:
Return:  Returns a Net_DNS_RR object of the next RR from a zone transfer.
See:  Net_DNS_Resolver::send_tcp()


[ 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!

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

API Tags:
Access:  public


[ 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: 

API Tags:
Return:  Returns an answer packet object
See:  Net_DNS_Resolver::send_tcp()


[ 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.

Parameters:
   $nsa: 

API Tags:
Access:  public


[ 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.

API Tags:
Return:  an object of type Net_DNS_Packet on success, or false on failure.
See:  Net_DNS::typesbyname(), Net_DNS::classesbyname()
Access:  public


[ 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.

API Tags:
Return:  an object of type Net_DNS_Packet, regardless of whether the packet has an answer or not
See:  Net_DNS::typesbyname(), Net_DNS::classesbyname()
Access:  public


[ 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.


API Tags:
See:  Net_DNS_Resolver::$resolv_conf, Net_DNS_Resolver::$dotfile, Net_DNS_Resolver::$confpath, Net_DNS_Resolver::$searchlist, Net_DNS_Resolver::$domain, Net_DNS_Resolver::$nameservers
Access:  public


[ 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.

API Tags:
Return:  an object of type Net_DNS_Packet on success, or false on failure.
See:  Net_DNS::typesbyname(), Net_DNS::classesbyname()
Access:  public


[ 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()

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

API Tags:
Return:  An answer packet object


[ 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

API Tags:
Return:  Returns an answer packet object
See:  Net_DNS_Resolver::send_udp(), Net_DNS_Resolver::send()


[ 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

API Tags:
Return:  Returns an answer packet object
See:  Net_DNS_Resolver::send_tcp(), Net_DNS_Resolver::send(), Net_DNS_Resolver::send_udp(), Net_DNS_Resolver::send_udp_no_sock_lib()


[ 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

API Tags:
Return:  Returns an answer packet object
See:  Net_DNS_Resolver::send_tcp(), Net_DNS_Resolver::send(), Net_DNS_Resolver::send_udp(), Net_DNS_Resolver::send_udp_with_sock_lib()


[ 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

API Tags:
Return:  Returns an answer packet object
See:  Net_DNS_Resolver::send_tcp(), Net_DNS_Resolver::send(), Net_DNS_Resolver::send_udp(), Net_DNS_Resolver::send_udp_no_sock_lib()


[ 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.


API Tags:
Access:  public


[ Top ]