Class: PacketGen::Header::OSPFv3::Hello
- Inherits:
-
Base
- Object
- Types::Fields
- Base
- PacketGen::Header::OSPFv3::Hello
- Defined in:
- lib/packetgen/header/ospfv3/hello.rb
Overview
This class handles OSPFv3 HELLO packets payload. The HELLO 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 ID |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Rtr Priority | Options |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| HelloInterval | RouterDeadInterval |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Designated Router ID |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Backup Designated Router ID |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Neighbor ID |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| ... |
A HELLO payload consists of:
-
a #interface_id field (Types::Int32),
-
a #priority field (Types::Int8),
-
an #options field (Types::Int24),
-
a #hello_interval field (Types::Int16),
-
a #dead_interval field (Types::Int16),
-
a #designated_router field (IP::Addr),
-
a #backup_designated_router field (IP::Addr),
-
a #neighbors array containing neighbors as IP::Addr.
Create a HELLO payload
# standalone
hello = PacketGen::Header::OSPFv3::Hello.new
# in a packet
pkt = PacketGen.gen('IPv6', src: source_ip).add('OSPFv3').add('OSPFv3::Hello')
# make IPv6 header correct for OSPF
pkt.ospfize
# access to Hello payload
pkt.ospfv3_hello # => PacketGen::Header::OSPFv3::Hello
HELLO attributes
hello.interface_id = 1
hello.priority = 1
# set options. Options may also be set one by one with #v6_opt, #e_opt,
# #n_opt, #r_opt and #dc_opt
hello. = 0x33
hello.hello_interval = 10
hello.dead_interval = 300
hello.designated_router = '0.0.0.1'
hello.backup_designated_router = '0.0.0.2'
# set neighbors identifiers
hello.neighbors << '1.1.1.1'
hello.neighbors << '2.2.2.2'
Instance Attribute Summary collapse
-
#backup_designated_router ⇒ String
The identity of the Backup Designated Router for this network, in the view of the sending router.
-
#dc_opt ⇒ Boolean
This bit describes the router’s handling of demand circuits.
-
#dead_interval ⇒ Integer
The number of seconds before declaring a silent router down.
-
#designated_router ⇒ String
The identity of the Designated Router for this network, in the view of the sending router.
-
#e_opt ⇒ Boolean
This bit describes the way AS-external-LSAs are flooded.
-
#hello_interval ⇒ Integer
The number of seconds between this router’s Hello packets.
-
#interface_id ⇒ String
The network mask associated with this interface.
-
#n_opt ⇒ Boolean
This bit indicates whether or not the router is attached to an NSSA.
-
#neighbors ⇒ IP::ArrayOfAddr
Array of neighbors.
-
#options ⇒ Integer
24-bit options field.
-
#priority ⇒ Integer
This router’s Router Priority.
-
#r_opt ⇒ Boolean
This bit indicates whether the originator is an active router.
-
#v6_opt ⇒ Boolean
If this bit is clear, the router/link should be excluded from IPv6 routing calculations.
-
#x_opt ⇒ Boolean
This bit should be set to 0, and ignored when received.
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
#backup_designated_router ⇒ String
The identity of the Backup Designated Router for this network, in the view of the sending router.
93 |
# File 'lib/packetgen/header/ospfv3/hello.rb', line 93 define_field :backup_designated_router, IP::Addr |
#dc_opt ⇒ Boolean
This bit describes the router’s handling of demand circuits.
75 |
# File 'lib/packetgen/header/ospfv3/hello.rb', line 75 OSPFv3.(self) |
#dead_interval ⇒ Integer
The number of seconds before declaring a silent router down.
83 |
# File 'lib/packetgen/header/ospfv3/hello.rb', line 83 define_field :dead_interval, Types::Int16 |
#designated_router ⇒ String
The identity of the Designated Router for this network, in the view of the sending router.
88 |
# File 'lib/packetgen/header/ospfv3/hello.rb', line 88 define_field :designated_router, IP::Addr |
#e_opt ⇒ Boolean
This bit describes the way AS-external-LSAs are flooded.
75 |
# File 'lib/packetgen/header/ospfv3/hello.rb', line 75 OSPFv3.(self) |
#hello_interval ⇒ Integer
The number of seconds between this router’s Hello packets.
79 |
# File 'lib/packetgen/header/ospfv3/hello.rb', line 79 define_field :hello_interval, Types::Int16 |
#interface_id ⇒ String
The network mask associated with this interface.
68 |
# File 'lib/packetgen/header/ospfv3/hello.rb', line 68 define_field :interface_id, Types::Int32 |
#n_opt ⇒ Boolean
This bit indicates whether or not the router is attached to an NSSA.
75 |
# File 'lib/packetgen/header/ospfv3/hello.rb', line 75 OSPFv3.(self) |
#neighbors ⇒ IP::ArrayOfAddr
Array of neighbors
97 |
# File 'lib/packetgen/header/ospfv3/hello.rb', line 97 define_field :neighbors, IP::ArrayOfAddr |
#options ⇒ Integer
75 |
# File 'lib/packetgen/header/ospfv3/hello.rb', line 75 OSPFv3.(self) |
#priority ⇒ Integer
This router’s Router Priority. Used in (Backup) Designated Router election.
73 |
# File 'lib/packetgen/header/ospfv3/hello.rb', line 73 define_field :priority, Types::Int8 |
#r_opt ⇒ Boolean
This bit indicates whether the originator is an active router.
75 |
# File 'lib/packetgen/header/ospfv3/hello.rb', line 75 OSPFv3.(self) |
#v6_opt ⇒ Boolean
If this bit is clear, the router/link should be excluded from IPv6 routing calculations.
75 |
# File 'lib/packetgen/header/ospfv3/hello.rb', line 75 OSPFv3.(self) |
#x_opt ⇒ Boolean
This bit should be set to 0, and ignored when received.
75 |
# File 'lib/packetgen/header/ospfv3/hello.rb', line 75 OSPFv3.(self) |