home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2004 December / PCpro_2004_12.ISO / files / webserver / xampp / xampp-perl-addon-1.4.9-installer.exe / MINFO.pm < prev    next >
Encoding:
Perl POD Document  |  2004-01-04  |  2.3 KB  |  118 lines

  1. package Net::DNS::RR::MINFO;
  2. #
  3. # $Id: MINFO.pm,v 2.101 2004/01/04 04:31:10 ctriv Exp $
  4. #
  5. use strict;
  6. use vars qw(@ISA $VERSION);
  7.  
  8. use Net::DNS::Packet;
  9.  
  10. @ISA     = qw(Net::DNS::RR);
  11. $VERSION = (qw$Revision: 2.101 $)[1];
  12.  
  13. sub new {
  14.     my ($class, $self, $data, $offset) = @_;
  15.  
  16.     if ($self->{"rdlength"} > 0) {
  17.         ($self->{"rmailbx"}, $offset) = Net::DNS::Packet::dn_expand($data, $offset);
  18.         ($self->{"emailbx"}, $offset) = Net::DNS::Packet::dn_expand($data, $offset);
  19.     }
  20.  
  21.     return bless $self, $class;
  22. }
  23.  
  24. sub new_from_string {
  25.     my ($class, $self, $string) = @_;
  26.  
  27.     if ($string && ($string =~ /^(\S+)\s+(\S+)$/)) {
  28.         $self->{"rmailbx"} = $1;
  29.         $self->{"emailbx"} = $2;
  30.         $self->{"rmailbx"} =~ s/\.+$//;
  31.         $self->{"emailbx"} =~ s/\.+$//;
  32.     }
  33.  
  34.     return bless $self, $class;
  35. }
  36.  
  37. sub rdatastr {
  38.     my $self = shift;
  39.  
  40.     return $self->{"rmailbx"}
  41.            ? "$self->{rmailbx}. $self->{emailbx}."
  42.            : '';
  43. }
  44.  
  45. sub rr_rdata {
  46.     my ($self, $packet, $offset) = @_;
  47.     my $rdata = "";
  48.  
  49.     if (exists $self->{"rmailbx"}) {
  50.         $rdata .= $packet->dn_comp($self->{"rmailbx"}, $offset);
  51.  
  52.         $rdata .= $packet->dn_comp($self->{"emailbx"},
  53.                        $offset + length $rdata);
  54.     }
  55.  
  56.     return $rdata;
  57. }
  58.  
  59.  
  60. sub _canonicalRdata {
  61.     my ($self, $packet, $offset) = @_;
  62.     my $rdata = "";
  63.  
  64.     if (exists $self->{"rmailbx"}) {
  65.         $rdata .= $self->_name2wire($self->{"rmailbx"});
  66.         $rdata .=  $self->_name2wire($self->{"emailbx"});
  67.     }
  68.  
  69.     return $rdata;
  70. }
  71.  
  72.  
  73. 1;
  74. __END__
  75.  
  76. =head1 NAME
  77.  
  78. Net::DNS::RR::MINFO - DNS MINFO resource record
  79.  
  80. =head1 SYNOPSIS
  81.  
  82. C<use Net::DNS::RR>;
  83.  
  84. =head1 DESCRIPTION
  85.  
  86. Class for DNS Mailbox Information (MINFO) resource records.
  87.  
  88. =head1 METHODS
  89.  
  90. =head2 rmailbx
  91.  
  92.     print "rmailbx = ", $rr->rmailbx, "\n";
  93.  
  94. Returns the RR's responsible mailbox field.  See RFC 1035.
  95.  
  96. =head2 emailbx
  97.  
  98.     print "emailbx = ", $rr->emailbx, "\n";
  99.  
  100. Returns the RR's error mailbox field.
  101.  
  102. =head1 COPYRIGHT
  103.  
  104. Copyright (c) 1997-2002 Michael Fuhr. 
  105.  
  106. Portions Copyright (c) 2002-2003 Chris Reinhardt.
  107.  
  108. All rights reserved.  This program is free software; you may redistribute
  109. it and/or modify it under the same terms as Perl itself.
  110.  
  111. =head1 SEE ALSO
  112.  
  113. L<perl(1)>, L<Net::DNS>, L<Net::DNS::Resolver>, L<Net::DNS::Packet>,
  114. L<Net::DNS::Header>, L<Net::DNS::Question>, L<Net::DNS::RR>,
  115. RFC 1035 Section 3.3.7
  116.  
  117. =cut
  118.