1package Net::DNS::RR::HINFO;
2#
3# $Id: HINFO.pm 639 2007-05-25 12:00:15Z olaf $
4#
5use strict;
6BEGIN {
7    eval { require bytes; }
8}
9use vars qw(@ISA $VERSION);
10use Net::DNS::RR::TXT;
11
12@ISA     = qw(Net::DNS::RR Net::DNS::RR::TXT);
13$VERSION = (qw$LastChangedRevision: 639 $)[1];
14
15sub new {
16	my ($class, $self, $data, $offset) = @_;
17
18	if ($self->{"rdlength"} > 0) {
19		my ($cpu, $os, $len);
20
21		($len) = unpack("\@$offset C", $$data);
22		++$offset;
23		$cpu = substr($$data, $offset, $len);
24		$offset += $len;
25
26		($len) = unpack("\@$offset C", $$data);
27		++$offset;
28		$os = substr($$data, $offset, $len);
29		$offset += $len;
30
31		$self->{"cpu"} = $cpu;
32		$self->{"os"}  = $os;
33	}
34
35	return bless $self, $class;
36}
37
38sub new_from_string {
39	my ( $class, $self, $rdata_string ) = @_ ;
40
41	bless $self, $class;
42
43	$self->_build_char_str_list($rdata_string);
44	my @elements= $self->char_str_list();
45	if (@elements==2){
46
47
48		$self->{"cpu"} = $elements[0];
49		$self->{"os"}  = $elements[1];
50	}else{
51		return;
52	}
53
54
55	return bless $self, $class;
56}
57
58sub rdatastr {
59	my $self = shift;
60
61	return $self->{"cpu"}
62	  ? qq("$self->{cpu}" "$self->{os}")
63	    : '';
64}
65
66sub rr_rdata {
67	my $self = shift;
68	my $rdata = "";
69
70	if (exists $self->{"cpu"}) {
71		$rdata .= pack("C", length $self->{"cpu"});
72		$rdata .= $self->{"cpu"};
73
74		$rdata .= pack("C", length $self->{"os"});
75		$rdata .= $self->{"os"};
76	}
77
78	return $rdata;
79}
80
811;
82__END__
83
84=head1 NAME
85
86Net::DNS::RR::HINFO - DNS HINFO resource record
87
88=head1 SYNOPSIS
89
90C<use Net::DNS::RR>;
91
92=head1 DESCRIPTION
93
94Class for DNS Host Information (HINFO) resource records.
95
96=head1 METHODS
97
98=head2 cpu
99
100    print "cpu = ", $rr->cpu, "\n";
101
102Returns the CPU type for this RR.
103
104=head2 os
105
106    print "os = ", $rr->os, "\n";
107
108Returns the operating system type for this RR.
109
110=head1 COPYRIGHT
111
112Copyright (c) 1997-2002 Michael Fuhr.
113Portions Copyright (c) 2002-2004 Chris Reinhardt
114Portions Copyright (c) 2007 NLnet Labs
115
116All rights reserved.  This program is free software; you may redistribute
117it and/or modify it under the same terms as Perl itself.
118
119=head1 SEE ALSO
120
121L<perl(1)>, L<Net::DNS>, L<Net::DNS::Resolver>, L<Net::DNS::Packet>,
122L<Net::DNS::Header>, L<Net::DNS::Question>, L<Net::DNS::RR>,
123RFC 1035 Section 3.3.2
124
125=cut
126