Class: PacketFu::TcpOption::SACKOK

Inherits:
PacketFu::TcpOption show all
Defined in:
lib/packetfu/protos/tcp/option.rb

Overview

Selective Acknowlegment OK option.

www.networksorcery.com/enp/protocol/tcp/option004.htm

Instance Attribute Summary

Attributes inherited from PacketFu::TcpOption

#kind, #optlen, #value

Instance Method Summary collapse

Methods inherited from PacketFu::TcpOption

#encode, #has_optlen?, #has_value?, #read, #to_s

Methods included from StructFu

#body=, #clone, #set_endianness, #sz, #typecast

Methods inherited from Struct

#force_binary

Constructor Details

#initialize(args = {}) ⇒ SACKOK

Returns a new instance of SACKOK.



186
187
188
189
190
191
# File 'lib/packetfu/protos/tcp/option.rb', line 186

def initialize(args={})
  super(
    args.merge(:kind => 4,
               :optlen => 2)
  )
end

Instance Method Details

#decodeObject

SACKOK options with sizes other than 2 are malformed.



194
195
196
197
198
199
200
# File 'lib/packetfu/protos/tcp/option.rb', line 194

def decode
  if self[:optlen].to_i == 2
    "SACKOK"
  else
    "SACKOK-bad:#{self[:value]}"
  end
end