class Net::DNS::RR::TXT

Attributes

txt[R]

Private Instance Methods

build_pack() click to toggle source
# File lib/net/dns/rr/txt.rb, line 13
def build_pack
  str = ""
  @txt.split(" ").each do |txt|
    str += [txt.length,txt].pack("C a*")
  end
  @txt_pack = str
  @rdlength = @txt_pack.size
end
get_data() click to toggle source
# File lib/net/dns/rr/txt.rb, line 22
def get_data
  @txt_pack
end
set_type() click to toggle source
# File lib/net/dns/rr/txt.rb, line 53
def set_type
  @type = Net::DNS::RR::Types.new("TXT")
end
subclass_new_from_binary(data,offset) click to toggle source
# File lib/net/dns/rr/txt.rb, line 38
def subclass_new_from_binary(data,offset)
  off_end = offset + @rdlength
  @txt = ""
  while offset < off_end
    len = data.unpack("@#{offset} C")[0]
    offset += 1
    str = data[offset..offset+len-1]
    offset += len
    @txt << str << " "
  end
  return offset
end
subclass_new_from_hash(args) click to toggle source
# File lib/net/dns/rr/txt.rb, line 26
def subclass_new_from_hash(args)
  if args.has_key? :txt
    @txt = args[:txt].strip
  else
    raise ArgumentError, ":txt field is mandatory but missing"
  end
end
subclass_new_from_string(str) click to toggle source
# File lib/net/dns/rr/txt.rb, line 34
def subclass_new_from_string(str)
  @txt = str.strip
end