Class: PacketGen::Header::OSPFv2::DbDescription

Inherits:
Base
  • Object
show all
Defined in:
lib/packetgen/header/ospfv2/db_description.rb

Overview

This class handles OSPFv2 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|         Interface MTU         |    Options    |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::OSPFv2::DbDescription.new
# in a packet
pkt = PacketGen.gen('IP').add('OSPFv2').add('OSPFv2::DbDescription')
pkt.ospfize
# access to DbDescription payload
pkt.ospfv2_dbdescription.class    # => PacketGen::Header::OSPFv2::DbDescription

DbDescription attributes

dbd = PacketGen::Header::OSPFv2::DbDescription.new
dbd.mtu = 1500
# set options. Options may also be set one by one with {#mt_opt},
# {#e_opt}, {#mc_opt}, {#n_opt}, {#l_opt}, {#dc_opt}, {#o_opt} and {#dn_opt}
dbd.options = 0
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)


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

OSPFv2.define_options(self)

#dn_optInteger

Returns:

  • (Integer)


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

OSPFv2.define_options(self)

#e_optInteger

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

Returns:

  • (Integer)


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

OSPFv2.define_options(self)

#flagsInteger

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

Returns:

  • (Integer)


84
# File 'lib/packetgen/header/ospfv2/db_description.rb', line 84

define_bit_attr :flags, zero: 5, i_flag: 1, m_flag: 1, ms_flag: 1

#i_flagInteger

Init bit

Returns:

  • (Integer)


84
# File 'lib/packetgen/header/ospfv2/db_description.rb', line 84

define_bit_attr :flags, zero: 5, i_flag: 1, m_flag: 1, ms_flag: 1

#l_optInteger

This specifies if a LLS Data block is present.

Returns:

  • (Integer)


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

OSPFv2.define_options(self)

#lsasArrayOfLSAHeader

Array of LSA headers

Returns:

  • (ArrayOfLSAHeader)


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

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

#m_flagInteger

More bit

Returns:

  • (Integer)


84
# File 'lib/packetgen/header/ospfv2/db_description.rb', line 84

define_bit_attr :flags, zero: 5, i_flag: 1, m_flag: 1, ms_flag: 1

#mc_optInteger

This bit describes whether IP multicast datagrams are forwarded.

Returns:

  • (Integer)


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

OSPFv2.define_options(self)

#ms_flagInteger

Master/Slave bit

Returns:

  • (Integer)


84
# File 'lib/packetgen/header/ospfv2/db_description.rb', line 84

define_bit_attr :flags, zero: 5, i_flag: 1, m_flag: 1, ms_flag: 1

#mt_optInteger

Returns:

  • (Integer)


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

OSPFv2.define_options(self)

#mtuInteger

16-bit interface MTU

Returns:

  • (Integer)


67
# File 'lib/packetgen/header/ospfv2/db_description.rb', line 67

define_attr :mtu, BinStruct::Int16

#n_optInteger

This bit specifies if NSSA is supported.

Returns:

  • (Integer)


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

OSPFv2.define_options(self)

#o_optInteger

Returns:

  • (Integer)


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

OSPFv2.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)


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

OSPFv2.define_options(self)

#sequence_numberInteger Also known as: seqnum

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

Returns:

  • (Integer)


90
# File 'lib/packetgen/header/ospfv2/db_description.rb', line 90

define_attr :sequence_number, BinStruct::Int32