Class: PacketFu::TcpOption::SACK
- Inherits:
-
PacketFu::TcpOption
- Object
- Struct
- PacketFu::TcpOption
- PacketFu::TcpOption::SACK
- Defined in:
- lib/packetfu/protos/tcp.rb
Overview
Selective Acknowledgement option.
www.networksorcery.com/enp/protocol/tcp/option004.htm
Note that SACK always takes its optlen from the size of the string.
Instance Attribute Summary
Attributes inherited from PacketFu::TcpOption
Instance Method Summary collapse
- #decode ⇒ Object
- #encode(str) ⇒ Object
-
#initialize(args = {}) ⇒ SACK
constructor
A new instance of SACK.
- #optlen=(i) ⇒ Object
- #value=(i) ⇒ Object
Methods inherited from PacketFu::TcpOption
#has_optlen?, #has_value?, #read, #to_s
Methods included from StructFu
#body=, #clone, #set_endianness, #sz, #typecast
Methods inherited from Struct
Constructor Details
#initialize(args = {}) ⇒ SACK
Returns a new instance of SACK.
417 418 419 420 421 422 423 |
# File 'lib/packetfu/protos/tcp.rb', line 417 def initialize(args={}) super( args.merge(:kind => 5, :optlen => ((args[:value] || "").size + 2) ) ) end |
Instance Method Details
#decode ⇒ Object
432 433 434 |
# File 'lib/packetfu/protos/tcp.rb', line 432 def decode "SACK:#{self[:value]}" end |
#encode(str) ⇒ Object
436 437 438 439 440 441 |
# File 'lib/packetfu/protos/tcp.rb', line 436 def encode(str) temp_obj = self.class.new(:value => str) self[:value] = temp_obj.value self[:optlen] = temp_obj.optlen.value self end |
#optlen=(i) ⇒ Object
425 |
# File 'lib/packetfu/protos/tcp.rb', line 425 def optlen=(i); typecast i; end |