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

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

Overview

Well Known Service resource.

Constant Summary collapse

TypeValue =
11
ClassValue =
IN::ClassValue

Constants inherited from Gem::Resolv::DNS::Resource

ClassHash, ClassInsensitiveTypes

Instance Attribute Summary collapse

Attributes inherited from Gem::Resolv::DNS::Resource

#ttl

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Gem::Resolv::DNS::Resource

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

Constructor Details

#initialize(address, protocol, bitmap) ⇒ WKS

Returns a new instance of WKS.



2701
2702
2703
2704
2705
# File 'lib/rubygems/vendor/resolv/lib/resolv.rb', line 2701

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

Instance Attribute Details

#addressObject (readonly)

The host these services run on.



2710
2711
2712
# File 'lib/rubygems/vendor/resolv/lib/resolv.rb', line 2710

def address
  @address
end

#bitmapObject (readonly)

A bit map of enabled services on this host.

If protocol is 6 (TCP) then the 26th bit corresponds to the SMTP service (port 25). If this bit is set, then an SMTP server should be listening on TCP port 25; if zero, SMTP service is not supported.



2725
2726
2727
# File 'lib/rubygems/vendor/resolv/lib/resolv.rb', line 2725

def bitmap
  @bitmap
end

#protocolObject (readonly)

IP protocol number for these services.



2715
2716
2717
# File 'lib/rubygems/vendor/resolv/lib/resolv.rb', line 2715

def protocol
  @protocol
end

Class Method Details

.decode_rdata(msg) ⇒ Object

:nodoc:



2733
2734
2735
2736
2737
2738
# File 'lib/rubygems/vendor/resolv/lib/resolv.rb', line 2733

def self.decode_rdata(msg) # :nodoc:
  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

:nodoc:



2727
2728
2729
2730
2731
# File 'lib/rubygems/vendor/resolv/lib/resolv.rb', line 2727

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