Class: PacketFu::TcpOption::MSS
- Inherits:
-
PacketFu::TcpOption
- Object
- Struct
- PacketFu::TcpOption
- PacketFu::TcpOption::MSS
- Defined in:
- lib/packetfu/protos/tcp.rb
Overview
Maximum Segment Size option.
Instance Attribute Summary
Attributes inherited from PacketFu::TcpOption
Instance Method Summary collapse
-
#decode ⇒ Object
MSS options with lengths other than 4 are malformed.
-
#initialize(args = {}) ⇒ MSS
constructor
A new instance of MSS.
- #value=(i) ⇒ Object
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
Constructor Details
#initialize(args = {}) ⇒ MSS
Returns a new instance of MSS.
341 342 343 344 345 346 347 348 |
# File 'lib/packetfu/protos/tcp.rb', line 341 def initialize(args={}) super( args.merge(:kind => 2, :optlen => 4 ) ) self[:value] = Int16.new(args[:value]) end |
Instance Method Details
#decode ⇒ Object
MSS options with lengths other than 4 are malformed.
353 354 355 356 357 358 359 |
# File 'lib/packetfu/protos/tcp.rb', line 353 def decode if self[:optlen].to_i == 4 "MSS:#{self[:value].to_i}" else "MSS-bad:#{self[:value]}" end end |
#value=(i) ⇒ Object
350 |
# File 'lib/packetfu/protos/tcp.rb', line 350 def value=(i); typecast i; end |