Class: PacketGen::Header::DNS::QDSection

Inherits:
RRSection show all
Defined in:
lib/packetgen/header/dns/qdsection.rb

Overview

Define a DNS Question Section

Author:

  • Sylvain Daubert

Constant Summary

Constants inherited from Types::Array

Types::Array::HUMAN_SEPARATOR

Instance Method Summary collapse

Methods inherited from RRSection

#initialize

Methods inherited from Types::Array

#force_binary, #initialize, set_of, #sz, #to_human, #to_s

Constructor Details

This class inherits a constructor from PacketGen::Header::DNS::RRSection

Instance Method Details

#<<(q) ⇒ QDSection

Add a question to this section. Increment associated counter

Parameters:

Returns:



# File 'lib/packetgen/header/dns/qdsection.rb', line 8


#delete(q) ⇒ Question

Delete a question

Parameters:

Returns:



# File 'lib/packetgen/header/dns/qdsection.rb', line 8


#push(q) ⇒ QDSection

Add a question to this section without incrementing associated counter

Parameters:

Returns:



# File 'lib/packetgen/header/dns/qdsection.rb', line 8


#read(str) ⇒ QDSection

Read Question section from a string

Parameters:

  • str (String)

    binary string

Returns:



24
25
26
27
28
29
30
31
32
33
34
# File 'lib/packetgen/header/dns/qdsection.rb', line 24

def read(str)
  clear
  return self if str.nil?
  force_binary str
  while str.length > 0 and self.size < @counter.to_i
    question = Question.new(@dns).read(str)
    str.slice!(0, question.sz)
    self.push question
  end
  self
end