Class: PacketGen::Header::OSPFv3::DbDescription

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

Overview

This class handles OSPFv3 DB description packets payload. The DB description 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+--+
|       0       |               Options                          |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+--+
|        Interface MTU          |      0        |0|0|0|0|0|I|M|MS|
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+--+
|                     DD sequence number                         |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+--+
|                                                                |
+-                                                              -+
|                                                                |
+-                      An LSA Header                           -+
|                                                                |
+-                                                              -+
|                                                                |
+-                                                              -+
|                                                                |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+--+
|                              ...                               |

A DB description payload is composed of:

Create a DbDescription payload

# standalone
dbd = PacketGen::Header::OSPFv3::DbDescription.new
# in a packet
pkt = PacketGen.gen('IPv6', src: source_ip).add('OSPFv3').add('OSPFv3::DbDescription')
# access to DbDescription payload
pkt.ospfv3_dbdescription    # => PacketGen::Header::OSPFv3::DbDescription

DbDescription attributes

dbd.reserved = 0
# set options. Options may also be set one by one with #v6_opt, #e_opt,
# #n_opt, #r_opt and #dc_opt
dbd.options = 0x33
dbd.mtu = 1500
dbd.flags = 0
dbd.seqnum = 0x800001
# add a LSA Router header
dbd.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
dbd.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

#dc_optBoolean

This bit describes the router's handling of demand circuits.

Returns:

  • (Boolean)

73
# File 'lib/packetgen/header/ospfv3/db_description.rb', line 73

OSPFv3.define_options(self)

#dn_optBoolean

Returns:

  • (Boolean)

73
# File 'lib/packetgen/header/ospfv3/db_description.rb', line 73

OSPFv3.define_options(self)

#e_optBoolean

This bit describes the way AS-external-LSAs are flooded.

Returns:

  • (Boolean)

73
# File 'lib/packetgen/header/ospfv3/db_description.rb', line 73

OSPFv3.define_options(self)

#flagsInteger

16-bit interface flags (#i_flag, #m_flag and #ms_flag)

Returns:

  • (Integer)

82
# File 'lib/packetgen/header/ospfv3/db_description.rb', line 82

define_field :flags, Types::Int16

#i_flagBoolean

Init bit from #flags field

Returns:

  • (Boolean)

92
# File 'lib/packetgen/header/ospfv3/db_description.rb', line 92

define_bit_fields_on :flags, :zz, 13, :i_flag, :m_flag, :ms_flag

#l_optBoolean

This specifies if a LLS Data block is present.

Returns:

  • (Boolean)

73
# File 'lib/packetgen/header/ospfv3/db_description.rb', line 73

OSPFv3.define_options(self)

#lsasArrayOfLSAHeader

Array of LSA headers

Returns:

  • (ArrayOfLSAHeader)

105
# File 'lib/packetgen/header/ospfv3/db_description.rb', line 105

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

#m_flagBoolean

More bit from #flags field

Returns:

  • (Boolean)

92
# File 'lib/packetgen/header/ospfv3/db_description.rb', line 92

define_bit_fields_on :flags, :zz, 13, :i_flag, :m_flag, :ms_flag

#mc_optBoolean

This bit describes whether IP multicast datagrams are forwarded.

Returns:

  • (Boolean)

73
# File 'lib/packetgen/header/ospfv3/db_description.rb', line 73

OSPFv3.define_options(self)

#ms_flagBoolean

Master/Slave bit from #flags field

Returns:

  • (Boolean)

92
# File 'lib/packetgen/header/ospfv3/db_description.rb', line 92

define_bit_fields_on :flags, :zz, 13, :i_flag, :m_flag, :ms_flag

#mt_optBoolean

Returns:

  • (Boolean)

73
# File 'lib/packetgen/header/ospfv3/db_description.rb', line 73

OSPFv3.define_options(self)

#mtuInteger

16-bit interface MTU

Returns:

  • (Integer)

78
# File 'lib/packetgen/header/ospfv3/db_description.rb', line 78

define_field :mtu, Types::Int16

#n_optBoolean

This bit specifies if NSSA is supported.

Returns:

  • (Boolean)

73
# File 'lib/packetgen/header/ospfv3/db_description.rb', line 73

OSPFv3.define_options(self)

#o_optBoolean

Returns:

  • (Boolean)

73
# File 'lib/packetgen/header/ospfv3/db_description.rb', line 73

OSPFv3.define_options(self)

#optionsInteger

8-bit options field. Handle #mt_opt, #e_opt, #mc_opt, #n_opt, #l_opt, #dc_opt, #o_opt and #dn_opt.

Returns:

  • (Integer)

73
# File 'lib/packetgen/header/ospfv3/db_description.rb', line 73

OSPFv3.define_options(self)

#reservedInteger

8-bit zero field before #options one

Returns:

  • (Integer)

70
# File 'lib/packetgen/header/ospfv3/db_description.rb', line 70

define_field :reserved, Types::Int8, default: 0

#sequence_numberInteger Also known as: seqnum

32-bit DD sequence number, used to sequence the collection of Database Description Packets.

Returns:

  • (Integer)

98
# File 'lib/packetgen/header/ospfv3/db_description.rb', line 98

define_field :sequence_number, Types::Int32