Method: PacketFu::EthHeader#read

Defined in:
lib/packetfu/protos/eth/header.rb

#read(str) ⇒ Object

Reads a string to populate the object.



178
179
180
181
182
183
184
185
186
# File 'lib/packetfu/protos/eth/header.rb', line 178

def read(str)
  force_binary(str)
  return self if str.nil?
  self[:eth_dst].read str[0,6]
  self[:eth_src].read str[6,6]
  self[:eth_proto].read str[12,2]
  self[:body].read str[14,str.size]
  self
end