Sha256: 8d9b452724509287474d3e1a677372780b93958bc1a7528bc692ee543c3c676c

Contents?: true

Size: 1.5 KB

Versions: 3

Compression:

Stored size: 1.5 KB

Contents

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

module Net
  module DNS
    class RR
      
      #------------------------------------------------------------
      # RR type PTR
      #------------------------------------------------------------
      class PTR < RR

        # Getter for PTR resource
        def ptr
          @ptrdname.to_s
        end
        alias_method :ptrdname, :ptr
        
        private
        
        def check_ptr(str)
          IPAddr.new str
        rescue
          raise RRArgumentError, "PTR section not valid"
        end
        
        def build_pack
          @ptrdname_pack = pack_name(@ptrdname)
          @rdlength = @ptrdname_pack.size
        end

        def set_type
          @type = Net::DNS::RR::RRTypes.new("PTR")
        end

        def get_data
          @ptrdname_pack
        end

        def get_inspect
          "#@ptrdname"
        end

        def subclass_new_from_hash(args)
          if args.has_key? :ptrdname or args.has_key? :ptr
            @ptrdname = args[0][:ptrdname]
          else
            raise RRArgumentError, ":ptrdname or :ptr field is mandatory but missing"
          end
        end

        def subclass_new_from_string(str)
          @ptrdname = check_ptr(str)
        end

        def subclass_new_from_binary(data,offset)
          @ptrdname,offset = dn_expand(data,offset)
          return offset
        end

      end # class PTR
      
    end # class RR
  end # module DNS
end # module Net

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
net-dns-0.2 lib/net/dns/rr/ptr.rb
net-dns-0.2.5 lib/net/dns/rr/ptr.rb~
net-dns-0.1 lib/net/dns/rr/ptr.rb