A Discrete-Event Network Simulator
API
Loading...
Searching...
No Matches
ns3::GlobalRoutingLinkRecord< T > Class Template Reference

A single link record for a link state advertisement. More...

#include "global-router-interface.h"

Inheritance diagram for ns3::GlobalRoutingLinkRecord< T >:
Collaboration diagram for ns3::GlobalRoutingLinkRecord< T >:

Public Types

enum  LinkType {
  Unknown = 0 , PointToPoint , TransitNetwork , StubNetwork ,
  VirtualLink
}
 Enumeration of the possible types of Global Routing Link Records. More...

Public Member Functions

 GlobalRoutingLinkRecord ()
 Construct an empty ("uninitialized") Global Routing Link Record.
 GlobalRoutingLinkRecord (LinkType linkType, IpAddress linkId, IpAddress linkData, IpAddress linkLocData, uint16_t metric)
 Construct an initialized Global Routing Link Record.
 GlobalRoutingLinkRecord (LinkType linkType, IpAddress linkId, IpAddress linkData, uint16_t metric)
 Construct an initialized Global Routing Link Record.
 ~GlobalRoutingLinkRecord ()
 Destroy a Global Routing Link Record.
IpAddress GetLinkData () const
 Get the Link Data field of the Global Routing Link Record.
IpAddress GetLinkId () const
 Get the Link ID field of the Global Routing Link Record.
IpAddress GetLinkLocData ()
 Set the Link Local Data field of the Global Routing Link Record.
LinkType GetLinkType () const
 Get the Link Type field of the Global Routing Link Record.
uint16_t GetMetric () const
 Get the Metric Data field of the Global Routing Link Record.
void SetLinkData (IpAddress addr)
 Set the Link Data field of the Global Routing Link Record.
void SetLinkId (IpAddress addr)
 Set the Link ID field of the Global Routing Link Record.
void SetLinkLocData (IpAddress addr)
 Set the Link Local Data field of the Global Routing Link Record.
void SetLinkType (LinkType linkType)
 Set the Link Type field of the Global Routing Link Record.
void SetMetric (uint16_t metric)
 Set the Metric Data field of the Global Routing Link Record.

Private Types

using Ip = typename std::conditional_t<IsIpv4, Ipv4, Ipv6>
 Alias for Ipv4 and Ipv6 classes.
using IpAddress = typename std::conditional_t<IsIpv4, Ipv4Address, Ipv6Address>
 Alias for Ipv4Address and Ipv6Address classes.
using IpHeader = typename std::conditional_t<IsIpv4, Ipv4Header, Ipv6Header>
 Alias for Ipv4Header and Ipv6Header classes.
using IpInterfaceAddress
 Alias for Ipv4InterfaceAddress and Ipv6InterfaceAddress classes.
using IpMaskOrPrefix = typename std::conditional_t<IsIpv4, Ipv4Mask, Ipv6Prefix>
 Alias for Ipv4Mask And Ipv6Prefix.
using IpRoute = typename std::conditional_t<IsIpv4, Ipv4Route, Ipv6Route>
 Alias for Ipv4Route and Ipv6Route classes.
using IpRoutingTableEntry
 Alias for Ipv4RoutingTableEntry and Ipv6RoutingTableEntry classes.

Private Attributes

IpAddress m_linkData
 m_linkId and m_linkData are defined by OSPF to have different meanings depending on the type of link a given link records represents.
IpAddress m_linkId
 m_linkId and m_linkData are defined by OSPF to have different meanings depending on the type of link a given link records represents.
IpAddress m_linkLocData
 m_linkLocData is not defined by the OSPF spec.
LinkType m_linkType
 The type of the Global Routing Link Record.
uint16_t m_metric
 The metric for a given link.

Static Private Attributes

static constexpr bool IsIpv4 = std::is_same_v<Ipv4Manager, T>
 Alias for determining whether the parent is Ipv4RoutingProtocol or Ipv6RoutingProtocol.

Friends

template<typename>
class GlobalRoutingLSA
 Friend class.

Detailed Description

template<typename T>
class ns3::GlobalRoutingLinkRecord< T >

A single link record for a link state advertisement.

The GlobalRoutingLinkRecord is modeled after the OSPF link record field of a Link State Advertisement. Right now we will only see two types of link records corresponding to a stub network and a point-to-point link (channel).

Definition at line 49 of file global-router-interface.h.

Member Typedef Documentation

◆ Ip

template<typename T>
using ns3::GlobalRoutingLinkRecord< T >::Ip = typename std::conditional_t<IsIpv4, Ipv4, Ipv6>
private

