1package Net::DNS::RR::DNAME;
2#
3# $Id: DNAME.pm 388 2005-06-22 10:06:05Z olaf $
4#
5use strict;
6BEGIN {
7    eval { require bytes; }
8}
9use vars qw(@ISA $VERSION);
10
11@ISA     = qw(Net::DNS::RR);
12$VERSION = (qw$LastChangedRevision: 388 $)[1];
13
14sub new {
15	my ($class, $self, $data, $offset) = @_;
16
17	if ($self->{"rdlength"} > 0) {
18		($self->{"dname"}) = Net::DNS::Packet::dn_expand($data, $offset);
19	}
20
21	return bless $self, $class;
22}
23
24sub new_from_string {
25	my ($class, $self, $string) = @_;
26
27	if ($string) {
28		$string =~ s/\.+$//;
29		$self->{"dname"} = $string;
30	}
31
32	return bless $self, $class;
33}
34
35sub rdatastr {
36	my $self = shift;
37
38	return $self->{"dname"} ? "$self->{dname}." : '';
39}
40
41sub rr_rdata {
42	my ($self, $packet, $offset) = @_;
43	my $rdata = "";
44
45	if (exists $self->{"dname"}) {
46		$rdata = $packet->dn_comp($self->{"dname"}, $offset);
47	}
48
49	return $rdata;
50}
51
521;
53__END__
54
55=head1 NAME
56
57Net::DNS::RR::DNAME - DNS DNAME resource record
58
59=head1 SYNOPSIS
60
61C<use Net::DNS::RR>;
62
63=head1 DESCRIPTION
64
65Class for DNS Non-Terminal Name Redirection (DNAME) resource records.
66
67=head1 METHODS
68
69=head2 dname
70
71    print "dname = ", $rr->dname, "\n";
72
73Returns the DNAME target.
74
75=head1 COPYRIGHT
76
77Copyright (c) 1997-2002 Michael Fuhr.
78
79Portions Copyright (c) 2002-2004 Chris Reinhardt.
80
81All rights reserved.  This program is free software; you may redistribute
82it and/or modify it under the same terms as Perl itself.
83
84=head1 SEE ALSO
85
86L<perl(1)>, L<Net::DNS>, L<Net::DNS::Resolver>, L<Net::DNS::Packet>,
87L<Net::DNS::Header>, L<Net::DNS::Question>, L<Net::DNS::RR>,
88RFC 2672
89
90=cut
91