Class: Packetnom::Packet::Eth

Inherits:
Object
  • Object
show all
Defined in:
lib/packet/eth.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#dstObject

Attributes



8
9
10
# File 'lib/packet/eth.rb', line 8

def dst
  @dst
end

#srcObject

Returns the value of attribute src.



9
10
11
# File 'lib/packet/eth.rb', line 9

def src
  @src
end

#typeObject Also known as: ethertype

Returns the value of attribute type.



10
11
12
# File 'lib/packet/eth.rb', line 10

def type
  @type
end