Class: Ethernet
- Inherits:
-
BinData::Record
- Object
- BinData::Record
- Ethernet
- Defined in:
- lib/ethernet.rb
Constant Summary collapse
- PROTOCOLS =
{ ipv4: 0x0800, arp: 0x0806, vlan: 0x8100 }
Instance Method Summary collapse
Instance Method Details
#has_vlan? ⇒ Boolean
29 30 31 |
# File 'lib/ethernet.rb', line 29 def has_vlan? protocol_internal == :vlan end |
#length ⇒ Object
37 38 39 |
# File 'lib/ethernet.rb', line 37 def length 14 + (has_vlan? ? 4 : 0) + payload.length end |
#protocol ⇒ Object
33 34 35 |
# File 'lib/ethernet.rb', line 33 def protocol has_vlan? ? vlan.protocol : protocol_internal end |