Class: PacketGen::Header::IP::LSRR
- Defined in:
- lib/packetgen/header/ip/option.rb
Overview
Loose Source and Record Route IP option
Constant Summary
Constants inherited from Option
Option::EOL_TYPE, Option::LSRR_TYPE, Option::NOP_TYPE, Option::RA_TYPE, Option::RR_TYPE, Option::SI_TYPE, Option::SSRR_TYPE
Instance Attribute Summary collapse
-
#data ⇒ BinStruct::Array<IP::Addr>
Array of IP addresses.
-
#pointer ⇒ Integer
8-bit po+++inter on next address.
Attributes inherited from Option
#copied, #length, #option_class, #type
Instance Method Summary collapse
-
#pointed_addr ⇒ Addr
Get IP address pointer by #pointer.
-
#to_human ⇒ String
Get a human readable string.
Methods inherited from Option
build, #initialize, #to_s, types
Constructor Details
This class inherits a constructor from PacketGen::Header::IP::Option
Instance Attribute Details
#data ⇒ BinStruct::Array<IP::Addr>
Array of IP addresses
171 |
# File 'lib/packetgen/header/ip/option.rb', line 171 define_attr :data, ArrayOfAddr, builder: ->(h, t) { t.new(length_from: -> { h.length - 3 }) } |
#pointer ⇒ Integer
8-bit po+++inter on next address
167 |
# File 'lib/packetgen/header/ip/option.rb', line 167 define_attr :pointer, BinStruct::Int8, default: 4 |
Instance Method Details
#pointed_addr ⇒ Addr
Get IP address pointer by #pointer
175 176 177 |
# File 'lib/packetgen/header/ip/option.rb', line 175 def pointed_addr data[pointer / 4 - 1] end |
#to_human ⇒ String
Get a human readable string
181 182 183 184 |
# File 'lib/packetgen/header/ip/option.rb', line 181 def to_human str = self.class.to_s.sub(/.*::/, '') str << ':' << self[:data].to_human end |