A Discrete-Event Network Simulator
API
ns3::GlobalRoutingLinkRecord Class Reference

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

#include "global-router-interface.h"

+ Collaboration diagram for ns3::GlobalRoutingLinkRecord:

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. More...
 
 GlobalRoutingLinkRecord (LinkType linkType, Ipv4Address linkId, Ipv4Address linkData, uint16_t metric)
 Construct an initialized Global Routing Link Record. More...
 
 ~GlobalRoutingLinkRecord ()
 Destroy a Global Routing Link Record. More...
 
Ipv4Address GetLinkData (void) const
 Get the Link Data field of the Global Routing Link Record. More...
 
Ipv4Address GetLinkId (void) const
 Get the Link ID field of the Global Routing Link Record. More...
 
LinkType GetLinkType (void) const
 Get the Link Type field of the Global Routing Link Record. More...
 
uint16_t GetMetric (void) const
 Get the Metric Data field of the Global Routing Link Record. More...
 
void SetLinkData (Ipv4Address addr)
 Set the Link Data field of the Global Routing Link Record. More...
 
void SetLinkId (Ipv4Address addr)
 Set the Link ID field of the Global Routing Link Record. More...
 
void SetLinkType (LinkType linkType)
 Set the Link Type field of the Global Routing Link Record. More...
 
void SetMetric (uint16_t metric)
 Set the Metric Data field of the Global Routing Link Record. More...
 

Private Attributes

Ipv4Address 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. More...
 
Ipv4Address 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. More...
 
LinkType m_linkType
 The type of the Global Routing Link Record. More...
 
uint16_t m_metric
 The metric for a given link. More...
 

Friends

class GlobalRoutingLSA
 Friend class. More...
 

Detailed Description

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 51 of file global-router-interface.h.

Member Enumeration Documentation

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 62 of file global-router-interface.h.

Constructor & Destructor Documentation

ns3::GlobalRoutingLinkRecord::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 45 of file global-router-interface.cc.

References NS_LOG_FUNCTION.

