Sha256: c51a96dd5b140db775d6988f4f7c08a0f99f3e75ccd3f79a499a271a8b0f529f

Contents?: true

Size: 794 Bytes

Versions: 4

Compression:

Stored size: 794 Bytes

Contents

require 'forwardable'

# Base module.
module Pio
  # Resubmit to the table_id
  class GotoTable
    # OpenFlow 1.3.4 OFPIT_GOTO_TABLE instruction format
    class Format < BinData::Record
      endian :big

      uint16 :instruction_type, value: 1
      uint16 :instruction_length, value: 8
      uint8 :table_id
      bit24 :padding
    end

    def self.read(raw_data)
      allocate.tap do |goto_table|
        goto_table.instance_variable_set :@format, Format.read(raw_data)
      end
    end

    extend Forwardable

    def_delegators :@format, :instruction_type
    def_delegators :@format, :instruction_length
    def_delegators :@format, :table_id
    def_delegators :@format, :to_binary_s

    def initialize(table_id)
      @format = Format.new(table_id: table_id)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
pio-0.25.0 lib/pio/open_flow13/goto_table.rb
pio-0.24.2 lib/pio/open_flow13/goto_table.rb
pio-0.24.1 lib/pio/open_flow13/goto_table.rb
pio-0.24.0 lib/pio/open_flow13/goto_table.rb