Class: PacketGen::Header::IPv6::HopByHop
- Inherits:
-
Extension
- Object
- Types::Fields
- Base
- Extension
- PacketGen::Header::IPv6::HopByHop
- Defined in:
- lib/packetgen/header/ipv6/hop_by_hop.rb
Overview
Hop-by-hop IPv6 extension
0 1 2 3
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Next Header | Hdr Ext Len | |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ +
| |
. .
. Options .
. .
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Hop-by-hop IPv6 extension header consists of:
-
a Extension#next header field (Types::Int8),
-
a Extension#length field (Types::Int8),
-
and a Extension#body, containing next header.
Instance Attribute Summary collapse
-
#options ⇒ Options
Specific options of extension header.
Attributes inherited from Extension
Attributes inherited from Base
Instance Method Summary collapse
-
#read(str) ⇒ self
Populate object from a binary string.
Methods inherited from Extension
Methods inherited from Base
#added_to_packet, bind, bind_header, calculate_and_set_length, #header_id, inherited, #initialize, #ip_header, known_headers, #ll_header, #method_name, #parse?, #protocol_name, protocol_name
Methods inherited from Types::Fields
#[], #[]=, #bits_on, #body=, define_bit_fields_on, define_field, define_field_after, define_field_before, delete_field, #fields, fields, #force_binary, inherited, #initialize, #inspect, #is_optional?, #is_present?, #offset_of, #optional?, #optional_fields, #present?, remove_bit_fields_on, remove_field, #sz, #to_h, #to_s, update_field
Constructor Details
This class inherits a constructor from PacketGen::Header::Base
Instance Attribute Details
Instance Method Details
#read(str) ⇒ self
Populate object from a binary string
119 120 121 122 123 124 125 126 127 |
# File 'lib/packetgen/header/ipv6/hop_by_hop.rb', line 119 def read(str) return self if str.nil? force_binary str self[:next].read str[0, 1] self[:length].read str[1, 1] self[:options].read str[2, real_length - 2] self[:body].read str[real_length..-1] self end |