26 #include "ns3/abort.h"
27 #include "ns3/assert.h"
28 #include "ns3/bridge-net-device.h"
29 #include "ns3/channel.h"
31 #include "ns3/net-device.h"
32 #include "ns3/node-list.h"
49 : m_linkId(
"0.0.0.0"),
50 m_linkData(
"0.0.0.0"),
138 m_linkStateId(
"0.0.0.0"),
139 m_advertisingRtr(
"0.0.0.0"),
141 m_networkLSANetworkMask(
"0.0.0.0"),
153 m_linkStateId(linkStateId),
154 m_advertisingRtr(advertisingRtr),
156 m_networkLSANetworkMask(
"0.0.0.0"),
165 : m_lsType(lsa.m_lsType),
166 m_linkStateId(lsa.m_linkStateId),
167 m_advertisingRtr(lsa.m_advertisingRtr),
168 m_networkLSANetworkMask(lsa.m_networkLSANetworkMask),
169 m_status(lsa.m_status),
170 m_node_id(lsa.m_node_id)
173 NS_ASSERT_MSG(
IsEmpty(),
"GlobalRoutingLSA::GlobalRoutingLSA (): Non-empty LSA in constructor");
264 NS_ASSERT_MSG(
false,
"GlobalRoutingLSA::GetLinkRecord (): invalid index");
365 NS_ASSERT_MSG(
false,
"GlobalRoutingLSA::GetAttachedRouter (): invalid index");
395 os <<
"========== Global Routing LSA ==========" << std::endl;
399 os <<
" (GlobalRoutingLSA::RouterLSA)";
403 os <<
" (GlobalRoutingLSA::NetworkLSA)";
407 os <<
" (GlobalRoutingLSA::ASExternalLSA)";
411 os <<
"(Unknown LSType)";
415 os <<
"m_linkStateId = " <<
m_linkStateId <<
" (Router ID)" << std::endl;
416 os <<
"m_advertisingRtr = " <<
m_advertisingRtr <<
" (Router ID)" << std::endl;
424 os <<
"---------- RouterLSA Link Record ----------" << std::endl;
428 os <<
" (GlobalRoutingLinkRecord::PointToPoint)" << std::endl;
429 os <<
"m_linkId = " << p->
m_linkId << std::endl;
430 os <<
"m_linkData = " << p->
m_linkData << std::endl;
431 os <<
"m_metric = " << p->
m_metric << std::endl;
435 os <<
" (GlobalRoutingLinkRecord::TransitNetwork)" << std::endl;
436 os <<
"m_linkId = " << p->
m_linkId <<
" (Designated router for network)"
438 os <<
"m_linkData = " << p->
m_linkData <<
" (This router's IP address)"
440 os <<
"m_metric = " << p->
m_metric << std::endl;
444 os <<
" (GlobalRoutingLinkRecord::StubNetwork)" << std::endl;
445 os <<
"m_linkId = " << p->
m_linkId <<
" (Network number of attached network)"
447 os <<
"m_linkData = " << p->
m_linkData <<
" (Network mask of attached network)"
449 os <<
"m_metric = " << p->
m_metric << std::endl;
453 os <<
" (Unknown LinkType)" << std::endl;
454 os <<
"m_linkId = " << p->
m_linkId << std::endl;
455 os <<
"m_linkData = " << p->
m_linkData << std::endl;
456 os <<
"m_metric = " << p->
m_metric << std::endl;
458 os <<
"---------- End RouterLSA Link Record ----------" << std::endl;
463 os <<
"---------- NetworkLSA Link Record ----------" << std::endl;
468 os <<
"attachedRouter = " << p << std::endl;
470 os <<
"---------- End NetworkLSA Link Record ----------" << std::endl;
474 os <<
"---------- ASExternalLSA Link Record --------" << std::endl;
482 os <<
"========== End Global Routing LSA ==========" << std::endl;
584 "GlobalRouter::DiscoverLSAs (): GetObject for <Node> interface failed");
603 "GlobalRouter::DiscoverLSAs (): GetObject for <Ipv4> interface failed");
627 for (uint32_t i = 0; i < numDevices; ++i)
631 if (DynamicCast<LoopbackNetDevice>(ndLocal))
643 int32_t ifIndex = ipv4Local->GetInterfaceForDevice(ndLocal);
646 "GlobalRouter::DiscoverLSAs(): Bridge ports must not have an IPv4 interface index");
655 int32_t interfaceNumber = ipv4Local->GetInterfaceForDevice(ndLocal);
656 if (interfaceNumber == -1 ||
657 !(ipv4Local->IsUp(interfaceNumber) && ipv4Local->IsForwarding(interfaceNumber)))
661 <<
"has no IP interface or is not enabled for forwarding, skipping");
675 if (ndLocal->IsBroadcast() && !ndLocal->IsPointToPoint())
680 else if (ndLocal->IsPointToPoint())
687 NS_ASSERT_MSG(0,
"GlobalRouter::DiscoverLSAs (): unknown link type");
700 uint32_t nDesignatedRouters = c.
GetN();
701 if (nDesignatedRouters > 0)
715 pLSA->SetLinkStateId((*i)->GetDestNetwork());
717 pLSA->SetNetworkLSANetworkMask((*i)->GetDestNetworkMask());
748 "GlobalRouter::ProcessSingleBroadcastLink(): Can't alloc link record");
762 "GlobalRouter::ProcessSingleBroadcastLink (): GetObject for <Ipv4> interface failed");
764 int32_t interfaceLocal = ipv4Local->GetInterfaceForDevice(nd);
766 interfaceLocal == -1,
767 "GlobalRouter::ProcessSingleBroadcastLink(): No interface index associated with device");
769 if (ipv4Local->GetNAddresses(interfaceLocal) > 1)
771 NS_LOG_WARN(
"Warning, interface has multiple IP addresses; using only the primary one");
773 Ipv4Address addrLocal = ipv4Local->GetAddress(interfaceLocal, 0).GetLocal();
774 Ipv4Mask maskLocal = ipv4Local->GetAddress(interfaceLocal, 0).GetMask();
775 NS_LOG_LOGIC(
"Working with local address " << addrLocal);
776 uint16_t metricLocal = ipv4Local->GetMetric(interfaceLocal);
803 maskLocalAddr.
Set(maskLocal.
Get());
804 plr->SetLinkData(maskLocalAddr);
805 plr->SetMetric(metricLocal);
832 if (designatedRtr !=
"255.255.255.255")
837 networkHere == networkThere,
838 "GlobalRouter::ProcessSingleBroadcastLink(): Network number confusion ("
839 << addrLocal <<
"/" << maskLocal.
GetPrefixLength() <<
", " << designatedRtr
842 if (designatedRtr == addrLocal)
847 plr->SetLinkId(designatedRtr);
852 plr->SetLinkData(addrLocal);
853 plr->SetMetric(metricLocal);
866 "GlobalRouter::ProcessBridgedBroadcastLink(): Called with non-bridge net device");
880 NS_ABORT_MSG_UNLESS (bnd,
"GlobalRouter::DiscoverLSAs (): GetObject for <BridgeNetDevice> failed");
891 NS_ABORT_MSG_UNLESS (ipv4Local,
"GlobalRouter::ProcessBridgedBroadcastLink (): GetObject for <Ipv4> interface failed");
893 int32_t interfaceLocal = ipv4Local->GetInterfaceForDevice (nd);
894 NS_ABORT_MSG_IF (interfaceLocal == -1,
"GlobalRouter::ProcessBridgedBroadcastLink(): No interface index associated with device");
896 if (ipv4Local->GetNAddresses (interfaceLocal) > 1)
898 NS_LOG_WARN (
"Warning, interface has multiple IP addresses; using only the primary one");
900 Ipv4Address addrLocal = ipv4Local->GetAddress (interfaceLocal, 0).GetLocal ();
901 Ipv4Mask maskLocal = ipv4Local->GetAddress (interfaceLocal, 0).GetMask ();
902 NS_LOG_LOGIC (
"Working with local address " << addrLocal);
903 uint16_t metricLocal = ipv4Local->GetMetric (interfaceLocal);
914 bool areTransitNetwork =
false;
917 for (uint32_t i = 0; i < bnd->GetNBridgePorts (); ++i)
929 areTransitNetwork =
true;
945 if (designatedRtrTemp !=
"255.255.255.255")
950 "GlobalRouter::ProcessSingleBroadcastLink(): Network number confusion (" <<
954 if (designatedRtrTemp < designatedRtr)
956 designatedRtr = designatedRtrTemp;
966 NS_ABORT_MSG_IF (plr == 0,
"GlobalRouter::ProcessBridgedBroadcastLink(): Can't alloc link record");
968 if (areTransitNetwork ==
false)
986 maskLocalAddr.
Set (maskLocal.
Get ());
1007 if (designatedRtr == addrLocal)
1037 Ptr<Node> nodeLocal = ndLocal->GetNode();
1042 "GlobalRouter::ProcessPointToPointLink (): GetObject for <Ipv4> interface failed");
1044 int32_t interfaceLocal = ipv4Local->GetInterfaceForDevice(ndLocal);
1046 interfaceLocal == -1,
1047 "GlobalRouter::ProcessPointToPointLink (): No interface index associated with device");
1049 if (ipv4Local->GetNAddresses(interfaceLocal) > 1)
1051 NS_LOG_WARN(
"Warning, interface has multiple IP addresses; using only the primary one");
1053 Ipv4Address addrLocal = ipv4Local->GetAddress(interfaceLocal, 0).GetLocal();
1054 NS_LOG_LOGIC(
"Working with local address " << addrLocal);
1055 uint16_t metricLocal = ipv4Local->GetMetric(interfaceLocal);
1076 Ptr<Node> nodeRemote = ndRemote->GetNode();
1080 "GlobalRouter::ProcessPointToPointLink(): GetObject for remote <Ipv4> failed");
1096 Ipv4Address rtrIdRemote = rtrRemote->GetRouterId();
1097 NS_LOG_LOGIC(
"Working with remote router " << rtrIdRemote);
1103 int32_t interfaceRemote = ipv4Remote->GetInterfaceForDevice(ndRemote);
1105 "GlobalRouter::ProcessPointToPointLinks(): No interface index associated with "
1112 if (ipv4Remote->GetNAddresses(interfaceRemote) > 1)
1114 NS_LOG_WARN(
"Warning, interface has multiple IP addresses; using only the primary one");
1116 Ipv4Address addrRemote = ipv4Remote->GetAddress(interfaceRemote, 0).GetLocal();
1117 Ipv4Mask maskRemote = ipv4Remote->GetAddress(interfaceRemote, 0).GetMask();
1118 NS_LOG_LOGIC(
"Working with remote address " << addrRemote);
1126 if (ipv4Remote->IsUp(interfaceRemote))
1128 NS_LOG_LOGIC(
"Remote side interface " << interfaceRemote <<
" is up-- add a type 1 link");
1132 "GlobalRouter::ProcessPointToPointLink(): Can't alloc link record");
1144 "GlobalRouter::ProcessPointToPointLink(): Can't alloc link record");
1158 uint32_t nDesignatedRouters = c.
GetN();
1159 NS_LOG_DEBUG(
"Number of designated routers: " << nDesignatedRouters);
1161 for (uint32_t i = 0; i < nDesignatedRouters; ++i)
1173 "GlobalRouter::ProcessPointToPointLink (): GetObject for <Ipv4> interface failed");
1175 int32_t interfaceLocal = ipv4Local->GetInterfaceForDevice(ndLocal);
1177 interfaceLocal == -1,
1178 "GlobalRouter::BuildNetworkLSAs (): No interface index associated with device");
1180 if (ipv4Local->GetNAddresses(interfaceLocal) > 1)
1182 NS_LOG_WARN(
"Warning, interface has multiple IP addresses; using only the primary one");
1184 Ipv4Address addrLocal = ipv4Local->GetAddress(interfaceLocal, 0).GetLocal();
1185 Ipv4Mask maskLocal = ipv4Local->GetAddress(interfaceLocal, 0).GetMask();
1189 "GlobalRouter::BuildNetworkLSAs(): Can't alloc link record");
1192 pLSA->SetLinkStateId(addrLocal);
1194 pLSA->SetNetworkLSANetworkMask(maskLocal);
1196 pLSA->SetNode(node);
1208 NS_LOG_LOGIC(
"Found " << deviceList.
GetN() <<
" non-bridged devices on channel");
1210 for (uint32_t i = 0; i < deviceList.
GetN(); i++)
1214 if (tempNd == ndLocal)
1216 NS_LOG_LOGIC(
"Adding " << addrLocal <<
" to Network LSA");
1217 pLSA->AddAttachedRouter(addrLocal);
1229 <<
" does not have GlobalRouter interface--skipping");
1238 int32_t tempInterface = tempIpv4->GetInterfaceForDevice(tempNd);
1240 if (tempInterface != -1)
1244 if (!tempIpv4->IsUp(tempInterface))
1246 NS_LOG_LOGIC(
"Remote side interface " << tempInterface <<
" not up");
1250 if (tempIpv4->GetNAddresses(tempInterface) > 1)
1252 NS_LOG_WARN(
"Warning, interface has multiple IP addresses; using only the "
1255 Ipv4Address tempAddr = tempIpv4->GetAddress(tempInterface, 0).GetLocal();
1256 NS_LOG_LOGIC(
"Adding " << tempAddr <<
" to Network LSA");
1257 pLSA->AddAttachedRouter(tempAddr);
1263 <<
" does not have IPv4 interface; skipping");
1279 for (std::size_t i = 0; i < ch->
GetNDevices(); i++)
1282 NS_LOG_LOGIC(
"checking to see if the device " << nd <<
" is bridged");
1287 << bnd <<
" with " << bnd->GetNBridgePorts() <<
" ports");
1291 for (uint32_t j = 0; j < bnd->GetNBridgePorts(); j++)
1294 if (bridgedDevice->GetChannel() == ch)
1299 NS_LOG_LOGIC(
"Calling on channel " << bridgedDevice->GetChannel());
1328 NS_LOG_LOGIC(
"Looking for designated router off of net device " << ndLocal <<
" on node "
1329 << ndLocal->GetNode()->GetId());
1337 for (uint32_t i = 0; i < nDevices; i++)
1342 Ptr<Node> nodeOther = ndOther->GetNode();
1344 NS_LOG_LOGIC(
"Examine channel device " << i <<
" on node " << nodeOther->
GetId());
1352 NS_LOG_LOGIC(
"checking to see if the device is bridged");
1356 NS_LOG_LOGIC(
"Device is bridged by BridgeNetDevice " << bnd);
1361 if (ndLocal == ndOther)
1376 NS_LOG_LOGIC(
"Checking for router on bridge net device " << bnd);
1381 int32_t interfaceOther =
ipv4->GetInterfaceForDevice(bnd);
1382 if (interfaceOther != -1)
1384 NS_LOG_LOGIC(
"Found router on bridge net device " << bnd);
1385 if (!
ipv4->IsUp(interfaceOther))
1387 NS_LOG_LOGIC(
"Remote side interface " << interfaceOther <<
" not up");
1390 if (
ipv4->GetNAddresses(interfaceOther) > 1)
1392 NS_LOG_WARN(
"Warning, interface has multiple IP addresses; using only the "
1395 Ipv4Address addrOther =
ipv4->GetAddress(interfaceOther, 0).GetLocal();
1396 designatedRtr = addrOther < designatedRtr ? addrOther : designatedRtr;
1397 NS_LOG_LOGIC(
"designated router now " << designatedRtr);
1414 NS_LOG_LOGIC(
"Looking through bridge ports of bridge net device " << bnd);
1415 for (uint32_t j = 0; j < bnd->GetNBridgePorts(); ++j)
1418 NS_LOG_LOGIC(
"Examining bridge port " << j <<
" device " << ndBridged);
1419 if (ndBridged == ndOther)
1421 NS_LOG_LOGIC(
"That bridge port is me, don't walk backward");
1425 NS_LOG_LOGIC(
"Recursively looking for routers down bridge port " << ndBridged);
1427 designatedRtr = addrOther < designatedRtr ? addrOther : designatedRtr;
1428 NS_LOG_LOGIC(
"designated router now " << designatedRtr);
1434 Ptr<Node> nodeOther = ndOther->GetNode();
1445 int32_t interfaceOther =
ipv4->GetInterfaceForDevice(ndOther);
1446 if (interfaceOther != -1)
1448 if (!
ipv4->IsUp(interfaceOther))
1450 NS_LOG_LOGIC(
"Remote side interface " << interfaceOther <<
" not up");
1453 NS_LOG_LOGIC(
"Found router on net device " << ndOther);
1454 if (
ipv4->GetNAddresses(interfaceOther) > 1)
1456 NS_LOG_WARN(
"Warning, interface has multiple IP addresses; using only the "
1459 Ipv4Address addrOther =
ipv4->GetAddress(interfaceOther, 0).GetLocal();
1460 designatedRtr = addrOther < designatedRtr ? addrOther : designatedRtr;
1461 NS_LOG_LOGIC(
"designated router now " << designatedRtr);
1466 return designatedRtr;
1489 NS_LOG_LOGIC(
"Looking for routers off of net device " << nd <<
" on node "
1490 << nd->GetNode()->GetId());
1496 for (uint32_t i = 0; i < nDevices; i++)
1501 NS_LOG_LOGIC(
"Examine channel device " << i <<
" on node " << ndOther->GetNode()->GetId());
1522 NS_LOG_LOGIC(
"Device is bridged by net device " << bnd);
1537 NS_LOG_LOGIC(
"Looking through bridge ports of bridge net device " << bnd);
1538 for (uint32_t j = 0; j < bnd->GetNBridgePorts(); ++j)
1541 NS_LOG_LOGIC(
"Examining bridge port " << j <<
" device " << ndBridged);
1542 if (ndBridged == ndOther)
1548 NS_LOG_LOGIC(
"Recursively looking for routers on bridge port " << ndBridged);
1551 NS_LOG_LOGIC(
"Found routers on bridge port, return true");
1555 NS_LOG_LOGIC(
"No routers on bridged net device, return false");
1560 Ptr<Node> nodeTemp = ndOther->GetNode();
1566 NS_LOG_LOGIC(
"Found GlobalRouter interface, return true");
1571 NS_LOG_LOGIC(
"No GlobalRouter interface on device, continue search");
1601 for (; i !=
m_LSAs.end(); i++, j++)
1679 if ((*i)->GetDestNetwork() == network && (*i)->GetDestNetworkMask() == networkMask)
1681 NS_LOG_LOGIC(
"Withdrawing route to network/mask " << network <<
"/" << networkMask);
1699 "GlobalRouter::GetAdjacent (): Channel with other than two devices");
1720 NS_ASSERT_MSG(
false,
"GlobalRouter::GetAdjacent (): Wrong or confused channel?");
1742 for (uint32_t i = 0; i < nDevices; ++i)
1747 if (ndTest->IsBridge())
1749 NS_LOG_LOGIC(
"device " << i <<
" is a bridge net device");
1753 "GlobalRouter::DiscoverLSAs (): GetObject for <BridgeNetDevice> failed");
1755 for (uint32_t j = 0; j < bnd->GetNBridgePorts(); ++j)
1757 NS_LOG_LOGIC(
"Examine bridge port " << j <<
" " << bnd->GetBridgePort(j));
1758 if (bnd->GetBridgePort(j) == nd)
1760 NS_LOG_LOGIC(
"Net device " << nd <<
" is bridged by " << bnd);
1766 NS_LOG_LOGIC(
"Net device " << nd <<
" is not bridged");
1787 if (bridgeNetDevice == *iter)
1789 NS_LOG_LOGIC(
"Bridge " << bridgeNetDevice <<
" has been visited.");
a virtual net device that bridges multiple LAN segments
virtual Ptr< NetDevice > GetDevice(std::size_t i) const =0
virtual std::size_t GetNDevices() const =0
static uint32_t AllocateRouterId()
Allocate a 32-bit router ID from monotonically increasing counter.
An interface aggregated to a node to provide global routing info.
Ipv4Address FindDesignatedRouterForLink(Ptr< NetDevice > ndLocal) const
Finds a designated router.
void MarkBridgeAsVisited(Ptr< BridgeNetDevice > device) const
When recursively checking for devices on the link, mark a given device as having been visited.
Ptr< Ipv4GlobalRouting > m_routingProtocol
the Ipv4GlobalRouting in use
bool GetLSA(uint32_t n, GlobalRoutingLSA &lsa) const
Get a Global Routing Link State Advertisements that this router has said that it can export.
void ProcessSingleBroadcastLink(Ptr< NetDevice > nd, GlobalRoutingLSA *pLSA, NetDeviceContainer &c)
Process a single broadcast link.
bool WithdrawRoute(Ipv4Address network, Ipv4Mask networkMask)
Withdraw a route from the global unicast routing table.
NetDeviceContainer FindAllNonBridgedDevicesOnLink(Ptr< Channel > ch) const
Return a container of all non-bridged NetDevices on a link.
bool BridgeHasAlreadyBeenVisited(Ptr< BridgeNetDevice > device) const
When recursively checking for devices on the link, check whether a given device has already been visi...
InjectedRoutes m_injectedRoutes
Routes we are exporting.
void ClearBridgesVisited() const
Clear the list of bridges visited on the link.
void InjectRoute(Ipv4Address network, Ipv4Mask networkMask)
Inject a route to be circulated to other routers as an external route.
Ptr< BridgeNetDevice > NetDeviceIsBridged(Ptr< NetDevice > nd) const
Decide whether or not a given net device is being bridged by a BridgeNetDevice.
Ipv4Address GetRouterId() const
Get the Router ID associated with this Global Router.
uint32_t GetNumLSAs() const
Get the Number of Global Routing Link State Advertisements that this router can export.
ListOfLSAs_t m_LSAs
database of GlobalRoutingLSAs
void ProcessBridgedBroadcastLink(Ptr< NetDevice > nd, GlobalRoutingLSA *pLSA, NetDeviceContainer &c)
Process a bridged broadcast link.
GlobalRouter()
Create a Global Router class.
Ipv4RoutingTableEntry * GetInjectedRoute(uint32_t i)
Return the injected route indexed by i.
void ClearLSAs()
Clear list of LSAs.
static TypeId GetTypeId()
Get the type ID.
Ptr< Ipv4GlobalRouting > GetRoutingProtocol()
Get the specific Global Routing Protocol used.
Ipv4Address m_routerId
router ID (its IPv4 address)
void RemoveInjectedRoute(uint32_t i)
Withdraw a route from the global unicast routing table.
bool AnotherRouterOnLink(Ptr< NetDevice > nd) const
Checks for the presence of another router on the NetDevice.
void SetRoutingProtocol(Ptr< Ipv4GlobalRouting > routing)
Set the specific Global Routing Protocol to be used.
Ptr< NetDevice > GetAdjacent(Ptr< NetDevice > nd, Ptr< Channel > ch) const
Link through the given channel and find the net device that's on the other end.
std::vector< Ptr< BridgeNetDevice > > m_bridgesVisited
Container of bridges visited.
void ProcessPointToPointLink(Ptr< NetDevice > ndLocal, GlobalRoutingLSA *pLSA)
Process a point to point link.
uint32_t DiscoverLSAs()
Walk the connected channels, discover the adjacent routers and build the associated number of Global ...
void DoDispose() override
Destructor implementation.
void ProcessBroadcastLink(Ptr< NetDevice > nd, GlobalRoutingLSA *pLSA, NetDeviceContainer &c)
Process a generic broadcast link.
uint32_t GetNInjectedRoutes()
Get the number of injected routes that have been added to the routing table.
void BuildNetworkLSAs(NetDeviceContainer c)
Build one NetworkLSA for each net device talking to a network that we are the designated router for.
a Link State Advertisement (LSA) for a router, used in global routing.
Ipv4Address GetAdvertisingRouter() const
Get the Advertising Router as defined by the OSPF spec.
void SetStatus(SPFStatus status)
Set the SPF status of the advertisement.
uint32_t m_node_id
node ID
void Print(std::ostream &os) const
Print the contents of the Global Routing Link State Advertisement and any Global Routing Link Records...
SPFStatus
Enumeration of the possible values of the status flag in the Routing Link State Advertisements.
@ LSA_SPF_NOT_EXPLORED
New vertex not yet considered.
uint32_t GetNAttachedRouters() const
Return the number of attached routers listed in the NetworkLSA.
Ptr< Node > GetNode() const
Get the Node pointer of the node that originated this LSA.
uint32_t AddLinkRecord(GlobalRoutingLinkRecord *lr)
Add a given Global Routing Link Record to the LSA.
LSType
corresponds to LS type field of RFC 2328 OSPF LSA header
SPFStatus GetStatus() const
Get the SPF status of the advertisement.
Ipv4Address m_linkStateId
The Link State ID is defined by the OSPF spec.
bool IsEmpty() const
Check to see if the list of Global Routing Link Records present in the Global Routing Link State Adve...
Ipv4Mask GetNetworkLSANetworkMask() const
For a Network LSA, get the Network Mask field that precedes the list of attached routers.
GlobalRoutingLSA()
Create a blank Global Routing Link State Advertisement.
ListOfLinkRecords_t m_linkRecords
Each Link State Advertisement contains a number of Link Records that describe the kinds of links that...
Ipv4Address GetAttachedRouter(uint32_t n) const
Return an Ipv4Address corresponding to the specified attached router.
void SetNode(Ptr< Node > node)
Set the Node pointer of the node that originated this LSA.
LSType GetLSType() const
Return the LSType field of the LSA.
uint32_t AddAttachedRouter(Ipv4Address addr)
Add an attached router to the list in the NetworkLSA.
uint32_t GetNLinkRecords() const
Return the number of Global Routing Link Records in the LSA.
~GlobalRoutingLSA()
Destroy an existing Global Routing Link State Advertisement.
Ipv4Address m_advertisingRtr
The Advertising Router is defined by the OSPF spec.
void SetLSType(LSType typ)
Set the LS type field of the LSA.
void ClearLinkRecords()
Release all of the Global Routing Link Records present in the Global Routing Link State Advertisement...
void SetAdvertisingRouter(Ipv4Address rtr)
Set the Advertising Router as defined by the OSPF spec.
SPFStatus m_status
This is a tristate flag used internally in the SPF computation to mark if an SPFVertex (a data struct...
LSType m_lsType
The type of the LSA.
ListOfAttachedRouters_t m_attachedRouters
Each Network LSA contains a list of attached routers.
GlobalRoutingLinkRecord * GetLinkRecord(uint32_t n) const
Return a pointer to the specified Global Routing Link Record.
void SetNetworkLSANetworkMask(Ipv4Mask mask)
For a Network LSA, set the Network Mask field that precedes the list of attached routers.
Ipv4Mask m_networkLSANetworkMask
Each Network LSA contains the network mask of the attached network.
void CopyLinkRecords(const GlobalRoutingLSA &lsa)
Copy any Global Routing Link Records in a given Global Routing Link State Advertisement to the curren...
void SetLinkStateId(Ipv4Address addr)
Set the Link State ID is defined by the OSPF spec.
GlobalRoutingLSA & operator=(const GlobalRoutingLSA &lsa)
Assignment operator for a Global Routing Link State Advertisement.
Ipv4Address GetLinkStateId() const
Get the Link State ID as defined by the OSPF spec.
A single link record for a link state advertisement.
LinkType m_linkType
The type of the Global Routing Link Record.
LinkType GetLinkType() const
Get 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.
void SetLinkId(Ipv4Address addr)
Set the Link ID field of the Global Routing Link Record.
Ipv4Address m_linkId
m_linkId and m_linkData are defined by OSPF to have different meanings depending on the type of link ...
Ipv4Address GetLinkId() const
Get the Link ID field of the Global Routing Link Record.
Ipv4Address m_linkData
m_linkId and m_linkData are defined by OSPF to have different meanings depending on the type of link ...
uint16_t GetMetric() const
Get the Metric Data field of the Global Routing Link Record.
void SetLinkData(Ipv4Address addr)
Set the Link Data field of the Global Routing Link Record.
Ipv4Address GetLinkData() const
Get the Link Data field of the Global Routing Link Record.
LinkType
Enumeration of the possible types of Global Routing Link Records.
@ StubNetwork
Record represents a leaf node network.
@ PointToPoint
Record representing a point to point channel.
@ TransitNetwork
Unused – for future OSPF compatibility
uint16_t m_metric
The metric for a given link.
GlobalRoutingLinkRecord()
Construct an empty ("uninitialized") Global Routing Link Record.
void SetLinkType(LinkType linkType)
Set the Link Type field of the Global Routing Link Record.
~GlobalRoutingLinkRecord()
Destroy a Global Routing Link Record.
Ipv4 addresses are stored in host order in this class.
void Set(uint32_t address)
input address is in host order.
Ipv4Address CombineMask(const Ipv4Mask &mask) const
Combine this address with a network mask.
Access to the IPv4 forwarding table, interfaces, and configuration.
a class to represent an Ipv4 address mask
uint16_t GetPrefixLength() const
uint32_t Get() const
Get the host-order 32-bit IP mask.
A record of an IPv4 routing table entry for Ipv4GlobalRouting and Ipv4StaticRouting.
static Ipv4RoutingTableEntry CreateNetworkRouteTo(Ipv4Address network, Ipv4Mask networkMask, Ipv4Address nextHop, uint32_t interface)
holds a vector of ns3::NetDevice pointers
uint32_t GetN() const
Get the number of Ptr<NetDevice> stored in this container.
void Add(NetDeviceContainer other)
Append the contents of another NetDeviceContainer to the end of this container.
Ptr< NetDevice > Get(uint32_t i) const
Get the Ptr<NetDevice> stored in this container at a given index.
uint32_t GetNDevices() const
Ptr< NetDevice > GetDevice(uint32_t index) const
Retrieve the index-th NetDevice associated to this node.
static Ptr< Node > GetNode(uint32_t n)
A base class which provides memory management and object aggregation.
Ptr< T > GetObject() const
Get a pointer to the requested aggregated Object.
virtual void DoDispose()
Destructor implementation.
a unique identifier for an interface.
TypeId SetParent(TypeId tid)
Set the parent TypeId.
#define NS_ASSERT(condition)
At runtime, in debugging builds, if this condition is not true, the program prints the source file,...
#define NS_ASSERT_MSG(condition, message)
At runtime, in debugging builds, if this condition is not true, the program prints the message to out...
#define NS_ABORT_MSG_UNLESS(cond, msg)
Abnormal program termination if a condition is false, with a message.
#define NS_ABORT_MSG(msg)
Unconditional abnormal program termination with a message.
#define NS_ABORT_MSG_IF(cond, msg)
Abnormal program termination if a condition is true, with a message.
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
#define NS_LOG_DEBUG(msg)
Use NS_LOG to output a message of level LOG_DEBUG.
#define NS_LOG_LOGIC(msg)
Use NS_LOG to output a message of level LOG_LOGIC.
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
#define NS_LOG_WARN(msg)
Use NS_LOG to output a message of level LOG_WARN.
#define NS_OBJECT_ENSURE_REGISTERED(type)
Register an Object subclass with the TypeId system.
Every class exported by the ns3 library is enclosed in the ns3 namespace.
std::ostream & operator<<(std::ostream &os, const Angles &a)