Class: PacketGen::Header::OSPFv2::LSUpdate
- Defined in:
- lib/packetgen/header/ospfv2/ls_update.rb
Overview
This class handles OSPFv2 Link State Update packets payload. The LSU 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| # LSAs |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| |
+- +-+
| LSAs |
+- +-+
| ... |
This paylod is implemented with two fields:
-
#lsas_count, a
BinStruct::Int32
field, -
and #lsas, an ArrayOfLSA object.
Instance Attribute Summary collapse
-
#lsas ⇒ ArrayOfLSA
Array of LSAs.
-
#lsas_count ⇒ Integer
Count of LSAs included in this update.
Instance Method Summary collapse
-
#calc_checksum ⇒ void
Calculate checksums of all LSAs.
-
#calc_length ⇒ Object
Calculate length of all LSAs.
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
#lsas ⇒ ArrayOfLSA
Array of LSAs
54 |
# File 'lib/packetgen/header/ospfv2/ls_update.rb', line 54 define_attr :lsas, ArrayOfLSA, builder: ->(h, t) { t.new(counter: h[:lsas_count]) } |
#lsas_count ⇒ Integer
Count of LSAs included in this update
50 |
# File 'lib/packetgen/header/ospfv2/ls_update.rb', line 50 define_attr :lsas_count, BinStruct::Int32 |
Instance Method Details
#calc_checksum ⇒ void
This method returns an undefined value.
Calculate checksums of all LSAs
58 59 60 |
# File 'lib/packetgen/header/ospfv2/ls_update.rb', line 58 def calc_checksum lsas.each(&:calc_checksum) end |
#calc_length ⇒ Object
Calculate length of all LSAs
63 64 65 |
# File 'lib/packetgen/header/ospfv2/ls_update.rb', line 63 def calc_length lsas.each(&:calc_length) end |