Class: PacketGen::Header::MLDv2::MLQ

Inherits:
PacketGen::Header::MLD show all
Defined in:
lib/packetgen/header/mldv2/mlq.rb

Overview

This class supports MLDv2 Multicast Listener Query messages.

From RFC 3810, a MLDv2 Multicast Listener Query message has the following format:

                    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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|  Type = 130   |      Code     |           Checksum            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|    Maximum Response Code      |           Reserved            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                                                               |
*                                                               *
|                                                               |
*                       Multicast Address                       *
|                                                               |
*                                                               *
|                                                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Resv  |S| QRV |     QQIC      |     Number of Sources (N)     |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                                                               |
*                                                               *
|                                                               |
*                       Source Address [1]                      *
|                                                               |
*                                                               *
|                                                               |
+-                                                             -+
|                                                               |
*                                                               *
|                                                               |
*                       Source Address [2]                      *
|                                                               |
*                                                               *
|                                                               |
+-                              .                              -+
.                               .                               .
.                               .                               .
+-                                                             -+
|                                                               |
*                                                               *
|                                                               |
*                       Source Address [N]                      *
|                                                               |
*                                                               *
|                                                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

type, code and checksum are fields from ICMPv6 header.

MLQ fields are:

Max Resp Delay

Max Resp Delay is the real delay value. Max Resp Code is the encoded delay. So #max_resp_delay and PacketGen::Header::MLD#max_resp_code attributes reflect this difference.

Author:

  • Sylvain Daubert

Since:

  • 2.4.0

Instance Attribute Summary collapse

Attributes inherited from PacketGen::Header::MLD

#body, #mcast_addr, #reserved

Instance Method Summary collapse

Methods inherited from PacketGen::Header::MLD

#added_to_packet, #mldize

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

#flag_qrvInteger

3-bit QRV (Querier's Robustness Variable)

Returns:

  • (Integer)

106
# File 'lib/packetgen/header/mldv2/mlq.rb', line 106

define_bit_fields_on :flags, :flag_resv, 4, :flag_s, :flag_qrv, 3

#flag_resvInteger

4-bit reserved field in #flags

Returns:

  • (Integer)

106
# File 'lib/packetgen/header/mldv2/mlq.rb', line 106

define_bit_fields_on :flags, :flag_resv, 4, :flag_s, :flag_qrv, 3

#flag_sBoolean

S Flag (Suppress Router-Side Processing)

Returns:

  • (Boolean)

106
# File 'lib/packetgen/header/mldv2/mlq.rb', line 106

define_bit_fields_on :flags, :flag_resv, 4, :flag_s, :flag_qrv, 3

#flagsInteger

8-bit flags

Returns:

  • (Integer)

82
# File 'lib/packetgen/header/mldv2/mlq.rb', line 82

define_field_before :body, :flags, Types::Int8

#number_of_sourcesInteger

16-bit number of sources

Returns:

  • (Integer)

90
# File 'lib/packetgen/header/mldv2/mlq.rb', line 90

define_field_before :body, :number_of_sources, Types::Int16

#qqicInteger

Note:

May return a different value from value previously set, as a float encoding is used to encode big values. See IGMPv3.decode.

Get QQIC value

Returns:

  • (Integer)

Since:

  • 2.4.0


86
# File 'lib/packetgen/header/mldv2/mlq.rb', line 86

define_field_before :body, :qqic, Types::Int8

#source_addrIPv6::ArrayOfAddr

Array of IPv6 source addresses

Returns:


94
95
# File 'lib/packetgen/header/mldv2/mlq.rb', line 94

define_field_before :body, :source_addr, IPv6::ArrayOfAddr,
builder: ->(h, t) { t.new(counter: h[:number_of_sources]) }

Instance Method Details

#max_resp_delayInteger

Note:

May return a different value from value previously set, as a float encoding is used to encode big values. See PacketGen::Header::MLDv2.decode.

Getter for max_resp_code for MLDv2 packets. Use PacketGen::Header::MLDv2.decode.

Returns:

  • (Integer)

Since:

  • 2.4.0


112
113
114
# File 'lib/packetgen/header/mldv2/mlq.rb', line 112

def max_resp_delay
  MLDv2.decode(self[:max_resp_delay].to_i)
end

#max_resp_delay=(value) ⇒ Integer

Setter for max_resp_code for MLDv2 packets. Use PacketGen::Header::MLDv2.encode.

Parameters:

  • value (Integer)

Returns:

  • (Integer)

Since:

  • 2.4.0


120
121
122
# File 'lib/packetgen/header/mldv2/mlq.rb', line 120

def max_resp_delay=(value)
  self[:max_resp_delay].value = MLDv2.encode(value)
end