Class: Pio::Parser
- Inherits:
-
Object
- Object
- Pio::Parser
- Defined in:
- lib/pio/parser.rb
Overview
Raw data parser.
Defined Under Namespace
Classes: IPv4Packet
Class Method Summary collapse
-
.read(raw_data) ⇒ Object
rubocop:disable MethodLength.
Class Method Details
.read(raw_data) ⇒ Object
rubocop:disable MethodLength
26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/pio/parser.rb', line 26 def self.read(raw_data) ethernet_frame = EthernetFrame.read(raw_data) case ethernet_frame.ether_type when Ethernet::Type::IPV4, Ethernet::Type::VLAN IPv4Packet.read raw_data when Ethernet::Type::ARP Pio::Arp.read raw_data when Ethernet::Type::LLDP Pio::Lldp.read raw_data else ethernet_frame end end |