Class: Pio::OpenFlow10::SetTos

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

Overview

An action to modify the IP ToS/DSCP field of a packet.

Instance Method Summary collapse

Methods inherited from Pio::OpenFlow::Action

action_header, method_missing, read, #to_binary

Constructor Details

#initialize(type_of_service) ⇒ SetTos

Returns a new instance of SetTos.



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

def initialize(type_of_service)
  # tos (IP ToS) value consists of 8 bits, of which only the
  # 6 high-order bits belong to DSCP, the 2 low-order bits must
  # be zero.
  unless type_of_service.unsigned_8bit? && (type_of_service % 4).zero?
    raise ArgumentError, 'Invalid type_of_service (ToS) value.'
  end
  super(type_of_service: type_of_service)
end