Sha256: 70b2fba8a8fa30844681733d1f6e41ba033e91a828d3914576b644226093f2bb

Contents?: true

Size: 1.45 KB

Versions: 13

Compression:

Stored size: 1.45 KB

Contents

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

module Net
  module DNS
    
    class RR
      
      #------------------------------------------------------------
      # RR type NS
      #------------------------------------------------------------
      class NS < RR
        attr_reader :nsdname

        private
        
        def check_name(name)
          unless name =~ /(\w\.?)+\s*$/ and name =~ /[a-zA-Z]/
            raise RRArgumentError, "NS Domain Name not valid: #{name}"
          end
          name
        end

        def build_pack
          @nsdname_pack = pack_name(@nsdname)
          @rdlength = @nsdname_pack.size
        end

        def set_type
          @type = Net::DNS::RR::Types.new("NS")
        end

        def get_data
          @nsdname_pack
        end

        def get_inspect
          "#@nsdname"
        end
          
        def subclass_new_from_hash(args)
          if args.has_key? :nsdname
            @nsdname = check_name args[:nsdname]
          else
            raise RRArgumentError, ":nsdname field is mandatory but missing"
          end
        end

        def subclass_new_from_string(str)
          @nsdname = check_name(str)
        end

        def subclass_new_from_binary(data,offset)
          @nsdname,offset = dn_expand(data,offset)
          return offset
        end
        
      end # class NS
      
    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/ns.rb
bluemonk-net-dns-0.5.1 lib/net/dns/rr/ns.rb
bluemonk-net-dns-0.5.2 lib/net/dns/rr/ns.rb
bluemonk-net-dns-0.5.3 lib/net/dns/rr/ns.rb
net-dns-0.5.3 lib/net/dns/rr/ns.rb
net-dns-0.5.1 lib/net/dns/rr/ns.rb
net-dns-0.2.5 lib/net/dns/rr/ns.rb
net-dns-0.3 lib/net/dns/rr/ns.rb
net-dns-0.2 lib/net/dns/rr/ns.rb
net-dns-0.1 lib/net/dns/rr/ns.rb
net-dns-0.5.2 lib/net/dns/rr/ns.rb
net-dns-0.4 lib/net/dns/rr/ns.rb
net-dns-0.5.0 lib/net/dns/rr/ns.rb