Sha256: 3bade0360697074f3955be98bf823e168d74d5c8ef4b969858507f7c04af4e3b

Contents?: true

Size: 868 Bytes

Versions: 14

Compression:

Stored size: 868 Bytes

Contents

require 'pio/open_flow'

# Base module.
module Pio
  # OpenFlow 1.0 Port Status message
  class PortStatus
    # What changed about the physical port
    class Reason < BinData::Primitive
      REASONS = { add: 0, delete: 1, modify: 2 }

      uint8 :reason

      def get
        REASONS.invert.fetch(reason)
      end

      def set(value)
        self.reason = REASONS.fetch(value)
      end
    end

    # Message body of Port Status
    class Body < BinData::Record
      endian :big

      reason :reason
      uint56 :padding
      hide :padding
      phy_port :desc
    end
  end

  OpenFlow::Message.factory(PortStatus, OpenFlow::PORT_STATUS) do
    def_delegators :body, :reason

    attr_writer :datapath_id

    def desc
      @desc ||= @format.body.desc.snapshot
      @desc.instance_variable_set :@datapath_id, @datapath_id
      @desc
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
pio-0.23.1 lib/pio/open_flow10/port_status.rb
pio-0.23.0 lib/pio/open_flow10/port_status.rb
pio-0.22.0 lib/pio/open_flow10/port_status.rb
pio-0.21.1 lib/pio/open_flow10/port_status.rb
pio-0.21.0 lib/pio/open_flow10/port_status.rb
pio-0.20.1 lib/pio/open_flow10/port_status.rb
pio-0.20.0 lib/pio/open_flow10/port_status.rb
pio-0.19.0 lib/pio/port_status.rb
pio-0.18.2 lib/pio/port_status.rb
pio-0.18.1 lib/pio/port_status.rb
pio-0.18.0 lib/pio/port_status.rb
pio-0.17.0 lib/pio/port_status.rb
pio-0.16.0 lib/pio/port_status.rb
pio-0.15.2 lib/pio/port_status.rb