Class: Pio::OpenFlow10::SetTransportSourcePort

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) ⇒ SetTransportSourcePort

Returns a new instance of SetTransportSourcePort.



15
16
17
18
19
20
21
22
23
24
# File 'lib/pio/open_flow10/set_transport_port.rb', line 15

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