Class: PacketGen::Header::OSPFv2::LSRequest

Inherits:
Base show all
Defined in:
lib/packetgen/header/ospfv2/ls_request.rb

Overview

This class handles OSPFv2 Link State Request packets payload. The LSR 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                          LS type                              |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                       Link State ID                           |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                     Advertising Router                        |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                              ...                              |

This paylod is implemented as a unique field: #lsrs, which is an ArrayOfLSR object.

Create a LSRequest payload

# standalone
lsr = PacketGen::Header::OSPFv2::LSRequest.new
# in a packet
pkt = PacketGen.gen('IP', src: source_ip).add('OSPFv2').add('OSPFv2::LSRequest')
# make IP header correct for OSPF
pkt.ospfize
# access to LSRequest payload
pkt.ospfv2_lsrequest    # => PacketGen::Header::OSPFv2::LSRequest

Add LSA requests to a LSRequest

lsr.lsrs << { type: 'Router', link_state_id: '0.0.0.1', advertising_router: '1.1.1.1'}

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

#lsrsArrayOfLSR

Returns:



85
# File 'lib/packetgen/header/ospfv2/ls_request.rb', line 85

define_field :lsrs, ArrayOfLSR