Class: Dnsruby::RR::IN::A

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

Overview

Class for DNS Address (A) resource records.

RFC 1035 Section 3.4.1

Constant Summary

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

#addressObject

The RR’s (Resolv::IPv4) address field



26
27
28
# File 'lib/dnsruby/resource/A.rb', line 26

def address
  @address
end

Class Method Details

.decode_rdata(msg) ⇒ Object

:nodoc: all



50
51
52
# File 'lib/dnsruby/resource/A.rb', line 50

def self.decode_rdata(msg) #:nodoc: all
  return self.new(IPv4.new(msg.get_bytes(4)))
end

Instance Method Details

#encode_rdata(msg, canonical = false) ⇒ Object

:nodoc: all



46
47
48
# File 'lib/dnsruby/resource/A.rb', line 46

def encode_rdata(msg, canonical=false) #:nodoc: all
  msg.put_bytes(@address.address)
end

#from_data(data) ⇒ Object

:nodoc: all



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

def from_data(data) #:nodoc: all
  @address = IPv4.create(data)
end

#from_hash(hash) ⇒ Object

Create the RR from a hash



33
34
35
# File 'lib/dnsruby/resource/A.rb', line 33

def from_hash(hash)
  @address = IPv4.create(hash[:address])
end

#from_string(input) ⇒ Object

Create the RR from a standard string



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

def from_string(input)
  @address = IPv4.create(input)
end

#rdata_to_stringObject



42
43
44
# File 'lib/dnsruby/resource/A.rb', line 42

def rdata_to_string
  return @address.to_s
end