Class: Pio::SetVlanVid
Overview
An action to modify the VLAN ID of a packet.
Instance Method Summary collapse
-
#initialize(number) ⇒ SetVlanVid
constructor
Creates an action to modify the VLAN ID of a packet.
Methods inherited from SetVlan
Constructor Details
#initialize(number) ⇒ SetVlanVid
Creates an action to modify the VLAN ID of a packet. The VLAN ID is 16-bits long but the actual VID (VLAN Identifier) of the IEEE 802.1Q frame is 12-bits.
20 21 22 23 24 25 26 27 28 |
# File 'lib/pio/set_vlan_vid.rb', line 20 def initialize(number) vlan_id = number.to_i unless vlan_id >= 1 && vlan_id <= 4095 fail ArgumentError, 'VLAN ID must be between 1 and 4095 inclusive' end @format = Format.new(vlan_id: vlan_id) rescue NoMethodError raise TypeError, 'VLAN ID must be an Integer.' end |