Alias for Ipv4 and Ipv6 classes.

Definition at line 58 of file global-router-interface.h.

◆ IpAddress

template<typename T>
using ns3::GlobalRoutingLinkRecord< T >::IpAddress = typename std::conditional_t<IsIpv4, Ipv4Address, Ipv6Address>
private

Alias for Ipv4Address and Ipv6Address classes.

Definition at line 61 of file global-router-interface.h.

◆ IpHeader

template<typename T>
using ns3::GlobalRoutingLinkRecord< T >::IpHeader = typename std::conditional_t<IsIpv4, Ipv4Header, Ipv6Header>
private

Alias for Ipv4Header and Ipv6Header classes.

Definition at line 67 of file global-router-interface.h.

◆ IpInterfaceAddress

template<typename T>
using ns3::GlobalRoutingLinkRecord< T >::IpInterfaceAddress
private
Initial value:
typename std::conditional_t<IsIpv4, Ipv4InterfaceAddress, Ipv6InterfaceAddress>

Alias for Ipv4InterfaceAddress and Ipv6InterfaceAddress classes.

Definition at line 70 of file global-router-interface.h.

◆ IpMaskOrPrefix

template<typename T>
using ns3::GlobalRoutingLinkRecord< T >::IpMaskOrPrefix = typename std::conditional_t<IsIpv4, Ipv4Mask, Ipv6Prefix>
private

Alias for Ipv4Mask And Ipv6Prefix.

Definition at line 78 of file global-router-interface.h.

◆ IpRoute

template<typename T>
using ns3::GlobalRoutingLinkRecord< T >::IpRoute = typename std::conditional_t<IsIpv4, Ipv4Route, Ipv6Route>
private

Alias for Ipv4Route and Ipv6Route classes.

Definition at line 64 of file global-router-interface.h.

◆ IpRoutingTableEntry

template<typename T>
using ns3::GlobalRoutingLinkRecord< T >::IpRoutingTableEntry
private
Initial value:
typename std::conditional_t<IsIpv4, Ipv4RoutingTableEntry, Ipv6RoutingTableEntry>

Alias for Ipv4RoutingTableEntry and Ipv6RoutingTableEntry classes.

Definition at line 74 of file global-router-interface.h.

Member Enumeration Documentation

◆ LinkType

template<typename T>
enum ns3::GlobalRoutingLinkRecord::LinkType

Enumeration of the possible types of Global Routing Link Records.

These values are defined in the OSPF spec. We currently only use PointToPoint and StubNetwork types.

Enumerator
Unknown 

Uninitialized Link Record.

PointToPoint 

Record representing a point to point channel.

TransitNetwork 

Unused – for future OSPF compatibility.

StubNetwork 

Record represents a leaf node network.

VirtualLink 

Unused – for future OSPF compatibility.

Definition at line 91 of file global-router-interface.h.

Constructor & Destructor Documentation

◆ GlobalRoutingLinkRecord() [1/3]

template<typename T>
ns3::GlobalRoutingLinkRecord< T >::GlobalRoutingLinkRecord ( )

Construct an empty ("uninitialized") Global Routing Link Record.

The Link ID and Link Data Ipv4 addresses are set to "0.0.0.0"; The Link Type is set to Unknown; The metric is set to 0.

Definition at line 39 of file global-router-interface.cc.

References m_linkData, m_linkId, m_linkLocData, m_linkType, m_metric, NS_LOG_FUNCTION, and Unknown.

◆ GlobalRoutingLinkRecord() [2/3]

template<typename T>
ns3::GlobalRoutingLinkRecord< T >::GlobalRoutingLinkRecord ( LinkType linkType,
IpAddress linkId,
IpAddress linkData,
uint16_t metric )

Construct an initialized Global Routing Link Record.

Parameters
linkTypeThe type of link record to construct.
linkIdThe link ID for the record.
linkDataThe link data field for the record.
metricThe metric field for the record.
See also
LinkType
SetLinkId
SetLinkData

Definition at line 50 of file global-router-interface.cc.

References m_linkData, m_linkId, m_linkLocData, m_linkType, m_metric, and NS_LOG_FUNCTION.

◆ GlobalRoutingLinkRecord() [3/3]

template<typename T>
ns3::GlobalRoutingLinkRecord< T >::GlobalRoutingLinkRecord ( LinkType linkType,
IpAddress linkId,
IpAddress linkData,
IpAddress linkLocData,
uint16_t metric )

Construct an initialized Global Routing Link Record.

