Sha256: 83171df67ecb278a86b76f9594e756ec04974a9805d84a6770765377aef5fbfc

Contents?: true

Size: 724 Bytes

Versions: 4

Compression:

Stored size: 724 Bytes

Contents

require 'bindata'
require 'pio/open_flow/transaction_id'

module Pio
  # OpenFlow message header parser
  class OpenFlowHeaderParser < BinData::Record
    endian :big

    uint8 :ofp_version
    uint8 :message_type
    uint16 :message_length
    transaction_id :transaction_id
  end

  # OpenFlow message header.
  class OpenFlowHeader < BinData::Record
    endian :big

    uint8 :ofp_version, value: :ofp_version_value
    virtual assert: -> { ofp_version == ofp_version_value }
    uint8 :message_type, value: :message_type_value
    virtual assert: -> { message_type == message_type_value }
    uint16 :message_length, initial_value: -> { 8 + body.length }
    transaction_id :transaction_id, initial_value: 0
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
pio-0.25.0 lib/pio/open_flow/open_flow_header.rb
pio-0.24.2 lib/pio/open_flow/open_flow_header.rb
pio-0.24.1 lib/pio/open_flow/open_flow_header.rb
pio-0.24.0 lib/pio/open_flow/open_flow_header.rb