Class: PacketGen::Header::OSPFv2::DbDescription
- Inherits:
-
Base
- Object
- Types::Fields
- Base
- PacketGen::Header::OSPFv2::DbDescription
- 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:
-
a 16-bit #mtu field (Types::Int16),
-
a 8-bit #options field (Types::Int8),
-
a 8-bit #flags field (Types::Int8). Supported flags are:
-
a 32-bit #sequence_number field (Types::Int32),
-
and an array of LSAHeaders (#lsas, ArrayOfLSA).
Create a DbDescription payload
# standalone
dbd = PacketGen::Header::OSPFv2::DbDescription.new
# in a packet
pkt = PacketGen.gen('IP', src: source_ip).add('OSPFv2').add('OSPFv2::DbDescription')
# access to DbDescription payload
pkt.ospfv2_dbdescription # => PacketGen::Header::OSPFv2::DbDescription
DbDescription attributes
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. = 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 }
# a header may also be set from an existing lsa
dbd.lsas << existing_lsa.to_lsa_header
Instance Attribute Summary collapse
-
#dc_opt ⇒ Boolean
This bit describes the router’s handling of demand circuits.
- #dn_opt ⇒ Boolean
-
#e_opt ⇒ Boolean
This bit describes the way AS-external-LSAs are flooded.
- #flags ⇒ Integer
-
#i_flag ⇒ Boolean
Init bit.
-
#l_opt ⇒ Boolean
This specifies if a LLS Data block is present.
-
#lsas ⇒ ArrayOfLSAHeader
Array of LSA headers.
-
#m_flag ⇒ Boolean
More bit.
-
#mc_opt ⇒ Boolean
This bit describes whether IP multicast datagrams are forwarded.
-
#ms_flag ⇒ Boolean
Master/Slave bit.
- #mt_opt ⇒ Boolean
-
#mtu ⇒ Integer
16-bit interface MTU.
-
#n_opt ⇒ Boolean
This bit specifies if NSSA is supported.
- #o_opt ⇒ Boolean
-
#options ⇒ Integer
8-bit options field.
-
#sequence_number ⇒ Integer
(also: #seqnum)
32-bit DD sequence number, used to sequence the collection of Database Description Packets.
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_opt ⇒ Boolean
This bit describes the router’s handling of demand circuits.
70 |
# File 'lib/packetgen/header/ospfv2/db_description.rb', line 70 OSPFv2.(self) |
#e_opt ⇒ Boolean
This bit describes the way AS-external-LSAs are flooded.
70 |
# File 'lib/packetgen/header/ospfv2/db_description.rb', line 70 OSPFv2.(self) |
#flags ⇒ Integer
75 |
# File 'lib/packetgen/header/ospfv2/db_description.rb', line 75 define_field :flags, Types::Int8 |
#i_flag ⇒ Boolean
Init bit
85 |
# File 'lib/packetgen/header/ospfv2/db_description.rb', line 85 define_bit_fields_on :flags, :zero, 5, :i_flag, :m_flag, :ms_flag |
#l_opt ⇒ Boolean
This specifies if a LLS Data block is present.
70 |
# File 'lib/packetgen/header/ospfv2/db_description.rb', line 70 OSPFv2.(self) |
#lsas ⇒ ArrayOfLSAHeader
Array of LSA headers
98 |
# File 'lib/packetgen/header/ospfv2/db_description.rb', line 98 define_field :lsas, ArrayOfLSA, builder: ->(_h, t) { t.new(only_headers: true) } |
#m_flag ⇒ Boolean
More bit
85 |
# File 'lib/packetgen/header/ospfv2/db_description.rb', line 85 define_bit_fields_on :flags, :zero, 5, :i_flag, :m_flag, :ms_flag |
#mc_opt ⇒ Boolean
This bit describes whether IP multicast datagrams are forwarded.
70 |
# File 'lib/packetgen/header/ospfv2/db_description.rb', line 70 OSPFv2.(self) |
#ms_flag ⇒ Boolean
Master/Slave bit
85 |
# File 'lib/packetgen/header/ospfv2/db_description.rb', line 85 define_bit_fields_on :flags, :zero, 5, :i_flag, :m_flag, :ms_flag |
#mtu ⇒ Integer
16-bit interface MTU
67 |
# File 'lib/packetgen/header/ospfv2/db_description.rb', line 67 define_field :mtu, Types::Int16 |
#n_opt ⇒ Boolean
This bit specifies if NSSA is supported.
70 |
# File 'lib/packetgen/header/ospfv2/db_description.rb', line 70 OSPFv2.(self) |
#options ⇒ Integer
70 |
# File 'lib/packetgen/header/ospfv2/db_description.rb', line 70 OSPFv2.(self) |