Parameters
linkTypeThe type of link record to construct.
linkIdThe link ID for the record.
linkDataThe link data field for the record.
linkLocDataThe link local data field for the record.
metricThe metric field for the record.
See also
LinkType
SetLinkId
SetLinkData

Definition at line 64 of file global-router-interface.cc.

References m_linkData, m_linkId, m_linkLocData, m_linkType, m_metric, and NS_LOG_FUNCTION.

◆ ~GlobalRoutingLinkRecord()

template<typename T>
ns3::GlobalRoutingLinkRecord< T >::~GlobalRoutingLinkRecord ( )

Destroy a Global Routing Link Record.

Currently does nothing. Here as a placeholder only.

Definition at line 79 of file global-router-interface.cc.

References NS_LOG_FUNCTION.

Member Function Documentation

◆ GetLinkData()

template<typename T>
GlobalRoutingLinkRecord< T >::IpAddress ns3::GlobalRoutingLinkRecord< T >::GetLinkData ( ) const

Get the Link Data field of the Global Routing Link Record.

For an OSPF type 1 link (PointToPoint) the Link Data will be the IP address of the node of the local side of the link.

For an OSPF type 3 link (StubNetwork), the Link Data will be the network mask

Returns
The Ipv4Address corresponding to the Link Data field of the record.

Definition at line 102 of file global-router-interface.cc.

References m_linkData, and NS_LOG_FUNCTION.

Referenced by ns3::GlobalRouteManagerImpl< T >::CheckForStubNode(), ns3::GlobalRouteManagerLSDB< T >::GetLSAByLinkData(), ns3::GlobalRoutingLinkRecord< ns3::Ipv4Manager >::GetMetric(), ns3::GlobalRouteManagerImpl< T >::SPFGetNextLink(), ns3::GlobalRouteManagerImpl< T >::SPFIntraAddRouter(), ns3::GlobalRouteManagerImpl< T >::SPFIntraAddStub(), and ns3::GlobalRouteManagerImpl< T >::SPFNexthopCalculation().

Here is the caller graph for this function:

◆ GetLinkId()

template<typename T>
GlobalRoutingLinkRecord< T >::IpAddress ns3::GlobalRoutingLinkRecord< T >::GetLinkId ( ) const

Get the Link ID field of the Global Routing Link Record.

For an OSPF type 1 link (PointToPoint) the Link ID will be the Router ID of the neighboring router.

For an OSPF type 3 link (StubNetwork), the Link ID will be the adjacent neighbor's IP address

Returns
The Ipv4Address corresponding to the Link ID field of the record.

Definition at line 86 of file global-router-interface.cc.

References m_linkId, and NS_LOG_FUNCTION.

Referenced by ns3::GlobalRouteManagerImpl< T >::CheckForStubNode(), ns3::GlobalRoutingLinkRecord< ns3::Ipv4Manager >::GetMetric(), ns3::GlobalRouteManagerImpl< T >::SPFGetNextLink(), ns3::GlobalRouteManagerImpl< T >::SPFIntraAddStub(), ns3::GlobalRouteManagerImpl< T >::SPFNext(), and ns3::GlobalRouteManagerImpl< T >::SPFProcessStubs().

Here is the caller graph for this function:

◆ GetLinkLocData()

template<typename T>
GlobalRoutingLinkRecord< T >::IpAddress ns3::GlobalRoutingLinkRecord< T >::GetLinkLocData ( )

Set the Link Local Data field of the Global Routing Link Record.

For an OSPF type 1 link (PointToPoint) the Link Local Data must be the Link Local IP address of the node of the local side of the link.

For an OSPF type 3 link (StubNetwork), the Link Local data field is not used.

Returns
addr An Ipv6Address to store in the Link Data field of the record.

Definition at line 158 of file global-router-interface.cc.

References NS_LOG_FUNCTION.

Referenced by ns3::GlobalRouteManagerImpl< T >::CheckForStubNode(), ns3::GlobalRoutingLinkRecord< ns3::Ipv4Manager >::GetMetric(), and ns3::GlobalRouteManagerImpl< T >::SPFNexthopCalculation().

Here is the caller graph for this function:

◆ GetLinkType()

template<typename T>
GlobalRoutingLinkRecord< T >::LinkType ns3::GlobalRoutingLinkRecord< T >::GetLinkType ( ) const

Get the Link Type field of the Global Routing Link Record.

The Link Type describes the kind of link a given record represents. The values are defined by OSPF.

See also
LinkType
Returns
The LinkType of the current Global Routing Link Record.

