Class: Dnsruby::RR::RP

Inherits:
Dnsruby::RR show all
Defined in:
lib/dnsruby/resource/RP.rb

Overview

Class for DNS Responsible Person (RP) resource records. RFC 1183 Section 2.2

Constant Summary collapse

ClassValue =

:nodoc: all

nil
TypeValue =

:nodoc: all

Types::RP

Constants inherited from Dnsruby::RR

ClassInsensitiveTypes

Instance Attribute Summary collapse

Attributes inherited from Dnsruby::RR

#klass, #name, #rdata, #ttl, #type

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Dnsruby::RR

#<=>, #==, #clone, create, #eql?, find_class, get_class, get_num, #hash, implemented_rrs, #init_defaults, new_from_data, new_from_hash, new_from_string, #rdlength, #sameRRset, #to_s

Instance Attribute Details

#mailboxObject

Returns a domain name that specifies the mailbox for the responsible person.



25
26
27
# File 'lib/dnsruby/resource/RP.rb', line 25

def mailbox
  @mailbox
end

#txtdomainObject

A domain name that specifies a TXT record containing further information about the responsible person.



28
29
30
# File 'lib/dnsruby/resource/RP.rb', line 28

def txtdomain
  @txtdomain
end

Class Method Details

.decode_rdata(msg) ⇒ Object

:nodoc: all



68
69
70
71
72
# File 'lib/dnsruby/resource/RP.rb', line 68

def self.decode_rdata(msg) #:nodoc: all
  mailbox = msg.get_name
  txtdomain = msg.get_name
  return self.new([mailbox, txtdomain])
end

Instance Method Details

#encode_rdata(msg, canonical = false) ⇒ Object

:nodoc: all



63
64
65
66
# File 'lib/dnsruby/resource/RP.rb', line 63

def encode_rdata(msg, canonical=false) #:nodoc: all
  msg.put_name(@mailbox, canonical)
  msg.put_name(@txtdomain, canonical)
end

#from_data(data) ⇒ Object

:nodoc: all



43
44
45
# File 'lib/dnsruby/resource/RP.rb', line 43

def from_data(data) #:nodoc: all
  @mailbox, @txtdomain= data
end

#from_hash(hash) ⇒ Object



38
39
40
41
# File 'lib/dnsruby/resource/RP.rb', line 38

def from_hash(hash)
  @mailbox = Name.create(hash[:mailbox])
  @txtdomain = Name.create(hash[:txtdomain])
end

#from_string(input) ⇒ Object

:nodoc: all



47
48
49
50
51
52
53
# File 'lib/dnsruby/resource/RP.rb', line 47

def from_string(input) #:nodoc: all
  if (input.length > 0)
    names = input.split(" ")
    @mailbox = Name.create(names[0])
    @txtdomain = Name.create(names[1])
  end
end

#rdata_to_stringObject

:nodoc: all



55
56
57
58
59
60
61
# File 'lib/dnsruby/resource/RP.rb', line 55

def rdata_to_string #:nodoc: all
  if (@mailbox!=nil)
    return "#{@mailbox.to_s(true)} #{@txtdomain.to_s(true)}"
  else
    return ""
  end
end