Class: Pio::OpenFlow10::SetTransportDestinationPort

Inherits:
Pio::OpenFlow::Action show all
Defined in:
lib/pio/open_flow10/set_transport_port.rb

Overview

An action to modify the source TCP/UDP port of a packet.

Instance Method Summary collapse

Methods inherited from Pio::OpenFlow::Action

action_header, method_missing, read, #to_binary

Constructor Details

#initialize(number) ⇒ SetTransportDestinationPort

Returns a new instance of SetTransportDestinationPort.



34
35
36
37
38
39
40
41
42
43
# File 'lib/pio/open_flow10/set_transport_port.rb', line 34

def initialize(number)
  port = number.to_i
  unless port.unsigned_16bit?
    raise ArgumentError,
          'TCP/UDP port must be an unsigned 16-bit integer.'
  end
  super(port: port)
rescue NoMethodError
  raise TypeError, 'TCP/UDP port must be an unsigned 16-bit integer.'
end