Sha256: c6f44453db02e90dc8c84875e8e5e38656914d66e4b98eaa80928d8c3ece9f1b
Contents?: true
Size: 1.56 KB
Versions: 9
Compression:
Stored size: 1.56 KB
Contents
# coding: utf-8 # This file is part of PacketGen # See https://github.com/sdaubert/packetgen for more informations # Copyright (C) 2016 Sylvain Daubert <sylvain.daubert@laposte.net> # This program is published under MIT license. module PacketGen module Header class Dot11 # IEEE 802.11 control frame header # @author Sylvain Daubert class Control < Dot11 # Control subtypes SUBTYPES = { 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 # Control subtypes with mac2 field SUBTYPES_WITH_MAC2 = [9, 10, 11, 14, 15].freeze # @param [Hash] options # @see Base#initialize def initialize(options={}) super({type: 1}.merge!(options)) @applicable_fields -= %i(mac3 sequence_ctrl mac4 qos_ctrl ht_ctrl) define_applicable_fields end # Get human readable subtype # @return [String] def human_subtype SUBTYPES[subtype] || subtype.to_s end private 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 sz = self.sz @applicable_fields[3, 0] = :mac2 end end end end end end
Version data entries
9 entries across 9 versions & 1 rubygems