Sha256: 4b22c774cb6507cf952b14095cc6de9aef68e403aa7fcdc11f835a145cadafbf

Contents?: true

Size: 763 Bytes

Versions: 5

Compression:

Stored size: 763 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
    rest :body
  end

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

    uint8 :ofp_version, value: :version_value
    virtual assert: -> { ofp_version == version_value }
    uint8 :message_type, value: :message_type_value
    virtual assert: -> { message_type == message_type_value }
    uint16 :message_length, initial_value: -> { length + body_length }
    transaction_id :transaction_id, initial_value: 0

    def length
      8
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
pio-0.30.0 lib/pio/open_flow/open_flow_header.rb
pio-0.29.0 lib/pio/open_flow/open_flow_header.rb
pio-0.28.1 lib/pio/open_flow/open_flow_header.rb
pio-0.28.0 lib/pio/open_flow/open_flow_header.rb
pio-0.27.2 lib/pio/open_flow/open_flow_header.rb