Class: PacketFu::TcpOption::ECHO

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

Overview

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 = {}) ⇒ ECHO

Returns a new instance of ECHO.



449
450
451
452
453
454
455
# File 'lib/packetfu/protos/tcp.rb', line 449

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

Instance Method Details

#decodeObject

ECHO options with lengths other than 6 are malformed.



458
459
460
461
462
463
464
# File 'lib/packetfu/protos/tcp.rb', line 458

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