class Net::DNS::RR::PTR
Pointer Record (PTR)¶ ↑
Class for DNS Pointer (PTR) resource records.
Pointer records are the opposite of A and AAAA RRs and are used in Reverse Map zone files to map an IP address (IPv4 or IPv6) to a host name.
Public Instance Methods
ptrdname()
click to toggle source
Gets the PTR value.
Returns a String.
# File lib/net/dns/rr/ptr.rb, line 19 def ptrdname @ptrdname.to_s end
Also aliased as: ptr
value()
click to toggle source
Gets the standardized value for this record, represented by the value of
ptrdname
.
Returns a String.
# File lib/net/dns/rr/ptr.rb, line 29 def value ptrdname.to_s end
Private Instance Methods
build_pack()
click to toggle source
# File lib/net/dns/rr/ptr.rb, line 36 def build_pack @ptrdname_pack = pack_name(@ptrdname) @rdlength = @ptrdname_pack.size end
check_name(input)
click to toggle source
# File lib/net/dns/rr/ptr.rb, line 73 def check_name(input) IPAddr.new(str) rescue raise ArgumentError, "Invalid PTR Section `#{input}'" end
get_data()
click to toggle source
# File lib/net/dns/rr/ptr.rb, line 41 def get_data @ptrdname_pack end
get_inspect()
click to toggle source
# File lib/net/dns/rr/ptr.rb, line 68 def get_inspect value end
set_type()
click to toggle source
# File lib/net/dns/rr/ptr.rb, line 64 def set_type @type = Net::DNS::RR::Types.new("PTR") end
subclass_new_from_binary(data, offset)
click to toggle source
# File lib/net/dns/rr/ptr.rb, line 57 def subclass_new_from_binary(data, offset) @ptrdname, offset = dn_expand(data, offset) offset end
subclass_new_from_hash(args)
click to toggle source
# File lib/net/dns/rr/ptr.rb, line 45 def subclass_new_from_hash(args) if args.has_key?(:ptrdname) or args.has_key?(:ptr) @ptrdname = args[:ptrdname] else raise ArgumentError, ":ptrdname or :ptr field is mandatory" end end
subclass_new_from_string(str)
click to toggle source
# File lib/net/dns/rr/ptr.rb, line 53 def subclass_new_from_string(str) @ptrdname = check_name(str) end