Class: PacketGen::Header::IGMPv3::GroupRecord
- Inherits:
-
Types::Fields
- Object
- Types::Fields
- PacketGen::Header::IGMPv3::GroupRecord
- Includes:
- Types::Fieldable
- Defined in:
- lib/packetgen/header/igmpv3/group_record.rb
Overview
Class to handle IGMPv3 Group Records.
A Group Record is a block of fields containing information pertaining to the sender’s membership in a single multicast group on the interface from which the Report is sent.
A Group Record 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Record Type | Aux Data Len | Number of Sources (N) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Multicast Address |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Source Address [1] |
+- -+
| Source Address [2] |
+- -+
. . .
. . .
. . .
+- -+
| Source Address [N] |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
. .
. Auxiliary Data .
. .
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Constant Summary collapse
- RECORD_TYPES =
Known record types
{ 'MODE_IS_INCLUDE' => 1, 'MODE_IS_EXCLUDE' => 2, 'CHANGE_TO_INCLUDE_MODE' => 3, 'CHANGE_TO_EXCLUDE_MODE' => 4, 'ALLOW_NEW_SOURCES' => 5, 'BLOCK_OLD_SOURCES' => 6 }.freeze
Instance Attribute Summary collapse
- #aux_data ⇒ String
-
#aux_data_len ⇒ Integer
8-bit length of of the Auxiliary Data field (#aux_data), in unit of 32-bit words.
-
#multicast_addr ⇒ IP::Addr
IP multicast address to which this Group Record pertains.
-
#number_of_sources ⇒ Integer
16-bit Number of source addresses in #source_addr.
-
#source_addr ⇒ IP::ArrayOfAddr
Array of source addresses.
-
#type ⇒ Integer
8-bit record type.
Instance Method Summary collapse
Methods included from Types::Fieldable
#format_inspect, #read, #sz, #to_s, #type_name
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::Types::Fields
Instance Attribute Details
#aux_data ⇒ String
80 81 |
# File 'lib/packetgen/header/igmpv3/group_record.rb', line 80 define_field :aux_data, Types::String, builder: ->(h, t) { t.new(length_from: -> { h[:aux_data_len].to_i * 4 }) } |
#aux_data_len ⇒ Integer
8-bit length of of the Auxiliary Data field (#aux_data), in unit of 32-bit words
64 |
# File 'lib/packetgen/header/igmpv3/group_record.rb', line 64 define_field :aux_data_len, Types::Int8, default: 0 |
#multicast_addr ⇒ IP::Addr
IP multicast address to which this Group Record pertains
72 |
# File 'lib/packetgen/header/igmpv3/group_record.rb', line 72 define_field :multicast_addr, IP::Addr, default: '0.0.0.0' |
#number_of_sources ⇒ Integer
16-bit Number of source addresses in #source_addr
68 |
# File 'lib/packetgen/header/igmpv3/group_record.rb', line 68 define_field :number_of_sources, Types::Int16, default: 0 |
#source_addr ⇒ IP::ArrayOfAddr
Array of source addresses
76 77 |
# File 'lib/packetgen/header/igmpv3/group_record.rb', line 76 define_field :source_addr, IP::ArrayOfAddr, builder: ->(h, t) { t.new(counter: h[:number_of_sources]) } |
#type ⇒ Integer
8-bit record type
59 |
# File 'lib/packetgen/header/igmpv3/group_record.rb', line 59 define_field :type, Types::Int8Enum, enum: RECORD_TYPES |
Instance Method Details
#human_type ⇒ Object
83 84 85 |
# File 'lib/packetgen/header/igmpv3/group_record.rb', line 83 def human_type self[:type].to_human end |
#to_human ⇒ Object
87 88 89 |
# File 'lib/packetgen/header/igmpv3/group_record.rb', line 87 def to_human "#{human_type}(ma:#{multicast_addr}|src:#{source_addr.to_human})" end |