Sha256: 82ec948d9d09ad4ddfb64623aca8b0cbd3440bf26afe9f2a20621b071c838026

Contents?: true

Size: 885 Bytes

Versions: 1

Compression:

Stored size: 885 Bytes

Contents

require 'bindata'
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
      hide :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_delegator :@format, :to_binary_s, :to_binary

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pio-0.30.0 lib/pio/open_flow13/goto_table.rb