Class: PacketGen::Header::MLDv2::McastAddressRecord
- Inherits:
-
BinStruct::Struct
- Object
- BinStruct::Struct
- PacketGen::Header::MLDv2::McastAddressRecord
- Includes:
- BinStruct::Structable
- Defined in:
- lib/packetgen/header/mldv2/mcast_address_record.rb
Overview
Class to handle MLDv2 Mcast Address Records (MAR).
A Mcast Address 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 [N] *
| |
* *
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
. .
. Auxiliary Data .
. .
| |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Constant Summary collapse
- RECORD_TYPES =
Known record types
IGMPv3::GroupRecord::RECORD_TYPES
Instance Attribute Summary collapse
-
#aux_data ⇒ String
Auxiliary data.
-
#aux_data_len ⇒ Integer
8-bit length of of the Auxiliary Data field (#aux_data), in unit of 32-bit words.
-
#multicast_addr ⇒ IPv6::Addr
IP multicast address to which this Multicast Address Record pertains.
-
#number_of_sources ⇒ Integer
16-bit Number of source addresses in #source_addr.
-
#source_addr ⇒ IPv6::ArrayOfAddr
Array of source addresses.
-
#type ⇒ Integer
8-bit record type.
Instance Method Summary collapse
-
#human_type ⇒ String
Get human-readable type.
-
#to_human ⇒ String
Get human-readable description.
Instance Attribute Details
#aux_data ⇒ String
Auxiliary data
86 87 |
# File 'lib/packetgen/header/mldv2/mcast_address_record.rb', line 86 define_attr :aux_data, BinStruct::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
69 |
# File 'lib/packetgen/header/mldv2/mcast_address_record.rb', line 69 define_attr :aux_data_len, BinStruct::Int8, default: 0 |
#multicast_addr ⇒ IPv6::Addr
IP multicast address to which this Multicast Address Record pertains
77 |
# File 'lib/packetgen/header/mldv2/mcast_address_record.rb', line 77 define_attr :multicast_addr, IPv6::Addr, default: '::' |
#number_of_sources ⇒ Integer
16-bit Number of source addresses in #source_addr
73 |
# File 'lib/packetgen/header/mldv2/mcast_address_record.rb', line 73 define_attr :number_of_sources, BinStruct::Int16, default: 0 |
#source_addr ⇒ IPv6::ArrayOfAddr
Array of source addresses
81 82 |
# File 'lib/packetgen/header/mldv2/mcast_address_record.rb', line 81 define_attr :source_addr, IPv6::ArrayOfAddr, builder: ->(h, t) { t.new(counter: h[:number_of_sources]) } |
#type ⇒ Integer
8-bit record type
64 |
# File 'lib/packetgen/header/mldv2/mcast_address_record.rb', line 64 define_attr :type, BinStruct::Int8Enum, enum: RECORD_TYPES |
Instance Method Details
#human_type ⇒ String
Get human-readable type
91 92 93 |
# File 'lib/packetgen/header/mldv2/mcast_address_record.rb', line 91 def human_type self[:type].to_human end |
#to_human ⇒ String
Get human-readable description
97 98 99 |
# File 'lib/packetgen/header/mldv2/mcast_address_record.rb', line 97 def to_human "#{human_type}(ma:#{multicast_addr}|src:#{source_addr.to_human})" end |