Sha256: 2341b4897f8cd355fe0dafdb9fa3ff59fc41529655b9419c8b7b724b57f9d671
Contents?: true
Size: 1.59 KB
Versions: 5
Compression:
Stored size: 1.59 KB
Contents
module Net # :nodoc: module DNS class RR #------------------------------------------------------------ # RR type TXT #------------------------------------------------------------ class TXT < RR attr_reader :txt private 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 def get_inspect "\"#{@txt}\"" end def get_data @txt_pack end 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 def subclass_new_from_string(str) @txt = str.strip if @txt[0] == '"' and @txt[-1] == '"' @txt = @txt[1, @txt.length-2] else raise ArgumentError, "TXT RR data must be enclosed in \"quotes\"" end end def subclass_new_from_binary(data,offset) off_end = offset + @rdlength rs = [] while offset < off_end len = data.unpack("@#{offset} C")[0] offset += 1 str = data[offset..offset+len-1] offset += len rs << str end @txt = rs.join(" ") return offset end private def set_type @type = Net::DNS::RR::Types.new("TXT") end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
net-dns2-0.8.7 | lib/net/dns/rr/txt.rb |
net-dns2-0.8.6 | lib/net/dns/rr/txt.rb |
net-dns2-0.8.5 | lib/net/dns/rr/txt.rb |
net-dns2-0.8.4 | lib/net/dns/rr/txt.rb |
net-dns2-0.8.3 | lib/net/dns/rr/txt.rb |