class Packetnom::Packet::Eth

Attributes

dst[RW]

Attributes

ethertype[RW]
src[RW]
type[RW]

Public Class Methods

new( bytes ) click to toggle source

Initialize the packet

# File lib/packet/eth.rb, line 13
def initialize( bytes )       
    # Layer 2
    @dst = bytes[0..5].join(':')
    @src = bytes[6..11].join(':')
    @type = bytes[12..13].join # http://en.wikipedia.org/wiki/EtherType

    # WHY DOES THIS HAVE PADDING ON ETHERTYPE ON REPLAY?!
    if @type.eql? '0000'
        @type = bytes[13..14].join
    end
    
end

Public Instance Methods

type?(is) click to toggle source
# File lib/packet/eth.rb, line 26
def type? (is)
    if type.eql? type
        return true
    end

    false
end