Class: Pio::SetIpTos
- Inherits:
-
Object
- Object
- Pio::SetIpTos
- Extended by:
- Forwardable
- Defined in:
- lib/pio/set_ip_tos.rb
Overview
An action to modify the IP ToS/DSCP field of a packet.
Defined Under Namespace
Classes: Format
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(type_of_service) ⇒ SetIpTos
constructor
A new instance of SetIpTos.
Constructor Details
#initialize(type_of_service) ⇒ SetIpTos
Returns a new instance of SetIpTos.
32 33 34 35 36 37 38 39 40 |
# File 'lib/pio/set_ip_tos.rb', line 32 def initialize(type_of_service) # nw_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 == 0 fail ArgumentError, 'Invalid type_of_service (ToS) value.' end @format = Format.new(type_of_service: type_of_service) end |
Class Method Details
.read(raw_data) ⇒ Object
19 20 21 22 23 |
# File 'lib/pio/set_ip_tos.rb', line 19 def self.read(raw_data) set_ip_tos = allocate set_ip_tos.instance_variable_set :@format, Format.read(raw_data) set_ip_tos end |