Class: PacketFu::TcpOption::ECHOREPLY

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

Returns a new instance of ECHOREPLY.



472
473
474
475
476
477
478
# File 'lib/packetfu/protos/tcp.rb', line 472

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

Instance Method Details

#decodeObject

ECHOREPLY options with lengths other than 6 are malformed.



481
482
483
484
485
486
487
# File 'lib/packetfu/protos/tcp.rb', line 481

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