Class: PacketGen::Header::Dot11::Control

Inherits:
PacketGen::Header::Dot11 show all
Defined in:
lib/packetgen/header/dot11/control.rb

Overview

IEEE 802.11 control frame header

This class make a PacketGen::Header::Dot11 header with #type set to 1 (control frame).

A IEEE 802.11 control header consists of:

Author:

  • Sylvain Daubert

Since:

  • 1.4.0

Constant Summary collapse

SUBTYPES =

Control subtypes

Since:

  • 1.4.0

{
  7 => 'Wrapper',
  8 => 'Block Ack Request',
  9 => 'Block Ack',
  10 => 'PS-Poll',
  11 => 'RTS',
  12 => 'CTS',
  13 => 'Ack',
  14 => 'CF-End',
  15 => 'CF-End+CF-Ack'
}.freeze
SUBTYPES_WITH_MAC2 =

Control subtypes with mac2 field

Since:

  • 1.4.0

[9, 10, 11, 14, 15].freeze

Constants inherited from PacketGen::Header::Dot11

TYPES

Instance Attribute Summary

Attributes inherited from PacketGen::Header::Dot11

#body, #fcs, #fragment_number, #frame_ctrl, #from_ds, #ht_ctrl, #id, #mac1, #mac2, #mac3, #mac4, #md, #mf, #order, #proto_version, #pwmngt, #qos_ctrl, #retry, #sequence_ctrl, #sequence_number, #subtype, #to_ds, #type, #wep

Instance Method Summary collapse

Methods inherited from PacketGen::Header::Dot11

#added_to_packet, #calc_checksum, #fields, #human_type, #inspect, #old_fields, #old_read, #read, #to_s, #to_w

Methods inherited from Base

bind, calculate_and_set_length, #header_id, inherited, #ip_header, #ll_header

Methods included from PacketGen::Headerable

#added_to_packet, included, #method_name, #packet, #packet=, #parse?, #protocol_name, #read

Methods inherited from Types::Fields

#[], #[]=, #bits_on, define_bit_fields_on, define_field, define_field_after, define_field_before, #fields, fields, inherited, #inspect, #offset_of, #optional?, #optional_fields, #present?, #read, remove_bit_fields_on, remove_field, #sz, #to_h, #to_s, update_field

Constructor Details

#initialize(options = {}) ⇒ Control

Returns a new instance of Control.

Parameters:

  • options (Hash) (defaults to: {})

See Also:

Since:

  • 1.4.0



45
46
47
48
49
# File 'lib/packetgen/header/dot11/control.rb', line 45

def initialize(options={})
  super({ type: 1 }.merge!(options))
  @applicable_fields -= %i[mac3 sequence_ctrl mac4 qos_ctrl ht_ctrl]
  define_applicable_fields
end

Instance Method Details

#human_subtypeString

Get human readable subtype

Returns:

  • (String)

Since:

  • 1.4.0



53
54
55
# File 'lib/packetgen/header/dot11/control.rb', line 53

def human_subtype
  SUBTYPES[subtype] || subtype.to_s
end