Class: PacketGen::Header::OSPFv3::LSAck

Inherits:
Base show all
Defined in:
lib/packetgen/header/ospfv3/ls_ack.rb

Overview

This class handles OSPFv3 Link State Acknownledgment packets payload. The LSAck payload 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                                                               |
+-                                                            +-+
|                             LSAs                              |
+-                                                            +-+
|                              ...                              |

This paylod is implemented with only one field:

Create a LSAck payload

# standalone
lsack = PacketGen::Header::OSPFv3::LSAck.new
# in a packet
pkt = PacketGen.gen('IPv6', src: source_ip).add('OSPFv3').add('OSPFv3::LSAck')
# access to LSAck payload
lasck = pkt.ospfv3_lsack    # => PacketGen::Header::OSPFv3::LSAck

Adding LSA headers to a LSAck payload

lsack.lsas << { type: 'Router', age: 40, link_state_id: '0.0.0.1', advertising_router: '1.1.1.1', sequence_number: 42, checksum: 0x1234, length: 56 }
# a header may also be set from an existing lsa
lasck.lsas << existing_lsa.to_lsa_header

Author:

  • Sylvain Daubert

Since:

  • 2.5.0

Instance Attribute Summary collapse

Method Summary

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

#lsasArrayOfLSA

Array of LSAs

Returns:


42
43
# File 'lib/packetgen/header/ospfv3/ls_ack.rb', line 42

define_field :lsas, ArrayOfLSA,
builder: ->(_h, t) { t.new(only_headers: true) }