A single link record for a link state advertisement. More...
#include "global-router-interface.h"
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. | |
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.
|
private |
Alias for Ipv4 and Ipv6 classes.
Definition at line 58 of file global-router-interface.h.
|
private |
Alias for Ipv4Address and Ipv6Address classes.
Definition at line 61 of file global-router-interface.h.
|
private |
Alias for Ipv4Header and Ipv6Header classes.
Definition at line 67 of file global-router-interface.h.
|
private |
Alias for Ipv4InterfaceAddress and Ipv6InterfaceAddress classes.
Definition at line 70 of file global-router-interface.h.
|
private |
Alias for Ipv4Mask And Ipv6Prefix.
Definition at line 78 of file global-router-interface.h.
|
private |
Alias for Ipv4Route and Ipv6Route classes.
Definition at line 64 of file global-router-interface.h.
|
private |
Alias for Ipv4RoutingTableEntry and Ipv6RoutingTableEntry classes.
Definition at line 74 of file global-router-interface.h.
| 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.
Definition at line 91 of file global-router-interface.h.
| 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.
| ns3::GlobalRoutingLinkRecord< T >::GlobalRoutingLinkRecord | ( | LinkType | linkType, |
| IpAddress | linkId, | ||
| IpAddress | linkData, | ||
| uint16_t | metric ) |
Construct an initialized Global Routing Link Record.
| linkType | The type of link record to construct. |
| linkId | The link ID for the record. |
| linkData | The link data field for the record. |
| metric | The metric field for the record. |
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.
| ns3::GlobalRoutingLinkRecord< T >::GlobalRoutingLinkRecord | ( | LinkType | linkType, |
| IpAddress | linkId, | ||
| IpAddress | linkData, | ||
| IpAddress | linkLocData, | ||
| uint16_t | metric ) |
Construct an initialized Global Routing Link Record.
| linkType | The type of link record to construct. |
| linkId | The link ID for the record. |
| linkData | The link data field for the record. |
| linkLocData | The link local data field for the record. |
| metric | The metric field for the record. |
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.
| 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.
| 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
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().
| 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
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().
| 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.
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().
| 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.
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().
| 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.
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().
| 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
| addr | An 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().
| 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
| addr | An 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().
| 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.
| addr | An 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().
| 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.
| linkType | The 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().
| 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.
| metric | The 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().
|
friend |
Friend class.
Definition at line 82 of file global-router-interface.h.
References GlobalRoutingLSA.
Referenced by GlobalRoutingLSA.
|
staticconstexprprivate |
Alias for determining whether the parent is Ipv4RoutingProtocol or Ipv6RoutingProtocol.
Definition at line 55 of file global-router-interface.h.
|
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().
|
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().
|
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().
|
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().
|
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().