ns3::GlobalRoutingLinkRecord::GlobalRoutingLinkRecord ( LinkType  linkType,
Ipv4Address  linkId,
Ipv4Address  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 55 of file global-router-interface.cc.

References NS_LOG_FUNCTION.

ns3::GlobalRoutingLinkRecord::~GlobalRoutingLinkRecord ( )

Destroy a Global Routing Link Record.

Currently does nothing. Here as a placeholder only.

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

References NS_LOG_FUNCTION.

Member Function Documentation

Ipv4Address ns3::GlobalRoutingLinkRecord::GetLinkData ( void  ) 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 89 of file global-router-interface.cc.

References m_linkData, and NS_LOG_FUNCTION.

Referenced by ns3::GlobalRouteManagerImpl::CheckForStubNode(), ns3::GlobalRoutingLSA::CopyLinkRecords(), ns3::GlobalRouteManagerLSDB::GetLSAByLinkData(), ns3::GlobalRouteManagerImpl::SPFGetNextLink(), ns3::GlobalRouteManagerImpl::SPFIntraAddRouter(), ns3::GlobalRouteManagerImpl::SPFIntraAddStub(), and ns3::GlobalRouteManagerImpl::SPFNexthopCalculation().

+ Here is the caller graph for this function:

Ipv4Address ns3::GlobalRoutingLinkRecord::GetLinkId ( void  ) 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 75 of file global-router-interface.cc.

References m_linkId, and NS_LOG_FUNCTION.

Referenced by ns3::GlobalRouteManagerImpl::CheckForStubNode(), ns3::GlobalRoutingLSA::CopyLinkRecords(), ns3::GlobalRouteManagerImpl::SPFGetNextLink(), and ns3::GlobalRouteManagerImpl::SPFIntraAddStub().

+ Here is the caller graph for this function:

GlobalRoutingLinkRecord::LinkType ns3::GlobalRoutingLinkRecord::GetLinkType ( void  ) 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 103 of file global-router-interface.cc.

References m_linkType, and NS_LOG_FUNCTION.

Referenced by ns3::GlobalRouteManagerImpl::CheckForStubNode(), ns3::GlobalRoutingLSA::CopyLinkRecords(), ns3::GlobalRouteManagerLSDB::GetLSAByLinkData(), and ns3::GlobalRouteManagerImpl::SPFIntraAddRouter().

+ Here is the caller graph for this function:

uint16_t ns3::GlobalRoutingLinkRecord::GetMetric ( void  ) 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 118 of file global-router-interface.cc.

References m_metric, and NS_LOG_FUNCTION.

Referenced by ns3::GlobalRoutingLSA::CopyLinkRecords(), and ns3::GlobalRouteManagerImpl::SPFNext().

+ Here is the caller graph for this function:

void ns3::GlobalRoutingLinkRecord::SetLinkData ( Ipv4Address  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 96 of file global-router-interface.cc.

References m_linkData, and NS_LOG_FUNCTION.

Referenced by ns3::GlobalRoutingLSA::CopyLinkRecords(), ns3::if(), ns3::GlobalRouter::ProcessBridgedBroadcastLink(), ns3::GlobalRouter::ProcessPointToPointLink(), and ns3::GlobalRouter::ProcessSingleBroadcastLink().

+ Here is the caller graph for this function:

void ns3::GlobalRoutingLinkRecord::SetLinkId ( Ipv4Address  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 82 of file global-router-interface.cc.

References m_linkId, and NS_LOG_FUNCTION.

Referenced by ns3::GlobalRoutingLSA::CopyLinkRecords(), ns3::if(), ns3::GlobalRouter::ProcessBridgedBroadcastLink(), ns3::GlobalRouter::ProcessPointToPointLink(), and ns3::GlobalRouter::ProcessSingleBroadcastLink().

+ Here is the caller graph for this function:

void ns3::GlobalRoutingLinkRecord::SetLinkType ( GlobalRoutingLinkRecord::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 110 of file global-router-interface.cc.

References m_linkType, and NS_LOG_FUNCTION.

Referenced by ns3::GlobalRoutingLSA::CopyLinkRecords(), ns3::GlobalRouter::ProcessBridgedBroadcastLink(), ns3::GlobalRouter::ProcessPointToPointLink(), and ns3::GlobalRouter::ProcessSingleBroadcastLink().

+ Here is the caller graph for this function:

void ns3::GlobalRoutingLinkRecord::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 125 of file global-router-interface.cc.

References m_metric, and NS_LOG_FUNCTION.

Referenced by ns3::GlobalRoutingLSA::CopyLinkRecords(), ns3::if(), ns3::GlobalRouter::ProcessBridgedBroadcastLink(), ns3::GlobalRouter::ProcessPointToPointLink(), and ns3::GlobalRouter::ProcessSingleBroadcastLink().

+ Here is the caller graph for this function:

Friends And Related Function Documentation

friend class GlobalRoutingLSA
friend

Friend class.

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

Member Data Documentation

Ipv4Address ns3::GlobalRoutingLinkRecord::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 225 of file global-router-interface.h.

Referenced by GetLinkData(), ns3::GlobalRoutingLSA::Print(), and SetLinkData().

Ipv4Address ns3::GlobalRoutingLinkRecord::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 214 of file global-router-interface.h.

Referenced by GetLinkId(), ns3::GlobalRoutingLSA::Print(), and SetLinkId().

LinkType ns3::GlobalRoutingLinkRecord::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 231 of file global-router-interface.h.

Referenced by GetLinkType(), ns3::GlobalRoutingLSA::Print(), and SetLinkType().

uint16_t ns3::GlobalRoutingLinkRecord::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 242 of file global-router-interface.h.

Referenced by GetMetric(), ns3::GlobalRoutingLSA::Print(), and SetMetric().


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