Definition at line 118 of file global-router-interface.cc.

References m_linkType, and NS_LOG_FUNCTION.

Referenced by ns3::GlobalRouteManagerImpl< T >::CheckForStubNode(), ns3::GlobalRouteManagerLSDB< T >::GetLSAByLinkData(), ns3::GlobalRoutingLinkRecord< ns3::Ipv4Manager >::GetMetric(), ns3::GlobalRouteManagerImpl< T >::SPFIntraAddRouter(), ns3::GlobalRouteManagerImpl< T >::SPFNext(), and ns3::GlobalRouteManagerImpl< T >::SPFProcessStubs().

Here is the caller graph for this function:

◆ GetMetric()

template<typename T>
uint16_t ns3::GlobalRoutingLinkRecord< T >::GetMetric ( ) const

Get the Metric Data field of the Global Routing Link Record.

The metric is an abstract cost associated with forwarding a packet across a link. A sum of metrics must have a well-defined meaning. That is, you shouldn't use bandwidth as a metric (how does the sum of the bandwidth of two hops relate to the cost of sending a packet); rather you should use something like delay.

Returns
The metric field of the Global Routing Link Record.

Definition at line 134 of file global-router-interface.cc.

References m_metric, and NS_LOG_FUNCTION.

Referenced by ns3::GlobalRoutingLinkRecord< ns3::Ipv4Manager >::GetMetric(), and ns3::GlobalRouteManagerImpl< T >::SPFNext().

Here is the caller graph for this function:

◆ SetLinkData()

template<typename T>
void ns3::GlobalRoutingLinkRecord< T >::SetLinkData ( IpAddress addr)

Set the Link Data field of the Global Routing Link Record.

For an OSPF type 1 link (PointToPoint) the Link Data must be the IP address of the node of the local side of the link.

For an OSPF type 3 link (StubNetwork), the Link Data must be set to the network mask

Parameters
addrAn Ipv4Address to store in the Link Data field of the record.

Definition at line 110 of file global-router-interface.cc.

References m_linkData, and NS_LOG_FUNCTION.

Referenced by ns3::GlobalRouter< T >::ProcessBridgedBroadcastLink(), and ns3::GlobalRouter< T >::ProcessPointToPointLink().

Here is the caller graph for this function:

◆ SetLinkId()

template<typename T>
void ns3::GlobalRoutingLinkRecord< T >::SetLinkId ( IpAddress addr)

Set the Link ID field of the Global Routing Link Record.

For an OSPF type 1 link (PointToPoint) the Link ID must be the Router ID of the neighboring router.

For an OSPF type 3 link (StubNetwork), the Link ID must be the adjacent neighbor's IP address

Parameters
addrAn Ipv4Address to store in the Link ID field of the record.

Definition at line 94 of file global-router-interface.cc.

References m_linkId, and NS_LOG_FUNCTION.

Referenced by ns3::GlobalRouter< T >::ProcessBridgedBroadcastLink(), and ns3::GlobalRouter< T >::ProcessPointToPointLink().

Here is the caller graph for this function:

◆ SetLinkLocData()

template<typename T>
void ns3::GlobalRoutingLinkRecord< T >::SetLinkLocData ( IpAddress addr)

Set the Link Local Data field of the Global Routing Link Record.

For an OSPF type 1 link (PointToPoint) the Link Local Data must be the Link Local IP address of the node of the local side of the link.

For an OSPF type 3 link (StubNetwork), the Link Local data field is not used.

Parameters
addrAn Ipv6Address to store in the Link Data field of the record.

Definition at line 150 of file global-router-interface.cc.

References m_linkLocData, and NS_LOG_FUNCTION.

Referenced by ns3::GlobalRouter< T >::ProcessBridgedBroadcastLink(), and ns3::GlobalRouter< T >::ProcessPointToPointLink().

Here is the caller graph for this function:

◆ SetLinkType()

template<typename T>
void ns3::GlobalRoutingLinkRecord< T >::SetLinkType ( GlobalRoutingLinkRecord< T >::LinkType linkType)

Set the Link Type field of the Global Routing Link Record.

The Link Type describes the kind of link a given record represents. The values are defined by OSPF.

See also
LinkType
Parameters
linkTypeThe new LinkType for the current Global Routing Link Record.

Definition at line 126 of file global-router-interface.cc.

References m_linkType, and NS_LOG_FUNCTION.

Referenced by ns3::GlobalRouter< T >::ProcessBridgedBroadcastLink(), and ns3::GlobalRouter< T >::ProcessPointToPointLink().

