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

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

Overview

Well Known Service resource.

Constant Summary

TypeValue =
11
ClassValue =
IN::ClassValue

Constants inherited from Resolv::DNS::Resource

ClassHash, ClassInsensitiveTypes

Instance Attribute Summary (collapse)

Attributes inherited from Resolv::DNS::Resource

#ttl

Class Method Summary (collapse)

Instance Method Summary (collapse)

Methods inherited from Resolv::DNS::Resource

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

Constructor Details

- (WKS) initialize(address, protocol, bitmap)

A new instance of WKS



1959
1960
1961
1962
1963
# File 'lib/resolv.rb', line 1959

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

Instance Attribute Details

- (Object) address (readonly)

The host these services run on.



1968
1969
1970
# File 'lib/resolv.rb', line 1968

def address
  @address
end

- (Object) bitmap (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.



1983
1984
1985
# File 'lib/resolv.rb', line 1983

def bitmap
  @bitmap
end

- (Object) protocol (readonly)

IP protocol number for these services.



1973
1974
1975
# File 'lib/resolv.rb', line 1973

def protocol
  @protocol
end

Class Method Details

+ (Object) decode_rdata(msg)

:nodoc:



1991
1992
1993
1994
1995
1996
# File 'lib/resolv.rb', line 1991

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

- (Object) encode_rdata(msg)

:nodoc:



1985
1986
1987
1988
1989
# File 'lib/resolv.rb', line 1985

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