Net::DNS::ToolKit::Question - Resource Handler


Net-DNS-ToolKit documentation Contained in the Net-DNS-ToolKit distribution.

Index


Code Index:

NAME

Top

Net::DNS::ToolKit::Question - Resource Handler

SYNOPSIS

Top

  DO NOT use Net::DNS::ToolKit::Question
  DO NOT require Net::DNS::ToolKit::Question

  Net::DNS::ToolKit::Question is autoloaded by
  class Net::DNS::ToolKit::RR and its methods
  are instantiated in a 'special' manner.

DESCRIPTION

Top

* ($newoff,$name,$type,$class) = $get->Question(\$buffer,$offset);

Get question from $buffer. Returns the expanded name, type and class.

  input:	pointer to buffer,
		offset into buffer
  returns:	new offset,
		expanded name,
		type,
		class

* ($newoff,@dnptrs) = $put->Question(\$buffer,$offset, $name,$type,$class,\@dnptrs);

Append a question to the $buffer. Returns a new pointer array for compressed names and the offset to the next RR.

NOTE: it is up to the user to update the question count. See: put_qdcount

Since the question usually is the first record to be appended to the buffer, @dnptrs may be ommitted. See the details at dn_comp.

Usage: ($newoff,@dnptrs)=$put->Question(\$buffer,$offset, $name,$type,$class);

  input:	pointer to buffer,
		offset into buffer,
		domain name,
		question type,
		question class,
		pointer to array of
		  previously compressed names,
  returns:	offset to next record,
		updated array of offsets to
		  previous compressed names
=cut




* ($name,$typeTXT,$classTXT) = $parse->Question($name,$type,$class);

Convert non-printable and numeric data into ascii text.

  input:	domain name,
		question type (numeric)
		question class (numeric)
  returns:	domain name,
		type TEXT,
		class TEXT

DEPENDENCIES

Top

	Net::DNS::ToolKit

EXPORT

Top

	none

AUTHOR

Top

Michael Robinton <michael@bizsystems.com>

COPYRIGHT

Top

See also:

Top

Net::DNS::ToolKit(3)


Net-DNS-ToolKit documentation Contained in the Net-DNS-ToolKit distribution.
package Net::DNS::ToolKit::Question;

#use 5.006;
use strict;
#use diagnostics;
#use warnings;

use Net::DNS::ToolKit qw(
	get16
	put16
	dn_comp
	dn_expand
);
use Net::DNS::Codes qw(TypeTxt ClassTxt);

use vars qw($VERSION);

$VERSION = do { my @r = (q$Revision: 0.03 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r };

sub DESTROY {}

sub get {
  my($self,$bp,$off) = @_;
  ($off, my $name) = dn_expand($bp,$off);
  (my $type,$off) = get16($bp,$off);
  (my $class,$off) = get16($bp,$off);
  return ($off,$name,$type,$class);
}

sub put {
  my($self,$bp,$off,$name,$type,$class,$dp) = @_;
  ($off, my @dnptrs)=dn_comp($bp,$off,\$name,$dp);
  $off = put16($bp,$off,$type);
  if (! $class && exists $self->{class}) {
    $class = $self->{class};
  }
  $off = put16($bp,$off,$class);
  return $off unless wantarray;
  return($off,@dnptrs);
}

sub parse {
  my($self,$name,$type,$class) = @_;
  return ($name.'.',TypeTxt->{$type},ClassTxt->{$class});
}

1;