Class: Net::DNS::RR::MB

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

Overview

NAME

Net::DNS::RR::MB - DNS MB resource record

DESCRIPTION

Class for DNS Mailbox (MB) resource records.

COPYRIGHT

Copyright © 1997-2002 Michael Fuhr.

Portions Copyright © 2002-2004 Chris Reinhardt.

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.

head1 SEE ALSO

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

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

#madnameObject

Returns the domain name of the host which has the specified mailbox.

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


48
49
50
# File 'lib/Net/DNS/RR/MB.rb', line 48

def madname
  @madname
end

Instance Method Details

#_canonicalRdataObject



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

def _canonicalRdata
  rdata = "";
  if (defined?@madname)
    rdata += _name2wire(@madname);
  end
  return rdata;
end

#new_from_data(data, offset) ⇒ Object



49
50
51
52
53
# File 'lib/Net/DNS/RR/MB.rb', line 49

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

#new_from_hash(values) ⇒ Object



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

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

#new_from_string(s) ⇒ Object



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

def new_from_string(s)
  if (s)
    string = s.sub(/\.+$/,"");
    @madname = string;
  end
end

#rdatastrObject



68
69
70
# File 'lib/Net/DNS/RR/MB.rb', line 68

def rdatastr
  return @madname ? "#{@madname}." : '';
end

#rr_rdata(packet, offset) ⇒ Object



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

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