Sha256: 06c561f76299bf3e4c9c99a15cf8b040f81f8e8cd3f27d8ea37aeee43ddf15c9

Contents?: true

Size: 1.32 KB

Versions: 1

Compression:

Stored size: 1.32 KB

Contents

require 'pio/open_flow/error_message'
require 'pio/open_flow/message'
require 'pio/open_flow13/error/error_type13'

module Pio
  module OpenFlow13
    module Error
      # Bad request error.
      class BadRequest < OpenFlow::Message
        # enum ofp_bad_request_code
        class BadRequestCode < BinData::Primitive
          ERROR_CODES = {
            bad_version: 0,
            bad_type: 1,
            bad_multipart: 2,
            bad_experimenter: 3,
            bad_experimenter_type: 4,
            permissions_error: 5,
            bad_length: 6,
            buffer_empty: 7,
            buffer_unknown: 8,
            bad_table_id: 9,
            controller_is_slave: 10,
            bad_port: 11,
            bad_packet: 12,
            multipart_buffer_overflow: 13
          }.freeze

          endian :big
          uint16 :error_code

          def get
            ERROR_CODES.invert.fetch(error_code)
          end

          def set(value)
            self.error_code = ERROR_CODES.fetch(value)
          end
        end

        open_flow_header version: 4,
                         type: OpenFlow::ErrorMessage.type,
                         length: -> { 12 + raw_data.length }
        error_type13 :error_type, value: -> { :bad_request }
        bad_request_code :error_code
        rest :raw_data
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pio-0.30.1 lib/pio/open_flow13/error/bad_request.rb