Module: Ethernet::Type

Included in:
Ethernet
Defined in:
lib/ethernet.rb

Constant Summary collapse

ETH_IPv4 =
0x0800
ETH_ARP =
0x0806
ETH_RARP =
0x8035
ETH_Ethertalk =
0x809B
ETH_AARP =
0x80F3
ETH_IEEE_802_1Q =
0x8100
ETH_IPv6 =
0x86DD

Class Method Summary collapse

Class Method Details

.to_s(type) ⇒ Object



37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/ethernet.rb', line 37

def self.to_s(type)
  case type
  when ETH_IPv4        ; 'IPv4'
  when ETH_IPv6        ; 'IPv6'
  when ETH_ARP         ; 'ARP'
  when ETH_RARP        ; 'RARP'
  when ETH_Ethertalk   ; 'AppleTalk Ethertalk'
  when ETH_AARP        ; 'AppleTalk Address Resolution Protocol'
  when ETH_IEEE_802_1Q ; 'IEEE_802_1Q'
  else
    format("0x%04x",type)
  end
end