Class: Pio::Features::Request

Inherits:
Message
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/pio/features/request.rb

Overview

OpenFlow 1.0 Features Request message

Instance Method Summary collapse

Methods inherited from Message

create_from

Constructor Details

#initializeRequest #initialize(transaction_id) ⇒ Request #initialize(user_options) ⇒ Request

Creates a Features Request OpenFlow message.

Overloads:

  • #initializeRequest

    Examples:

    Pio::Features::Request.new
  • #initialize(transaction_id) ⇒ Request

    Examples:

    Pio::Features::Request.new(123)

    Parameters:

    • transaction_id (Number)

      An unsigned 32-bit integer number associated with this message.

  • #initialize(user_options) ⇒ Request

    Examples:

    Pio::Features::Request.new(transaction_id: 123)
    Pio::Features::Request.new(xid: 123)

    Parameters:

    • user_options (Hash)

      The options to create a message with.

    Options Hash (user_options):

    • :transaction_id (Number)
    • :xid (Number)

      An alias to transaction_id.


42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/pio/features/request.rb', line 42

def initialize(user_options = {})
  if user_options.respond_to?(:to_i)
    @options = { transaction_id: user_options.to_i,
                 message_type: 5 }
  elsif user_options.respond_to?(:[])
    @options = user_options.dup.merge(message_type: 5)
    handle_user_hash_options
  else
    fail TypeError
  end
  @features = Format.new(@options)
end