Sha256: 4e2473ba5aec907ccf3a3edb63f4c70cd0420a577f8a24ef08f1778557fae665

Contents?: true

Size: 1.75 KB

Versions: 1

Compression:

Stored size: 1.75 KB

Contents

require 'pio/open_flow10/match'
require 'pio/open_flow10/stats_type'
require 'pio/open_flow/format'
require 'pio/open_flow/message'

# Base module.
module Pio
  # OpenFlow 1.0 messages
  module OpenFlow10
    # OpenFlow 1.0 FlowStats messages
    module FlowStats
      # OpenFlow 1.0 Flow Stats Request message
      class Request < OpenFlow::Message
        # Body for Stats Request of type :flow
        class FlowStatsRequestBody < BinData::Record
          endian :big

          match_open_flow10 :match
          uint8 :table_id, initial_value: 0xff
          string :padding, length: 1
          hide :padding
          port_number :out_port, initial_value: -> { :none }
        end

        # Message body of Flow Stats Request.
        class Body < BinData::Record
          endian :big

          stats_type :stats_type, value: -> { :flow }
          uint16 :flags
          choice :stats_request_body, selection: -> { stats_type.to_s } do
            flow_stats_request_body 'flow'
            string :default
          end

          def length
            48
          end

          def method_missing(method, *args, &block)
            stats_request_body.__send__(method, *args, &block)
          end
        end

        # OpenFlow 1.0 Flow Stats Request message format.
        class Format < BinData::Record
          extend OpenFlow::Format

          header version: 1, message_type: 16
          body :body
        end

        body_option :match

        def initialize(user_options = {})
          validate_user_options user_options
          header_options = parse_header_options(user_options)
          @format = Format.new(header: header_options,
                               body: { stats_request_body: user_options })
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pio-0.25.0 lib/pio/open_flow10/flow_stats_request.rb