Class: Dnsruby::RR::IN::WKS

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

Overview

RFC 1035, Section 3.4.2 (deprecated)

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, #from_data, #from_hash, #from_string, get_class, get_num, #hash, implemented_rrs, #init_defaults, new_from_data, new_from_hash, new_from_string, #rdata_to_string, #rdlength, #sameRRset, #to_s

Constructor Details

#initialize(address, protocol, bitmap) ⇒ WKS

Returns a new instance of WKS.



81
82
83
84
85
# File 'lib/dnsruby/resource/IN.rb', line 81

def initialize(address, protocol, bitmap)
  @address = IPv4.create(address)
  @protocol = protocol
  @bitmap = bitmap
end

Instance Attribute Details

#addressObject (readonly)

Returns the value of attribute address.



86
87
88
# File 'lib/dnsruby/resource/IN.rb', line 86

def address
  @address
end

#bitmapObject (readonly)

Returns the value of attribute bitmap.



86
87
88
# File 'lib/dnsruby/resource/IN.rb', line 86

def bitmap
  @bitmap
end

#protocolObject (readonly)

Returns the value of attribute protocol.



86
87
88
# File 'lib/dnsruby/resource/IN.rb', line 86

def protocol
  @protocol
end

Class Method Details

.decode_rdata(msg) ⇒ Object

:nodoc: all



94
95
96
97
98
99
# File 'lib/dnsruby/resource/IN.rb', line 94

def self.decode_rdata(msg) #:nodoc: all
  address = IPv4.new(msg.get_bytes(4))
  protocol, = msg.get_unpack("n")
  bitmap = msg.get_bytes
  return self.new(address, protocol, bitmap)
end

Instance Method Details

#encode_rdata(msg, canonical = false) ⇒ Object

:nodoc: all



88
89
90
91
92
# File 'lib/dnsruby/resource/IN.rb', line 88

def encode_rdata(msg, canonical=false) #:nodoc: all
  msg.put_bytes(@address.address)
  msg.put_pack("n", @protocol)
  msg.put_bytes(@bitmap)
end