Class: Net::DNS::RR::X25

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

Overview

NAME

Net::DNS::RR::X25 - DNS X25 resource record

DESCRIPTION

Class for DNS X25 resource records.

COPYRIGHT

Copyright © 1997-2002 Michael Fuhr.

Portions Copyright © 2002-2004 Chris Reinhardt.

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 1183 Section 3.1

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

#_canonicalRdata, #_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

#psdnObject

Returns the PSDN address.

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


46
47
48
# File 'lib/Net/DNS/RR/X25.rb', line 46

def psdn
  @psdn
end

Instance Method Details

#new_from_data(data, offset) ⇒ Object



47
48
49
50
51
52
53
54
# File 'lib/Net/DNS/RR/X25.rb', line 47

def new_from_data(data, offset)
  if (@rdlength > 0)
    len = data.unpack("\@#{offset} C")[0]
    offset+=1
    @psdn = data[offset, len].to_i();
    offset += len;
  end
end

#new_from_hash(values) ⇒ Object



56
57
58
59
60
# File 'lib/Net/DNS/RR/X25.rb', line 56

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

#new_from_string(string) ⇒ Object



62
63
64
65
66
# File 'lib/Net/DNS/RR/X25.rb', line 62

def new_from_string(string)
  if (string && string =~ /^\s*["']?(.*?)["']?\s*$/)
    @psdn = $1.to_i();
  end
end

#rdatastrObject



68
69
70
71
72
73
74
# File 'lib/Net/DNS/RR/X25.rb', line 68

def rdatastr
  if defined?@psdn 
    return "'#{@psdn}'" 
  else
    return  ''
  end
end

#rr_rdata(*args) ⇒ Object



76
77
78
79
80
81
82
83
84
85
86
# File 'lib/Net/DNS/RR/X25.rb', line 76

def rr_rdata(*args)
  rdata = "";
  
  if (defined?@psdn)
    s = "%d" % @psdn
    rdata += [s.length].pack("C");
    rdata += s;
  end
  
  return rdata;
end