Class: PacketGen::Header::IPv6::Extension Abstract
- Inherits:
-
Base
- Object
- Types::Fields
- Base
- PacketGen::Header::IPv6::Extension
- Defined in:
- lib/packetgen/header/ipv6/extension.rb
Overview
You should not use this class but its subclasses.
Base class to handle IPv6 extensions A IPv6 extension header has the following format:
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 .
. .
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Such a header consists of:
-
a #next header field (Types::Int8),
-
a #length field (Types::Int8),
-
an #options field (Types::String),
-
and a #body, containing next header.
Direct Known Subclasses
Instance Attribute Summary collapse
- #body ⇒ String, Base
-
#length ⇒ Integer
8-bit extension length, in 8-octets units, not including the first 8 octets.
-
#next ⇒ Integer
8-bit Next header field.
-
#options ⇒ String
Specific options of extension header.
Instance Method Summary collapse
-
#calc_length ⇒ Integer
Compute length and set
len
field. -
#real_length ⇒ Integer
Get real extension header length.
Methods inherited from Base
bind, calculate_and_set_length, #header_id, inherited, #initialize, #ip_header, #ll_header
Methods included from PacketGen::Headerable
#added_to_packet, included, #method_name, #packet, #packet=, #parse?, #protocol_name, #read
Methods inherited from Types::Fields
#[], #[]=, #bits_on, define_bit_fields_on, define_field, define_field_after, define_field_before, #fields, fields, inherited, #initialize, #inspect, #offset_of, #optional?, #optional_fields, #present?, #read, 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
#body ⇒ String, Base
50 |
# File 'lib/packetgen/header/ipv6/extension.rb', line 50 define_field :body, Types::String |
#length ⇒ Integer
8-bit extension length, in 8-octets units, not including the first 8 octets.
42 |
# File 'lib/packetgen/header/ipv6/extension.rb', line 42 define_field :length, Types::Int8 |
Instance Method Details
#calc_length ⇒ Integer
Compute length and set len
field
60 61 62 |
# File 'lib/packetgen/header/ipv6/extension.rb', line 60 def calc_length self.length = (.sz + 2) / 8 - 1 end |
#real_length ⇒ Integer
Get real extension header length
54 55 56 |
# File 'lib/packetgen/header/ipv6/extension.rb', line 54 def real_length (length + 1) * 8 end |