Class Net::DNS::RR::Classes
In: lib/net/dns/rr/classes.rb
Parent: Object

Net::DNS::Classes

This is an auxiliary class to handle Net::DNS::RR class field in a DNS packet.

Methods

default=   inspect   new   regexp   to_i   to_s   valid?  

Constants

CLASSES = { 'IN' => 1, # RFC 1035 'CH' => 3, # RFC 1035 'HS' => 4, # RFC 1035 'NONE' => 254, # RFC 2136 'ANY' => 255, # RFC 1035 }   Hash with the values of each RR class stored with the respective id number.

Public Class methods

Be able to control the default class to assign when cls argument is nil. Default to IN

Creates a new object representing an RR class. Performs some checks on the argument validity too. Il cls is nil, the default value is ANY or the one set with Classes.default=

Gives in output the keys from the Classes hash in a format suited for regexps

Returns whether cls is a valid RR class.

  Net::DNS::RR::Classes.valid?("IN")
  # => true
  Net::DNS::RR::Classes.valid?(1)
  # => true
  Net::DNS::RR::Classes.valid?("Q")
  # => false
  Net::DNS::RR::Classes.valid?(256)
  # => false
  Net::DNS::RR::Classes.valid?(Hash.new)
  # => ArgumentError

FIXME: valid? should never raise.

Raises

ArgumentError:if cls isn‘t either a String or a Fixnum

Public Instance methods

Returns the class in number format (default for normal use)

FIXME: inspect must return a String.

Returns the class in numeric format, usable by the pack methods for data transfers.

Returns the class in string format, ex. "IN" or "CH" or such a string.

[Validate]