Here is the caller graph for this function:

◆ SetMetric()

template<typename T>
void ns3::GlobalRoutingLinkRecord< T >::SetMetric ( uint16_t metric)

Set the Metric Data field of the Global Routing Link Record.

The metric is an abstract cost associated with forwarding a packet across a link. A sum of metrics must have a well-defined meaning. That is, you shouldn't use bandwidth as a metric (how does the sum of the bandwidth of two hops relate to the cost of sending a packet); rather you should use something like delay.

Parameters
metricThe new metric for the current Global Routing Link Record.

Definition at line 142 of file global-router-interface.cc.

References m_metric, and NS_LOG_FUNCTION.

Referenced by ns3::GlobalRouter< T >::ProcessBridgedBroadcastLink(), and ns3::GlobalRouter< T >::ProcessPointToPointLink().

Here is the caller graph for this function:

◆ GlobalRoutingLSA

template<typename T>
template<typename>
friend class GlobalRoutingLSA
friend

Friend class.

Definition at line 82 of file global-router-interface.h.

References GlobalRoutingLSA.

Referenced by GlobalRoutingLSA.

Member Data Documentation

◆ IsIpv4

template<typename T>
bool ns3::GlobalRoutingLinkRecord< T >::IsIpv4 = std::is_same_v<Ipv4Manager, T>
staticconstexprprivate

Alias for determining whether the parent is Ipv4RoutingProtocol or Ipv6RoutingProtocol.

Definition at line 55 of file global-router-interface.h.

◆ m_linkData

template<typename T>
IpAddress ns3::GlobalRoutingLinkRecord< T >::m_linkData
private

m_linkId and m_linkData are defined by OSPF to have different meanings depending on the type of link a given link records represents.

They work together.

For Type 1 link (PointToPoint), set m_linkData to local IP address

For Type 3 link (Stub), set m_linkData to mask

Definition at line 296 of file global-router-interface.h.

Referenced by GlobalRoutingLinkRecord(), GlobalRoutingLinkRecord(), GlobalRoutingLinkRecord(), GetLinkData(), and SetLinkData().

◆ m_linkId

template<typename T>
IpAddress ns3::GlobalRoutingLinkRecord< T >::m_linkId
private

m_linkId and m_linkData are defined by OSPF to have different meanings depending on the type of link a given link records represents.

They work together.

For Type 1 link (PointToPoint), set m_linkId to Router ID of neighboring router.

For Type 3 link (Stub), set m_linkId to neighbor's IP address

Definition at line 285 of file global-router-interface.h.

Referenced by GlobalRoutingLinkRecord(), GlobalRoutingLinkRecord(), GlobalRoutingLinkRecord(), GetLinkId(), and SetLinkId().

◆ m_linkLocData

template<typename T>
IpAddress ns3::GlobalRoutingLinkRecord< T >::m_linkLocData
private

m_linkLocData is not defined by the OSPF spec.

This field is used to store the link local address associated with the link on the local side.

For Type 1 link (PointToPoint), set m_linkLocData to Link local IP address on the local side

For Type 3 link (Stub), this is not used.

Definition at line 307 of file global-router-interface.h.

Referenced by GlobalRoutingLinkRecord(), GlobalRoutingLinkRecord(), GlobalRoutingLinkRecord(), and SetLinkLocData().

◆ m_linkType

template<typename T>
LinkType ns3::GlobalRoutingLinkRecord< T >::m_linkType
private

The type of the Global Routing Link Record.

Defined in the OSPF spec. We currently only use PointToPoint and StubNetwork types.

Definition at line 313 of file global-router-interface.h.

Referenced by GlobalRoutingLinkRecord(), GlobalRoutingLinkRecord(), GlobalRoutingLinkRecord(), ns3::GlobalRoutingLSA< ns3::Ipv4Manager >::ClearLinkRecords(), GetLinkType(), and SetLinkType().

◆ m_metric

template<typename T>
uint16_t ns3::GlobalRoutingLinkRecord< T >::m_metric
private

The metric for a given link.

A metric is abstract cost associated with forwarding a packet across a link. A sum of metrics must have a well-defined meaning. That is, you shouldn't use bandwidth as a metric (how does the sum of the bandwidth of two hops relate to the cost of sending a packet); rather you should use something like delay.

Definition at line 324 of file global-router-interface.h.

Referenced by GlobalRoutingLinkRecord(), GlobalRoutingLinkRecord(), GlobalRoutingLinkRecord(), GetMetric(), and SetMetric().


The documentation for this class was generated from the following files: