Sha256: 6143d9a3c040cdd0895a7c1cb7466e73355513afafd1d3518f91b15cd42ac00d

Contents?: true

Size: 648 Bytes

Versions: 1

Compression:

Stored size: 648 Bytes

Contents

require 'pio/open_flow/action'

module Pio
  module OpenFlow10
    # An action to modify the VLAN priority of a packet.
    class SetVlanPriority < OpenFlow::Action
      action_header action_type: 2, action_length: 8
      uint16 :vlan_priority
      string :padding, length: 2
      hide :padding

      def initialize(number)
        priority = number.to_i
        if priority < 0 || priority > 7
          raise ArgumentError, 'VLAN priority must be between 0 and 7 inclusive'
        end
        super(vlan_priority: priority)
      rescue NoMethodError
        raise TypeError, 'VLAN priority must be an Integer.'
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pio-0.30.1 lib/pio/open_flow10/set_vlan_priority.rb