Class: PacketGen::Header::OSPFv2::Link

Inherits:
BinStruct::Struct
  • Object
show all
Includes:
BinStruct::Structable
Defined in:
lib/packetgen/header/ospfv2/lsa.rb

Overview

This class handles links in a LSA router payload.

Author:

  • Sylvain Daubert

Since:

  • 2.5.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#dataIP::Addr

Link data

Returns:



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

define_attr :data, IP::Addr

#idIP::Addr

Identify the link

Returns:



63
# File 'lib/packetgen/header/ospfv2/lsa.rb', line 63

define_attr :id, IP::Addr

#metricInteger

The cost of using this router link

Returns:

  • (Integer)


83
# File 'lib/packetgen/header/ospfv2/lsa.rb', line 83

define_attr :metric, BinStruct::Int16

#tosArrayOfTosMetric

Additionnal TOS metrics

Returns:



87
# File 'lib/packetgen/header/ospfv2/lsa.rb', line 87

define_attr :tos, ArrayOfTosMetric, builder: ->(h, t) { t.new(counter: h[:tos_count]) }

#tos_countInteger

Count of #TOS metrics

Returns:

  • (Integer)


79
# File 'lib/packetgen/header/ospfv2/lsa.rb', line 79

define_attr :tos_count, BinStruct::Int8

#typeInteger

Link type.

  • 1: Point-to-point connection to another router

  • 2: Connection to a transit network

  • 3: Connection to a stub network

  • 4: Virtual link

Returns:

  • (Integer)


75
# File 'lib/packetgen/header/ospfv2/lsa.rb', line 75

define_attr :type, BinStruct::Int8

Instance Method Details

#to_humanString

Get human-readable description

Returns:

  • (String)

Since:

  • 2.5.0



91
92
93
# File 'lib/packetgen/header/ospfv2/lsa.rb', line 91

def to_human
  "<type:#{type},metric:#{metric},id:#{id},data:#{data}>"
end