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

Inherits:
Base
  • Object
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:

Examples:

Create a DbDescription payload

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

DbDescription attributes

dbd = PacketGen::Header::OSPFv3::DbDescription.new
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 }

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, #to_s

Constructor Details

This class inherits a constructor from PacketGen::Header::Base

Instance Attribute Details

#dc_optInteger

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

Returns:

  • (Integer)


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

OSPFv3.define_options(self)

#e_optInteger

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

Returns:

  • (Integer)


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)


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

define_bit_attr :flags, zz: 13, i_flag: 1, m_flag: 1, ms_flag: 1

#i_flagInteger

Init bit from #flags field

Returns:

  • (Integer)


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

define_bit_attr :flags, zz: 13, i_flag: 1, m_flag: 1, ms_flag: 1

#lsasArrayOfLSA

Array of LSA headers

Returns:



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

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

#m_flagInteger

More bit from #flags field

Returns:

  • (Integer)


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

define_bit_attr :flags, zz: 13, i_flag: 1, m_flag: 1, ms_flag: 1

#ms_flagInteger

Master/Slave bit from #flags field

Returns:

  • (Integer)


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

define_bit_attr :flags, zz: 13, i_flag: 1, m_flag: 1, ms_flag: 1

#mtuInteger

16-bit interface MTU

Returns:

  • (Integer)


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

define_attr :mtu, BinStruct::Int16

#n_optInteger

This bit indicates whether or not the router is attached to an NSSA.

Returns:

  • (Integer)


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

OSPFv3.define_options(self)

#optionsInteger

24-bit options field. Handle #v6_opt, #e_opt, #x_opt, #n_opt, #r_opt and #dc_opt.

Returns:

  • (Integer)


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

OSPFv3.define_options(self)

#r_optInteger

This bit indicates whether the originator is an active router.

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_attr :reserved, BinStruct::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)


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

define_attr :sequence_number, BinStruct::Int32

#v6_optInteger

If this bit is clear, the router/link should be excluded from IPv6 routing calculations.

Returns:

  • (Integer)


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

OSPFv3.define_options(self)

#x_optInteger

This bit should be set to 0, and ignored when received.

Returns:

  • (Integer)


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

OSPFv3.define_options(self)