class Pio::Parser

Raw data parser.

Public Class Methods

read(raw_data) click to toggle source

rubocop:disable MethodLength

# 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