The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Net::DNS::Method - Base class for Net::DNS::Server methods

SYNOPSIS

  use Net::DNS::Method;
  package Net::DNS::Method::Sample;

  our @ISA = qw( ... Net::DNS::Method ... );

  sub new { ... }
  sub A { ... }

DESCRIPTION

This is a base class to help in the creation of method classes for use within the Net::DNS::Server package. This class provides specific methods to do nothing to particular DNS questions. In general, this class consists of a number of methods that are called like in the following example.

->A($q, $ans)

This would be invoked by Net::DNS::Server upon the arrival of a query of type 'A'.

The method can check the question, passed as a Net::DNS::Qustion object in $q. Usually, the method will then modify the Net::DNS::Packet object in $ans to provide an answer.

Net::DNS::Server will call sequentially all of the registered Net::DNS::Method::* objects for a given question. After this sequence of calls ends, the response can be sent depending on what the methods have requsted.

The return value of the method is given as an OR of the following values.

NS_IGNORE

Requests that the current question be ignored.

NS_STOP

Requests that no further objects be invoked.

NS_OK

Indicates that the current method matched the question and presumably, altered the answer. Control is passed to the next method in sequence. After the last method is invoked, the answer will be sent to the client unless NS_IGNORE is returned by this or a later method.

NS_FAIL

Indicates that the current method did not match the packet.

NS_SPLIT

Indicates that the response must be splitted in individual answers and sent accordingly. This is used for AXFR requests.

There is one such method for each type of RR supported by Net::DNS. Additionally, the ->ANY method is provided, which calls all the defined RRs in succession.

EXPORT

NS_* constants used for the return values.

HISTORY

$Id: Method.pm,v 1.2 2002/10/23 04:43:58 lem Exp $

1.00 Wed Oct 11 10:43:05 2000
  • original version; created by h2xs 1.20 with options -Xfn Net::DNS::Method -v 1.00

1.10 Fri Oct 12 10:49:07 2000
  • Added ->ANY to do the expected thing (ie, evoke all the available data). Implementors might want to override the supplied definition to be a bit more efficient.

1.20 Tue Nov 1 16:35:00 2000
  • Modified ->AXFR so that the same thing that ->AXFR happens by default.

1.21 Mon Nov 27 16:34:00 2000
  • Added NS_SPLIT.

  • ->AXFR does not work reliably, so 1.20 was undone.

  • ->ANY fixes the rcode depending on success/failure of the modules.

2.00 Tue Oct 22 13:36:00 2002
  • Started work to prepare a public distribution

AUTHOR

Luis E. Munoz <luismunoz@cpan.org>

SEE ALSO

perl(1), Net::DNS(3), Net::DNS::Server(3), Net::DNS::Question(3), Net::DNS::Packet(3).