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