Class: PacketGen::Header::TCP::Options

Inherits:
Types::Array show all
Defined in:
lib/packetgen/header/tcp/options.rb

Overview

Container for TCP options in TCP header.

Author:

  • Sylvain Daubert

Constant Summary

Constants inherited from Types::Array

Types::Array::HUMAN_SEPARATOR

Constants included from Types::LengthFrom

Types::LengthFrom::MAX_SZ_TO_READ

Class Method Summary collapse

Methods inherited from Types::Array

#<<, #==, #[], #clear, #clear!, #delete, #delete_at, #each, #empty?, #first, #initialize, #initialize_copy, #last, #push, #read, set_of, set_of_klass, #size, #sz, #to_a, #to_human, #to_s

Methods included from Types::LengthFrom

#initialize_length_from, #read_with_length_from, #sz_to_read

Methods included from Types::Fieldable

#format_inspect, #read, #sz, #to_human, #to_s, #type_name

Constructor Details

This class inherits a constructor from PacketGen::Types::Array

Class Method Details

.option_classesArray<Class>

Returns:

  • (Array<Class>)


21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/packetgen/header/tcp/options.rb', line 21

def self.option_classes
  return @klasses if defined? @klasses

  @klasses = []
  Option.constants.each do |cst|
    next unless cst.to_s.end_with? '_KIND'

    optname = cst.to_s.sub('_KIND', '')
    @klasses[Option.const_get(cst)] = TCP.const_get(optname)
  end
  @klasses
end