Sha256: 548ada5538a47a4aae0150bdde50b735d43733bbdb29958cb81b115242a27390

Contents?: true

Size: 1.19 KB

Versions: 9

Compression:

Stored size: 1.19 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 data frame header
      # @author Sylvain Daubert
      class Data < Dot11

        # @param [Hash] options
        # @see Base#initialize
        def initialize(options={})
          super({type: 2}.merge!(options))
          @applicable_fields -= %i(mac4 qos_ctrl ht_ctrl)
          define_applicable_fields
        end

        private

        def define_applicable_fields
          super
          if subtype >= 8 and !@applicable_fields.include? :qos_ctrl
            # Insert after mac4, if present
            # else insert after sequence_ctrl
            if @applicable_fields.include? :mac4
              idx = @applicable_fields.index(:mac4)
              @applicable_fields[idx, 0] = :qos_ctrl
            else
              @applicable_fields[6, 0] = :qos_ctrl
            end
          elsif subtype < 8
            @applicable_fields -= %i(qos_ctrl)
          end
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
packetgen-2.1.2 lib/packetgen/header/dot11/data.rb
packetgen-2.1.1 lib/packetgen/header/dot11/data.rb
packetgen-2.1.0 lib/packetgen/header/dot11/data.rb
packetgen-2.0.1 lib/packetgen/header/dot11/data.rb
packetgen-2.0.0 lib/packetgen/header/dot11/data.rb
packetgen-1.4.3 lib/packetgen/header/dot11/data.rb
packetgen-1.4.2 lib/packetgen/header/dot11/data.rb
packetgen-1.4.1 lib/packetgen/header/dot11/data.rb
packetgen-1.4.0 lib/packetgen/header/dot11/data.rb