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

ptr()
Alias for: ptrdname
ptrdname() click to toggle source

Gets the PTR value.

Returns a String.

# File lib/net/dns/rr/ptr.rb, line 17
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 27
def value
  ptrdname.to_s
end

Private Instance Methods

build_pack() click to toggle source
# File lib/net/dns/rr/ptr.rb, line 33
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 69
def check_name(input)
  IPAddr.new(str)
rescue StandardError
  raise ArgumentError, "Invalid PTR Section `#{input}'"
end
get_data() click to toggle source
# File lib/net/dns/rr/ptr.rb, line 38
def get_data
  @ptrdname_pack
end
get_inspect() click to toggle source
# File lib/net/dns/rr/ptr.rb, line 65
def get_inspect
  value
end
set_type() click to toggle source
# File lib/net/dns/rr/ptr.rb, line 61
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 54
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 42
def subclass_new_from_hash(args)
  if args.key?(:ptrdname) || args.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 50
def subclass_new_from_string(str)
  @ptrdname = check_name(str)
end