EthNic is the Network Interface Controler portion of a MAC address, used in EthHeader.
Header Definition
Fixnum :n1 Fixnum :n2 Fixnum :n3
Methods
Class Public methods
Source: show
# File lib/packetfu/protos/eth.rb, line 78 def initialize(args={}) args.each_pair {|k,v| args[k] = 0 unless v} super(args[:n0], args[:n1], args[:n2]) end
Instance Public methods
Reads a string to populate the object.
Source: show
# File lib/packetfu/protos/eth.rb, line 89 def read(str) force_binary(str) return self if str.nil? self[:n0], self[:n1], self[:n2] = str[0,3].unpack("C3") self end
Returns the object in string form.
Source: show
# File lib/packetfu/protos/eth.rb, line 84 def to_s [n0,n1,n2].map {|x| x.to_i}.pack("C3") end