class PacketGen::Header::Dot11::Control

IEEE 802.11 control frame header

This class make a {Dot11} header with {#type} set to 1 (control frame).

A IEEE 802.11 control header consists of:

@author Sylvain Daubert

Constants

SUBTYPES

Control subtypes

SUBTYPES_WITH_MAC2

Control subtypes with mac2 field

Public Class Methods

new(options={}) click to toggle source

@param [Hash] options @see Base#initialize

Calls superclass method PacketGen::Header::Dot11::new
# File lib/packetgen/header/dot11/control.rb, line 44
def initialize(options={})
  super({ type: 1 }.merge!(options))
  @applicable_fields -= %i[mac3 sequence_ctrl mac4 qos_ctrl ht_ctrl]
  define_applicable_fields
end

Public Instance Methods

human_subtype() click to toggle source

Get human readable subtype @return [String]

# File lib/packetgen/header/dot11/control.rb, line 52
def human_subtype
  SUBTYPES[subtype] || subtype.to_s
end

Private Instance Methods

define_applicable_fields() click to toggle source
# File lib/packetgen/header/dot11/control.rb, line 58
def define_applicable_fields
  super
  if @applicable_fields.include? :mac2
    @applicable_fields -= %i[mac2] unless SUBTYPES_WITH_MAC2.include? self.subtype
  elsif SUBTYPES_WITH_MAC2.include? self.subtype
    @applicable_fields[3, 0] = :mac2
  end
end