Class: Nesser::PTR

Inherits:
Object
  • Object
show all
Defined in:
lib/nesser/packets/rr_types.rb

Overview

PTR record - ie, reverse DNS

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:) ⇒ PTR

Returns a new instance of PTR.



186
187
188
# File 'lib/nesser/packets/rr_types.rb', line 186

def initialize(name:)
  @name = name
end

Instance Attribute Details

#nameObject

Returns the value of attribute name.



184
185
186
# File 'lib/nesser/packets/rr_types.rb', line 184

def name
  @name
end

Class Method Details

.unpack(unpacker) ⇒ Object



190
191
192
193
194
195
# File 'lib/nesser/packets/rr_types.rb', line 190

def self.unpack(unpacker)
  # We don't really need the length for anything, so just discard it
  unpacker.unpack('n')

  return self.new(name: unpacker.unpack_name())
end

Instance Method Details

#pack(packer) ⇒ Object



197
198
199
200
201
# File 'lib/nesser/packets/rr_types.rb', line 197

def pack(packer)
  length = packer.pack_name(@name, dry_run: true)
  packer.pack('n', length)
  packer.pack_name(@name)
end

#to_sObject



203
204
205
# File 'lib/nesser/packets/rr_types.rb', line 203

def to_s()
  return "#{@name} [PTR]"
end