Class: DNS::ResourceRecord::IN::HINFO

Inherits:
Data
  • Object
show all
Defined in:
lib/faildns/resourcerecord/IN/HINFO.rb

Overview

+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
/                      CPU                      /
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
/                       OS                      /
+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+

where:

CPU A <character-string> which specifies the CPU type.

OS A <character-string> which specifies the operating

system type.

Standard values for CPU and OS can be found in [RFC-1010].

HINFO records are used to acquire general information about a host. The main use is for protocols such as FTP that can use special procedures when talking between machines or operating systems of the same type. ++

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Data

parse

Constructor Details

#initialize(cpu, os) ⇒ HINFO

Returns a new instance of HINFO.



61
62
63
64
# File 'lib/faildns/resourcerecord/IN/HINFO.rb', line 61

def initialize (cpu, os)
  @cpu = cpu
  @os  = os
end

Instance Attribute Details

#cpuObject (readonly)

Returns the value of attribute cpu.



59
60
61
# File 'lib/faildns/resourcerecord/IN/HINFO.rb', line 59

def cpu
  @cpu
end

#osObject (readonly)

Returns the value of attribute os.



59
60
61
# File 'lib/faildns/resourcerecord/IN/HINFO.rb', line 59

def os
  @os
end

Class Method Details

._parse(string, original) ⇒ Object



50
51
52
53
54
55
56
57
# File 'lib/faildns/resourcerecord/IN/HINFO.rb', line 50

def self._parse (string, original)
  string = string.clone

  cpu = string[1, (tmp = string.unpack('C'))]; string[0, tmp + 1] = ''
  os  = string[1, string.unpack('C')]

  HINFO.new(cpu, os)
end

Instance Method Details

#packObject



66
67
68
# File 'lib/faildns/resourcerecord/IN/HINFO.rb', line 66

def pack
  [@cpu.length].unpack('C') + @cpu + [@os.length].unpack('C') + @os
end

#to_sObject



70
71
72
# File 'lib/faildns/resourcerecord/IN/HINFO.rb', line 70

def to_s
  "#{@os} on #{@cpu}"
end