Sha256: cf5472850484de67ed2524fdfb9618645c43983685d734509cef68fcf6b81e0e

Contents?: true

Size: 1.48 KB

Versions: 13

Compression:

Stored size: 1.48 KB

Contents

##
#
# Net::DNS::RR::TXT
#
#       $Id: TXT.rb,v 1.4 2006/07/28 07:33:36 bluemonk Exp $
#
##


module Net
  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 set_type
          @type = Net::DNS::RR::Types.new("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 RRArgumentError, ":txt field is mandatory but missing"
          end
        end
        
        def subclass_new_from_string(str)
          @txt = str.strip
        end
        
        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 

      end # class TXT
      
    end # class RR
  end # module DNS
end # module Net




Version data entries

13 entries across 13 versions & 2 rubygems

Version Path
bluemonk-net-dns-0.5.0 lib/net/dns/rr/txt.rb
bluemonk-net-dns-0.5.1 lib/net/dns/rr/txt.rb
bluemonk-net-dns-0.5.2 lib/net/dns/rr/txt.rb
bluemonk-net-dns-0.5.3 lib/net/dns/rr/txt.rb
net-dns-0.5.3 lib/net/dns/rr/txt.rb
net-dns-0.1 lib/net/dns/rr/txt.rb
net-dns-0.4 lib/net/dns/rr/txt.rb
net-dns-0.5.0 lib/net/dns/rr/txt.rb
net-dns-0.2.5 lib/net/dns/rr/txt.rb
net-dns-0.2 lib/net/dns/rr/txt.rb
net-dns-0.5.1 lib/net/dns/rr/txt.rb
net-dns-0.5.2 lib/net/dns/rr/txt.rb
net-dns-0.3 lib/net/dns/rr/txt.rb