Class: PacketGen::Header::IP::Options

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

Overview

Class to handle IP options

Author:

  • Sylvain Daubert

Constant Summary collapse

HUMAN_SEPARATOR =
';'

Constants included from Types::LengthFrom

Types::LengthFrom::MAX_SZ_TO_READ

Instance 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

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, #type_name

Constructor Details

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

Instance Method Details

#to_sString

Get binary string

Returns:

  • (String)

20
21
22
23
24
# File 'lib/packetgen/header/ip/options.rb', line 20

def to_s
  str = super
  str += ([0] * (4 - (str.length % 4))).pack('C*') if str.length % 4 != 0
  str
end