Class: Resolv::DNS::Resource::IN::WKS

Inherits:
Resolv::DNS::Resource show all
Defined in:
lib/resolv.rb

Constant Summary

Constants inherited from Resolv::DNS::Resource

ClassHash, ClassInsensitiveTypes, ClassValue

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Resolv::DNS::Resource

#==, #eql?, get_class, #hash

Constructor Details

#initialize(address, protocol, bitmap) ⇒ WKS

Returns a new instance of WKS.



1661
1662
1663
1664
1665
# File 'lib/resolv.rb', line 1661

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



1666
1667
1668
# File 'lib/resolv.rb', line 1666

def address
  @address
end

#bitmapObject (readonly)

Returns the value of attribute bitmap



1666
1667
1668
# File 'lib/resolv.rb', line 1666

def bitmap
  @bitmap
end

#protocolObject (readonly)

Returns the value of attribute protocol



1666
1667
1668
# File 'lib/resolv.rb', line 1666

def protocol
  @protocol
end

Class Method Details

.decode_rdata(msg) ⇒ Object



1674
1675
1676
1677
1678
1679
# File 'lib/resolv.rb', line 1674

def self.decode_rdata(msg)
  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) ⇒ Object



1668
1669
1670
1671
1672
# File 'lib/resolv.rb', line 1668

def encode_rdata(msg)
  msg.put_bytes(@address.address)
  msg.put_pack("n", @protocol)
  msg.put_bytes(@bitmap)
end