|
INET Framework for OMNeT++/OMNEST
|
#include <Ospfv3Area.h>
|
| | Ospfv3Area (Ipv4Address areaID, Ospfv3Instance *containingInstance, Ospfv3AreaType type) |
| |
| virtual | ~Ospfv3Area () |
| |
| Ipv4Address | getAreaID () const |
| |
| Ospfv3AreaType | getAreaType () const |
| |
| bool | hasInterface (std::string) |
| |
| void | addInterface (Ospfv3Interface *) |
| |
| void | init () |
| |
| void | debugDump () |
| |
| void | ageDatabase () |
| |
| int | getInstanceType () |
| |
| void | setiInstanceType (int type) |
| |
| Ospfv3Instance * | getInstance () const |
| |
| void | setExternalRoutingCapability (bool capable) |
| |
| void | setStubDefaultCost (int newCost) |
| |
| void | setTransitCapability (bool capable) |
| |
| Ospfv3Interface * | getInterfaceById (int id) |
| |
| Ospfv3Interface * | getNetworkLSAInterface (Ipv4Address id) |
| |
| Ospfv3Interface * | getInterfaceByIndex (int id) |
| |
| bool | getExternalRoutingCapability () |
| |
| int | getStubDefaultCost () |
| |
| bool | getTransitCapability () |
| |
| Ospfv3Interface * | findVirtualLink (Ipv4Address routerID) |
| |
| Ospfv3Interface * | getInterface (int i) const |
| |
| Ospfv3Interface * | getInterfaceByIndex (Ipv4Address address) |
| |
| int | getInterfaceCount () const |
| |
| Ospfv3Lsa * | getLSAbyKey (LSAKeyType lsaKey) |
| |
| void | addAddressRange (Ipv6AddressRange addressRange, bool advertise) |
| |
| bool | hasAddressRange (Ipv6AddressRange addressRange) const |
| |
| void | addAddressRange (Ipv4AddressRange addressRange, bool advertise) |
| |
| bool | hasAddressRange (Ipv4AddressRange addressRange) const |
| |
| RouterLSA * | originateRouterLSA () |
| | ----------------------------------— Router LSA -----------------------------------—// More...
|
| |
| int | getRouterLSACount () |
| |
| RouterLSA * | getRouterLSA (int i) |
| |
| RouterLSA * | getRouterLSAbyKey (LSAKeyType lsaKey) |
| |
| bool | installRouterLSA (const Ospfv3RouterLsa *lsaC) |
| |
| bool | updateRouterLSA (RouterLSA *currentLsa, const Ospfv3RouterLsa *newLsa) |
| |
| bool | routerLSADiffersFrom (Ospfv3RouterLsa *currentLsa, const Ospfv3RouterLsa *newLsa) |
| |
| Ipv4Address | getNewRouterLinkStateID () |
| |
| Ipv4Address | getRouterLinkStateID () |
| |
| uint32_t | getCurrentRouterSequence () |
| |
| void | incrementRouterSequence () |
| |
| RouterLSA * | findRouterLSAByID (Ipv4Address linkStateID) |
| |
| RouterLSA * | findRouterLSA (Ipv4Address routerID) |
| |
| void | deleteRouterLSA (int index) |
| |
| void | addRouterLSA (RouterLSA *newLSA) |
| |
| RouterLSA * | routerLSAAlreadyExists (RouterLSA *newLsa) |
| |
| void | addNetworkLSA (NetworkLSA *newLSA) |
| |
| NetworkLSA * | originateNetworkLSA (Ospfv3Interface *interface) |
| |
| int | getNetworkLSACount () |
| |
| NetworkLSA * | getNetworkLSA (int i) |
| |
| bool | installNetworkLSA (const Ospfv3NetworkLsa *lsaC) |
| |
| bool | updateNetworkLSA (NetworkLSA *currentLsa, const Ospfv3NetworkLsa *newLsa) |
| |
| bool | networkLSADiffersFrom (Ospfv3NetworkLsa *currentLsa, const Ospfv3NetworkLsa *newLsa) |
| |
| Ipv4Address | getNewNetworkLinkStateID () |
| |
| Ipv4Address | getNetworkLinkStateID () |
| |
| uint32_t | getCurrentNetworkSequence () |
| |
| void | incrementNetworkSequence () |
| |
| NetworkLSA * | findNetworkLSAByLSID (Ipv4Address linkStateID) |
| |
| NetworkLSA * | getNetworkLSAbyKey (LSAKeyType LSAKey) |
| |
| NetworkLSA * | findNetworkLSA (uint32_t intID, Ipv4Address routerID) |
| |
| void | addInterAreaPrefixLSA (InterAreaPrefixLSA *newLSA) |
| |
| int | getInterAreaPrefixLSACount () |
| |
| InterAreaPrefixLSA * | getInterAreaPrefixLSA (int i) |
| |
| void | originateDefaultInterAreaPrefixLSA (Ospfv3Area *toArea) |
| |
| void | originateInterAreaPrefixLSA (Ospfv3IntraAreaPrefixLsa *lsa, Ospfv3Area *fromArea, bool checkDuplicate) |
| |
| void | originateInterAreaPrefixLSA (const Ospfv3Lsa *prefLsa, Ospfv3Area *fromArea) |
| |
| bool | installInterAreaPrefixLSA (const Ospfv3InterAreaPrefixLsa *lsaC) |
| |
| bool | updateInterAreaPrefixLSA (InterAreaPrefixLSA *currentLsa, const Ospfv3InterAreaPrefixLsa *newLsa) |
| |
| bool | interAreaPrefixLSADiffersFrom (Ospfv3InterAreaPrefixLsa *currentLsa, const Ospfv3InterAreaPrefixLsa *newLsa) |
| |
| Ipv4Address | getNewInterAreaPrefixLinkStateID () |
| |
| uint32_t | getCurrentInterAreaPrefixSequence () |
| |
| void | incrementInterAreaPrefixSequence () |
| |
| InterAreaPrefixLSA * | InterAreaPrefixLSAAlreadyExists (const Ospfv3InterAreaPrefixLsa *newLsa) |
| |
| InterAreaPrefixLSA * | findInterAreaPrefixLSAbyAddress (const L3Address address, int prefixLen) |
| |
| IntraAreaPrefixLSA * | originateIntraAreaPrefixLSA () |
| |
| IntraAreaPrefixLSA * | originateNetIntraAreaPrefixLSA (NetworkLSA *networkLSA, Ospfv3Interface *interface, bool checkDuplicate) |
| |
| void | addIntraAreaPrefixLSA (IntraAreaPrefixLSA *newLSA) |
| |
| int | getIntraAreaPrefixLSACount () |
| |
| IntraAreaPrefixLSA * | getIntraAreaPrefixLSA (int i) |
| |
| IntraAreaPrefixLSA * | getNetIntraAreaPrefixLSA (L3Address prefix, int prefLen) |
| |
| bool | installIntraAreaPrefixLSA (const Ospfv3IntraAreaPrefixLsa *lsaC) |
| |
| bool | updateIntraAreaPrefixLSA (IntraAreaPrefixLSA *currentLsa, const Ospfv3IntraAreaPrefixLsa *newLsa) |
| |
| bool | intraAreaPrefixLSADiffersFrom (Ospfv3IntraAreaPrefixLsa *currentLsa, const Ospfv3IntraAreaPrefixLsa *newLsa) |
| |
| Ipv4Address | getNewIntraAreaPrefixLinkStateID () |
| |
| void | subtractIntraAreaPrefixLinkStateID () |
| |
| uint32_t | getCurrentIntraAreaPrefixSequence () |
| |
| void | incrementIntraAreaPrefixSequence () |
| |
| IntraAreaPrefixLSA * | findIntraAreaPrefixByAddress (L3Address address, int prefix) |
| |
| IntraAreaPrefixLSA * | findIntraAreaPrefixLSAByReference (LSAKeyType lsaKey) |
| |
| IntraAreaPrefixLSA * | IntraAreaPrefixLSAAlreadyExists (const Ospfv3IntraAreaPrefixLsa *newLsa) |
| |
| const Ospfv3LsaHeader * | findLSA (LSAKeyType lsaKey) |
| |
| bool | floodLSA (const Ospfv3Lsa *lsa, Ospfv3Interface *interface=nullptr, Ospfv3Neighbor *neighbor=nullptr) |
| |
| void | removeFromAllRetransmissionLists (LSAKeyType lsaKey) |
| |
| bool | isOnAnyRetransmissionList (LSAKeyType lsaKey) const |
| |
| bool | hasAnyNeighborInStates (int state) const |
| |
| bool | hasAnyPassiveInterface () const |
| |
| void | calculateShortestPathTree (std::vector< Ospfv3RoutingTableEntry * > &newTableIPv6, std::vector< Ospfv3Ipv4RoutingTableEntry * > &newTableIPv4) |
| |
| void | calculateInterAreaRoutes (std::vector< Ospfv3RoutingTableEntry * > &newTable, std::vector< Ospfv3Ipv4RoutingTableEntry * > &newTableIPv4) |
| |
| bool | nextHopAlreadyExists (std::vector< NextHop > *hops, NextHop nextHop) const |
| |
| std::vector< NextHop > * | calculateNextHops (Ospfv3Lsa *destination, Ospfv3Lsa *parent) const |
| |
| void | addRouterEntry (RouterLSA *routerLSA, LSAKeyType lsaKey, std::vector< Ospfv3RoutingTableEntry * > &newTableIPv6, std::vector< Ospfv3Ipv4RoutingTableEntry * > &newTableIPv4) |
| |
| bool | findSameOrWorseCostRoute (const std::vector< Ospfv3RoutingTableEntry * > &newTable, const InterAreaPrefixLSA &interAreaPrefixLSA, unsigned short currentCost, bool &destinationInRoutingTable, std::list< Ospfv3RoutingTableEntry * > &sameOrWorseCost) const |
| | Browse through the newTable looking for entries describing the same destination as the currentLSA. More...
|
| |
| bool | findSameOrWorseCostRoute (const std::vector< Ospfv3Ipv4RoutingTableEntry * > &newTable, const InterAreaPrefixLSA &interAreaPrefixLSA, unsigned short currentCost, bool &destinationInRoutingTable, std::list< Ospfv3Ipv4RoutingTableEntry * > &sameOrWorseCost) const |
| |
| Ospfv3RoutingTableEntry * | createRoutingTableEntryFromInterAreaPrefixLSA (const InterAreaPrefixLSA &interAreaPrefixLSA, unsigned short entryCost, const Ospfv3RoutingTableEntry &borderRouterEntry) const |
| | Returns a new RoutingTableEntry based on the input Inter-Area-Prefix LSA, with the input cost and the borderRouterEntry's next hops. More...
|
| |
| Ospfv3Ipv4RoutingTableEntry * | createRoutingTableEntryFromInterAreaPrefixLSA (const InterAreaPrefixLSA &interAreaPrefixLSA, unsigned short entryCost, const Ospfv3Ipv4RoutingTableEntry &borderRouterEntry) const |
| |
| void | recheckInterAreaPrefixLSAs (std::vector< Ospfv3RoutingTableEntry * > &newTableIPv6) |
| |
| void | recheckInterAreaPrefixLSAs (std::vector< Ospfv3Ipv4RoutingTableEntry * > &newTableIPv4) |
| |
| bool | hasLink (Ospfv3Lsa *fromLSA, Ospfv3Lsa *toLSA) const |
| |
| std::string | detailedInfo () const |
| |
| void | setSpfTreeRoot (RouterLSA *routerLSA) |
| |
◆ Ospfv3Area()
◆ ~Ospfv3Area()
| inet::ospfv3::Ospfv3Area::~Ospfv3Area |
( |
| ) |
|
|
virtual |
29 for (
int i = 0; i < interfaceNum; i++) {
34 for (
long j = 0; j < lsaCount; j++) {
39 for (
long k = 0;
k < lsaCount;
k++) {
44 for (
long m = 0;
m < lsaCount;
m++) {
49 for (
long m = 0;
m < lsaCount;
m++) {
◆ addAddressRange() [1/2]
| void inet::ospfv3::Ospfv3Area::addAddressRange |
( |
Ipv4AddressRange |
addressRange, |
|
|
bool |
advertise |
|
) |
| |
1949 bool erased =
false;
1951 for (
int i = 0; i < addressRangeNum; i++) {
1953 if (curRange.contains(addressRange)) {
1956 throw cRuntimeError(
"Inconsistent advertise settings for %s and %s address ranges in area %s",
1957 addressRange.str().c_str(), curRange.str().c_str(),
areaID.
str(
false).c_str());
1960 else if (addressRange.contains(curRange)) {
1962 throw cRuntimeError(
"Inconsistent advertise settings for %s and %s address ranges in area %s",
1963 addressRange.str().c_str(), curRange.str().c_str(),
areaID.
str(
false).c_str());
1970 if (erased && found)
1971 throw cRuntimeError(
"Model error: bad contents in IPv4areaAddressRanges vector");
◆ addAddressRange() [2/2]
| void inet::ospfv3::Ospfv3Area::addAddressRange |
( |
Ipv6AddressRange |
addressRange, |
|
|
bool |
advertise |
|
) |
| |
1895 bool erased =
false;
1897 for (
int i = 0; i < addressRangeNum; i++) {
1899 if (curRange.contains(addressRange)) {
1902 throw cRuntimeError(
"Inconsistent advertise settings for %s and %s address ranges in area %s",
1903 addressRange.str().c_str(), curRange.str().c_str(),
areaID.
str(
false).c_str());
1906 else if (addressRange.contains(curRange)) {
1908 throw cRuntimeError(
"Inconsistent advertise settings for %s and %s address ranges in area %s",
1909 addressRange.str().c_str(), curRange.str().c_str(),
areaID.
str(
false).c_str());
1916 if (erased && found)
1917 throw cRuntimeError(
"Model error: bad contents in areaAddressRanges vector");
Referenced by inet::ospfv3::Ospfv3Process::parseConfig().
◆ addInterAreaPrefixLSA()
◆ addInterface()
| void inet::ospfv3::Ospfv3Area::addInterface |
( |
Ospfv3Interface * |
newInterface | ) |
|
◆ addIntraAreaPrefixLSA()
◆ addNetworkLSA()
| void inet::ospfv3::Ospfv3Area::addNetworkLSA |
( |
NetworkLSA * |
newLSA | ) |
|
|
inline |
◆ addRouterEntry()
2436 L3Address destinationID;
2441 if (iapLSA !=
nullptr) {
2442 for (
size_t i = 0; i < iapLSA->getPrefixesArraySize(); i++) {
2443 destinationID = iapLSA->getPrefixes(i).addressPrefix;
2444 prefixLen = iapLSA->getPrefixes(i).prefixLen;
2448 Ospfv3RoutingTableEntry *entry =
new Ospfv3RoutingTableEntry(this->
getInstance()->ift, destinationID.toIpv6(), prefixLen,
IRoute::OSPF);
2449 unsigned int nextHopCount = routerLSA->getNextHopCount();
2452 entry->setLinkStateOrigin(routerLSA);
2455 entry->setCost(routerLSA->getDistance());
2456 if (routerLSA->getBBit())
2459 if (routerLSA->getEBit())
2462 entry->setDestinationType(destinationType);
2463 entry->setOptionalCapabilities(routerLSA->getOspfOptions());
2464 for (
unsigned int j = 0; j < nextHopCount; j++) {
2465 entry->addNextHop(routerLSA->getNextHop(j));
2468 newTableIPv6.push_back(entry);
2471 Ospfv3Ipv4RoutingTableEntry *entry =
new Ospfv3Ipv4RoutingTableEntry(this->
getInstance()->ift, destinationID.toIpv4(), prefixLen,
IRoute::OSPF);
2472 unsigned int nextHopCount = routerLSA->getNextHopCount();
2475 entry->setLinkStateOrigin(routerLSA);
2478 entry->setCost(routerLSA->getDistance());
2479 if (routerLSA->getBBit()) {
2482 if (routerLSA->getEBit()) {
2486 entry->setDestinationType(destinationType);
2487 entry->setOptionalCapabilities(routerLSA->getOspfOptions());
2488 for (
unsigned int j = 0; j < nextHopCount; j++) {
2489 entry->addNextHop(routerLSA->getNextHop(j));
2492 newTableIPv4.push_back(entry);
◆ addRouterLSA()
| void inet::ospfv3::Ospfv3Area::addRouterLSA |
( |
RouterLSA * |
newLSA | ) |
|
|
inline |
◆ ageDatabase()
| void inet::ospfv3::Ospfv3Area::ageDatabase |
( |
| ) |
|
188 bool shouldRebuildRoutingTable =
false;
192 for (i = 0; i < lsaCount; i++) {
194 unsigned short lsAge = lsa->getHeader().getLsaAge();
199 if ((selfOriginated && (lsAge < (
LS_REFRESH_TIME - 1))) || (!selfOriginated && (lsAge < (
MAX_AGE - 1)))) {
200 lsa->getHeaderForUpdate().setLsaAge(lsAge + 1);
202 if (!lsa->validateLSChecksum()) {
203 EV_ERROR <<
"Invalid LS checksum. Memory error detected!\n";
206 lsa->incrementInstallTime();
216 long sequenceNumber = lsa->getHeader().getLsaSequenceNumber();
218 lsa->getHeaderForUpdate().setLsaAge(
MAX_AGE);
220 lsa->incrementInstallTime();
224 newLSA->getHeaderForUpdate().setLsaSequenceNumber(sequenceNumber + 1);
231 if (!selfOriginated && (lsAge ==
MAX_AGE - 1)) {
232 lsa->getHeaderForUpdate().setLsaAge(
MAX_AGE);
234 lsa->incrementInstallTime();
239 lsaKey.linkStateID = lsa->getHeader().getLinkStateID();
240 lsaKey.advertisingRouter = lsa->getHeader().getAdvertisingRouter();
245 if (!selfOriginated ) {
249 shouldRebuildRoutingTable =
true;
253 long sequenceNumber = lsa->getHeader().getLsaSequenceNumber();
267 if ((*routerIt) ==
nullptr) {
277 for (i = 0; i < lsaCount; i++) {
278 unsigned short lsAge =
networkLSAList[i]->getHeader().getLsaAge();
281 Ospfv3Interface *localIntf =
nullptr;
282 if (lsa->getHeader().getAdvertisingRouter() == this->getInstance()->getProcess()->getRouterID()) {
285 bool selfOriginated =
false;
287 if ((localIntf !=
nullptr) &&
289 (localIntf->getNeighborCount() > 0) &&
292 selfOriginated =
true;
295 if ((selfOriginated && (lsAge < (
LS_REFRESH_TIME - 1))) || (!selfOriginated && (lsAge < (
MAX_AGE - 1)))) {
296 lsa->getHeaderForUpdate().setLsaAge(lsAge + 1);
298 if (!lsa->validateLSChecksum()) {
299 EV_ERROR <<
"Invalid LS checksum. Memory error detected!\n";
302 lsa->incrementInstallTime();
311 long sequenceNumber = lsa->getHeader().getLsaSequenceNumber();
313 lsa->getHeaderForUpdate().setLsaAge(
MAX_AGE);
315 lsa->incrementInstallTime();
320 if (newLSA !=
nullptr) {
321 newLSA->getHeaderForUpdate().setLsaSequenceNumber(sequenceNumber + 1);
326 lsa->getHeaderForUpdate().setLsaAge(
MAX_AGE);
327 lsa->incrementInstallTime();
333 if (!selfOriginated && (lsAge ==
MAX_AGE - 1)) {
334 lsa->getHeaderForUpdate().setLsaAge(
MAX_AGE);
336 lsa->incrementInstallTime();
341 lsaKey.linkStateID = lsa->getHeader().getLinkStateID();
342 lsaKey.advertisingRouter = lsa->getHeader().getAdvertisingRouter();
347 if (!selfOriginated ) {
351 shouldRebuildRoutingTable =
true;
355 long sequenceNumber = lsa->getHeader().getLsaSequenceNumber();
357 if (newLSA !=
nullptr) {
375 if ((*networkIt) ==
nullptr) {
385 for (i = 0; i < lsaCount; i++) {
389 Ospfv3Interface *localIntf =
nullptr;
390 if (lsa->getHeader().getAdvertisingRouter() == this->getInstance()->getProcess()->getRouterID()) {
393 bool selfOriginated =
false;
395 if ((localIntf !=
nullptr) &&
397 (localIntf->getNeighborCount() > 0) &&
400 selfOriginated =
true;
403 if ((selfOriginated && (lsAge < (
LS_REFRESH_TIME - 1))) || (!selfOriginated && (lsAge < (
MAX_AGE - 1)))) {
404 lsa->getHeaderForUpdate().setLsaAge(lsAge + 1);
406 if (!lsa->validateLSChecksum()) {
407 EV_ERROR <<
"Invalid LS checksum. Memory error detected!\n";
410 lsa->incrementInstallTime();
419 long sequenceNumber = lsa->getHeader().getLsaSequenceNumber();
421 lsa->getHeaderForUpdate().setLsaAge(
MAX_AGE);
423 lsa->incrementInstallTime();
426 IntraAreaPrefixLSA *newLSA =
nullptr;
429 NetworkLSA *netLSA =
findNetworkLSA(localIntf->getInterfaceId(), this->getInstance()->getProcess()->getRouterID());
436 if (newLSA !=
nullptr) {
443 lsa->getHeaderForUpdate().setLsaAge(
MAX_AGE);
444 lsa->incrementInstallTime();
451 if (!selfOriginated && (lsAge ==
MAX_AGE - 1)) {
452 lsa->getHeaderForUpdate().setLsaAge(
MAX_AGE);
454 lsa->incrementInstallTime();
460 lsaKey.linkStateID = lsa->getHeader().getLinkStateID();
461 lsaKey.advertisingRouter = lsa->getHeader().getAdvertisingRouter();
466 if (!selfOriginated ) {
471 if (area->getAreaID() == this->getAreaID())
473 for (
size_t prefs = 0; prefs < lsa->getPrefixesArraySize(); prefs++) {
475 if (interLSA !=
nullptr) {
477 area->floodLSA(interLSA);
486 shouldRebuildRoutingTable =
true;
489 IntraAreaPrefixLSA *newLSA =
nullptr;
491 NetworkLSA *netLSA =
findNetworkLSA(localIntf->getInterfaceId(), this->getInstance()->getProcess()->getRouterID());
498 long sequenceNumber = lsa->getHeader().getLsaSequenceNumber();
500 if (newLSA !=
nullptr) {
519 if ((*intraArIt) ==
nullptr) {
529 for (i = 0; i < lsaCount; i++) {
535 if ((selfOriginated && (lsaAge < (
LS_REFRESH_TIME - 1))) || (!selfOriginated && (lsaAge < (
MAX_AGE - 1)))) {
536 lsa->getHeaderForUpdate().setLsaAge(lsaAge + 1);
538 if (!lsa->validateLSChecksum()) {
539 EV_ERROR <<
"Invalid LS checksum. Memory error detected!\n";
542 lsa->incrementInstallTime();
552 long sequenceNumber = lsa->getHeader().getLsaSequenceNumber();
554 lsa->getHeaderForUpdate().setLsaAge(
MAX_AGE);
556 lsa->incrementInstallTime();
562 bool lsaFromFarArea =
true;
565 if (area->getAreaID() == this->getAreaID())
568 IntraAreaPrefixLSA *iapLSA =
nullptr;
570 if (iapLSA !=
nullptr) {
571 area->originateInterAreaPrefixLSA(iapLSA, area,
false);
572 lsaFromFarArea =
false;
576 if (lsaFromFarArea) {
579 if (area->getAreaID() == this->getAreaID())
583 if (interLSA !=
nullptr && interLSA->getHeader().getLsaAge() !=
MAX_AGE) {
584 area->originateInterAreaPrefixLSA(interLSA, area);
596 lsaKey.advertisingRouter = lsa->getHeader().getAdvertisingRouter();
600 if (!selfOriginated ) {
604 shouldRebuildRoutingTable =
true;
606 else if (this->
getInstance()->getAreaCount() > 1) {
609 if (area->getAreaID() == this->getAreaID())
612 IntraAreaPrefixLSA *iapLSA =
nullptr;
614 if (iapLSA !=
nullptr) {
615 if (iapLSA->getHeader().getLsaAge() !=
MAX_AGE) {
616 area->originateInterAreaPrefixLSA(iapLSA, area,
false);
622 shouldRebuildRoutingTable =
true;
627 InterAreaPrefixLSA *interLSA = area->findInterAreaPrefixLSAbyAddress(lsa->getPrefix().addressPrefix, lsa->getPrefix().prefixLen);
628 if (interLSA !=
nullptr && interLSA->getHeader().getLsaAge() !=
MAX_AGE) {
629 area->originateInterAreaPrefixLSA(interLSA, area);
635 shouldRebuildRoutingTable =
true;
647 if ((*interIt) ==
nullptr) {
655 shouldRebuildRoutingTable |=
interfaceList[x]->ageDatabase();
659 for (
long m = 0;
m < interfaceCount;
m++) {
663 if (shouldRebuildRoutingTable) {
◆ calculateInterAreaRoutes()
2691 EV_DEBUG <<
"Calculating Inter-Area Routes for Backbone\n";
2692 unsigned long i = 0;
2693 unsigned long j = 0;
2697 for (i = 0; i < lsaCount; i++) {
2699 const Ospfv3LsaHeader& currentHeader = currentLSA->getHeader();
2701 unsigned long routeCost = currentLSA->getMetric();
2702 unsigned short lsAge = currentHeader.getLsaAge();
2703 Ipv4Address originatingRouter = currentHeader.getAdvertisingRouter();
2715 char lsType = currentHeader.getLsaType();
2719 unsigned long routeCount = newTableIPv6.size();
2720 Ipv6AddressRange destination;
2723 destination.prefix = currentLSA->getPrefix().addressPrefix.toIpv6();
2724 destination.prefixLength = currentLSA->getPrefix().prefixLen;
2727 bool foundIntraAreaRoute =
false;
2729 for (j = 0; j < routeCount; j++) {
2730 Ospfv3RoutingTableEntry *routingEntry = newTableIPv6[j];
2734 destination.containedByRange(routingEntry->getDestPrefix(), routingEntry->getPrefixLength()))
2736 foundIntraAreaRoute =
true;
2740 if (foundIntraAreaRoute) {
2745 Ospfv3RoutingTableEntry *borderRouterEntry =
nullptr;
2746 LinkLSA *linkLSA =
nullptr;
2747 for (
size_t iface = 0; iface <
interfaceList.size(); iface++) {
2748 linkLSA =
interfaceList[iface]->findLinkLSAbyAdvRouter(originatingRouter);
2749 if (linkLSA !=
nullptr)
2752 if (linkLSA !=
nullptr) {
2754 for (j = 0; j < routeCount; j++) {
2756 Ospfv3RoutingTableEntry *routingEntry = newTableIPv6[j];
2759 for (
size_t pfxs = 0; pfxs < linkLSA->getPrefixesArraySize(); pfxs++) {
2760 const Ospfv3LsaHeader header = routingEntry->getLinkStateOrigin()->getHeader();
2763 if ((routingEntry->getArea() ==
areaID) &&
2766 (header.getAdvertisingRouter() == linkLSA->getHeader().getAdvertisingRouter()) &&
2767 (routingEntry->getDestPrefix() == linkLSA->getPrefixes(pfxs).addressPrefix.toIpv6()))
2769 borderRouterEntry = routingEntry;
2773 if (borderRouterEntry !=
nullptr)
2782 if (routerLSA ==
nullptr) {
2786 if (routerLSA->getRoutersArraySize() < 1) {
2789 for (
size_t ro = 0; ro < routerLSA->getRoutersArraySize(); ro++) {
2791 lsaKey.advertisingRouter = routerLSA->getRouters(ro).neighborRouterID;
2792 lsaKey.linkStateID = Ipv4Address(routerLSA->getRouters(ro).neighborInterfaceID);
2793 lsaKey.LSType = routerLSA->getRouters(ro).type;
2796 if (iapLSA ==
nullptr)
2799 for (j = 0; j < routeCount; j++) {
2801 Ospfv3RoutingTableEntry *routingEntry = newTableIPv6[j];
2804 for (
size_t pfxs = 0; pfxs < iapLSA->getPrefixesArraySize(); pfxs++) {
2805 const Ospfv3LsaHeader header = routingEntry->getLinkStateOrigin()->getHeader();
2808 if ((routingEntry->getArea() ==
areaID) &&
2811 (header.getAdvertisingRouter() == iapLSA->getHeader().getAdvertisingRouter()) &&
2812 (routingEntry->getDestPrefix() == iapLSA->getPrefixes(pfxs).addressPrefix.toIpv6()))
2814 borderRouterEntry = routingEntry;
2818 if (borderRouterEntry !=
nullptr)
2821 if (borderRouterEntry !=
nullptr)
2826 if (borderRouterEntry ==
nullptr) {
2835 bool destinationInRoutingTable =
true;
2837 unsigned short currentCost = routeCost + borderRouterEntry->getCost();
2838 std::list<Ospfv3RoutingTableEntry *> sameOrWorseCost;
2843 destinationInRoutingTable,
2849 if (destinationInRoutingTable && (sameOrWorseCost.size() > 0)) {
2850 Ospfv3RoutingTableEntry *equalEntry =
nullptr;
2855 for (
auto checkedEntry : sameOrWorseCost) {
2856 if (checkedEntry->getCost() > currentCost) {
2857 for (
auto entryIt = newTableIPv6.begin(); entryIt != newTableIPv6.end(); entryIt++) {
2858 if (checkedEntry == (*entryIt)) {
2859 newTableIPv6.erase(entryIt);
2865 equalEntry = checkedEntry;
2868 unsigned long nextHopCount = borderRouterEntry->getNextHopCount();
2869 if (equalEntry !=
nullptr) {
2873 for (
unsigned long j = 0; j < nextHopCount; j++) {
2874 equalEntry->addNextHop(borderRouterEntry->getNextHop(j));
2879 ASSERT(newEntry !=
nullptr);
2880 newTableIPv6.push_back(newEntry);
2885 ASSERT(newEntry !=
nullptr);
2886 newTableIPv6.push_back(newEntry);
2891 unsigned long routeCount = newTableIPv4.size();
2892 Ipv4AddressRange destination;
2895 destination.address = currentLSA->getPrefix().addressPrefix.toIpv4();
2896 destination.mask = destination.address.makeNetmask(currentLSA->getPrefix().prefixLen);
2899 bool foundIntraAreaRoute =
false;
2901 for (j = 0; j < routeCount; j++) {
2902 Ospfv3Ipv4RoutingTableEntry *routingEntry = newTableIPv4[j];
2906 destination.containedByRange(routingEntry->getDestination(), routingEntry->getNetmask()))
2908 foundIntraAreaRoute =
true;
2912 if (foundIntraAreaRoute) {
2917 Ospfv3Ipv4RoutingTableEntry *borderRouterEntry =
nullptr;
2922 if (routerLSA ==
nullptr) {
2925 if (routerLSA->getRoutersArraySize() < 1) {
2929 Ospfv3IntraAreaPrefixLsa *iapLSA =
nullptr;
2930 for (
size_t rIndex = 0; rIndex < routerLSA->getRoutersArraySize(); rIndex++) {
2932 lsaKey.linkStateID = (Ipv4Address)routerLSA->getRouters(rIndex).neighborInterfaceID;
2933 lsaKey.advertisingRouter = routerLSA->getRouters(rIndex).neighborRouterID;
2937 if (iapLSA ==
nullptr)
2941 if (iapLSA ==
nullptr)
2945 for (j = 0; j < routeCount; j++) {
2946 Ospfv3Ipv4RoutingTableEntry *routingEntry = newTableIPv4[j];
2947 for (
size_t pfxs = 0; pfxs < iapLSA->getPrefixesArraySize(); pfxs++) {
2949 if ((routingEntry->getArea() ==
areaID) &&
2952 (routingEntry->getDestination() == iapLSA->getPrefixes(pfxs).addressPrefix.toIpv4()))
2954 borderRouterEntry = routingEntry;
2958 if (borderRouterEntry !=
nullptr)
2962 if (borderRouterEntry ==
nullptr) {
2971 bool destinationInRoutingTable =
true;
2972 unsigned short currentCost = routeCost + borderRouterEntry->getCost();
2973 std::list<Ospfv3Ipv4RoutingTableEntry *> sameOrWorseCost;
2978 destinationInRoutingTable,
2984 if (destinationInRoutingTable && (sameOrWorseCost.size() > 0)) {
2985 Ospfv3Ipv4RoutingTableEntry *equalEntry =
nullptr;
2990 for (
auto checkedEntry : sameOrWorseCost) {
2991 if (checkedEntry->getCost() > currentCost) {
2992 for (
auto entryIt = newTableIPv4.begin(); entryIt != newTableIPv4.end(); entryIt++) {
2993 if (checkedEntry == (*entryIt)) {
2994 newTableIPv4.erase(entryIt);
3000 equalEntry = checkedEntry;
3003 unsigned long nextHopCount = borderRouterEntry->getNextHopCount();
3005 if (equalEntry !=
nullptr) {
3009 for (
unsigned long j = 0; j < nextHopCount; j++) {
3010 equalEntry->addNextHop(borderRouterEntry->getNextHop(j));
3015 ASSERT(newEntry !=
nullptr);
3016 newTableIPv4.push_back(newEntry);
3021 ASSERT(newEntry !=
nullptr);
3022 newTableIPv4.push_back(newEntry);
Referenced by inet::ospfv3::Ospfv3Process::rebuildRoutingTable().
◆ calculateNextHops()
3100 EV_DEBUG <<
"Calculating Next Hops\n";
3101 std::vector<NextHop> *hops =
new std::vector<NextHop>;
3103 RouterLSA *routerLSA =
dynamic_cast<RouterLSA *
>(parent);
3104 if (routerLSA !=
nullptr) {
3106 unsigned int nextHopCount = routerLSA->getNextHopCount();
3107 for (i = 0; i < nextHopCount; i++) {
3109 hops->push_back(routerLSA->getNextHop(i));
3114 RouterLSA *destinationRouterLSA =
dynamic_cast<RouterLSA *
>(destination);
3115 if (destinationRouterLSA !=
nullptr) {
3117 for (i = 0; i < interfaceNum; i++) {
3128 if (ptpNeighbor !=
nullptr) {
3131 lsaKey.linkStateID = Ipv4Address(ptpNeighbor->getNeighborInterfaceID());
3132 lsaKey.advertisingRouter = ptpNeighbor->getNeighborID();
3134 LinkLSA *linklsa =
interfaceList[i]->getLinkLSAbyKey(lsaKey);
3136 if (linklsa !=
nullptr) {
3138 nextHop.hopAddress = linklsa->getLinkLocalInterfaceAdd();
3139 nextHop.advertisingRouter = destinationRouterLSA->getHeader().getAdvertisingRouter();
3142 hops->push_back(nextHop);
3149 throw cRuntimeError(
"P2MP in in next hop calculation not implemented yet");
3154 NetworkLSA *destinationNetworkLSA =
dynamic_cast<NetworkLSA *
>(destination);
3155 if (destinationNetworkLSA !=
nullptr) {
3156 Ipv4Address networkDesignatedRouter = destinationNetworkLSA->getHeader().getAdvertisingRouter();
3157 Ipv4Address networkDRintID = destinationNetworkLSA->getHeader().getLinkStateID();
3159 for (i = 0; i < interfaceNum; i++) {
3163 (
interfaceList[i]->getDesignatedID() == networkDesignatedRouter)
3164 && ((Ipv4Address)
interfaceList[i]->getDesignatedIntID() == networkDRintID))
3172 nextHop.advertisingRouter = destinationNetworkLSA->getHeader().getAdvertisingRouter();
3174 hops->push_back(nextHop);
3182 NetworkLSA *networkLSA =
dynamic_cast<NetworkLSA *
>(parent);
3183 if (networkLSA !=
nullptr) {
3185 unsigned int nextHopCount = networkLSA->getNextHopCount();
3186 for (i = 0; i < nextHopCount; i++) {
3188 hops->push_back(networkLSA->getNextHop(i));
3194 Ipv4Address parentLinkStateID = parent->getHeader().getAdvertisingRouter();
3196 RouterLSA *destinationRouterLSA =
dynamic_cast<RouterLSA *
>(destination);
3197 if (destinationRouterLSA !=
nullptr) {
3198 const Ipv4Address& destinationRouterID = destinationRouterLSA->getHeaderForUpdate().getLinkStateID();
3199 unsigned int linkCount = destinationRouterLSA->getRoutersArraySize();
3200 for (i = 0; i < linkCount; i++) {
3201 Ospfv3RouterLsaBody& link = destinationRouterLSA->getRoutersForUpdate(i);
3205 (link.neighborRouterID == parentLinkStateID))
3211 for (j = 0; j < interfaceNum; j++) {
3217 Ospfv3Neighbor *nextHopNeighbor =
interfaceList[j]->getNeighborById(destinationRouterID);
3220 if (nextHopNeighbor !=
nullptr) {
3222 lsaKey.linkStateID = Ipv4Address(nextHopNeighbor->getNeighborInterfaceID());
3223 lsaKey.advertisingRouter = nextHopNeighbor->getNeighborID();
3226 LinkLSA *linklsa =
interfaceList[j]->getLinkLSAbyKey(lsaKey);
3228 if (linklsa !=
nullptr) {
3230 nextHop.hopAddress = linklsa->getLinkLocalInterfaceAdd();
3231 nextHop.advertisingRouter = destinationRouterLSA->getHeader().getAdvertisingRouter();
3233 hops->push_back(nextHop);
◆ calculateShortestPathTree()
2000 EV_DEBUG <<
"Calculating SPF Tree for area " << this->
getAreaID() <<
"\n";
2006 bool finished =
false;
2007 std::vector<Ospfv3Lsa *> treeVertices;
2008 Ospfv3Lsa *justAddedVertex;
2009 std::vector<Ospfv3Lsa *> candidateVertices;
2010 unsigned long i, j,
k;
2011 unsigned long lsaCount;
2015 if (routerLSA ==
nullptr) {
2032 for (i = 0; i < lsaCount; i++) {
2036 for (i = 0; i < lsaCount; i++) {
2047 RouterLSA *routerVertex = check_and_cast<RouterLSA *>(justAddedVertex);
2048 if (routerVertex->getVBit()) {
2052 int testCount = routerVertex->getRoutersArraySize();
2053 for (
int iteration = 0; iteration < testCount; iteration++) {
2054 Ospfv3RouterLsaBody router = routerVertex->getRouters(iteration);
2055 Ospfv3Lsa *joiningVertex;
2061 joiningVertex =
findNetworkLSA(router.neighborInterfaceID, router.neighborRouterID);
2068 if ((joiningVertex ==
nullptr) ||
2069 (joiningVertex->getHeader().getLsaAge() ==
MAX_AGE)
2070 || (!
hasLink(joiningVertex, justAddedVertex)))
2075 unsigned int treeSize = treeVertices.size();
2076 bool alreadyOnTree =
false;
2078 for (j = 0; j < treeSize; j++) {
2079 if (treeVertices[j] == joiningVertex) {
2080 alreadyOnTree =
true;
2084 if (alreadyOnTree) {
2089 unsigned long linkStateCost = routerVertex->getDistance() + routerVertex->getRouters(iteration).metric;
2090 unsigned int candidateCount = candidateVertices.size();
2091 Ospfv3Lsa *candidate =
nullptr;
2093 for (j = 0; j < candidateCount; j++) {
2094 if (candidateVertices[j] == joiningVertex) {
2095 candidate = candidateVertices[j];
2098 if (candidate !=
nullptr) {
2099 RoutingInfo *routingInfo = check_and_cast<RoutingInfo *>(candidate);
2100 unsigned long candidateDistance = routingInfo->getDistance();
2102 if (linkStateCost > candidateDistance) {
2105 if (linkStateCost < candidateDistance) {
2106 routingInfo->setDistance(linkStateCost);
2107 routingInfo->clearNextHops();
2109 std::vector<NextHop> *newNextHops =
calculateNextHops(joiningVertex, justAddedVertex);
2110 unsigned int nextHopCount = newNextHops->size();
2111 for (
k = 0;
k < nextHopCount;
k++) {
2112 routingInfo->addNextHop((*newNextHops)[
k]);
2118 RouterLSA *joiningRouterVertex = check_and_cast<RouterLSA *>(joiningVertex);
2119 joiningRouterVertex->setDistance(linkStateCost);
2120 std::vector<NextHop> *newNextHops =
calculateNextHops(joiningVertex, justAddedVertex);
2121 unsigned int nextHopCount = newNextHops->size();
2122 for (
k = 0;
k < nextHopCount;
k++) {
2123 joiningRouterVertex->addNextHop((*newNextHops)[
k]);
2126 RoutingInfo *vertexRoutingInfo = check_and_cast<RoutingInfo *>(joiningRouterVertex);
2127 vertexRoutingInfo->setParent(justAddedVertex);
2129 candidateVertices.push_back(joiningRouterVertex);
2132 NetworkLSA *joiningNetworkVertex = check_and_cast<NetworkLSA *>(joiningVertex);
2133 joiningNetworkVertex->setDistance(linkStateCost);
2134 std::vector<NextHop> *newNextHops =
calculateNextHops(joiningVertex, justAddedVertex);
2136 unsigned int nextHopCount = newNextHops->size();
2137 for (
k = 0;
k < nextHopCount;
k++) {
2138 joiningNetworkVertex->addNextHop((*newNextHops)[
k]);
2144 RoutingInfo *vertexRoutingInfo = check_and_cast<RoutingInfo *>(joiningNetworkVertex);
2145 vertexRoutingInfo->setParent(justAddedVertex);
2147 candidateVertices.push_back(joiningNetworkVertex);
2154 NetworkLSA *networkVertex = check_and_cast<NetworkLSA *>(justAddedVertex);
2155 unsigned int routerCount = networkVertex->getAttachedRouterArraySize();
2156 for (i = 0; i < routerCount; i++) {
2157 RouterLSA *joiningVertex =
findRouterLSA(networkVertex->getAttachedRouter(i));
2158 if ((joiningVertex ==
nullptr) ||
2159 (joiningVertex->getHeader().getLsaAge() ==
MAX_AGE) ||
2160 (!
hasLink(joiningVertex, justAddedVertex)))
2164 unsigned int treeSize = treeVertices.size();
2165 bool alreadyOnTree =
false;
2167 for (j = 0; j < treeSize; j++) {
2168 if (treeVertices[j] == joiningVertex) {
2169 alreadyOnTree =
true;
2173 if (alreadyOnTree) {
2177 unsigned long linkStateCost = networkVertex->getDistance();
2178 unsigned int candidateCount = candidateVertices.size();
2179 Ospfv3Lsa *candidate =
nullptr;
2181 for (j = 0; j < candidateCount; j++) {
2182 if (candidateVertices[j] == joiningVertex) {
2183 candidate = candidateVertices[j];
2186 if (candidate !=
nullptr) {
2187 RoutingInfo *routingInfo = check_and_cast<RoutingInfo *>(candidate);
2188 unsigned long candidateDistance = routingInfo->getDistance();
2190 if (linkStateCost > candidateDistance) {
2193 if (linkStateCost < candidateDistance) {
2194 routingInfo->setDistance(linkStateCost);
2195 routingInfo->clearNextHops();
2197 std::vector<NextHop> *newNextHops =
calculateNextHops(joiningVertex, justAddedVertex);
2198 unsigned int nextHopCount = newNextHops->size();
2199 for (
k = 0;
k < nextHopCount;
k++) {
2200 routingInfo->addNextHop((*newNextHops)[
k]);
2205 joiningVertex->setDistance(linkStateCost);
2206 std::vector<NextHop> *newNextHops =
calculateNextHops(joiningVertex, justAddedVertex);
2208 unsigned int nextHopCount = newNextHops->size();
2209 for (
k = 0;
k < nextHopCount;
k++) {
2210 joiningVertex->addNextHop((*newNextHops)[
k]);
2213 RoutingInfo *vertexRoutingInfo = check_and_cast<RoutingInfo *>(joiningVertex);
2214 vertexRoutingInfo->setParent(justAddedVertex);
2216 candidateVertices.push_back(joiningVertex);
2221 if (candidateVertices.empty()) {
2225 unsigned int candidateCount = candidateVertices.size();
2227 Ospfv3Lsa *closestVertex = candidateVertices[0];
2230 for (i = 0; i < candidateCount; i++) {
2231 RoutingInfo *routingInfo = check_and_cast<RoutingInfo *>(candidateVertices[i]);
2232 unsigned long currentDistance = routingInfo->getDistance();
2234 if (currentDistance < minDistance) {
2235 closestVertex = candidateVertices[i];
2236 minDistance = currentDistance;
2239 if (currentDistance == minDistance) {
2240 if ((closestVertex->getHeader().getLsaType() ==
ROUTER_LSA) &&
2241 (candidateVertices[i]->getHeader().getLsaType() ==
NETWORK_LSA))
2243 closestVertex = candidateVertices[i];
2249 treeVertices.push_back(closestVertex);
2251 for (
auto it = candidateVertices.begin(); it != candidateVertices.end(); it++) {
2252 if ((*it) == closestVertex) {
2253 candidateVertices.erase(it);
2257 if (closestVertex->getHeader().getLsaType() ==
ROUTER_LSA) {
2258 RouterLSA *routerLSA = check_and_cast<RouterLSA *>(closestVertex);
2260 size_t arrSiz = routerLSA->getRoutersArraySize();
2262 if ((routerLSA->getBBit() || routerLSA->getEBit()) &&
2263 (routerLSA->getHeader().getAdvertisingRouter() != this->getInstance()->getProcess()->getRouterID()))
2269 size_t tree = treeVertices.size();
2271 for (
size_t t = 0; t < tree; t++) {
2272 for (
size_t r = 0; r < arrSiz; r++) {
2273 if (treeVertices[t]->getHeader().getAdvertisingRouter() == routerLSA->getRouters(r).neighborRouterID) {
2289 lsaKey.linkStateID = (Ipv4Address)routerLSA->getHeader().getLinkStateID();
2290 lsaKey.advertisingRouter = routerLSA->getHeader().getAdvertisingRouter();
2293 lsaKey.linkStateID = (Ipv4Address)routerLSA->getRouters(attached).neighborInterfaceID;
2294 lsaKey.advertisingRouter = routerLSA->getRouters(attached).neighborRouterID;
2298 lsaKey.LSType = routerLSA->getRouters(attached).type;
2304 if (routerLSA->getHeader().getAdvertisingRouter() != this->getInstance()->getProcess()->getRouterID()) {
2306 lsaKey.linkStateID = (Ipv4Address)routerLSA->getHeader().getLinkStateID();
2307 lsaKey.advertisingRouter = routerLSA->getHeader().getAdvertisingRouter();
2313 if (closestVertex->getHeader().getLsaType() ==
NETWORK_LSA) {
2314 NetworkLSA *networkLSA = check_and_cast<NetworkLSA *>(closestVertex);
2318 lsaKey.linkStateID = networkLSA->getHeader().getLinkStateID();
2319 lsaKey.advertisingRouter = networkLSA->getHeader().getAdvertisingRouter();
2322 L3Address destinationID;
2325 if (iapLSA !=
nullptr) {
2326 for (
size_t i = 0; i < iapLSA->getPrefixesArraySize(); i++) {
2327 destinationID = iapLSA->getPrefixes(i).addressPrefix;
2328 prefixLen = iapLSA->getPrefixes(i).prefixLen;
2329 unsigned int nextHopCount = networkLSA->getNextHopCount();
2330 bool overWrite =
false;
2332 Ospfv3RoutingTableEntry *entry =
nullptr;
2333 size_t routeCount = newTableIPv6.size();
2336 for (
size_t rt = 0; rt < routeCount; rt++) {
2338 Ospfv3RoutingTableEntry *routingEntry = newTableIPv6[rt];
2339 Ipv6Address entryAddress = routingEntry->getDestPrefix();
2341 if (entryAddress == destinationID.toIpv6()) {
2342 if (destinationID.toIpv6() > longestMatch) {
2343 longestMatch = destinationID.toIpv6();
2344 entry = routingEntry;
2349 if (entry !=
nullptr) {
2350 const Ospfv3Lsa *entryOrigin = entry->getLinkStateOrigin();
2351 if ((entry->getCost() != networkLSA->getDistance()) ||
2352 (entryOrigin->getHeader().getLinkStateID() >= networkLSA->getHeader().getLinkStateID()))
2358 if ((entry ==
nullptr) || (overWrite)) {
2359 if (entry ==
nullptr) {
2360 entry =
new Ospfv3RoutingTableEntry(this->
getInstance()->ift, destinationID.toIpv6(), prefixLen,
IRoute::OSPF);
2362 entry->setLinkStateOrigin(networkLSA);
2365 entry->setCost(networkLSA->getDistance());
2367 entry->setOptionalCapabilities(networkLSA->getOspfOptions());
2369 for (
unsigned int j = 0; j < nextHopCount; j++) {
2370 entry->addNextHop(networkLSA->getNextHop(j));
2373 newTableIPv6.push_back(entry);
2378 Ospfv3Ipv4RoutingTableEntry *entry =
nullptr;
2379 size_t routeCount = newTableIPv4.size();
2382 for (
size_t rt = 0; rt < routeCount; rt++) {
2384 Ospfv3Ipv4RoutingTableEntry *routingEntry = newTableIPv4[rt];
2385 Ipv4Address entryAddress = routingEntry->getDestination();
2387 if (entryAddress == destinationID.toIpv4()) {
2388 if (destinationID.toIpv4() > longestMatch) {
2389 longestMatch = destinationID.toIpv4();
2390 entry = routingEntry;
2395 if (entry !=
nullptr) {
2396 const Ospfv3Lsa *entryOrigin = entry->getLinkStateOrigin();
2397 if ((entry->getCost() != networkLSA->getDistance()) ||
2398 (entryOrigin->getHeader().getLinkStateID() >= networkLSA->getHeader().getLinkStateID()))
2404 if ((entry ==
nullptr) || (overWrite)) {
2405 if (entry ==
nullptr) {
2406 entry =
new Ospfv3Ipv4RoutingTableEntry(this->
getInstance()->ift, destinationID.toIpv4(), prefixLen,
IRoute::OSPF);
2408 entry->setLinkStateOrigin(networkLSA);
2411 entry->setCost(networkLSA->getDistance());
2413 entry->setOptionalCapabilities(networkLSA->getOspfOptions());
2414 for (
unsigned int j = 0; j < nextHopCount; j++) {
2415 entry->addNextHop(networkLSA->getNextHop(j));
2419 newTableIPv4.push_back(entry);
2428 justAddedVertex = closestVertex;
2430 }
while (!finished);
Referenced by inet::ospfv3::Ospfv3Process::rebuildRoutingTable().
◆ createRoutingTableEntryFromInterAreaPrefixLSA() [1/2]
2666 Ipv4AddressRange destination;
2667 destination.address = interAreaPrefixLSA.getPrefix().addressPrefix.toIpv4();
2668 destination.mask = destination.address.makeNetmask(interAreaPrefixLSA.getPrefix().prefixLen);
2669 Ospfv3Ipv4RoutingTableEntry *newEntry =
new Ospfv3Ipv4RoutingTableEntry(this->
getInstance()->ift, destination.address, destination.mask.getNetmaskLength(),
IRoute::OSPF);
2676 newEntry->setLinkStateOrigin(&interAreaPrefixLSA);
2677 newEntry->setArea(
areaID);
2679 newEntry->setCost(entryCost);
2681 unsigned int nextHopCount = borderRouterEntry.getNextHopCount();
2682 for (
unsigned int j = 0; j < nextHopCount; j++) {
2683 newEntry->addNextHop(borderRouterEntry.getNextHop(j));
◆ createRoutingTableEntryFromInterAreaPrefixLSA() [2/2]
Returns a new RoutingTableEntry based on the input Inter-Area-Prefix LSA, with the input cost and the borderRouterEntry's next hops.
2635 Ipv6AddressRange destination;
2637 destination.prefix = interAreaPrefixLSA.getPrefix().addressPrefix.toIpv6();
2638 destination.prefixLength = interAreaPrefixLSA.getPrefix().prefixLen;
2640 Ospfv3RoutingTableEntry *newEntry =
new Ospfv3RoutingTableEntry(this->
getInstance()->ift, destination.prefix, destination.prefixLength,
IRoute::OSPF);
2648 newEntry->setLinkStateOrigin(&interAreaPrefixLSA);
2649 newEntry->setArea(
areaID);
2651 newEntry->setCost(entryCost);
2653 unsigned int nextHopCount = borderRouterEntry.getNextHopCount();
2654 for (
unsigned int j = 0; j < nextHopCount; j++) {
2655 newEntry->addNextHop(borderRouterEntry.getNextHop(j));
◆ debugDump()
| void inet::ospfv3::Ospfv3Area::debugDump |
( |
| ) |
|
3507 for (
auto it = this->
interfaceList.begin(); it != this->interfaceList.end(); it++)
3508 EV_DEBUG <<
"\t\tinterface id: " << (*it)->getIntName() <<
"\n";
◆ deleteRouterLSA()
| void inet::ospfv3::Ospfv3Area::deleteRouterLSA |
( |
int |
index | ) |
|
886 const Ospfv3LsaHeader& routerHeader = delRouter->getHeader();
889 for (
int i = 0; i < prefixCount; i++) {
893 if (lsa->getReferencedAdvRtr() == routerHeader.getAdvertisingRouter() &&
894 lsa->getReferencedLSID() == routerHeader.getLinkStateID() &&
898 prefLSA->getHeaderForUpdate().setLsaAge(
MAX_AGE);
900 EV_DEBUG <<
"Deleting old Router-LSA, set age of appropriate Intra-Area-Prefix-LSA to MAX_AGE\n";
Referenced by inet::ospfv3::Ospfv3InterfaceState::changeState().
◆ detailedInfo()
| std::string inet::ospfv3::Ospfv3Area::detailedInfo |
( |
| ) |
const |
3513 std::stringstream out;
3515 out <<
"Ospfv3 1 address-family ";
3517 out <<
"ipv4 (router-id ";
3519 out <<
"ipv6 (router-id ";
3525 out <<
"Router Link States (Area " << this->
getAreaID().
str(
false) <<
")\n";
3526 out <<
"ADV Router\tAge\tSeq#\t\tFragment ID\tLink count\tBits\n";
3527 for (
auto it = this->
routerLSAList.begin(); it != this->routerLSAList.end(); it++) {
3528 Ospfv3LsaHeader& header = (*it)->getHeaderForUpdate();
3529 bool bitsEmpty =
true;
3530 out << header.getAdvertisingRouter() <<
"\t\t";
3531 out << header.getLsaAge() <<
"\t0x" <<
std::hex << header.getLsaSequenceNumber() << std::dec <<
"\t0\t\t";
3532 out << (*it)->getRoutersArraySize() <<
"\t\t";
3533 if ((*it)->getNtBit()) {
3537 if ((*it)->getXBit()) {
3541 if ((*it)->getVBit()) {
3545 if ((*it)->getEBit()) {
3549 if ((*it)->getBBit()) {
3561 out <<
"\nNet Link States (Area " << this->
getAreaID().
str(
false) <<
")\n";
3562 out <<
"ADV Router\tAge\tSeq#\t\tLink State ID\tRtr count\n";
3563 for (
auto it = this->
networkLSAList.begin(); it != this->networkLSAList.end(); it++) {
3564 Ospfv3LsaHeader& header = (*it)->getHeaderForUpdate();
3565 out << header.getAdvertisingRouter() <<
"\t\t";
3566 out << header.getLsaAge() <<
"\t0x" <<
std::hex << header.getLsaSequenceNumber() << std::dec <<
"\t" << header.getLinkStateID().str(
false) <<
"\t\t" << (*it)->getAttachedRouterArraySize() <<
"\n";
3571 out <<
"\nInter Area Prefix Link States (Area " << this->
getAreaID().
str(
false) <<
")\n";
3572 out <<
"ADV Router\tAge\tSeq#\t\tPrefix\n";
3574 Ospfv3LsaHeader& header = (*it)->getHeaderForUpdate();
3575 out << header.getAdvertisingRouter() <<
"\t\t";
3576 out << header.getLsaAge() <<
"\t0x" <<
std::hex << header.getLsaSequenceNumber() << std::dec <<
"\t";
3578 L3Address addrPref = (*it)->getPrefix().addressPrefix;
3580 out << (*it)->getPrefix().addressPrefix.str() <<
"/" << (int)(*it)->getPrefix().prefixLen << endl;
3583 Ipv6Address ipv6addr = addrPref.toIpv6();
3584 ipv6addr = ipv6addr.getPrefix((*it)->getPrefix().prefixLen);
3586 out <<
"::/0" << endl;
3588 out << ipv6addr.str() <<
"/" << (int)(*it)->getPrefix().prefixLen << endl;
3593 out <<
"\nLink (Type-8) Link States (Area " << this->
getAreaID().
str(
false) <<
")\n";
3594 out <<
"ADV Router\tAge\tSeq#\t\tLink State ID\tInterface\n";
3595 for (
auto it = this->
interfaceList.begin(); it != this->interfaceList.end(); it++) {
3596 int linkLSACount = (*it)->getLinkLSACount();
3597 for (
int i = 0; i < linkLSACount; i++) {
3598 Ospfv3LsaHeader& header = (*it)->getLinkLSA(i)->getHeaderForUpdate();
3599 out << header.getAdvertisingRouter() <<
"\t\t";
3600 out << header.getLsaAge() <<
"\t0x" <<
std::hex << header.getLsaSequenceNumber() << std::dec <<
"\t" << header.getLinkStateID().str(
false) <<
"\t\t" << (*it)->getIntName() <<
"\n";
3605 out <<
"\nIntra Area Prefix Link States (Area" << this->
getAreaID().
str(
false) <<
")\n";
3606 out <<
"ADV Router\tAge\tSeq#\t\tLink ID\t\tRef-lstype\tRef-LSID\n";
3608 Ospfv3LsaHeader& header = (*it)->getHeaderForUpdate();
3609 out << header.getAdvertisingRouter() <<
"\t\t";
3610 if ((*it)->getReferencedLSType() == 2)
3611 out << header.getLsaAge() <<
"\t0x" <<
std::hex << header.getLsaSequenceNumber() << std::dec <<
"\t" << header.getLinkStateID().str(
false) <<
"\t\t0x200" << (*it)->getReferencedLSType() <<
"\t\t" << (*it)->getReferencedLSID().str(
false) <<
"\n\n";
3613 out << header.getLsaAge() <<
"\t0x" <<
std::hex << header.getLsaSequenceNumber() << std::dec <<
"\t" << header.getLinkStateID().str(
false) <<
"\t\t0x200" << (*it)->getReferencedLSType() <<
"\t\t0\n\n";
Referenced by inet::ospfv3::operator<<().
◆ findInterAreaPrefixLSAbyAddress()
◆ findIntraAreaPrefixByAddress()
1810 for (
size_t i = 0; i < (*it)->getPrefixesArraySize(); i++) {
1811 if ((*it)->getPrefixes(i).addressPrefix == address && (*it)->getPrefixes(i).prefixLen == prefix)
Referenced by ageDatabase().
◆ findIntraAreaPrefixLSAByReference()
1821 if (((*it)->getReferencedLSType() == lsaKey.LSType) && ((*it)->getReferencedLSID() == lsaKey.linkStateID) && ((*it)->getReferencedAdvRtr() == lsaKey.advertisingRouter)) {
◆ findLSA()
142 switch (lsaKey.LSType) {
145 if (lsa ==
nullptr) {
149 const Ospfv3LsaHeader *lsaHeader = &(lsa->getHeader());
156 if (lsa ==
nullptr) {
160 const Ospfv3LsaHeader *lsaHeader = &(lsa->getHeader());
Referenced by inet::ospfv3::Ospfv3Interface::preProcessDDPacket().
◆ findNetworkLSA()
◆ findNetworkLSAByLSID()
◆ findRouterLSA()
◆ findRouterLSAByID()
974 for (
auto it = this->
routerLSAList.begin(); it != this->routerLSAList.end(); it++) {
975 if ((*it)->getHeader().getLinkStateID() == linkStateID) {
◆ findSameOrWorseCostRoute() [1/2]
2571 destinationInRoutingTable =
false;
2572 sameOrWorseCost.clear();
2574 long routeCount = newTable.size();
2575 Ipv4AddressRange destination;
2576 destination.address = interAreaPrefixLSA.getPrefix().addressPrefix.toIpv4();
2577 destination.mask = destination.address.makeNetmask(interAreaPrefixLSA.getPrefix().prefixLen);
2579 for (
long j = 0; j < routeCount; j++) {
2580 Ospfv3Ipv4RoutingTableEntry *routingEntry = newTable[j];
2581 bool foundMatching =
false;
2585 isSameNetwork(destination.address, destination.mask, routingEntry->getDestination(), routingEntry->getNetmask()))
2587 foundMatching =
true;
2593 (destination.address == routingEntry->getDestination()) &&
2594 (destination.mask == routingEntry->getNetmask()))
2596 foundMatching =
true;
2600 if (foundMatching) {
2601 destinationInRoutingTable =
true;
2609 (routingEntry->getCost() < currentCost)))
2616 (routingEntry->getCost() >= currentCost))
2618 sameOrWorseCost.push_back(routingEntry);
◆ findSameOrWorseCostRoute() [2/2]
Browse through the newTable looking for entries describing the same destination as the currentLSA.
If a cheaper route is found then skip this LSA(return true), else note those which are of equal or worse cost than the currentCost.
2510 destinationInRoutingTable =
false;
2511 sameOrWorseCost.clear();
2513 long routeCount = newTable.size();
2514 Ipv6AddressRange destination;
2515 destination.prefix = interAreaPrefixLSA.getPrefix().addressPrefix.toIpv6();
2516 destination.prefixLength = interAreaPrefixLSA.getPrefix().prefixLen;
2518 for (
long j = 0; j < routeCount; j++) {
2519 Ospfv3RoutingTableEntry *routingEntry = newTable[j];
2520 bool foundMatching =
false;
2523 isSameNetwork(destination.prefix, destination.prefixLength, routingEntry->getDestPrefix(), routingEntry->getPrefixLength()))
2525 foundMatching =
true;
2531 (destination.prefix == routingEntry->getDestPrefix()) &&
2532 (destination.prefixLength == routingEntry->getPrefixLength()))
2534 foundMatching =
true;
2538 if (foundMatching) {
2539 destinationInRoutingTable =
true;
2547 (routingEntry->getCost() < currentCost)))
2554 (routingEntry->getCost() >= currentCost))
2556 sameOrWorseCost.push_back(routingEntry);
◆ findVirtualLink()
◆ floodLSA()
◆ getAreaID()
| Ipv4Address inet::ospfv3::Ospfv3Area::getAreaID |
( |
| ) |
const |
|
inline |
◆ getAreaType()
◆ getCurrentInterAreaPrefixSequence()
| uint32_t inet::ospfv3::Ospfv3Area::getCurrentInterAreaPrefixSequence |
( |
| ) |
|
|
inline |
◆ getCurrentIntraAreaPrefixSequence()
| uint32_t inet::ospfv3::Ospfv3Area::getCurrentIntraAreaPrefixSequence |
( |
| ) |
|
|
inline |
◆ getCurrentNetworkSequence()
| uint32_t inet::ospfv3::Ospfv3Area::getCurrentNetworkSequence |
( |
| ) |
|
|
inline |
◆ getCurrentRouterSequence()
| uint32_t inet::ospfv3::Ospfv3Area::getCurrentRouterSequence |
( |
| ) |
|
|
inline |
◆ getExternalRoutingCapability()
| bool inet::ospfv3::Ospfv3Area::getExternalRoutingCapability |
( |
| ) |
|
|
inline |
◆ getInstance()
Referenced by inet::ospfv3::Ospfv3Interface::acknowledgeLSA(), inet::ospfv3::Ospfv3Interface::addDelayedAcknowledgement(), inet::ospfv3::Ospfv3Interface::ageDatabase(), inet::ospfv3::Ospfv3InterfaceState::calculateDesignatedRouter(), inet::ospfv3::Ospfv3NeighborState::changeState(), inet::ospfv3::Ospfv3InterfaceState::changeState(), inet::ospfv3::Ospfv3Neighbor::clearRequestRetransmissionTimer(), inet::ospfv3::Ospfv3Neighbor::clearUpdateRetransmissionTimer(), inet::ospfv3::Ospfv3Interface::detailedInfo(), inet::ospfv3::Ospfv3Process::floodLSA(), inet::ospfv3::Ospfv3Interface::floodLSA(), inet::ospfv3::Ospfv3Neighbor::needAdjacency(), originateDefaultInterAreaPrefixLSA(), originateInterAreaPrefixLSA(), inet::ospfv3::Ospfv3Interface::originateLinkLSA(), inet::ospfv3::Ospfv3Interface::processDDPacket(), inet::ospfv3::Ospfv3InterfaceStateDown::processEvent(), inet::ospfv3::Ospfv3NeighborStateAttempt::processEvent(), inet::ospfv3::Ospfv3NeighborStateFull::processEvent(), inet::ospfv3::Ospfv3NeighborStateLoading::processEvent(), inet::ospfv3::Ospfv3NeighborStateExchange::processEvent(), inet::ospfv3::Ospfv3NeighborStateDown::processEvent(), inet::ospfv3::Ospfv3NeighborState2Way::processEvent(), inet::ospfv3::Ospfv3NeighborStateExStart::processEvent(), inet::ospfv3::Ospfv3NeighborStateInit::processEvent(), inet::ospfv3::Ospfv3InterfaceStateDr::processEvent(), inet::ospfv3::Ospfv3InterfaceStateDrOther::processEvent(), inet::ospfv3::Ospfv3InterfaceStateWaiting::processEvent(), inet::ospfv3::Ospfv3InterfaceStatePointToPoint::processEvent(), inet::ospfv3::Ospfv3InterfaceStateBackup::processEvent(), inet::ospfv3::Ospfv3Interface::processHelloPacket(), inet::ospfv3::Ospfv3Interface::processLSR(), inet::ospfv3::Ospfv3Interface::processLSU(), inet::ospfv3::Ospfv3Neighbor::reset(), inet::ospfv3::Ospfv3Neighbor::retransmitDatabaseDescriptionPacket(), inet::ospfv3::Ospfv3Neighbor::retransmitUpdatePacket(), inet::ospfv3::Ospfv3Neighbor::sendDDPacket(), inet::ospfv3::Ospfv3Interface::sendDelayedAcknowledgements(), inet::ospfv3::Ospfv3Neighbor::sendLinkStateRequestPacket(), inet::ospfv3::Ospfv3Interface::sendLSAcknowledgement(), inet::ospfv3::Ospfv3Neighbor::startRequestRetransmissionTimer(), inet::ospfv3::Ospfv3Neighbor::startUpdateRetransmissionTimer(), inet::ospfv3::Ospfv3Interface::~Ospfv3Interface(), and inet::ospfv3::Ospfv3Neighbor::~Ospfv3Neighbor().
◆ getInstanceType()
| int inet::ospfv3::Ospfv3Area::getInstanceType |
( |
| ) |
|
|
inline |
◆ getInterAreaPrefixLSA()
◆ getInterAreaPrefixLSACount()
| int inet::ospfv3::Ospfv3Area::getInterAreaPrefixLSACount |
( |
| ) |
|
|
inline |
◆ getInterface()
◆ getInterfaceById()
◆ getInterfaceByIndex() [1/2]
104 return (interfaceIt == this->
interfaceByIndex.end()) ? nullptr : interfaceIt->second;
◆ getInterfaceByIndex() [2/2]
130 for (
int i = 0; i < interfaceNum; i++) {
132 (Ipv4Address(
interfaceList[i]->getInterfaceIndex()) == LinkStateID))
◆ getInterfaceCount()
| int inet::ospfv3::Ospfv3Area::getInterfaceCount |
( |
| ) |
const |
|
inline |
◆ getIntraAreaPrefixLSA()
◆ getIntraAreaPrefixLSACount()
| int inet::ospfv3::Ospfv3Area::getIntraAreaPrefixLSACount |
( |
| ) |
|
|
inline |
◆ getLSAbyKey()
1830 switch (LSAKey.LSType) {
1832 for (
auto it = this->
routerLSAList.begin(); it != this->routerLSAList.end(); it++) {
1833 if (((*it)->getHeader().getAdvertisingRouter() == LSAKey.advertisingRouter) && (*it)->getHeader().getLinkStateID() == LSAKey.linkStateID) {
1840 for (
auto it = this->
networkLSAList.begin(); it != this->networkLSAList.end(); it++) {
1841 if (((*it)->getHeader().getAdvertisingRouter() == LSAKey.advertisingRouter) && (*it)->getHeader().getLinkStateID() == LSAKey.linkStateID) {
1849 if (((*it)->getHeader().getAdvertisingRouter() == LSAKey.advertisingRouter) && (*it)->getHeader().getLinkStateID() == LSAKey.linkStateID) {
1856 for (
auto it = this->
routerLSAList.begin(); it != this->routerLSAList.end(); it++) {
1857 if (((*it)->getHeader().getAdvertisingRouter() == LSAKey.advertisingRouter) && (*it)->getHeader().getLinkStateID() == LSAKey.linkStateID) {
1864 for (
auto it = this->
routerLSAList.begin(); it != this->routerLSAList.end(); it++) {
1865 if (((*it)->getHeader().getAdvertisingRouter() == LSAKey.advertisingRouter) && (*it)->getHeader().getLinkStateID() == LSAKey.linkStateID) {
1873 if (((*it)->getHeader().getAdvertisingRouter() == LSAKey.advertisingRouter) && (*it)->getHeader().getLinkStateID() == LSAKey.linkStateID) {
1880 for (
auto it = this->
interfaceList.begin(); it != this->interfaceList.end(); it++) {
1881 LinkLSA *lsa = (*it)->getLinkLSAbyKey(LSAKey);
Referenced by inet::ospfv3::Ospfv3Process::findLSA().
◆ getNetIntraAreaPrefixLSA()
◆ getNetworkLinkStateID()
| Ipv4Address inet::ospfv3::Ospfv3Area::getNetworkLinkStateID |
( |
| ) |
|
|
inline |
◆ getNetworkLSA()
| NetworkLSA* inet::ospfv3::Ospfv3Area::getNetworkLSA |
( |
int |
i | ) |
|
|
inline |
◆ getNetworkLSAbyKey()
1025 for (
auto it = this->
networkLSAList.begin(); it != this->networkLSAList.end(); it++) {
1026 if (((*it)->getHeader().getAdvertisingRouter() == LSAKey.advertisingRouter) && (*it)->getHeader().getLinkStateID() == LSAKey.linkStateID) {
◆ getNetworkLSACount()
| int inet::ospfv3::Ospfv3Area::getNetworkLSACount |
( |
| ) |
|
|
inline |
◆ getNetworkLSAInterface()
93 for (
auto it = this->
interfaceList.begin(); it != this->interfaceList.end(); it++) {
94 if (Ipv4Address((*it)->getInterfaceId()) ==
id)
◆ getNewInterAreaPrefixLinkStateID()
| Ipv4Address inet::ospfv3::Ospfv3Area::getNewInterAreaPrefixLinkStateID |
( |
| ) |
|
◆ getNewIntraAreaPrefixLinkStateID()
| Ipv4Address inet::ospfv3::Ospfv3Area::getNewIntraAreaPrefixLinkStateID |
( |
| ) |
|
1795 int newIP = currIP.
getInt() + 1;
◆ getNewNetworkLinkStateID()
| Ipv4Address inet::ospfv3::Ospfv3Area::getNewNetworkLinkStateID |
( |
| ) |
|
1091 int newIP = currIP.
getInt() + 1;
◆ getNewRouterLinkStateID()
| Ipv4Address inet::ospfv3::Ospfv3Area::getNewRouterLinkStateID |
( |
| ) |
|
180 int newIP = currIP.
getInt() + 1;
◆ getRouterLinkStateID()
| Ipv4Address inet::ospfv3::Ospfv3Area::getRouterLinkStateID |
( |
| ) |
|
|
inline |
◆ getRouterLSA()
| RouterLSA* inet::ospfv3::Ospfv3Area::getRouterLSA |
( |
int |
i | ) |
|
|
inline |
◆ getRouterLSAbyKey()
◆ getRouterLSACount()
| int inet::ospfv3::Ospfv3Area::getRouterLSACount |
( |
| ) |
|
|
inline |
◆ getStubDefaultCost()
| int inet::ospfv3::Ospfv3Area::getStubDefaultCost |
( |
| ) |
|
|
inline |
◆ getTransitCapability()
| bool inet::ospfv3::Ospfv3Area::getTransitCapability |
( |
| ) |
|
|
inline |
◆ hasAddressRange() [1/2]
| bool inet::ospfv3::Ospfv3Area::hasAddressRange |
( |
Ipv4AddressRange |
addressRange | ) |
const |
1990 for (
int i = 0; i < addressRangeNum; i++) {
◆ hasAddressRange() [2/2]
| bool inet::ospfv3::Ospfv3Area::hasAddressRange |
( |
Ipv6AddressRange |
addressRange | ) |
const |
1936 for (
int i = 0; i < addressRangeNum; i++) {
◆ hasAnyNeighborInStates()
| bool inet::ospfv3::Ospfv3Area::hasAnyNeighborInStates |
( |
int |
state | ) |
const |
926 for (
long i = 0; i < interfaceCount; i++) {
◆ hasAnyPassiveInterface()
| bool inet::ospfv3::Ospfv3Area::hasAnyPassiveInterface |
( |
| ) |
const |
◆ hasInterface()
| bool inet::ospfv3::Ospfv3Area::hasInterface |
( |
std::string |
interfaceName | ) |
|
◆ hasLink()
3033 RouterLSA *fromRouterLSA =
dynamic_cast<RouterLSA *
>(fromLSA);
3034 if (fromRouterLSA !=
nullptr) {
3035 unsigned int linkCount = fromRouterLSA->getRoutersArraySize();
3036 RouterLSA *toRouterLSA =
dynamic_cast<RouterLSA *
>(toLSA);
3037 if (toRouterLSA !=
nullptr) {
3038 for (i = 0; i < linkCount; i++) {
3039 Ospfv3RouterLsaBody& link = fromRouterLSA->getRoutersForUpdate(i);
3044 (link.neighborRouterID == toRouterLSA->getHeader().getAdvertisingRouter()))
3051 NetworkLSA *toNetworkLSA =
dynamic_cast<NetworkLSA *
>(toLSA);
3052 if (toNetworkLSA !=
nullptr) {
3053 for (i = 0; i < linkCount; i++) {
3054 Ospfv3RouterLsaBody& link = fromRouterLSA->getRoutersForUpdate(i);
3057 (link.neighborRouterID == toNetworkLSA->getHeader().getAdvertisingRouter()))
3069 NetworkLSA *fromNetworkLSA =
dynamic_cast<NetworkLSA *
>(fromLSA);
3070 if (fromNetworkLSA !=
nullptr) {
3071 unsigned int routerCount = fromNetworkLSA->getAttachedRouterArraySize();
3072 RouterLSA *toRouterLSA =
dynamic_cast<RouterLSA *
>(toLSA);
3073 if (toRouterLSA !=
nullptr) {
3074 for (i = 0; i < routerCount; i++) {
3075 if (fromNetworkLSA->getAttachedRouter(i) == toRouterLSA->getHeader().getAdvertisingRouter()) {
◆ incrementInterAreaPrefixSequence()
| void inet::ospfv3::Ospfv3Area::incrementInterAreaPrefixSequence |
( |
| ) |
|
|
inline |
◆ incrementIntraAreaPrefixSequence()
| void inet::ospfv3::Ospfv3Area::incrementIntraAreaPrefixSequence |
( |
| ) |
|
|
inline |
◆ incrementNetworkSequence()
| void inet::ospfv3::Ospfv3Area::incrementNetworkSequence |
( |
| ) |
|
|
inline |
◆ incrementRouterSequence()
| void inet::ospfv3::Ospfv3Area::incrementRouterSequence |
( |
| ) |
|
|
inline |
◆ init()
| void inet::ospfv3::Ospfv3Area::init |
( |
| ) |
|
62 for (
auto it = this->
interfaceList.begin(); it != this->interfaceList.end(); it++) {
63 (*it)->setInterfaceIndex(this->
getInstance()->getUniqueId());
69 EV_DEBUG <<
"Creating InterAreaPrefixLSA from IntraAreaPrefixLSA\n";
70 if (prefixLsa !=
nullptr) {
◆ installInterAreaPrefixLSA()
1289 const Ospfv3LsaHeader& header = lsa->getHeader();
1290 EV_DEBUG <<
"\n\nInstalling Inter-Area-Prefix LSA:\nLink State ID: " << header.getLinkStateID() <<
"\nAdvertising router: " << header.getAdvertisingRouter();
1291 EV_DEBUG <<
"\nLS Seq Number: " << header.getLsaSequenceNumber() << endl;
1293 EV_DEBUG <<
"Prefix Address: " << lsa->getPrefix().addressPrefix;
1294 EV_DEBUG <<
"\nPrefix Length: " <<
static_cast<unsigned int>(lsa->getPrefix().prefixLen);
1295 if (lsa->getPrefix().dnBit)
1297 if (lsa->getPrefix().laBit)
1299 if (lsa->getPrefix().nuBit)
1301 if (lsa->getPrefix().pBit)
1303 if (lsa->getPrefix().xBit)
1306 EV_DEBUG <<
", Metric: " << lsa->getMetric() <<
"\n";
1309 lsaKey.linkStateID = lsa->getHeader().getLinkStateID();
1310 lsaKey.advertisingRouter = lsa->getHeader().getAdvertisingRouter();
1311 lsaKey.LSType = lsa->getHeader().getLsaType();
1316 if (lsaInDatabase !=
nullptr) {
1318 EV_DEBUG <<
"Only updating\n";
1322 InterAreaPrefixLSA *lsaCopy =
new InterAreaPrefixLSA(*lsa);
1324 EV_DEBUG <<
"creating new one\n";
Referenced by originateDefaultInterAreaPrefixLSA(), and originateInterAreaPrefixLSA().
◆ installIntraAreaPrefixLSA()
1616 const Ospfv3LsaHeader& header = lsa->getHeader();
1618 EV_DEBUG <<
"Installing Intra-Area-Prefix LSA:\nLink State ID: " << header.getLinkStateID() <<
"\nAdvertising router: " << header.getAdvertisingRouter();
1619 EV_DEBUG <<
"\nLS Seq Number: " << header.getLsaSequenceNumber() <<
"\nReferenced LSA Type: " << lsa->getReferencedLSType();
1621 for (
int i = 0; i < lsa->getNumPrefixes(); i++) {
1622 const Ospfv3LsaPrefixMetric& prefix = lsa->getPrefixes(i);
1623 EV_DEBUG <<
"Prefix Address: " << prefix.addressPrefix;
1624 EV_DEBUG <<
"\nPrefix Length: " <<
static_cast<unsigned int>(prefix.prefixLen);
1636 EV_DEBUG <<
", Metric: " << prefix.metric <<
"\n";
1640 lsaKey.linkStateID = lsa->getHeader().getLinkStateID();
1641 lsaKey.advertisingRouter = lsa->getHeader().getAdvertisingRouter();
1642 lsaKey.LSType = lsa->getHeader().getLsaType();
1647 while (in < intraPrefCnt) {
1651 for (
size_t prefN = 0; prefN < lsa->getPrefixesArraySize(); prefN++) {
1652 for (
size_t prefR = 0; prefR < prefLSA->getPrefixesArraySize(); prefR++) {
1653 L3Address netPref = lsa->getPrefixes(prefN).addressPrefix;
1654 short netPrefixLen = lsa->getPrefixes(prefN).prefixLen;
1655 if (prefLSA->getReferencedLSType() ==
ROUTER_LSA) {
1656 L3Address routerPref = prefLSA->getPrefixesForUpdate(prefR).addressPrefix;
1657 short routerPrefixLen = prefLSA->getPrefixes(prefR).prefixLen;
1660 if (routerPref.getPrefix(routerPrefixLen) == netPref.getPrefix(netPrefixLen)) {
1661 EV_DEBUG <<
"Deleting old IntraAreaPrefixLSA, install new one IntraAreaPrefixLSA\n";
1683 if (lsa->getReferencedLSType() ==
ROUTER_LSA) {
1685 for (
int i = 0; i < intraPrefCnt; i++) {
1687 if (prefLSA->getReferencedLSType() ==
NETWORK_LSA) {
1688 for (
size_t prefR = 0; prefR < lsa->getPrefixesArraySize(); prefR++) {
1689 L3Address routerPref = lsa->getPrefixes(prefR).addressPrefix;
1690 short routerPrefixLen = lsa->getPrefixes(prefR).prefixLen;
1691 for (
size_t prefN = 0; prefN < prefLSA->getPrefixesArraySize(); prefN++) {
1692 L3Address netPref = prefLSA->getPrefixes(prefN).addressPrefix;
1693 short netPrefixLen = prefLSA->getPrefixes(prefN).prefixLen;
1694 if (routerPref.getPrefix(routerPrefixLen) == netPref.getPrefix(netPrefixLen)) {
1695 EV_DEBUG <<
"Came LSA type 9 with referenced prefix of LSType 1, have one with LSType 2, doing nothing\n";
1704 IntraAreaPrefixLSA *lsaInDatabase = (IntraAreaPrefixLSA *)this->
getLSAbyKey(lsaKey);
1705 if (lsaInDatabase ==
nullptr)
1709 if ((*it)->getHeader().getAdvertisingRouter() == lsa->getHeader().getAdvertisingRouter() &&
1710 ((*it)->getReferencedLSType() == lsa->getReferencedLSType()) &&
1711 ((*it)->getHeader().getLinkStateID() < lsa->getHeader().getLinkStateID()) &&
1712 ((*it)->getPrefixesArraySize() != lsa->getPrefixesArraySize()) &&
1713 ((*it)->getHeader().getLsaAge() !=
MAX_AGE))
1715 lsaInDatabase = (*it);
1720 if (lsaInDatabase !=
nullptr) {
1721 if (lsaInDatabase->getHeader().getLsaSequenceNumber() <= lsa->getHeader().getLsaSequenceNumber()) {
1727 IntraAreaPrefixLSA *lsaCopy =
new IntraAreaPrefixLSA(*lsa);
Referenced by inet::ospfv3::Ospfv3InterfaceState::changeState(), and inet::ospfv3::Ospfv3InterfaceStateDown::processEvent().
◆ installNetworkLSA()
| bool inet::ospfv3::Ospfv3Area::installNetworkLSA |
( |
const Ospfv3NetworkLsa * |
lsaC | ) |
|
1036 lsaKey.linkStateID = lsa->getHeader().getLinkStateID();
1037 lsaKey.advertisingRouter = lsa->getHeader().getAdvertisingRouter();
1038 lsaKey.LSType = lsa->getHeader().getLsaType();
1040 NetworkLSA *lsaInDatabase = (NetworkLSA *)this->
getLSAbyKey(lsaKey);
1041 if (lsaInDatabase !=
nullptr) {
1046 NetworkLSA *lsaCopy =
new NetworkLSA(*lsa);
Referenced by inet::ospfv3::Ospfv3InterfaceState::changeState().
◆ installRouterLSA()
| bool inet::ospfv3::Ospfv3Area::installRouterLSA |
( |
const Ospfv3RouterLsa * |
lsaC | ) |
|
813 lsaKey.linkStateID = lsa->getHeader().getLinkStateID();
814 lsaKey.advertisingRouter = lsa->getHeader().getAdvertisingRouter();
815 lsaKey.LSType = lsa->getHeader().getLsaType();
817 RouterLSA *lsaInDatabase = (RouterLSA *)this->
getLSAbyKey(lsaKey);
818 if (lsaInDatabase !=
nullptr) {
823 RouterLSA *lsaCopy =
new RouterLSA(*lsa);
824 EV_DEBUG <<
"RouterLSA was added to routerLSAList\n";
Referenced by inet::ospfv3::Ospfv3InterfaceState::changeState().
◆ InterAreaPrefixLSAAlreadyExists()
1360 if ((*it)->getHeader().getAdvertisingRouter() == newLsa->getHeader().getAdvertisingRouter() &&
1361 (*it)->getPrefix().addressPrefix == newLsa->getPrefix().addressPrefix &&
1362 (*it)->getPrefix().prefixLen == newLsa->getPrefix().prefixLen)
Referenced by originateInterAreaPrefixLSA().
◆ interAreaPrefixLSADiffersFrom()
1340 const Ospfv3LsaHeader& thisHeader = currentLsa->getHeader();
1341 const Ospfv3LsaHeader& lsaHeader = newLsa->getHeader();
1342 bool differentHeader = (((thisHeader.getLsaAge() ==
MAX_AGE) && (lsaHeader.getLsaAge() !=
MAX_AGE)) ||
1343 ((thisHeader.getLsaAge() !=
MAX_AGE) && (lsaHeader.getLsaAge() ==
MAX_AGE)) ||
1344 (thisHeader.getLsaLength() != lsaHeader.getLsaLength()));
1345 bool differentBody =
false;
1347 if (!differentHeader) {
1349 (currentLsa->getPrefix() != newLsa->getPrefix()) ||
1350 (currentLsa->getMetric() != newLsa->getMetric()));
1353 return differentHeader || differentBody;
◆ IntraAreaPrefixLSAAlreadyExists()
1582 if ((*it)->getHeader().getAdvertisingRouter() == newLsa->getHeader().getAdvertisingRouter() &&
1583 (*it)->getHeader().getLsaAge() !=
MAX_AGE)
1585 if ((*it)->getReferencedLSType() == newLsa->getReferencedLSType()) {
1586 if ((*it)->getPrefixesArraySize() == newLsa->getPrefixesArraySize()) {
1588 for (
size_t x = 0; x < newLsa->getPrefixesArraySize(); x++) {
1589 if (((*it)->getPrefixes(x).addressPrefix == newLsa->getPrefixes(x).addressPrefix) &&
1590 ((*it)->getPrefixes(x).prefixLen == newLsa->getPrefixes(x).prefixLen) &&
1591 ((*it)->getPrefixes(x).metric == newLsa->getPrefixes(x).metric) &&
1592 ((*it)->getPrefixes(x).dnBit == newLsa->getPrefixes(x).dnBit) &&
1593 ((*it)->getPrefixes(x).laBit == newLsa->getPrefixes(x).laBit) &&
1594 ((*it)->getPrefixes(x).nuBit == newLsa->getPrefixes(x).nuBit) &&
1595 ((*it)->getPrefixes(x).pBit == newLsa->getPrefixes(x).pBit) &&
1596 ((*it)->getPrefixes(x).xBit == newLsa->getPrefixes(x).xBit))
◆ intraAreaPrefixLSADiffersFrom()
1754 const Ospfv3LsaHeader& thisHeader = currentLsa->getHeader();
1755 const Ospfv3LsaHeader& lsaHeader = newLsa->getHeader();
1756 bool differentHeader = (((thisHeader.getLsaAge() ==
MAX_AGE) && (lsaHeader.getLsaAge() !=
MAX_AGE)) ||
1757 ((thisHeader.getLsaAge() !=
MAX_AGE) && (lsaHeader.getLsaAge() ==
MAX_AGE)) ||
1758 (thisHeader.getLsaLength() != lsaHeader.getLsaLength()));
1759 bool differentBody =
false;
1761 if (!differentHeader) {
1762 differentBody = ((currentLsa->getNumPrefixes() != newLsa->getNumPrefixes()) ||
1763 (currentLsa->getReferencedLSType() != newLsa->getReferencedLSType()) ||
1764 (currentLsa->getReferencedLSID() != newLsa->getReferencedLSID()) ||
1765 (currentLsa->getReferencedAdvRtr() != newLsa->getReferencedAdvRtr()));
1767 if (!differentBody) {
1768 unsigned int referenceCount = currentLsa->getNumPrefixes();
1769 for (
unsigned int i = 0; i < referenceCount; i++) {
1770 Ospfv3LsaPrefixMetric currentPrefix = currentLsa->getPrefixes(i);
1771 Ospfv3LsaPrefixMetric newPrefix = newLsa->getPrefixes(i);
1772 bool differentLink = ((currentPrefix.addressPrefix != newPrefix.addressPrefix) ||
1773 (currentPrefix.dnBit != newPrefix.dnBit) ||
1774 (currentPrefix.laBit != newPrefix.laBit) ||
1775 (currentPrefix.metric != newPrefix.metric) ||
1776 (currentPrefix.nuBit != newPrefix.nuBit) ||
1777 (currentPrefix.pBit != newPrefix.pBit) ||
1778 (currentPrefix.prefixLen != newPrefix.prefixLen) ||
1779 (currentPrefix.xBit != newPrefix.xBit));
1781 if (differentLink) {
1782 differentBody =
true;
1789 return differentHeader || differentBody;
◆ isOnAnyRetransmissionList()
| bool inet::ospfv3::Ospfv3Area::isOnAnyRetransmissionList |
( |
LSAKeyType |
lsaKey | ) |
const |
954 for (
long i = 0; i < interfaceCount; i++) {
955 if (
interfaceList.at(i)->isOnAnyRetransmissionList(lsaKey)) {
◆ networkLSADiffersFrom()
1063 const Ospfv3LsaHeader& thisHeader = currentLsa->getHeader();
1064 const Ospfv3LsaHeader& lsaHeader = newLsa->getHeader();
1065 bool differentHeader = (((thisHeader.getLsaAge() ==
MAX_AGE) && (lsaHeader.getLsaAge() !=
MAX_AGE)) ||
1066 ((thisHeader.getLsaAge() !=
MAX_AGE) && (lsaHeader.getLsaAge() ==
MAX_AGE)) ||
1067 (thisHeader.getLsaLength() != lsaHeader.getLsaLength()));
1068 bool differentBody =
false;
1070 if (!differentHeader) {
1071 differentBody = (currentLsa->getOspfOptions() != newLsa->getOspfOptions());
1072 if (!differentBody) {
1073 unsigned int attachedCount = currentLsa->getAttachedRouterArraySize();
1074 for (
unsigned int i = 0; i < attachedCount; i++) {
1075 bool differentLink = (currentLsa->getAttachedRouter(i) != newLsa->getAttachedRouter(i));
1077 if (differentLink) {
1078 differentBody =
true;
1085 return differentHeader || differentBody;
◆ nextHopAlreadyExists()
| bool inet::ospfv3::Ospfv3Area::nextHopAlreadyExists |
( |
std::vector< NextHop > * |
hops, |
|
|
NextHop |
nextHop |
|
) |
| const |
3089 for (
size_t i = 0; i < hops->size(); i++) {
3090 if ((*hops)[i].advertisingRouter == nextHop.advertisingRouter &&
3091 (*hops)[i].hopAddress == nextHop.hopAddress &&
3092 (*hops)[i].ifIndex == nextHop.ifIndex)
◆ originateDefaultInterAreaPrefixLSA()
| void inet::ospfv3::Ospfv3Area::originateDefaultInterAreaPrefixLSA |
( |
Ospfv3Area * |
toArea | ) |
|
1254 InterAreaPrefixLSA *newLsa =
new InterAreaPrefixLSA();
1255 Ospfv3LsaHeader& newHeader = newLsa->getHeaderForUpdate();
1256 newHeader.setLsaAge(0);
1258 newHeader.setLinkStateID(toArea->getInstance()->getNewInterAreaPrefixLinkStateID());
1259 newHeader.setAdvertisingRouter(this->
getInstance()->getProcess()->getRouterID());
1260 newHeader.setLsaSequenceNumber(toArea->getCurrentInterAreaPrefixSequence());
1261 toArea->incrementInterAreaPrefixSequence();
1263 auto& newPrefix = newLsa->getPrefixForUpdate();
1264 newPrefix.dnBit =
false;
1265 newPrefix.laBit =
false;
1266 newPrefix.nuBit =
false;
1267 newPrefix.pBit =
false;
1268 newPrefix.xBit =
false;
1269 newLsa->setMetric(1);
1270 newPrefix.prefixLen = 0;
1273 Ipv4Address defaultPref = Ipv4Address(
"0.0.0.0");
1274 newPrefix.addressPrefix = defaultPref;
1278 Ipv6Address defaultPref = Ipv6Address(
"::");
1279 newPrefix.addressPrefix = defaultPref;
1283 toArea->installInterAreaPrefixLSA(newLsa);
◆ originateInterAreaPrefixLSA() [1/2]
| void inet::ospfv3::Ospfv3Area::originateInterAreaPrefixLSA |
( |
const Ospfv3Lsa * |
prefLsa, |
|
|
Ospfv3Area * |
fromArea |
|
) |
| |
1186 lsaKey.linkStateID = prefLsa->getHeader().getLinkStateID();
1187 lsaKey.advertisingRouter = prefLsa->getHeader().getAdvertisingRouter();
1188 lsaKey.LSType = prefLsa->getHeader().getLsaType();
1192 if (area->getAreaID() == fromArea->getAreaID())
1196 const Ospfv3InterAreaPrefixLsa *lsa = check_and_cast<const Ospfv3InterAreaPrefixLsa *>(prefLsa);
1199 InterAreaPrefixLSA *lsaInDatabase = area->findInterAreaPrefixLSAbyAddress(lsa->getPrefix().addressPrefix, lsa->getPrefix().prefixLen);
1204 InterAreaPrefixLSA *newLsa =
new InterAreaPrefixLSA();
1207 if (lsaInDatabase !=
nullptr)
1208 (*newLsa) = (*lsaInDatabase);
1225 Ospfv3LsaHeader& newHeader = newLsa->getHeaderForUpdate();
1227 newHeader.setLinkStateID(area->getInstance()->getNewInterAreaPrefixLinkStateID());
1228 newHeader.setAdvertisingRouter(this->
getInstance()->getProcess()->getRouterID());
1229 newHeader.setLsaSequenceNumber(area->getCurrentInterAreaPrefixSequence());
1230 area->incrementInterAreaPrefixSequence();
1232 Ospfv3LsaHeader& newHeader2 = newLsa->getHeaderForUpdate();
1233 if (prefLsa->getHeader().getLsaAge() ==
MAX_AGE)
1234 newHeader2.setLsaAge(
MAX_AGE);
1236 newHeader2.setLsaAge(0);
1237 newLsa->setPrefix(lsa->getPrefix());
1238 newLsa->setMetric(lsa->getMetric());
1241 if (area->installInterAreaPrefixLSA(newLsa))
1242 area->floodLSA(newLsa);
◆ originateInterAreaPrefixLSA() [2/2]
1123 for (
size_t ref = 0; ref < lsa->getPrefixesArraySize(); ref++) {
1124 InterAreaPrefixLSA *newLsa =
new InterAreaPrefixLSA();
1125 Ospfv3LsaHeader& newHeader = newLsa->getHeaderForUpdate();
1126 newHeader.setLsaAge(0);
1129 newHeader.setAdvertisingRouter(this->
getInstance()->getProcess()->getRouterID());
1132 Ospfv3LsaPrefixMetric& prefix = lsa->getPrefixesForUpdate(ref);
1133 auto& newPrefix = newLsa->getPrefixForUpdate();
1134 newPrefix.dnBit = prefix.dnBit;
1135 newPrefix.laBit = prefix.laBit;
1136 newPrefix.nuBit = prefix.nuBit;
1137 newPrefix.pBit = prefix.pBit;
1138 newPrefix.xBit = prefix.xBit;
1139 newLsa->setMetric(prefix.metric);
1140 newPrefix.prefixLen = prefix.prefixLen;
1141 newPrefix.addressPrefix = prefix.addressPrefix;
1144 newHeader.setLsaLength(packetLength.get());
1146 int duplicateForArea = 0;
1149 if (area->getAreaID() == fromArea->getAreaID())
1152 if (checkDuplicate) {
1154 if (lsaDuplicate !=
nullptr && lsaDuplicate->getHeader().getLsaAge() !=
MAX_AGE) {
1159 if (area->installInterAreaPrefixLSA(newLsa))
1160 area->floodLSA(newLsa);
1169 area->installInterAreaPrefixLSA(newLsa);
1170 area->floodLSA(newLsa);
1175 if (duplicateForArea == this->
getInstance()->getAreaCount() - 1) {
Referenced by ageDatabase(), and inet::ospfv3::Ospfv3Interface::processLSU().
◆ originateIntraAreaPrefixLSA()
1384 int prefixCount = 0;
1387 IntraAreaPrefixLSA *newLsa =
new IntraAreaPrefixLSA();
1388 Ospfv3LsaHeader& newHeader = newLsa->getHeaderForUpdate();
1389 newHeader.setLsaAge(0);
1392 newHeader.setAdvertisingRouter(this->
getInstance()->getProcess()->getRouterID());
1396 for (
auto it = this->
routerLSAList.begin(); it != this->routerLSAList.end(); it++) {
1397 const Ospfv3LsaHeader& routerHeader = (*it)->getHeader();
1398 if (routerHeader.getAdvertisingRouter() != this->getInstance()->getProcess()->getRouterID()) {
1403 newLsa->setReferencedLSID(routerHeader.getLinkStateID());
1404 newLsa->setReferencedAdvRtr(routerHeader.getAdvertisingRouter());
1408 int currentPrefix = 1;
1409 for (
auto it = this->
interfaceList.begin(); it != this->interfaceList.end(); it++) {
1412 NetworkInterface *ie =
CHK(this->
getInstance()->getProcess()->ift->findInterfaceByName((*it)->getIntName().c_str()));
1413 const auto& ipv6int = ie->findProtocolData<Ipv6InterfaceData>();
1419 numPrefixes = ipv6int->getNumAddresses();
1422 for (
int i = 0; i < numPrefixes; i++) {
1424 const auto& ipv4Data = ie->getProtocolData<Ipv4InterfaceData>();
1425 Ipv4Address ipAdd = ipv4Data->getIPAddress();
1426 Ospfv3LsaPrefixMetric prefix;
1427 prefix.prefixLen = ipv4Data->getNetmask().getNetmaskLength();
1429 prefix.addressPrefix = L3Address(ipAdd.getPrefix(prefix.prefixLen));
1430 newLsa->setPrefixesArraySize(currentPrefix);
1431 newLsa->setPrefixes(currentPrefix - 1, prefix);
1437 Ipv6Address ipv6 = ipv6int->getAddress(i);
1438 if (ipv6.isGlobal()) {
1439 Ospfv3LsaPrefixMetric prefix;
1451 prefix.addressPrefix = ipv6.getPrefix(prefix.prefixLen);
1453 newLsa->setPrefixesArraySize(currentPrefix);
1454 newLsa->setPrefixes(currentPrefix - 1, prefix);
1465 newHeader.setLsaLength(packetLength.get());
1466 newLsa->setNumPrefixes(prefixCount);
1468 if (prefixCount == 0) {
1473 if ((*it)->getHeader().getAdvertisingRouter() == this->getInstance()->getProcess()->getRouterID() &&
1474 (*it)->getReferencedLSType() ==
ROUTER_LSA &&
1475 (*it)->getHeader().getLsaAge() !=
MAX_AGE)
1477 (*it)->getHeaderForUpdate().setLsaAge(
MAX_AGE);
Referenced by inet::ospfv3::Ospfv3InterfaceState::changeState(), and inet::ospfv3::Ospfv3InterfaceStateDown::processEvent().
◆ originateNetIntraAreaPrefixLSA()
1498 EV_DEBUG <<
"Originate New NETWORK INTRA AREA LSA\n";
1502 NetworkInterface *ie =
CHK(this->
getInstance()->getProcess()->ift->findInterfaceByName(interface->getIntName().c_str()));
1503 const auto& ipv6int = ie->findProtocolData<Ipv6InterfaceData>();
1504 Ospfv3LsaHeader& header = networkLSA->getHeaderForUpdate();
1506 IntraAreaPrefixLSA *newLsa =
new IntraAreaPrefixLSA();
1507 Ospfv3LsaHeader& newHeader = newLsa->getHeaderForUpdate();
1508 newHeader.setLsaAge(0);
1511 newHeader.setAdvertisingRouter(this->
getInstance()->getProcess()->getRouterID());
1515 newLsa->setReferencedLSID(header.getLinkStateID());
1516 newLsa->setReferencedAdvRtr(header.getAdvertisingRouter());
1522 numPrefixes = ipv6int->getNumAddresses();
1524 int currentPrefix = 1;
1525 int prefixCount = 0;
1526 for (
int i = 0; i < numPrefixes; i++) {
1528 const auto& ipv4Data = ie->getProtocolData<Ipv4InterfaceData>();
1529 Ipv4Address ipAdd = ipv4Data->getIPAddress();
1530 Ospfv3LsaPrefixMetric prefix;
1531 prefix.prefixLen = ipv4Data->getNetmask().getNetmaskLength();
1533 prefix.addressPrefix = L3Address(ipAdd.getPrefix(prefix.prefixLen));
1534 newLsa->setPrefixesArraySize(currentPrefix);
1535 newLsa->setPrefixes(currentPrefix - 1, prefix);
1541 Ipv6Address ipv6 = ipv6int->getAddress(i);
1543 if (ipv6.isGlobal()) {
1544 Ospfv3LsaPrefixMetric prefix;
1549 prefix.prefixLen = 64;
1551 prefix.addressPrefix = ipv6.getPrefix(prefix.prefixLen);
1553 newLsa->setPrefixesArraySize(currentPrefix);
1554 newLsa->setPrefixes(currentPrefix - 1, prefix);
1562 newLsa->setNumPrefixes(prefixCount);
1563 newHeader.setLsaLength(packetLength.get());
1566 if (checkDuplicate) {
1568 if (prefixLsa !=
nullptr) {
Referenced by inet::ospfv3::Ospfv3InterfaceState::changeState().
◆ originateNetworkLSA()
986 NetworkLSA *networkLsa =
new NetworkLSA();
987 Ospfv3LsaHeader& lsaHeader = networkLsa->getHeaderForUpdate();
988 Ospfv3Options lsOptions;
992 lsaHeader.setLsaAge(0);
995 lsaHeader.setLinkStateID(Ipv4Address(interface->getInterfaceId()));
996 lsaHeader.setAdvertisingRouter(this->
getInstance()->getProcess()->getRouterID());
1002 networkLsa->setOspfOptions(lsOptions);
1003 int attachedCount = interface->getNeighborCount();
1004 if (attachedCount >= 1) {
1005 networkLsa->setAttachedRouterArraySize(attachedCount + 1);
1006 for (
int i = 0; i < attachedCount; i++) {
1007 Ospfv3Neighbor *neighbor = interface->getNeighbor(i);
1008 networkLsa->setAttachedRouter(i, neighbor->getNeighborID());
1011 networkLsa->setAttachedRouter(attachedCount, this->
getInstance()->getProcess()->getRouterID());
1015 lsaHeader.setLsaLength(packetLength);
Referenced by inet::ospfv3::Ospfv3NeighborState::changeState(), and inet::ospfv3::Ospfv3InterfaceState::changeState().
◆ originateRouterLSA()
| RouterLSA * inet::ospfv3::Ospfv3Area::originateRouterLSA |
( |
| ) |
|
----------------------------------— Router LSA -----------------------------------—//
- Into any given OSPF area, a router will originate several LSAs.
680 EV_DEBUG <<
"Originating RouterLSA (Router-LSA)\n";
681 RouterLSA *routerLSA =
new RouterLSA;
682 Ospfv3LsaHeader& lsaHeader = routerLSA->getHeaderForUpdate();
684 Ospfv3Options lsOptions;
687 lsaHeader.setLsaAge(0);
690 lsaHeader.setLinkStateID(this->
getInstance()->getProcess()->getRouterID());
691 lsaHeader.setAdvertisingRouter(this->
getInstance()->getProcess()->getRouterID());
695 routerLSA->setBBit(
true);
698 for (
int i = 0; i < interfaceCount; i++) {
709 Ospfv3RouterLsaBody routerLSABody;
711 switch (intf->getType()) {
713 for (
int nei = 0; nei < intf->getNeighborCount(); nei++) {
714 Ospfv3Neighbor *neighbor = intf->getNeighbor(nei);
715 EV_DEBUG <<
"neighbor state = " << neighbor->getState() <<
"\n";
719 routerLSABody.interfaceID = intf->getInterfaceId();
720 routerLSABody.metric =
METRIC;
721 routerLSABody.neighborInterfaceID = neighbor->getNeighborInterfaceID();
722 routerLSABody.neighborRouterID = neighbor->getNeighborID();
724 routerLSA->setRoutersArraySize(i + 1);
725 routerLSA->setRouters(i, routerLSABody);
733 Ospfv3Neighbor *DRouter = intf->getNeighborById(intf->getDesignatedID());
736 ((intf->getDesignatedID() == this->getInstance()->getProcess()->getRouterID()) &&
737 intf->getNeighborCount() > 0))
739 routerLSABody.interfaceID = intf->getInterfaceId();
740 routerLSABody.metric =
METRIC;
742 routerLSABody.neighborInterfaceID = intf->getDesignatedIntID();
743 routerLSABody.neighborRouterID = intf->getDesignatedID();
745 routerLSA->setRoutersArraySize(i + 1);
746 routerLSA->setRouters(i, routerLSABody);
756 EV_DEBUG <<
"NBMA and P2MP for interface type is not in originate Router-LSA ymplemented yet\n";
Referenced by inet::ospfv3::Ospfv3NeighborState::changeState(), and inet::ospfv3::Ospfv3InterfaceState::changeState().
◆ recheckInterAreaPrefixLSAs() [1/2]
3379 unsigned long i = 0;
3380 unsigned long j = 0;
3383 for (i = 0; i < lsaCount; i++) {
3385 const Ospfv3LsaHeader& currentHeader = currentLSA->getHeader();
3387 unsigned long routeCost = currentLSA->getMetric();
3388 unsigned short lsAge = currentHeader.getLsaAge();
3389 Ipv4Address originatingRouter = currentHeader.getAdvertisingRouter();
3396 unsigned long routeCount = newTableIPv4.size();
3397 char lsaType = currentHeader.getLsaType();
3398 Ospfv3Ipv4RoutingTableEntry *destinationEntry =
nullptr;
3399 Ipv4AddressRange destination;
3401 destination.address = currentLSA->getPrefix().addressPrefix.toIpv4();
3402 destination.mask = destination.address.makeNetmask(currentLSA->getPrefix().prefixLen);
3404 for (j = 0; j < routeCount; j++) {
3405 Ospfv3Ipv4RoutingTableEntry *routingEntry = newTableIPv4[j];
3406 bool foundMatching =
false;
3410 (destination.address == routingEntry->getDestination()) &&
3411 (destination.mask == routingEntry->getDestination().makeNetmask(routingEntry->getPrefixLength())))
3413 foundMatching =
true;
3419 (destination.address == routingEntry->getDestination()) &&
3420 (destination.mask == routingEntry->getDestination().makeNetmask(routingEntry->getPrefixLength())))
3422 foundMatching =
true;
3426 if (foundMatching) {
3435 destinationEntry = routingEntry;
3440 if (destinationEntry ==
nullptr) {
3444 Ospfv3Ipv4RoutingTableEntry *borderRouterEntry =
nullptr;
3445 unsigned short currentCost = routeCost;
3450 if (routerLSA ==
nullptr) {
3453 if (routerLSA->getRoutersArraySize() < 1) {
3457 Ospfv3IntraAreaPrefixLsa *iapLSA =
nullptr;
3458 for (
size_t rIndex = 0; rIndex < routerLSA->getRoutersArraySize(); rIndex++) {
3460 lsaKey.linkStateID = (Ipv4Address)routerLSA->getRouters(rIndex).neighborInterfaceID;
3461 lsaKey.advertisingRouter = routerLSA->getRouters(rIndex).neighborRouterID;
3462 lsaKey.LSType = routerLSA->getRouters(rIndex).type;
3465 if (iapLSA ==
nullptr)
3469 if (iapLSA ==
nullptr)
3472 for (j = 0; j < routeCount; j++) {
3473 Ospfv3Ipv4RoutingTableEntry *routingEntry = newTableIPv4[j];
3474 for (
size_t pfxs = 0; pfxs < iapLSA->getPrefixesArraySize(); pfxs++) {
3475 if ((routingEntry->getArea() ==
areaID) &&
3478 (routingEntry->getDestination() == iapLSA->getPrefixes(pfxs).addressPrefix.toIpv4()))
3480 borderRouterEntry = routingEntry;
3481 currentCost += borderRouterEntry->getCost();
3486 if (borderRouterEntry ==
nullptr) {
3490 if (currentCost <= destinationEntry->getCost()) {
3491 if (currentCost < destinationEntry->getCost()) {
3492 destinationEntry->clearNextHops();
3495 unsigned long nextHopCount = borderRouterEntry->getNextHopCount();
3497 for (j = 0; j < nextHopCount; j++) {
3498 destinationEntry->addNextHop(borderRouterEntry->getNextHop(j));
◆ recheckInterAreaPrefixLSAs() [2/2]
| void inet::ospfv3::Ospfv3Area::recheckInterAreaPrefixLSAs |
( |
std::vector< Ospfv3RoutingTableEntry * > & |
newTableIPv6 | ) |
|
3250 unsigned long i = 0;
3251 unsigned long j = 0;
3254 for (i = 0; i < lsaCount; i++) {
3256 const Ospfv3LsaHeader& currentHeader = currentLSA->getHeader();
3258 unsigned long routeCost = currentLSA->getMetric();
3259 unsigned short lsAge = currentHeader.getLsaAge();
3260 Ipv4Address originatingRouter = currentHeader.getAdvertisingRouter();
3267 unsigned long routeCount = newTableIPv6.size();
3268 char lsaType = currentHeader.getLsaType();
3269 Ospfv3RoutingTableEntry *destinationEntry =
nullptr;
3270 Ipv6AddressRange destination;
3272 destination.prefix = currentLSA->getPrefix().addressPrefix.toIpv6();
3273 destination.prefixLength = currentLSA->getPrefix().prefixLen;
3275 for (j = 0; j < routeCount; j++) {
3276 Ospfv3RoutingTableEntry *routingEntry = newTableIPv6[j];
3277 bool foundMatching =
false;
3281 (destination.prefix == routingEntry->getDestPrefix()) &&
3282 (destination.prefixLength == routingEntry->getPrefixLength()))
3284 foundMatching =
true;
3290 (destination.prefix == routingEntry->getDestPrefix()) &&
3291 (destination.prefixLength == routingEntry->getPrefixLength()))
3293 foundMatching =
true;
3297 if (foundMatching) {
3307 destinationEntry = routingEntry;
3312 if (destinationEntry ==
nullptr) {
3316 Ospfv3RoutingTableEntry *borderRouterEntry =
nullptr;
3317 unsigned short currentCost = routeCost;
3322 if (routerLSA ==
nullptr) {
3325 if (routerLSA->getRoutersArraySize() < 1) {
3329 Ospfv3IntraAreaPrefixLsa *iapLSA =
nullptr;
3330 for (
size_t rIndex = 0; rIndex < routerLSA->getRoutersArraySize(); rIndex++) {
3332 lsaKey.linkStateID = (Ipv4Address)routerLSA->getRouters(rIndex).neighborInterfaceID;
3333 lsaKey.advertisingRouter = routerLSA->getRouters(rIndex).neighborRouterID;
3334 lsaKey.LSType = routerLSA->getRouters(rIndex).type;
3337 if (iapLSA ==
nullptr)
3341 if (iapLSA ==
nullptr)
3344 for (j = 0; j < routeCount; j++) {
3345 Ospfv3RoutingTableEntry *routingEntry = newTableIPv6[j];
3346 for (
size_t pfxs = 0; pfxs < iapLSA->getPrefixesArraySize(); pfxs++) {
3347 if ((routingEntry->getArea() ==
areaID) &&
3350 (routingEntry->getDestPrefix() == iapLSA->getPrefixes(pfxs).addressPrefix.toIpv6()))
3352 borderRouterEntry = routingEntry;
3353 currentCost += borderRouterEntry->getCost();
3358 if (borderRouterEntry ==
nullptr) {
3362 if (currentCost <= destinationEntry->getCost()) {
3363 if (currentCost < destinationEntry->getCost()) {
3364 destinationEntry->clearNextHops();
3367 unsigned long nextHopCount = borderRouterEntry->getNextHopCount();
3369 for (j = 0; j < nextHopCount; j++) {
3370 destinationEntry->addNextHop(borderRouterEntry->getNextHop(j));
◆ removeFromAllRetransmissionLists()
| void inet::ospfv3::Ospfv3Area::removeFromAllRetransmissionLists |
( |
LSAKeyType |
lsaKey | ) |
|
◆ routerLSAAlreadyExists()
769 for (
auto it = this->
routerLSAList.begin(); it != this->routerLSAList.end(); it++) {
770 if ((*it)->getHeader().getAdvertisingRouter() == newLsa->getHeader().getAdvertisingRouter() &&
771 (*it)->getHeader().getLinkStateID() == newLsa->getHeader().getLinkStateID() &&
772 (*it)->getHeader().getLsaAge() !=
MAX_AGE &&
773 (*it)->getHeader().getLsaAge() !=
MAX_AGE)
775 if ((*it)->getRoutersArraySize() == newLsa->getRoutersArraySize()) {
777 for (
size_t x = 0; x < newLsa->getRoutersArraySize(); x++) {
778 if ((*it)->getRouters(x).interfaceID == newLsa->getRouters(x).interfaceID &&
779 (*it)->getRouters(x).metric == newLsa->getRouters(x).metric &&
780 (*it)->getRouters(x).neighborInterfaceID == newLsa->getRouters(x).neighborInterfaceID &&
781 (*it)->getRouters(x).neighborRouterID == newLsa->getRouters(x).neighborRouterID &&
782 (*it)->getRouters(x).type == newLsa->getRouters(x).type)
◆ routerLSADiffersFrom()
847 const Ospfv3LsaHeader& thisHeader = currentLsa->getHeader();
848 const Ospfv3LsaHeader& lsaHeader = newLsa->getHeader();
849 bool differentHeader = (((thisHeader.getLsaAge() ==
MAX_AGE) && (lsaHeader.getLsaAge() !=
MAX_AGE)) ||
850 ((thisHeader.getLsaAge() !=
MAX_AGE) && (lsaHeader.getLsaAge() ==
MAX_AGE)) ||
851 (thisHeader.getLsaLength() != lsaHeader.getLsaLength()));
852 bool differentBody =
false;
854 if (!differentHeader) {
855 differentBody = ((currentLsa->getNtBit() != newLsa->getNtBit()) ||
856 (currentLsa->getEBit() != newLsa->getEBit()) ||
857 (currentLsa->getBBit() != newLsa->getBBit()) ||
858 (currentLsa->getVBit() != newLsa->getVBit()) ||
859 (currentLsa->getXBit() != newLsa->getXBit()) ||
860 (currentLsa->getRoutersArraySize() != newLsa->getRoutersArraySize()));
862 if (!differentBody) {
863 unsigned int routersCount = currentLsa->getRoutersArraySize();
864 for (
unsigned int i = 0; i < routersCount; i++) {
865 auto thisRouter = currentLsa->getRouters(i);
866 auto lsaRouter = newLsa->getRouters(i);
867 bool differentLink = ((thisRouter.type != lsaRouter.type) ||
868 (thisRouter.metric != lsaRouter.metric) ||
869 (thisRouter.interfaceID != lsaRouter.interfaceID) ||
870 (thisRouter.neighborInterfaceID != lsaRouter.neighborInterfaceID) ||
871 (thisRouter.neighborRouterID != lsaRouter.neighborRouterID));
874 differentBody =
true;
881 return differentHeader || differentBody;
◆ setExternalRoutingCapability()
| void inet::ospfv3::Ospfv3Area::setExternalRoutingCapability |
( |
bool |
capable | ) |
|
|
inline |
◆ setiInstanceType()
| void inet::ospfv3::Ospfv3Area::setiInstanceType |
( |
int |
type | ) |
|
|
inline |
◆ setSpfTreeRoot()
| void inet::ospfv3::Ospfv3Area::setSpfTreeRoot |
( |
RouterLSA * |
routerLSA | ) |
|
|
inline |
◆ setStubDefaultCost()
| void inet::ospfv3::Ospfv3Area::setStubDefaultCost |
( |
int |
newCost | ) |
|
|
inline |
◆ setTransitCapability()
| void inet::ospfv3::Ospfv3Area::setTransitCapability |
( |
bool |
capable | ) |
|
|
inline |
◆ subtractIntraAreaPrefixLinkStateID()
| void inet::ospfv3::Ospfv3Area::subtractIntraAreaPrefixLinkStateID |
( |
| ) |
|
1803 int newIP = currIP.
getInt() - 1;
◆ updateInterAreaPrefixLSA()
1332 (*currentLsa) = (*newLsa);
1334 currentLsa->resetInstallTime();
◆ updateIntraAreaPrefixLSA()
1741 *currentLsa = *newLsa;
◆ updateNetworkLSA()
◆ updateRouterLSA()
◆ areaID
◆ areaType
◆ containingInstance
◆ externalRoutingCapability
| bool inet::ospfv3::Ospfv3Area::externalRoutingCapability = false |
|
private |
◆ instanceType
| int inet::ospfv3::Ospfv3Area::instanceType |
|
private |
◆ interAreaPrefixLSAByID
◆ interAreaPrefixLSAList
◆ interAreaPrefixLSASequenceNumber
◆ interfaceById
◆ interfaceByIndex
| std::map<int, Ospfv3Interface *> inet::ospfv3::Ospfv3Area::interfaceByIndex |
|
private |
◆ interfaceByName
| std::map<std::string, Ospfv3Interface *> inet::ospfv3::Ospfv3Area::interfaceByName |
|
private |
◆ interfaceList
◆ intraAreaPrefixLSAByID
◆ intraAreaPrefixLSAList
◆ intraAreaPrefixLSASequenceNumber
◆ intraAreaPrefixLsID
◆ IPv4advertiseAddressRanges
| std::map<Ipv4AddressRange, bool> inet::ospfv3::Ospfv3Area::IPv4advertiseAddressRanges |
|
private |
◆ IPv4areaAddressRanges
◆ IPv6advertiseAddressRanges
| std::map<Ipv6AddressRange, bool> inet::ospfv3::Ospfv3Area::IPv6advertiseAddressRanges |
|
private |
◆ IPv6areaAddressRanges
◆ networkLSAList
| std::vector<NetworkLSA *> inet::ospfv3::Ospfv3Area::networkLSAList |
|
private |
◆ networkLSAsByID
◆ networkLSASequenceNumber
◆ networkLsID
◆ routerLSAList
| std::vector<RouterLSA *> inet::ospfv3::Ospfv3Area::routerLSAList |
|
private |
◆ routerLSAsByID
◆ routerLSASequenceNumber
◆ routerLsID
◆ spfTreeRoot
| RouterLSA* inet::ospfv3::Ospfv3Area::spfTreeRoot = nullptr |
|
private |
◆ stubDefaultCost
| int inet::ospfv3::Ospfv3Area::stubDefaultCost |
|
private |
◆ transitCapability
| bool inet::ospfv3::Ospfv3Area::transitCapability = false |
|
private |
◆ v6
| bool inet::ospfv3::Ospfv3Area::v6 |
|
private |
The documentation for this class was generated from the following files:
bool transitCapability
Definition: Ospfv3Area.h:190
#define CHK(x)
Definition: INETDefs.h:87
std::vector< NetworkLSA * > networkLSAList
Definition: Ospfv3Area.h:201
Ospfv3LsaFunctionCode
Enum generated from inet/routing/ospfv3/Ospfv3Packet.msg:103 by opp_msgtool.
Definition: Ospfv3Packet_m.h:395
bool installIntraAreaPrefixLSA(const Ospfv3IntraAreaPrefixLsa *lsaC)
Definition: Ospfv3Area.cc:1614
const Ipv4AddressRange NULL_IPV4ADDRESSRANGE(Ipv4Address(0, 0, 0, 0), Ipv4Address(0, 0, 0, 0))
bool v6
Definition: Ospfv3Area.h:171
uint32_t getInt() const
Returns the address as an uint32_t in host byte order (e.g.
Definition: Ipv4Address.h:186
bool hasLink(Ospfv3Lsa *fromLSA, Ospfv3Lsa *toLSA) const
Definition: Ospfv3Area.cc:3030
bool findSameOrWorseCostRoute(const std::vector< Ospfv3RoutingTableEntry * > &newTable, const InterAreaPrefixLSA &interAreaPrefixLSA, unsigned short currentCost, bool &destinationInRoutingTable, std::list< Ospfv3RoutingTableEntry * > &sameOrWorseCost) const
Browse through the newTable looking for entries describing the same destination as the currentLSA.
Definition: Ospfv3Area.cc:2504
@ FULL_STATE
Definition: Ospfv3Neighbor.h:50
@ NBMA_TYPE
Definition: Ospfv3Interface.h:54
std::vector< IntraAreaPrefixLSA * > intraAreaPrefixLSAList
Definition: Ospfv3Area.h:208
std::map< std::string, Ospfv3Interface * > interfaceByName
Definition: Ospfv3Area.h:183
uint32_t intraAreaPrefixLSASequenceNumber
Definition: Ospfv3Area.h:210
virtual const Ospfv3LsaHeader & getHeader() const
@ BROADCAST_TYPE
Definition: Ospfv3Interface.h:53
RouterLSA * findRouterLSA(Ipv4Address routerID)
Definition: Ospfv3Area.cc:962
#define MAX_SEQUENCE_NUMBER
Definition: Ospfv2Common.h:34
Ospfv3Area(Ipv4Address areaID, Ospfv3Instance *containingInstance, Ospfv3AreaType type)
Definition: Ospfv3Area.cc:15
Ospfv3InterfaceType
Definition: Ospfv3Interface.h:50
@ DOWN_STATE
Definition: Ospfv3Neighbor.h:43
IntraAreaPrefixLSA * findIntraAreaPrefixByAddress(L3Address address, int prefix)
Definition: Ospfv3Area.cc:1807
Ospfv3Process * getProcess() const
Definition: Ospfv3Instance.h:32
void subtractInterAreaPrefixLinkStateID()
Definition: Ospfv3Instance.cc:176
uint32_t networkLSASequenceNumber
Definition: Ospfv3Area.h:203
Ipv4Address NextHop
Definition: BgpCommon.h:50
virtual Ospfv3LsaHeader & getHeaderForUpdate()
Definition: Ospfv3Packet_m.h:370
int getAreaCount()
Definition: Ospfv3Instance.h:43
std::string hex(uint16_t l)
Definition: INETUtils.cc:28
bool externalRoutingCapability
Definition: Ospfv3Area.h:188
bool interAreaPrefixLSADiffersFrom(Ospfv3InterAreaPrefixLsa *currentLsa, const Ospfv3InterAreaPrefixLsa *newLsa)
Definition: Ospfv3Area.cc:1338
void incrementInterAreaPrefixSequence()
Definition: Ospfv3Area.h:108
InterAreaPrefixLSA * InterAreaPrefixLSAAlreadyExists(const Ospfv3InterAreaPrefixLsa *newLsa)
Definition: Ospfv3Area.cc:1357
RoutingPathType
Definition: Ospfv3RoutingTableEntry.h:80
bool isOnAnyRetransmissionList(LSAKeyType lsaKey) const
Definition: Ospfv3Area.cc:951
bool routerLSADiffersFrom(Ospfv3RouterLsa *currentLsa, const Ospfv3RouterLsa *newLsa)
Definition: Ospfv3Area.cc:845
int stubDefaultCost
Definition: Ospfv3Area.h:189
@ ATTEMPT_STATE
Definition: Ospfv3Neighbor.h:44
@ INTERFACE_STATE_LOOPBACK
Definition: Ospfv3Interface.h:28
uint32_t routerLSASequenceNumber
Definition: Ospfv3Area.h:199
Ipv4Address networkLsID
Definition: Ospfv3Area.h:202
bool updateRouterLSA(RouterLSA *currentLsa, const Ospfv3RouterLsa *newLsa)
Definition: Ospfv3Area.cc:830
@ POINT_TO_POINT
Definition: Ospfv3Packet_m.h:507
@ TRANSIT_NETWORK
Definition: Ospfv3Packet_m.h:508
bool installRouterLSA(const Ospfv3RouterLsa *lsaC)
Definition: Ospfv3Area.cc:810
int isInRoutingTable6(Ipv6RoutingTable *rtTable, Ipv6Address addr)
Definition: Ospfv3Process.cc:104
std::map< Ipv4Address, RouterLSA * > routerLSAsByID
Definition: Ospfv3Area.h:192
IntraAreaPrefixLSA * originateIntraAreaPrefixLSA()
Definition: Ospfv3Area.cc:1381
static const unsigned char AREA_BORDER_ROUTER_DESTINATION
Definition: Ospfv3RoutingTableEntry.h:91
#define MAX_AGE
Definition: Ospfv2Common.h:27
uint32_t getCurrentIntraAreaPrefixSequence()
Definition: Ospfv3Area.h:124
void incrementNetworkSequence()
Definition: Ospfv3Area.h:91
@ INTERAREA
Definition: Ospfv3RoutingTableEntry.h:21
@ INTRA_AREA_PREFIX_LSA
Definition: Ospfv3Packet_m.h:404
RouterLSA * spfTreeRoot
Definition: Ospfv3Area.h:212
const B OSPFV3_INTRA_AREA_PREFIX_LSA_HEADER_LENGTH
Definition: Ospfv3Common.h:71
@ NETWORK_LSA
Definition: Ospfv3Packet_m.h:397
void rebuildRoutingTable()
Definition: Ospfv3Process.cc:840
@ STUB
Definition: Ospfv3Area.h:21
bool hasAddressRange(const Ipv6AddressRange &addressRange) const
Definition: Ospfv3Process.cc:478
std::map< Ipv4Address, IntraAreaPrefixLSA * > intraAreaPrefixLSAByID
Definition: Ospfv3Area.h:195
IntraAreaPrefixLSA * IntraAreaPrefixLSAAlreadyExists(const Ospfv3IntraAreaPrefixLsa *newLsa)
Definition: Ospfv3Area.cc:1579
RoutingPathType
Definition: Ospfv3RoutingTableEntry.h:19
Ospfv3Instance * getInstance() const
Definition: Ospfv3Area.h:41
@ LINK_LSA
Definition: Ospfv3Packet_m.h:403
Ospfv3AreaType getAreaType() const
Definition: Ospfv3Area.h:33
#define IPV4INSTANCE
Definition: Ospfv3Common.h:20
std::vector< NextHop > * calculateNextHops(Ospfv3Lsa *destination, Ospfv3Lsa *parent) const
Definition: Ospfv3Area.cc:3098
Ipv4Address getNewIntraAreaPrefixLinkStateID()
Definition: Ospfv3Area.cc:1792
#define INITIAL_SEQUENCE_NUMBER
Definition: Ospfv2Common.h:33
std::map< Ipv4Address, InterAreaPrefixLSA * > interAreaPrefixLSAByID
Definition: Ospfv3Area.h:194
bool hasAnyNeighborInStates(int state) const
Definition: Ospfv3Area.cc:923
IntraAreaPrefixLSA * findIntraAreaPrefixLSAByReference(LSAKeyType lsaKey)
Definition: Ospfv3Area.cc:1818
const Ipv4Address BACKBONE_AREAID(0, 0, 0, 0)
int getAddressFamily()
Definition: Ospfv3Instance.h:31
bool nextHopAlreadyExists(std::vector< NextHop > *hops, NextHop nextHop) const
Definition: Ospfv3Area.cc:3086
Ipv4Address intraAreaPrefixLsID
Definition: Ospfv3Area.h:209
InterAreaPrefixLSA * findInterAreaPrefixLSAbyAddress(const L3Address address, int prefixLen)
Definition: Ospfv3Area.cc:1370
@ INTERFACE_STATE_DOWN
Definition: Ospfv3Interface.h:27
Ipv4Address routerLsID
Definition: Ospfv3Area.h:198
void incrementIntraAreaPrefixSequence()
Definition: Ospfv3Area.h:125
Ipv4Address getRouterID()
Definition: Ospfv3Process.h:40
intscale< b, 1, 8 > B
Definition: Units.h:1168
@ INTERFACE_UP_EVENT
Definition: Ospfv3Interface.h:38
std::vector< InterAreaPrefixLSA * > interAreaPrefixLSAList
Definition: Ospfv3Area.h:205
static const unsigned char AS_BOUNDARY_ROUTER_DESTINATION
Definition: Ospfv3RoutingTableEntry.h:31
@ NSSA_LSA
Definition: Ospfv3Packet_m.h:402
B calculateLSASize(const Ospfv3RouterLsa *routerLSA)
Definition: Ospfv3Lsa.cc:19
@ OSPF
managed by the given routing protocol
Definition: IRoute.h:35
static const Ipv6Address UNSPECIFIED_ADDRESS
The unspecified address.
Definition: Ipv6Address.h:54
Ospfv3Instance * containingInstance
Definition: Ospfv3Area.h:187
Ipv4Address areaID
Definition: Ospfv3Area.h:173
@ POINTTOMULTIPOINT_TYPE
Definition: Ospfv3Interface.h:55
void erase(std::vector< T > &v, int pos)
Definition: stlutils.h:101
@ RESERVED
Definition: Ospfv3Packet_m.h:509
removed type
Definition: IUdp-gates.txt:7
#define IPV6INSTANCE
Definition: Ospfv3Common.h:21
Ospfv3Area * getArea(int i)
Definition: Ospfv3Instance.h:37
bool floodLSA(const Ospfv3Lsa *lsa, Ospfv3Interface *interface=nullptr, Ospfv3Neighbor *neighbor=nullptr)
Definition: Ospfv3Area.cc:908
const B OSPFV3_LSA_HEADER_LENGTH
Definition: Ospfv3Common.h:59
NetworkLSA * getNetworkLSAbyKey(LSAKeyType LSAKey)
Definition: Ospfv3Area.cc:1023
static const unsigned char AREA_BORDER_ROUTER_DESTINATION
Definition: Ospfv3RoutingTableEntry.h:30
@ INTRAAREA
Definition: Ospfv3RoutingTableEntry.h:81
const B OSPFV3_INTER_AREA_PREFIX_LSA_HEADER_LENGTH
Definition: Ospfv3Common.h:67
@ INTRAAREA
Definition: Ospfv3RoutingTableEntry.h:20
@ POINTTOPOINT_TYPE
Definition: Ospfv3Interface.h:52
@ TYPE1_EXTERNAL
Definition: Ospfv3RoutingTableEntry.h:22
@ VIRTUAL_LINK
Definition: Ospfv3Packet_m.h:510
IntraAreaPrefixLSA * originateNetIntraAreaPrefixLSA(NetworkLSA *networkLSA, Ospfv3Interface *interface, bool checkDuplicate)
Definition: Ospfv3Area.cc:1496
int instanceType
Definition: Ospfv3Area.h:186
@ TYPE2_EXTERNAL
Definition: Ospfv3RoutingTableEntry.h:23
std::string str(bool printUnspec=true) const
Returns the string representation of the address (e.g.
Definition: Ipv4Address.cc:98
@ INTER_AREA_PREFIX_LSA
Definition: Ospfv3Packet_m.h:398
std::map< Ipv6AddressRange, bool > IPv6advertiseAddressRanges
Definition: Ospfv3Area.h:179
RouterLSA * originateRouterLSA()
----------------------------------— Router LSA -----------------------------------—//
Definition: Ospfv3Area.cc:678
unsigned char RoutingDestinationType
Definition: Ospfv3RoutingTableEntry.h:26
bool updateInterAreaPrefixLSA(InterAreaPrefixLSA *currentLsa, const Ospfv3InterAreaPrefixLsa *newLsa)
Definition: Ospfv3Area.cc:1329
void originateDefaultInterAreaPrefixLSA(Ospfv3Area *toArea)
Definition: Ospfv3Area.cc:1248
void removeFromAllRetransmissionLists(LSAKeyType lsaKey)
Definition: Ospfv3Area.cc:943
#define CHECK_AGE
Definition: Ospfv2Common.h:28
std::vector< Ospfv3Interface * > interfaceList
Definition: Ospfv3Area.h:175
static const unsigned char NETWORK_DESTINATION
Definition: Ospfv3RoutingTableEntry.h:29
void setDistance(unsigned long d)
Definition: Ospfv3Lsa.h:53
NetworkLSA * originateNetworkLSA(Ospfv3Interface *interface)
Definition: Ospfv3Area.cc:983
const double k
Definition: Qam1024Modulation.cc:14
NetworkLSA * findNetworkLSA(uint32_t intID, Ipv4Address routerID)
Definition: Ospfv3Area.cc:1096
bool updateNetworkLSA(NetworkLSA *currentLsa, const Ospfv3NetworkLsa *newLsa)
Definition: Ospfv3Area.cc:1052
Ospfv3RouterLsaType
Enum generated from inet/routing/ospfv3/Ospfv3Packet.msg:188 by opp_msgtool.
Definition: Ospfv3Packet_m.h:506
void subtractIntraAreaPrefixLinkStateID()
Definition: Ospfv3Area.cc:1800
Ospfv3Lsa * getLSAbyKey(LSAKeyType lsaKey)
Definition: Ospfv3Area.cc:1828
@ IPv6
Definition: L3Address.h:36
std::map< int, Ospfv3Interface * > interfaceByIndex
Definition: Ospfv3Area.h:185
@ TYPE1_EXTERNAL
Definition: Ospfv3RoutingTableEntry.h:83
@ VIRTUAL_TYPE
Definition: Ospfv3Interface.h:56
Ospfv3Interface * getNetworkLSAInterface(Ipv4Address id)
Definition: Ospfv3Area.cc:90
void originateInterAreaPrefixLSA(Ospfv3IntraAreaPrefixLsa *lsa, Ospfv3Area *fromArea, bool checkDuplicate)
Definition: Ospfv3Area.cc:1117
ModuleRefByPar< Ipv6RoutingTable > rt6
Definition: Ospfv3Process.h:72
Ospfv3RoutingTableEntry * createRoutingTableEntryFromInterAreaPrefixLSA(const InterAreaPrefixLSA &interAreaPrefixLSA, unsigned short entryCost, const Ospfv3RoutingTableEntry &borderRouterEntry) const
Returns a new RoutingTableEntry based on the input Inter-Area-Prefix LSA, with the input cost and the...
Definition: Ospfv3Area.cc:2631
#define LS_INFINITY
Definition: Ted.cc:23
static const Ipv4Address UNSPECIFIED_ADDRESS
0.0.0.0
Definition: Ipv4Address.h:91
#define METRIC
Definition: Ospfv3Common.h:12
const value_type & get() const
Definition: Units.h:108
@ EXCHANGE_STATE
Definition: Ospfv3Neighbor.h:48
std::vector< Ipv6AddressRange > IPv6areaAddressRanges
Definition: Ospfv3Area.h:178
static const unsigned char NETWORK_DESTINATION
Definition: Ospfv3RoutingTableEntry.h:90
std::map< Ipv4AddressRange, bool > IPv4advertiseAddressRanges
Definition: Ospfv3Area.h:181
void addRouterEntry(RouterLSA *routerLSA, LSAKeyType lsaKey, std::vector< Ospfv3RoutingTableEntry * > &newTableIPv6, std::vector< Ospfv3Ipv4RoutingTableEntry * > &newTableIPv4)
Definition: Ospfv3Area.cc:2434
@ INTER_AREA_ROUTER_LSA
Definition: Ospfv3Packet_m.h:399
RouterLSA * getRouterLSAbyKey(LSAKeyType lsaKey)
Definition: Ospfv3Area.cc:799
uint32_t getCurrentInterAreaPrefixSequence()
Definition: Ospfv3Area.h:107
uint32_t interAreaPrefixLSASequenceNumber
Definition: Ospfv3Area.h:206
@ TYPE2_EXTERNAL
Definition: Ospfv3RoutingTableEntry.h:84
std::vector< Ipv4AddressRange > IPv4areaAddressRanges
Definition: Ospfv3Area.h:180
bool isSameNetwork(Ipv6Address address1, int prefixLen1, Ipv6Address address2, int prefixLen2)
Definition: Ospfv3Common.h:145
const Ipv6AddressRange NULL_IPV6ADDRESSRANGE(Ipv6Address(0, 0, 0, 0), 0)
Ospfv3AreaType areaType
Definition: Ospfv3Area.h:174
static const unsigned char AS_BOUNDARY_ROUTER_DESTINATION
Definition: Ospfv3RoutingTableEntry.h:92
value< double, units::m > m
Definition: Units.h:1233
const B OSPFV3_LSA_PREFIX_HEADER_LENGTH
Definition: Ospfv3Common.h:77
bool hasAddressRange(Ipv6AddressRange addressRange) const
Definition: Ospfv3Area.cc:1933
bool networkLSADiffersFrom(Ospfv3NetworkLsa *currentLsa, const Ospfv3NetworkLsa *newLsa)
Definition: Ospfv3Area.cc:1061
#define LS_REFRESH_TIME
Definition: Ospfv2Common.h:24
@ ROUTER_LSA
Definition: Ospfv3Packet_m.h:396
std::vector< RouterLSA * > routerLSAList
Definition: Ospfv3Area.h:197
bool intraAreaPrefixLSADiffersFrom(Ospfv3IntraAreaPrefixLsa *currentLsa, const Ospfv3IntraAreaPrefixLsa *newLsa)
Definition: Ospfv3Area.cc:1752
Ipv4Address getAreaID() const
Definition: Ospfv3Area.h:32
void incrementRouterSequence()
Definition: Ospfv3Area.h:73
bool updateIntraAreaPrefixLSA(IntraAreaPrefixLSA *currentLsa, const Ospfv3IntraAreaPrefixLsa *newLsa)
Definition: Ospfv3Area.cc:1738
uint32_t getCurrentNetworkSequence()
Definition: Ospfv3Area.h:90
@ INTERAREA
Definition: Ospfv3RoutingTableEntry.h:82
int getIntraAreaPrefixLSACount()
Definition: Ospfv3Area.h:116
std::map< Ipv4Address, NetworkLSA * > networkLSAsByID
Definition: Ospfv3Area.h:193
Ipv4Address getNewInterAreaPrefixLinkStateID()
bool containsKey(const std::map< K, V, _C > &m, const Tk &a)
Definition: stlutils.h:80
std::map< int, Ospfv3Interface * > interfaceById
Definition: Ospfv3Area.h:184
@ UNKNOWN_TYPE
Definition: Ospfv3Interface.h:51
@ LOADING_STATE
Definition: Ospfv3Neighbor.h:49
@ INTERFACE_STATE_DESIGNATED
Definition: Ospfv3Interface.h:33
IntraAreaPrefixLSA * getIntraAreaPrefixLSA(int i)
Definition: Ospfv3Area.h:117
uint32_t getCurrentRouterSequence()
Definition: Ospfv3Area.h:72
int getRouterLSACount()
Definition: Ospfv3Area.h:64