Sha256: 7866ff0ba43c5df6594f0341c53553ef2b8c2a611cf24a7b8cd40dcb02c2994c

Contents?: true

Size: 768 Bytes

Versions: 3

Compression:

Stored size: 768 Bytes

Contents

require 'bindata'
require 'pio/open_flow'

# Base module.
module Pio
  # OpenFlow 1.0 Packet-Out message
  class PacketOut
    # Message body of Packet-Out
    class Body < BinData::Record
      endian :big

      uint32 :buffer_id
      uint16 :in_port
      uint16 :actions_len, initial_value: -> { actions.binary.length }
      actions :actions, length: -> { actions_len }
      rest :data

      def empty?
        false
      end

      def length
        8 + actions_len + data.length
      end
    end
  end

  OpenFlow::Message.factory(PacketOut, OpenFlow::PACKET_OUT) do
    def_delegators :body, :buffer_id
    def_delegators :body, :in_port
    def_delegators :body, :actions_len
    def_delegators :body, :actions
    def_delegators :body, :data
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
pio-0.16.0 lib/pio/packet_out.rb
pio-0.15.2 lib/pio/packet_out.rb
pio-0.15.1 lib/pio/packet_out.rb