Sha256: 463ce5a9230c99b80a40a8df03f129fe6951053174ea4007e530551e52344338
Contents?: true
Size: 1.03 KB
Versions: 5
Compression:
Stored size: 1.03 KB
Contents
require 'forwardable' # Base module. module Pio remove_const :SendOutPort if const_defined?(:SendOutPort) # Output to switch port. class SendOutPort # OpenFlow 1.3.4 OFPAT_OUTPUT action format. class Format < BinData::Record NO_BUFFER = 0xffff endian :big uint16 :action_type, value: 0 uint16 :action_length, value: 16 uint32 :port uint16 :max_length, initial_value: NO_BUFFER uint48 :padding end def self.read(raw_data) allocate.tap do |send_out_port| send_out_port.instance_variable_set :@format, Format.read(raw_data) end end extend Forwardable def_delegators :@format, :action_type def_delegators :@format, :action_length def_delegators :@format, :port def_delegator :@format, :to_binary_s, :to_binary def initialize(port) @format = Format.new(port: port) end def max_length case @format.max_length when Format::NO_BUFFER :no_buffer else @format.max_length end end end end
Version data entries
5 entries across 5 versions & 1 rubygems