lib/packetgen/header/ospfv2.rb in packetgen-2.6.0 vs lib/packetgen/header/ospfv2.rb in packetgen-2.7.0
- old
+ new
@@ -5,11 +5,10 @@
# frozen_string_literal: true
module PacketGen
module Header
-
# This class supports OSPFv2 (RFC 2328).
# A OSPFv2 header 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
@@ -67,31 +66,31 @@
# * {OSPFv2::LSRequest},
# * {OSPFv2::LSUpdate},
# * or {OSPFv2::LSAck}.
#
# @author Sylvain Daubert
+ # @since 2.5.0
class OSPFv2 < Base
-
# IP protocol number for OSPF
IP_PROTOCOL = 89
-
+
# OSPF packet types
- TYPES = {
+ TYPES = {
'HELLO' => 1,
'DB_DESCRIPTION' => 2,
'LS_REQUEST' => 3,
'LS_UPDATE' => 4,
'LS_ACK' => 5
- }
+ }.freeze
# Authentication types
AU_TYPES = {
'NO_AUTH' => 0,
'PASSWORD' => 1,
'CRYPTO' => 2,
'CRYPTO_WITH_ESN' => 3
- }
+ }.freeze
# @!attribute version
# 8-bit OSPF version
# @return [Integer]
define_field :version, Types::Int8, default: 2
@@ -234,10 +233,10 @@
ip.ttl = 1 if ip[:dst].mcast?
end
end
self.add_class OSPFv2
- IP.bind_header OSPFv2, protocol: OSPFv2::IP_PROTOCOL
+ IP.bind OSPFv2, protocol: OSPFv2::IP_PROTOCOL
end
end
require_relative 'ospfv2/hello'
require_relative 'ospfv2/lsa_header'