Class: Net::DNS::RR::PTR
- Inherits:
-
Net::DNS::RR
- Object
- Net::DNS::RR
- Net::DNS::RR::PTR
- Defined in:
- lib/Net/DNS/RR/PTR.rb
Overview
NAME
Net::DNS::RR::PTR - DNS PTR resource record
DESCRIPTION
Class for DNS Pointer (PTR) 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 1035 Section 3.3.12
Constant Summary
Constants inherited from Net::DNS::RR
Instance Attribute Summary collapse
-
#ptrdname ⇒ Object
Returns the domain name associated with this record.
Attributes inherited from Net::DNS::RR
#name, #rdata, #rdlength, #rrclass, #ttl, #type
Instance Method Summary collapse
- #_canonicalRdata(packet, offset) ⇒ Object
- #new_from_data(data, offset) ⇒ Object
- #new_from_hash(values) ⇒ Object
- #new_from_string(s) ⇒ 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
#ptrdname ⇒ Object
Returns the domain name associated with this record.
print "ptrdname = ", rr.ptrdname, "\n"
46 47 48 |
# File 'lib/Net/DNS/RR/PTR.rb', line 46 def ptrdname @ptrdname end |
Instance Method Details
#_canonicalRdata(packet, offset) ⇒ Object
81 82 83 84 85 86 87 88 89 |
# File 'lib/Net/DNS/RR/PTR.rb', line 81 def _canonicalRdata(packet, offset) rdata = ""; if (defined?@ptrdname) rdata += _name2wire(@ptrdname); end return rdata; end |
#new_from_data(data, offset) ⇒ Object
47 48 49 50 51 |
# File 'lib/Net/DNS/RR/PTR.rb', line 47 def new_from_data(data, offset) if (@rdlength > 0) @ptrdname = Net::DNS::Packet::(data, offset)[0]; end end |
#new_from_hash(values) ⇒ Object
60 61 62 63 64 |
# File 'lib/Net/DNS/RR/PTR.rb', line 60 def new_from_hash(values) if (values.has_key?:ptrdname) @ptrdname = values[:ptrdname] end end |
#new_from_string(s) ⇒ Object
53 54 55 56 57 58 |
# File 'lib/Net/DNS/RR/PTR.rb', line 53 def new_from_string(s) if (s != nil) string = s.gsub(/\.+$/, ""); @ptrdname = string; end end |
#rdatastr ⇒ Object
66 67 68 69 |
# File 'lib/Net/DNS/RR/PTR.rb', line 66 def rdatastr return @ptrdname ? "#{@ptrdname}." : ''; end |
#rr_rdata(packet, offset) ⇒ Object
71 72 73 74 75 76 77 78 79 |
# File 'lib/Net/DNS/RR/PTR.rb', line 71 def rr_rdata(packet, offset) rdata = ""; if (defined?@ptrdname) rdata += packet.dn_comp(@ptrdname, offset); end return rdata; end |