### Home Classes Methods

### In Files

- lib/packetfu/protos/tcp/option.rb

### Parent

PacketFu::TcpOption

### Methods

- ::new
- #decode
- #encode
- #optlen=
- #value=

### Files

- .document
- README.rdoc

### Class/Module Index

Quicksearch

- PacketFu
- PacketFu::ARPHeader
- PacketFu::ARPHeaderMixin
- PacketFu::ARPPacket
- PacketFu::AddrIpv6
- PacketFu::Capture
- PacketFu::Config
- PacketFu::EthHeader
- PacketFu::EthHeaderMixin
- PacketFu::EthMac
- PacketFu::EthNic
- PacketFu::EthOui
- PacketFu::EthPacket
- PacketFu::HSRPHeader
- PacketFu::HSRPHeaderMixin
- PacketFu::HSRPPacket
- PacketFu::ICMPHeader
- PacketFu::ICMPHeaderMixin
- PacketFu::ICMPPacket
- PacketFu::IPHeader
- PacketFu::IPHeaderMixin
- PacketFu::IPPacket
- PacketFu::IPv6Header
- PacketFu::IPv6HeaderMixin
- PacketFu::IPv6Packet
- PacketFu::Inject
- PacketFu::InvalidHeader
- PacketFu::InvalidPacket
- PacketFu::LLDPHeader
- PacketFu::LLDPHeaderMixin
- PacketFu::LLDPPacket
- PacketFu::Octets
- PacketFu::Packet
- PacketFu::PcapFile
- PacketFu::PcapHeader
- PacketFu::PcapPacket
- PacketFu::PcapPackets
- PacketFu::Read
- PacketFu::TCPHeader
- PacketFu::TCPHeaderMixin
- PacketFu::TCPPacket
- PacketFu::TcpEcn
- PacketFu::TcpFlags
- PacketFu::TcpHlen
- PacketFu::TcpOption
- PacketFu::TcpOption::ECHO
- PacketFu::TcpOption::ECHOREPLY
- PacketFu::TcpOption::EOL
- PacketFu::TcpOption::MSS
- PacketFu::TcpOption::NOP
- PacketFu::TcpOption::SACK
- PacketFu::TcpOption::SACKOK
- PacketFu::TcpOption::TS
- PacketFu::TcpOption::WS
- PacketFu::TcpOptions
- PacketFu::TcpReserved
- PacketFu::Timestamp
- PacketFu::UDPHeader
- PacketFu::UDPHeaderMixin
- PacketFu::UDPPacket
- PacketFu::Utils
- PacketFu::Write
- StructFu
- StructFu::Int
- StructFu::Int16
- StructFu::Int16be
- StructFu::Int16le
- StructFu::Int32
- StructFu::Int32be
- StructFu::Int32le
- StructFu::Int8
- StructFu::IntString
- StructFu::String
- Struct

No matching classes.

# PacketFu::TcpOption::SACK

Selective Acknowledgement option.

www.networksorcery.com/enp/protocol/tcp/option004.htm

Note that SACK always takes its optlen from the size of the string.

### Public Class Methods

new(args={}) click to toggle source

    # File lib/packetfu/protos/tcp/option.rb, line 209
    def initialize(args={})
      super(
        args.merge(:kind => 5,
                   :optlen => ((args[:value] || "").size + 2)
                  )
      )
    end

### Public Instance Methods

decode() click to toggle source

    # File lib/packetfu/protos/tcp/option.rb, line 224
    def decode
        "SACK:#{self[:value]}"
    end

encode(str) click to toggle source

    # File lib/packetfu/protos/tcp/option.rb, line 228
    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) click to toggle source

    # File lib/packetfu/protos/tcp/option.rb, line 217
    def optlen=(i); typecast i; end

value=(i) click to toggle source

    # File lib/packetfu/protos/tcp/option.rb, line 219
    def value=(i)
      self[:optlen] = Int8.new(i.to_s.size + 2)
      self[:value] = StructFu::String.new(i)
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.