Class: PacketFu::TcpOption::SACKOK

Inherits:
PacketFu::TcpOption show all
Defined in:
lib/packetfu/protos/tcp.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.



393
394
395
396
397
398
# File 'lib/packetfu/protos/tcp.rb', line 393

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

Instance Method Details

#decodeObject

SACKOK options with sizes other than 2 are malformed.



401
402
403
404
405
406
407
# File 'lib/packetfu/protos/tcp.rb', line 401

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