Class: Net::DNS::RR::NS

Inherits:
Net::DNS::RR show all
Defined in:
lib/Net/DNS/RR/NS.rb

Overview

NAME

Net::DNS::RR::NS - DNS NS resource record

DESCRIPTION

Class for DNS Name Server (NS) resource records.

COPYRIGHT

Copyright © 1997-2002 Michael Fuhr.

Portions Copyright © 2002-2004 Chris Reinhardt.

Portions Copyright © 2005 O.M, Kolkman, RIPE NCC.

Portions Copyright © 2005-2006 O.M, Kolkman, NLnet Labs.

Ruby version Copyright © 2006 AlexD (Nominet UK)

All rights reserved. This program is free software; you may redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO

Net::DNS, Net::DNS::Resolver, Net::DNS::Packet, Net::DNS::Header, Net::DNS::Question, Net::DNS::RR, RFC 1035 Section 3.3.11

Constant Summary

Constants inherited from Net::DNS::RR

RRS

Instance Attribute Summary collapse

Attributes inherited from Net::DNS::RR

#name, #rdata, #rdlength, #rrclass, #ttl, #type

Instance Method Summary collapse

Methods inherited from Net::DNS::RR

#_canonicaldata, _get_subclass, _name2wire, #_name2wire, build_regex, create, #create_rrsort_func, #data, #get_rrsort_func, #init, #init_rrsort_func, #inspect, new_from_data, new_from_hash, new_from_string, #set_rrsort_func

Instance Attribute Details

#nsdnameObject

Returns the name of the nameserver.

print "nsdname = ", rr.nsdname, "\n"


52
53
54
# File 'lib/Net/DNS/RR/NS.rb', line 52

def nsdname
  @nsdname
end

Instance Method Details

#_canonicalRdataObject



92
93
94
95
96
# File 'lib/Net/DNS/RR/NS.rb', line 92

def _canonicalRdata
  # rdata contains a compressed domainname... we should not have that.
  rdata=_name2wire(@nsdname);
  return rdata;
end

#new_from_data(data, offset) ⇒ Object



53
54
55
56
57
# File 'lib/Net/DNS/RR/NS.rb', line 53

def new_from_data(data, offset)
  if (@rdlength > 0)
    @nsdname = Net::DNS::Packet.dn_expand(data, offset)[0];
  end
end

#new_from_hash(values) ⇒ Object



66
67
68
69
70
# File 'lib/Net/DNS/RR/NS.rb', line 66

def new_from_hash(values)
  if values.has_key?(:nsdname)
    @nsdname = values[:nsdname]
  end
end

#new_from_string(string) ⇒ Object



59
60
61
62
63
64
# File 'lib/Net/DNS/RR/NS.rb', line 59

def new_from_string(string)
  if (string)
    string.gsub!(/\.+$/, "");
    @nsdname = string;
  end
end

#rdatastrObject



72
73
74
75
76
77
78
# File 'lib/Net/DNS/RR/NS.rb', line 72

def rdatastr
  if @nsdname
    return  "#{@nsdname}." 
  else
    return  '';
  end
end

#rr_rdata(packet, offset) ⇒ Object



80
81
82
83
84
85
86
87
88
# File 'lib/Net/DNS/RR/NS.rb', line 80

def rr_rdata(packet, offset)
  rdata = "";
  
  if (defined?@nsdname)
    rdata += packet.dn_comp(@nsdname, offset);
  end
  
  return rdata;
end