Method: PacketFu::TcpOption#read

Defined in:
lib/packetfu/protos/tcp/option.rb

#read(str) ⇒ Object

Reads a string to populate the object.



46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/packetfu/protos/tcp/option.rb', line 46

def read(str)
  force_binary(str)
  return self if str.nil?
  self[:kind].read(str[0,1])
  if str[1,1]
    self[:optlen].read(str[1,1])
    if str[2,1] && optlen.value > 2
      self[:value].read(str[2,optlen.value-2])
    end
  end
  self
end