Class: Net::DNS::RR::AFSDB
- Inherits:
-
Net::DNS::RR
- Object
- Net::DNS::RR
- Net::DNS::RR::AFSDB
- Defined in:
- lib/Net/DNS/RR/AFSDB.rb
Overview
NAME
Net::DNS::RR::AFSDB - DNS AFSDB resource record
DESCRIPTION
Class for DNS AFS Data Base (AFSDB) resource records.
COPYRIGHT
Copyright © 1997-2002 Michael Fuhr.
Portions Copyright © 2002-2004 Chris Reinhardt.
All rights reserved. This program is free software; you may redistribute it and/or modify it under the same terms as Perl itself.
SEE ALSO
Net::DNS, Net::DNS::Resolver, Net::DNS::Packet, Net::DNS::Header, Net::DNS::Question, Net::DNS::RR, RFC 1183 Section 1
Constant Summary
Constants inherited from Net::DNS::RR
Instance Attribute Summary collapse
-
#hostname ⇒ Object
Returns the RR’s hostname field.
-
#subtype ⇒ Object
Returns the RR’s subtype field.
Attributes inherited from Net::DNS::RR
#name, #rdata, #rdlength, #rrclass, #ttl, #type
Instance Method Summary collapse
- #_canonicalRdata ⇒ Object
- #new_from_data(data, offset) ⇒ Object
- #new_from_hash(values) ⇒ Object
- #new_from_string(string) ⇒ Object
- #rdatastr ⇒ Object
- #rr_rdata(packet, offset) ⇒ Object
Methods inherited from Net::DNS::RR
#_canonicaldata, _get_subclass, _name2wire, #_name2wire, build_regex, create, #create_rrsort_func, #data, #get_rrsort_func, #init, #init_rrsort_func, #inspect, new_from_data, new_from_hash, new_from_string, #set_rrsort_func
Instance Attribute Details
#hostname ⇒ Object
Returns the RR’s hostname field. See RFC 1183.
print "hostname = ", rr.hostname, "\n"
53 54 55 |
# File 'lib/Net/DNS/RR/AFSDB.rb', line 53 def hostname @hostname end |
#subtype ⇒ Object
Returns the RR’s subtype field. Use of the subtype field is documented in RFC 1183.
print "subtype = ", rr.subtype, "\n"
47 48 49 |
# File 'lib/Net/DNS/RR/AFSDB.rb', line 47 def subtype @subtype end |
Instance Method Details
#_canonicalRdata ⇒ Object
102 103 104 105 106 107 108 109 110 |
# File 'lib/Net/DNS/RR/AFSDB.rb', line 102 def _canonicalRdata # rdata contains a compressed domainname... we should not have that. rdata=""; if (defined?@subtype) rdata += @subtype.pack("n"); rdata += _name2wire(@hostname); end return rdata; end |
#new_from_data(data, offset) ⇒ Object
54 55 56 57 58 59 60 61 62 |
# File 'lib/Net/DNS/RR/AFSDB.rb', line 54 def new_from_data (data, offset) if (@rdlength > 0) subtype = data.unpack("\@#{offset} n")[0]; offset += Net::DNS::INT16SZ; hostname = Net::DNS::Packet::(data, offset)[0]; @subtype = subtype; @hostname = hostname; end end |
#new_from_hash(values) ⇒ Object
72 73 74 75 76 77 78 79 |
# File 'lib/Net/DNS/RR/AFSDB.rb', line 72 def new_from_hash(values) if (values.has_key?(:subtype)) @subtype=values[:subtype] end if (values.has_key?(:hostname)) @hostname=values[:hostname] end end |
#new_from_string(string) ⇒ Object
64 65 66 67 68 69 70 |
# File 'lib/Net/DNS/RR/AFSDB.rb', line 64 def new_from_string(string) if (string!=nil && (string =~ /^(\d+)\s+(\S+)$/o)) @subtype = $1; @hostname = $2; @hostname.sub!(/\.+$/o,""); end end |
#rdatastr ⇒ Object
81 82 83 84 85 86 87 |
# File 'lib/Net/DNS/RR/AFSDB.rb', line 81 def rdatastr if defined?@subtype return "#{@subtype} #{@hostname}." else return ''; end end |
#rr_rdata(packet, offset) ⇒ Object
89 90 91 92 93 94 95 96 97 98 |
# File 'lib/Net/DNS/RR/AFSDB.rb', line 89 def rr_rdata (packet, offset) rdata = ""; if (defined?@subtype) rdata += [@subtype].pack("n"); rdata += packet.dn_comp(@hostname, offset + rdata.length); end return rdata; end |