Class: Packetnom::Packet::Eth
- Inherits:
-
Object
- Object
- Packetnom::Packet::Eth
- Defined in:
- lib/packet/eth.rb
Instance Attribute Summary collapse
-
#dst ⇒ Object
Attributes.
-
#src ⇒ Object
Returns the value of attribute src.
-
#type ⇒ Object
(also: #ethertype)
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(bytes) ⇒ Eth
constructor
Initialize the packet.
Constructor Details
#initialize(bytes) ⇒ Eth
Initialize the packet
13 14 15 16 17 18 19 20 21 |
# File 'lib/packet/eth.rb', line 13 def initialize( bytes ) @packet = bytes # Layer 2 @dst = bytes[0..5].join(':') @src = bytes[6..11].join(':') @type = bytes[12..13].join() # http://en.wikipedia.org/wiki/EtherType end |
Instance Attribute Details
#dst ⇒ Object
Attributes
8 9 10 |
# File 'lib/packet/eth.rb', line 8 def dst @dst end |
#src ⇒ Object
Returns the value of attribute src.
9 10 11 |
# File 'lib/packet/eth.rb', line 9 def src @src end |
#type ⇒ Object Also known as: ethertype
Returns the value of attribute type.
10 11 12 |
# File 'lib/packet/eth.rb', line 10 def type @type end |