32 bool shouldRebuildRoutingTable =
false;
34 neighbor->changeState(newState, currentState);
37 RouterID routerID = neighbor->getInterface()->getArea()->getRouter()->getRouterID();
38 RouterLSA *routerLSA = neighbor->getInterface()->getArea()->findRouterLSA(routerID);
40 if (routerLSA !=
nullptr) {
41 long sequenceNumber = routerLSA->getHeader().getLsSequenceNumber();
43 routerLSA->getHeader().setLsAge(
MAX_AGE);
44 neighbor->getInterface()->getArea()->floodLSA(routerLSA);
45 routerLSA->incrementInstallTime();
48 RouterLSA *newLSA = neighbor->getInterface()->getArea()->originateRouterLSA();
50 newLSA->getHeader().setLsSequenceNumber(sequenceNumber + 1);
51 shouldRebuildRoutingTable |= routerLSA->update(newLSA);
54 neighbor->getInterface()->getArea()->floodLSA(routerLSA);
59 NetworkLSA *networkLSA = neighbor->getInterface()->getArea()->findNetworkLSA(neighbor->getInterface()->getAddressRange().address);
61 if (networkLSA !=
nullptr) {
62 long sequenceNumber = networkLSA->getHeader().getLsSequenceNumber();
64 networkLSA->getHeader().setLsAge(
MAX_AGE);
65 neighbor->getInterface()->getArea()->floodLSA(networkLSA);
66 networkLSA->incrementInstallTime();
69 NetworkLSA *newLSA = neighbor->getInterface()->getArea()->originateNetworkLSA(neighbor->getInterface());
71 if (newLSA !=
nullptr) {
72 newLSA->getHeader().setLsSequenceNumber(sequenceNumber + 1);
73 shouldRebuildRoutingTable |= networkLSA->update(newLSA);
77 networkLSA->getHeader().setLsAge(
MAX_AGE);
78 networkLSA->incrementInstallTime();
81 neighbor->getInterface()->getArea()->floodLSA(networkLSA);
87 if (shouldRebuildRoutingTable) {
88 neighbor->getInterface()->getArea()->getRouter()->rebuildRoutingTable();
NeighborStateType
Definition: OSPFNeighbor.h:61
#define MAX_SEQUENCE_NUMBER
Definition: OSPFcommon.h:43
Definition: OSPFInterface.h:70
#define MAX_AGE
Definition: OSPFcommon.h:36
Definition: OSPFNeighbor.h:69
IPv4Address RouterID
Definition: OSPFcommon.h:137