INET Framework for OMNeT++/OMNEST
inet::ospfv3::Ospfv3Area Class Reference

#include <Ospfv3Area.h>

Inheritance diagram for inet::ospfv3::Ospfv3Area:

Public Member Functions

 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)
 
Ospfv3InstancegetInstance () const
 
void setExternalRoutingCapability (bool capable)
 
void setStubDefaultCost (int newCost)
 
void setTransitCapability (bool capable)
 
Ospfv3InterfacegetInterfaceById (int id)
 
Ospfv3InterfacegetNetworkLSAInterface (Ipv4Address id)
 
Ospfv3InterfacegetInterfaceByIndex (int id)
 
bool getExternalRoutingCapability ()
 
int getStubDefaultCost ()
 
bool getTransitCapability ()
 
Ospfv3InterfacefindVirtualLink (Ipv4Address routerID)
 
Ospfv3InterfacegetInterface (int i) const
 
Ospfv3InterfacegetInterfaceByIndex (Ipv4Address address)
 
int getInterfaceCount () const
 
Ospfv3LsagetLSAbyKey (LSAKeyType lsaKey)
 
void addAddressRange (Ipv6AddressRange addressRange, bool advertise)
 
bool hasAddressRange (Ipv6AddressRange addressRange) const
 
void addAddressRange (Ipv4AddressRange addressRange, bool advertise)
 
bool hasAddressRange (Ipv4AddressRange addressRange) const
 
RouterLSAoriginateRouterLSA ()
 ----------------------------------— Router LSA -----------------------------------—// More...
 
int getRouterLSACount ()
 
RouterLSAgetRouterLSA (int i)
 
RouterLSAgetRouterLSAbyKey (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 ()
 
RouterLSAfindRouterLSAByID (Ipv4Address linkStateID)
 
RouterLSAfindRouterLSA (Ipv4Address routerID)
 
void deleteRouterLSA (int index)
 
void addRouterLSA (RouterLSA *newLSA)
 
RouterLSArouterLSAAlreadyExists (RouterLSA *newLsa)
 
void addNetworkLSA (NetworkLSA *newLSA)
 
NetworkLSAoriginateNetworkLSA (Ospfv3Interface *interface)
 
int getNetworkLSACount ()
 
NetworkLSAgetNetworkLSA (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 ()
 
NetworkLSAfindNetworkLSAByLSID (Ipv4Address linkStateID)
 
NetworkLSAgetNetworkLSAbyKey (LSAKeyType LSAKey)
 
NetworkLSAfindNetworkLSA (uint32_t intID, Ipv4Address routerID)
 
void addInterAreaPrefixLSA (InterAreaPrefixLSA *newLSA)
 
int getInterAreaPrefixLSACount ()
 
InterAreaPrefixLSAgetInterAreaPrefixLSA (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 ()
 
InterAreaPrefixLSAInterAreaPrefixLSAAlreadyExists (const Ospfv3InterAreaPrefixLsa *newLsa)
 
InterAreaPrefixLSAfindInterAreaPrefixLSAbyAddress (const L3Address address, int prefixLen)
 
IntraAreaPrefixLSAoriginateIntraAreaPrefixLSA ()
 
IntraAreaPrefixLSAoriginateNetIntraAreaPrefixLSA (NetworkLSA *networkLSA, Ospfv3Interface *interface, bool checkDuplicate)
 
void addIntraAreaPrefixLSA (IntraAreaPrefixLSA *newLSA)
 
int getIntraAreaPrefixLSACount ()
 
IntraAreaPrefixLSAgetIntraAreaPrefixLSA (int i)
 
IntraAreaPrefixLSAgetNetIntraAreaPrefixLSA (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 ()
 
IntraAreaPrefixLSAfindIntraAreaPrefixByAddress (L3Address address, int prefix)
 
IntraAreaPrefixLSAfindIntraAreaPrefixLSAByReference (LSAKeyType lsaKey)
 
IntraAreaPrefixLSAIntraAreaPrefixLSAAlreadyExists (const Ospfv3IntraAreaPrefixLsa *newLsa)
 
const Ospfv3LsaHeaderfindLSA (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
 
Ospfv3RoutingTableEntrycreateRoutingTableEntryFromInterAreaPrefixLSA (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...
 
Ospfv3Ipv4RoutingTableEntrycreateRoutingTableEntryFromInterAreaPrefixLSA (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)
 

Private Attributes

bool v6
 
Ipv4Address areaID
 
Ospfv3AreaType areaType
 
std::vector< Ospfv3Interface * > interfaceList
 
std::vector< Ipv6AddressRangeIPv6areaAddressRanges
 
std::map< Ipv6AddressRange, bool > IPv6advertiseAddressRanges
 
std::vector< Ipv4AddressRangeIPv4areaAddressRanges
 
std::map< Ipv4AddressRange, bool > IPv4advertiseAddressRanges
 
std::map< std::string, Ospfv3Interface * > interfaceByName
 
std::map< int, Ospfv3Interface * > interfaceById
 
std::map< int, Ospfv3Interface * > interfaceByIndex
 
int instanceType
 
Ospfv3InstancecontainingInstance
 
bool externalRoutingCapability = false
 
int stubDefaultCost
 
bool transitCapability = false
 
std::map< Ipv4Address, RouterLSA * > routerLSAsByID
 
std::map< Ipv4Address, NetworkLSA * > networkLSAsByID
 
std::map< Ipv4Address, InterAreaPrefixLSA * > interAreaPrefixLSAByID
 
std::map< Ipv4Address, IntraAreaPrefixLSA * > intraAreaPrefixLSAByID
 
std::vector< RouterLSA * > routerLSAList
 
Ipv4Address routerLsID = Ipv4Address::UNSPECIFIED_ADDRESS
 
uint32_t routerLSASequenceNumber = INITIAL_SEQUENCE_NUMBER
 
std::vector< NetworkLSA * > networkLSAList
 
Ipv4Address networkLsID = Ipv4Address::UNSPECIFIED_ADDRESS
 
uint32_t networkLSASequenceNumber = INITIAL_SEQUENCE_NUMBER
 
std::vector< InterAreaPrefixLSA * > interAreaPrefixLSAList
 
uint32_t interAreaPrefixLSASequenceNumber = INITIAL_SEQUENCE_NUMBER
 
std::vector< IntraAreaPrefixLSA * > intraAreaPrefixLSAList
 
Ipv4Address intraAreaPrefixLsID = (Ipv4Address)1
 
uint32_t intraAreaPrefixLSASequenceNumber = INITIAL_SEQUENCE_NUMBER
 
RouterLSAspfTreeRoot = nullptr
 

Constructor & Destructor Documentation

◆ Ospfv3Area()

inet::ospfv3::Ospfv3Area::Ospfv3Area ( Ipv4Address  areaID,
Ospfv3Instance containingInstance,
Ospfv3AreaType  type 
)
16 {
17  this->areaID = areaID;
18  this->containingInstance = parent;
19  this->externalRoutingCapability = true;
20  this->areaType = type;
21  this->spfTreeRoot = nullptr;
22 
23  WATCH_PTRVECTOR(this->interfaceList);
24 }

◆ ~Ospfv3Area()

inet::ospfv3::Ospfv3Area::~Ospfv3Area ( )
virtual
27 {
28  int interfaceNum = interfaceList.size();
29  for (int i = 0; i < interfaceNum; i++) {
30  delete interfaceList[i];
31  }
32  interfaceList.clear();
33  long lsaCount = routerLSAList.size();
34  for (long j = 0; j < lsaCount; j++) {
35  delete routerLSAList[j];
36  }
37  routerLSAList.clear();
38  lsaCount = networkLSAList.size();
39  for (long k = 0; k < lsaCount; k++) {
40  delete networkLSAList[k];
41  }
42  networkLSAList.clear();
43  lsaCount = interAreaPrefixLSAList.size();
44  for (long m = 0; m < lsaCount; m++) {
45  delete interAreaPrefixLSAList[m];
46  }
47  interAreaPrefixLSAList.clear();
48  lsaCount = intraAreaPrefixLSAList.size();
49  for (long m = 0; m < lsaCount; m++) {
50  delete intraAreaPrefixLSAList[m];
51  }
52  intraAreaPrefixLSAList.clear();
53 }

Member Function Documentation

◆ addAddressRange() [1/2]

void inet::ospfv3::Ospfv3Area::addAddressRange ( Ipv4AddressRange  addressRange,
bool  advertise 
)
1946 {
1947  int addressRangeNum = IPv4areaAddressRanges.size();
1948  bool found = false;
1949  bool erased = false;
1950 
1951  for (int i = 0; i < addressRangeNum; i++) {
1952  Ipv4AddressRange curRange = IPv4areaAddressRanges[i];
1953  if (curRange.contains(addressRange)) { // contains or same
1954  found = true;
1955  if (IPv4advertiseAddressRanges[curRange] != advertise) {
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());
1958  }
1959  }
1960  else if (addressRange.contains(curRange)) {
1961  if (IPv4advertiseAddressRanges[curRange] != advertise) {
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());
1964  }
1965  IPv4advertiseAddressRanges.erase(curRange);
1967  erased = true;
1968  }
1969  }
1970  if (erased && found) // the found entry contains new entry and new entry contains erased entry ==> the found entry also contains the erased entry
1971  throw cRuntimeError("Model error: bad contents in IPv4areaAddressRanges vector");
1972  if (erased) {
1973  auto it = IPv4areaAddressRanges.begin();
1974  while (it != IPv4areaAddressRanges.end()) {
1975  if (*it == NULL_IPV4ADDRESSRANGE)
1976  it = IPv4areaAddressRanges.erase(it);
1977  else
1978  it++;
1979  }
1980  }
1981  if (!found) {
1982  IPv4areaAddressRanges.push_back(addressRange);
1983  IPv4advertiseAddressRanges[addressRange] = advertise;
1984  }
1985 }

◆ addAddressRange() [2/2]

void inet::ospfv3::Ospfv3Area::addAddressRange ( Ipv6AddressRange  addressRange,
bool  advertise 
)
1892 {
1893  int addressRangeNum = IPv6areaAddressRanges.size();
1894  bool found = false;
1895  bool erased = false;
1896 
1897  for (int i = 0; i < addressRangeNum; i++) {
1898  Ipv6AddressRange curRange = IPv6areaAddressRanges[i];
1899  if (curRange.contains(addressRange)) { // contains or same
1900  found = true;
1901  if (IPv6advertiseAddressRanges[curRange] != advertise) {
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());
1904  }
1905  }
1906  else if (addressRange.contains(curRange)) {
1907  if (IPv6advertiseAddressRanges[curRange] != advertise) {
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());
1910  }
1911  IPv6advertiseAddressRanges.erase(curRange);
1913  erased = true;
1914  }
1915  }
1916  if (erased && found) // the found entry contains new entry and new entry contains erased entry ==> the found entry also contains the erased entry
1917  throw cRuntimeError("Model error: bad contents in areaAddressRanges vector");
1918  if (erased) {
1919  auto it = IPv6areaAddressRanges.begin();
1920  while (it != IPv6areaAddressRanges.end()) {
1921  if (*it == NULL_IPV6ADDRESSRANGE)
1922  it = IPv6areaAddressRanges.erase(it);
1923  else
1924  it++;
1925  }
1926  }
1927  if (!found) {
1928  IPv6areaAddressRanges.push_back(addressRange);
1929  IPv6advertiseAddressRanges[addressRange] = advertise;
1930  }
1931 }

Referenced by inet::ospfv3::Ospfv3Process::parseConfig().

◆ addInterAreaPrefixLSA()

void inet::ospfv3::Ospfv3Area::addInterAreaPrefixLSA ( InterAreaPrefixLSA newLSA)
inline
97 { this->interAreaPrefixLSAList.push_back(newLSA); }

◆ addInterface()

void inet::ospfv3::Ospfv3Area::addInterface ( Ospfv3Interface newInterface)
108 {
109  this->interfaceList.push_back(newInterface);
110  this->interfaceByName[newInterface->getIntName()] = newInterface;
111  this->interfaceById[newInterface->getInterfaceId()] = newInterface;
112 } // addArea

Referenced by inet::ospfv3::Ospfv3Process::parseConfig().

◆ addIntraAreaPrefixLSA()

void inet::ospfv3::Ospfv3Area::addIntraAreaPrefixLSA ( IntraAreaPrefixLSA newLSA)
inline
115 { this->intraAreaPrefixLSAList.push_back(newLSA); }

◆ addNetworkLSA()

void inet::ospfv3::Ospfv3Area::addNetworkLSA ( NetworkLSA newLSA)
inline
81 { this->networkLSAList.push_back(newLSA); }

◆ addRouterEntry()

void inet::ospfv3::Ospfv3Area::addRouterEntry ( RouterLSA routerLSA,
LSAKeyType  lsaKey,
std::vector< Ospfv3RoutingTableEntry * > &  newTableIPv6,
std::vector< Ospfv3Ipv4RoutingTableEntry * > &  newTableIPv4 
)
2435 {
2436  L3Address destinationID;
2437  uint8_t prefixLen;
2438 
2439  Ospfv3IntraAreaPrefixLsa *iapLSA = findIntraAreaPrefixLSAByReference(lsaKey); // find appropriate LSA type 9 based on reference in packet.
2440 
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;
2445 
2446  // if this LSA is part of IPv6 AF
2447  if (destinationID.getType() == L3Address::IPv6) {
2448  Ospfv3RoutingTableEntry *entry = new Ospfv3RoutingTableEntry(this->getInstance()->ift, destinationID.toIpv6(), prefixLen, IRoute::OSPF);
2449  unsigned int nextHopCount = routerLSA->getNextHopCount();
2451 
2452  entry->setLinkStateOrigin(routerLSA);
2453  entry->setArea(areaID);
2454  entry->setPathType(Ospfv3RoutingTableEntry::INTRAAREA);
2455  entry->setCost(routerLSA->getDistance());
2456  if (routerLSA->getBBit())
2458 
2459  if (routerLSA->getEBit())
2461 
2462  entry->setDestinationType(destinationType);
2463  entry->setOptionalCapabilities(routerLSA->getOspfOptions());
2464  for (unsigned int j = 0; j < nextHopCount; j++) {
2465  entry->addNextHop(routerLSA->getNextHop(j));
2466  }
2467 
2468  newTableIPv6.push_back(entry);
2469  }
2470  else { // if this LSA is part of IPv4 AF
2471  Ospfv3Ipv4RoutingTableEntry *entry = new Ospfv3Ipv4RoutingTableEntry(this->getInstance()->ift, destinationID.toIpv4(), prefixLen, IRoute::OSPF);
2472  unsigned int nextHopCount = routerLSA->getNextHopCount();
2474 
2475  entry->setLinkStateOrigin(routerLSA);
2476  entry->setArea(areaID);
2477  entry->setPathType(Ospfv3Ipv4RoutingTableEntry::INTRAAREA);
2478  entry->setCost(routerLSA->getDistance());
2479  if (routerLSA->getBBit()) {
2481  }
2482  if (routerLSA->getEBit()) {
2484  }
2485 
2486  entry->setDestinationType(destinationType);
2487  entry->setOptionalCapabilities(routerLSA->getOspfOptions());
2488  for (unsigned int j = 0; j < nextHopCount; j++) {
2489  entry->addNextHop(routerLSA->getNextHop(j));
2490  }
2491 
2492  newTableIPv4.push_back(entry);
2493  }
2494  }
2495  }
2496 }

◆ addRouterLSA()

void inet::ospfv3::Ospfv3Area::addRouterLSA ( RouterLSA newLSA)
inline
77 { this->routerLSAList.push_back(newLSA); }

◆ ageDatabase()

void inet::ospfv3::Ospfv3Area::ageDatabase ( )
186 {
187  long lsaCount = this->getRouterLSACount();
188  bool shouldRebuildRoutingTable = false;
189  long i;
190 
191  // ROUTER-LSA
192  for (i = 0; i < lsaCount; i++) {
193  RouterLSA *lsa = routerLSAList[i];
194  unsigned short lsAge = lsa->getHeader().getLsaAge();
195  bool selfOriginated = (lsa->getHeader().getAdvertisingRouter() == this->getInstance()->getProcess()->getRouterID());
196  // TODO unreachability is not managed, Should be on places where it is as a comment
197 // bool unreachable = parentRouter->isDestinationUnreachable(lsa);
198 
199  if ((selfOriginated && (lsAge < (LS_REFRESH_TIME - 1))) || (!selfOriginated && (lsAge < (MAX_AGE - 1)))) {
200  lsa->getHeaderForUpdate().setLsaAge(lsAge + 1);
201  if ((lsAge + 1) % CHECK_AGE == 0) {
202  if (!lsa->validateLSChecksum()) { // always return true
203  EV_ERROR << "Invalid LS checksum. Memory error detected!\n";
204  }
205  }
206  lsa->incrementInstallTime();
207  }
208  if (selfOriginated && (lsAge == (LS_REFRESH_TIME - 1))) {
209 // if (unreachable) {
210 // lsa->getHeader().setLsaAge(MAX_AGE);
211 // floodLSA(lsa);
212 // lsa->incrementInstallTime();
213 // }
214 // else
215 
216  long sequenceNumber = lsa->getHeader().getLsaSequenceNumber();
217  if (sequenceNumber == MAX_SEQUENCE_NUMBER) {
218  lsa->getHeaderForUpdate().setLsaAge(MAX_AGE);
219  floodLSA(lsa);
220  lsa->incrementInstallTime();
221  }
222  else {
223  RouterLSA *newLSA = originateRouterLSA();
224  newLSA->getHeaderForUpdate().setLsaSequenceNumber(sequenceNumber + 1);
225  shouldRebuildRoutingTable |= updateRouterLSA(lsa, newLSA);
226  delete newLSA;
227 
228  floodLSA(lsa);
229  }
230  }
231  if (!selfOriginated && (lsAge == MAX_AGE - 1)) {
232  lsa->getHeaderForUpdate().setLsaAge(MAX_AGE);
233  floodLSA(lsa);
234  lsa->incrementInstallTime();
235  }
236  if (lsAge == MAX_AGE) {
237  LSAKeyType lsaKey;
238 
239  lsaKey.linkStateID = lsa->getHeader().getLinkStateID();
240  lsaKey.advertisingRouter = lsa->getHeader().getAdvertisingRouter();
241 
242  if (!isOnAnyRetransmissionList(lsaKey) &&
244  {
245  if (!selfOriginated /*|| unreachable*/) {
246  routerLSAsByID.erase(lsa->getHeader().getLinkStateID());
247  delete lsa;
248  routerLSAList[i] = nullptr;
249  shouldRebuildRoutingTable = true;
250  }
251  else {
252  RouterLSA *newLSA = originateRouterLSA();
253  long sequenceNumber = lsa->getHeader().getLsaSequenceNumber();
254 
255  newLSA->getHeaderForUpdate().setLsaSequenceNumber((sequenceNumber == MAX_SEQUENCE_NUMBER) ? INITIAL_SEQUENCE_NUMBER : sequenceNumber + 1);
256  shouldRebuildRoutingTable |= updateRouterLSA(lsa, newLSA);
257  delete newLSA;
258 
259  floodLSA(lsa);
260  }
261  }
262  }
263  }
264 
265  auto routerIt = routerLSAList.begin();
266  while (routerIt != routerLSAList.end()) {
267  if ((*routerIt) == nullptr) {
268  routerIt = routerLSAList.erase(routerIt);
269  }
270  else {
271  routerIt++;
272  }
273  }
274 
275  // NETWORK-LSA
276  lsaCount = networkLSAList.size();
277  for (i = 0; i < lsaCount; i++) {
278  unsigned short lsAge = networkLSAList[i]->getHeader().getLsaAge();
279 // bool unreachable = parentRouter->isDestinationUnreachable(networkLSAs[i]);
280  NetworkLSA *lsa = networkLSAList[i];
281  Ospfv3Interface *localIntf = nullptr;
282  if (lsa->getHeader().getAdvertisingRouter() == this->getInstance()->getProcess()->getRouterID()) {
283  localIntf = getNetworkLSAInterface(lsa->getHeader().getLinkStateID());
284  }
285  bool selfOriginated = false;
286 
287  if ((localIntf != nullptr) &&
288  (localIntf->getState() == Ospfv3Interface::INTERFACE_STATE_DESIGNATED) &&
289  (localIntf->getNeighborCount() > 0) &&
290  (localIntf->hasAnyNeighborInState(Ospfv3Neighbor::FULL_STATE)))
291  {
292  selfOriginated = true;
293  }
294 
295  if ((selfOriginated && (lsAge < (LS_REFRESH_TIME - 1))) || (!selfOriginated && (lsAge < (MAX_AGE - 1)))) {
296  lsa->getHeaderForUpdate().setLsaAge(lsAge + 1);
297  if ((lsAge + 1) % CHECK_AGE == 0) { // always TRUE
298  if (!lsa->validateLSChecksum()) {
299  EV_ERROR << "Invalid LS checksum. Memory error detected!\n";
300  }
301  }
302  lsa->incrementInstallTime();
303  }
304  if (selfOriginated && (lsAge == (LS_REFRESH_TIME - 1))) {
305 // if (unreachable) {
306 // lsa->getHeader().setLsaAge(MAX_AGE);
307 // floodLSA(lsa);
308 // lsa->incrementInstallTime();
309 // }
310 // else {
311  long sequenceNumber = lsa->getHeader().getLsaSequenceNumber();
312  if (sequenceNumber == MAX_SEQUENCE_NUMBER) {
313  lsa->getHeaderForUpdate().setLsaAge(MAX_AGE);
314  floodLSA(lsa);
315  lsa->incrementInstallTime();
316  }
317  else {
318  NetworkLSA *newLSA = originateNetworkLSA(localIntf);
319 
320  if (newLSA != nullptr) {
321  newLSA->getHeaderForUpdate().setLsaSequenceNumber(sequenceNumber + 1);
322  shouldRebuildRoutingTable |= updateNetworkLSA(lsa, newLSA);
323  delete newLSA;
324  }
325  else { // no neighbors on the network -> old NetworkLSA must be flushed
326  lsa->getHeaderForUpdate().setLsaAge(MAX_AGE);
327  lsa->incrementInstallTime();
328  }
329 
330  floodLSA(lsa);
331  }
332  }
333  if (!selfOriginated && (lsAge == MAX_AGE - 1)) {
334  lsa->getHeaderForUpdate().setLsaAge(MAX_AGE);
335  floodLSA(lsa);
336  lsa->incrementInstallTime();
337  }
338  if (lsAge == MAX_AGE) {
339  LSAKeyType lsaKey;
340 
341  lsaKey.linkStateID = lsa->getHeader().getLinkStateID();
342  lsaKey.advertisingRouter = lsa->getHeader().getAdvertisingRouter();
343 
344  if (!isOnAnyRetransmissionList(lsaKey) &&
345  !hasAnyNeighborInStates(Ospfv3Neighbor::EXCHANGE_STATE | Ospfv3Neighbor::LOADING_STATE)) // Final state for Neighbor is FULL_STATE
346  {
347  if (!selfOriginated /*|| unreachable*/) {
348  networkLSAsByID.erase(lsa->getHeader().getLinkStateID());
349  delete lsa;
350  networkLSAList[i] = nullptr;
351  shouldRebuildRoutingTable = true;
352  }
353  else {
354  NetworkLSA *newLSA = originateNetworkLSA(localIntf);
355  long sequenceNumber = lsa->getHeader().getLsaSequenceNumber();
356 
357  if (newLSA != nullptr) {
358  newLSA->getHeaderForUpdate().setLsaSequenceNumber((sequenceNumber == MAX_SEQUENCE_NUMBER) ? INITIAL_SEQUENCE_NUMBER : sequenceNumber + 1);
359  shouldRebuildRoutingTable |= updateNetworkLSA(lsa, newLSA);
360  delete newLSA;
361 
362  floodLSA(lsa);
363  delete lsa;
364  }
365  else { // no neighbors on the network -> old NetworkLSA must be deleted
366  delete networkLSAList[i];
367  }
368  }
369  }
370  }
371  }
372 
373  auto networkIt = networkLSAList.begin();
374  while (networkIt != networkLSAList.end()) {
375  if ((*networkIt) == nullptr) {
376  networkIt = networkLSAList.erase(networkIt);
377  }
378  else {
379  networkIt++;
380  }
381  }
382 
383  // INTRA-AREA-PREFIX-LSA
384  lsaCount = intraAreaPrefixLSAList.size();
385  for (i = 0; i < lsaCount; i++) {
386  unsigned short lsAge = intraAreaPrefixLSAList[i]->getHeader().getLsaAge();
387 // bool unreachable = parentRouter->isDestinationUnreachable(networkLSAs[i]);
388  IntraAreaPrefixLSA *lsa = intraAreaPrefixLSAList[i];
389  Ospfv3Interface *localIntf = nullptr;
390  if (lsa->getHeader().getAdvertisingRouter() == this->getInstance()->getProcess()->getRouterID()) {
391  localIntf = getNetworkLSAInterface(lsa->getReferencedLSID());
392  }
393  bool selfOriginated = false;
394 
395  if ((localIntf != nullptr) &&
396  (localIntf->getState() == Ospfv3Interface::INTERFACE_STATE_DESIGNATED) &&
397  (localIntf->getNeighborCount() > 0) &&
398  (localIntf->hasAnyNeighborInState(Ospfv3Neighbor::FULL_STATE)))
399  {
400  selfOriginated = true;
401  }
402 
403  if ((selfOriginated && (lsAge < (LS_REFRESH_TIME - 1))) || (!selfOriginated && (lsAge < (MAX_AGE - 1)))) {
404  lsa->getHeaderForUpdate().setLsaAge(lsAge + 1);
405  if ((lsAge + 1) % CHECK_AGE == 0) { // always TRUE
406  if (!lsa->validateLSChecksum()) {
407  EV_ERROR << "Invalid LS checksum. Memory error detected!\n";
408  }
409  }
410  lsa->incrementInstallTime();
411  }
412  if (selfOriginated && (lsAge == (LS_REFRESH_TIME - 1))) {
413 // if (unreachable) {
414 // lsa->getHeader().setLsaAge(MAX_AGE);
415 // floodLSA(lsa);
416 // lsa->incrementInstallTime();
417 // }
418 // else {
419  long sequenceNumber = lsa->getHeader().getLsaSequenceNumber();
420  if (sequenceNumber == MAX_SEQUENCE_NUMBER) {
421  lsa->getHeaderForUpdate().setLsaAge(MAX_AGE);
422  floodLSA(lsa);
423  lsa->incrementInstallTime();
424  }
425  else {
426  IntraAreaPrefixLSA *newLSA = nullptr;
427  // If this is DR, find Network LSA from which make new IntraAreaPrefix LSA
428  if (localIntf != nullptr && localIntf->getType() == Ospfv3Interface::BROADCAST_TYPE) {
429  NetworkLSA *netLSA = findNetworkLSA(localIntf->getInterfaceId(), this->getInstance()->getProcess()->getRouterID());
430  newLSA = originateNetIntraAreaPrefixLSA(netLSA, localIntf, false);
431  }
432  else { // Ospfv3Interface::ROUTER_TYPE
433  newLSA = originateIntraAreaPrefixLSA();
434  }
435 
436  if (newLSA != nullptr) {
437 // newLSA->getHeaderForUpdate().setLsaSequenceNumber(sequenceNumber + 1);
438  shouldRebuildRoutingTable |= updateIntraAreaPrefixLSA(lsa, newLSA);
439 // if (lsa != newLSA)
440 // delete newLSA;
441  }
442  else { // no neighbors on the network -> old NetworkLSA must be flushed
443  lsa->getHeaderForUpdate().setLsaAge(MAX_AGE);
444  lsa->incrementInstallTime();
445  }
446  floodLSA(lsa);
447 // delete lsa;
448  }
449  }
450 
451  if (!selfOriginated && (lsAge == MAX_AGE - 1)) {
452  lsa->getHeaderForUpdate().setLsaAge(MAX_AGE);
453  floodLSA(lsa);
454  lsa->incrementInstallTime();
455  }
456 
457  if (lsAge == MAX_AGE) {
458  LSAKeyType lsaKey;
459 
460  lsaKey.linkStateID = lsa->getHeader().getLinkStateID();
461  lsaKey.advertisingRouter = lsa->getHeader().getAdvertisingRouter();
462 
463  if (!isOnAnyRetransmissionList(lsaKey) &&
465  {
466  if (!selfOriginated /*|| unreachable*/) {
467  if (this->getInstance()->getAreaCount() > 1) { // this is ABR
468  // invalidate all INTER LSA in ohter areas, which have been made from this INTRA LSA
469  for (int ar = 0; ar < this->getInstance()->getAreaCount(); ar++) {
470  Ospfv3Area *area = this->getInstance()->getArea(ar);
471  if (area->getAreaID() == this->getAreaID())
472  continue;
473  for (size_t prefs = 0; prefs < lsa->getPrefixesArraySize(); prefs++) {
474  InterAreaPrefixLSA *interLSA = area->findInterAreaPrefixLSAbyAddress(lsa->getPrefixes(prefs).addressPrefix, lsa->getPrefixes(prefs).prefixLen);
475  if (interLSA != nullptr) {
476  interLSA->getHeaderForUpdate().setLsaAge(MAX_AGE);
477  area->floodLSA(interLSA);
478  }
479  }
480  }
481  }
482 
483  intraAreaPrefixLSAByID.erase(lsa->getHeader().getLinkStateID());
484  delete lsa;
485  intraAreaPrefixLSAList[i] = nullptr;
486  shouldRebuildRoutingTable = true;
487  }
488  else {
489  IntraAreaPrefixLSA *newLSA = nullptr;
490  if (localIntf != nullptr && localIntf->getType() == Ospfv3Interface::BROADCAST_TYPE) {
491  NetworkLSA *netLSA = findNetworkLSA(localIntf->getInterfaceId(), this->getInstance()->getProcess()->getRouterID());
492  newLSA = originateNetIntraAreaPrefixLSA(netLSA, localIntf, false);
493  }
494  else { // Ospfv3Interface::ROUTER_TYPE
495  newLSA = originateIntraAreaPrefixLSA();
496  }
497 
498  long sequenceNumber = lsa->getHeader().getLsaSequenceNumber();
499 
500  if (newLSA != nullptr) {
501  newLSA->getHeaderForUpdate().setLsaSequenceNumber((sequenceNumber == MAX_SEQUENCE_NUMBER) ? INITIAL_SEQUENCE_NUMBER : sequenceNumber + 1);
502  shouldRebuildRoutingTable |= updateIntraAreaPrefixLSA(lsa, newLSA);
503 // delete newLSA;
504 
505  floodLSA(lsa);
506 // delete lsa;
507  }
508  else {
509  // no neighbors on the network -> old NetworkLSA must be flushed
510  delete intraAreaPrefixLSAList[i];
511  }
512  }
513  }
514  }
515  }
516 
517  auto intraArIt = intraAreaPrefixLSAList.begin();
518  while (intraArIt != intraAreaPrefixLSAList.end()) {
519  if ((*intraArIt) == nullptr) {
520  intraArIt = intraAreaPrefixLSAList.erase(intraArIt);
521  }
522  else {
523  intraArIt++;
524  }
525  }
526 
527  // INTER-AREA-PREFIX-LSA
528  lsaCount = interAreaPrefixLSAList.size();
529  for (i = 0; i < lsaCount; i++) {
530  unsigned short lsaAge = interAreaPrefixLSAList[i]->getHeader().getLsaAge();
531  bool selfOriginated = (interAreaPrefixLSAList[i]->getHeader().getAdvertisingRouter() == this->getInstance()->getProcess()->getRouterID());
532 // bool unreachable = this->getInstance()->getProcess()->isDestinationUnreachable(interAreaPrefixLSAList[i]);
533  InterAreaPrefixLSA *lsa = interAreaPrefixLSAList[i];
534 
535  if ((selfOriginated && (lsaAge < (LS_REFRESH_TIME - 1))) || (!selfOriginated && (lsaAge < (MAX_AGE - 1)))) {
536  lsa->getHeaderForUpdate().setLsaAge(lsaAge + 1);
537  if ((lsaAge + 1) % CHECK_AGE == 0) {
538  if (!lsa->validateLSChecksum()) {
539  EV_ERROR << "Invalid LS checksum. Memory error detected!\n";
540  }
541  }
542  lsa->incrementInstallTime();
543  }
544  //---------------------------------------------------------------------------------------------------
545  if (selfOriginated && (lsaAge == (LS_REFRESH_TIME - 1))) {
546 // if (unreachable) {
547 // lsa->getHeader().setLsaAge(MAX_AGE);
548 // floodLSA(lsa);
549 // lsa->incrementInstallTime();
550 // }
551 // else {
552  long sequenceNumber = lsa->getHeader().getLsaSequenceNumber();
553  if (sequenceNumber == MAX_SEQUENCE_NUMBER) {
554  lsa->getHeaderForUpdate().setLsaAge(MAX_AGE);
555  floodLSA(lsa);
556  lsa->incrementInstallTime();
557  }
558  else {
559 // InterAreaPrefixLSA *newLSA = nullptr;
560  // If this is ABR, go to area where this LSA is created and make new.
561  if (this->getInstance()->getAreaCount() > 1) { // if its self-originate, find corresponding INTRA LSA
562  bool lsaFromFarArea = true;
563  for (int ar = 0; ar < this->getInstance()->getAreaCount(); ar++) {
564  Ospfv3Area *area = this->getInstance()->getArea(ar);
565  if (area->getAreaID() == this->getAreaID())
566  continue;
567 
568  IntraAreaPrefixLSA *iapLSA = nullptr;
569  iapLSA = area->findIntraAreaPrefixByAddress(lsa->getPrefix().addressPrefix, lsa->getPrefix().prefixLen);
570  if (iapLSA != nullptr) { // corresponding intra-LSA has been found
571  area->originateInterAreaPrefixLSA(iapLSA, area, false);
572  lsaFromFarArea = false;
573  break;
574  }
575  }
576  if (lsaFromFarArea) { // corresponding intra-LSA has NOT been found
577  for (int ar = 0; ar < this->getInstance()->getAreaCount(); ar++) {
578  Ospfv3Area *area = this->getInstance()->getArea(ar);
579  if (area->getAreaID() == this->getAreaID())
580  continue;
581  // search then for correspoding INTER LSA with same prefix
582  InterAreaPrefixLSA *interLSA = area->findInterAreaPrefixLSAbyAddress(lsa->getPrefix().addressPrefix, lsa->getPrefix().prefixLen);
583  if (interLSA != nullptr && interLSA->getHeader().getLsaAge() != MAX_AGE) {
584  area->originateInterAreaPrefixLSA(interLSA, area);
585  }
586  }
587  }
588  }
589  }
590  }
591 
592  if (lsaAge == MAX_AGE) {
593  LSAKeyType lsaKey;
594 
595  lsaKey.linkStateID = lsa->getHeader().getLinkStateID();
596  lsaKey.advertisingRouter = lsa->getHeader().getAdvertisingRouter();
597 
598  if (!isOnAnyRetransmissionList(lsaKey)) {
600  if (!selfOriginated /*|| unreachable*/) {
601  interAreaPrefixLSAByID.erase(lsa->getHeader().getLinkStateID());
602  delete lsa;
603  interAreaPrefixLSAList[i] = nullptr;
604  shouldRebuildRoutingTable = true;
605  }
606  else if (this->getInstance()->getAreaCount() > 1) { // if its self-originate, find corresponding INTRA LSA
607  for (int ar = 0; ar < this->getInstance()->getAreaCount(); ar++) {
608  Ospfv3Area *area = this->getInstance()->getArea(ar);
609  if (area->getAreaID() == this->getAreaID())
610  continue;
611 
612  IntraAreaPrefixLSA *iapLSA = nullptr;
613  iapLSA = area->findIntraAreaPrefixByAddress(lsa->getPrefix().addressPrefix, lsa->getPrefix().prefixLen);
614  if (iapLSA != nullptr) { // corresponding LSA has been found
615  if (iapLSA->getHeader().getLsaAge() != MAX_AGE) {
616  area->originateInterAreaPrefixLSA(iapLSA, area, false);
617  }
618  else {
619  interAreaPrefixLSAByID.erase(lsa->getHeader().getLinkStateID());
620  delete lsa;
621  interAreaPrefixLSAList[i] = nullptr;
622  shouldRebuildRoutingTable = true;
623  }
624  }
625  else { // corresponding LSA has NOT been found
626  // search then for correspoding INTER LSA with same prefix
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);
630  }
631  else {
632  interAreaPrefixLSAByID.erase(lsa->getHeader().getLinkStateID());
633  delete lsa;
634  interAreaPrefixLSAList[i] = nullptr;
635  shouldRebuildRoutingTable = true;
636  }
637  }
638  }
639  }
640  }
641  }
642  }
643  }
644 
645  auto interIt = interAreaPrefixLSAList.begin();
646  while (interIt != interAreaPrefixLSAList.end()) {
647  if ((*interIt) == nullptr) {
648  interIt = interAreaPrefixLSAList.erase(interIt);
649  }
650  else {
651  interIt++;
652  }
653  }
654  for (size_t x = 0; x < interfaceList.size(); x++) {
655  shouldRebuildRoutingTable |= interfaceList[x]->ageDatabase();
656  }
657 
658  long interfaceCount = interfaceList.size();
659  for (long m = 0; m < interfaceCount; m++) {
660  interfaceList[m]->ageTransmittedLSALists();
661  }
662 
663  if (shouldRebuildRoutingTable) {
665  }
666  // TODO Protocol creates only some LSA. After new LSA will be added, aging for them need to be also added.
667 }

◆ calculateInterAreaRoutes()

void inet::ospfv3::Ospfv3Area::calculateInterAreaRoutes ( std::vector< Ospfv3RoutingTableEntry * > &  newTable,
std::vector< Ospfv3Ipv4RoutingTableEntry * > &  newTableIPv4 
)
2690 {
2691  EV_DEBUG << "Calculating Inter-Area Routes for Backbone\n";
2692  unsigned long i = 0;
2693  unsigned long j = 0;
2694  unsigned long lsaCount = interAreaPrefixLSAList.size();
2695 
2696  // go through all LSA 3
2697  for (i = 0; i < lsaCount; i++) {
2698  InterAreaPrefixLSA *currentLSA = interAreaPrefixLSAList[i];
2699  const Ospfv3LsaHeader& currentHeader = currentLSA->getHeader();
2700 
2701  unsigned long routeCost = currentLSA->getMetric();
2702  unsigned short lsAge = currentHeader.getLsaAge();
2703  Ipv4Address originatingRouter = currentHeader.getAdvertisingRouter();
2704  bool selfOriginated = (originatingRouter == this->getInstance()->getProcess()->getRouterID());
2705 
2706  /* (1) If the cost specified by the LSA is LSInfinity, or if the
2707  LSA's LS age is equal to MaxAge, then examine the the next
2708  LSA.
2709 
2710  (2) If the LSA was originated by the calculating router itself,
2711  examine the next LSA.*/
2712  if ((routeCost == LS_INFINITY) || (lsAge == MAX_AGE) || (selfOriginated)) { // (1) and(2)
2713  continue;
2714  }
2715  char lsType = currentHeader.getLsaType();
2716 
2717  // for IPv6 AF
2718  if (v6) {
2719  unsigned long routeCount = newTableIPv6.size();
2720  Ipv6AddressRange destination;
2721 
2722  // get Prefix and Prefix length from LSA 3
2723  destination.prefix = currentLSA->getPrefix().addressPrefix.toIpv6();
2724  destination.prefixLength = currentLSA->getPrefix().prefixLen;
2725 
2726  if ((lsType == INTER_AREA_PREFIX_LSA) && (this->getInstance()->getProcess()->hasAddressRange(destination))) { // (3)
2727  bool foundIntraAreaRoute = false;
2728  // look for an "Active" INTRA_AREA route
2729  for (j = 0; j < routeCount; j++) {
2730  Ospfv3RoutingTableEntry *routingEntry = newTableIPv6[j];
2731 
2732  if ((routingEntry->getDestinationType() == Ospfv3RoutingTableEntry::NETWORK_DESTINATION) &&
2733  (routingEntry->getPathType() == Ospfv3RoutingTableEntry::INTRAAREA) &&
2734  destination.containedByRange(routingEntry->getDestPrefix(), routingEntry->getPrefixLength()))
2735  {
2736  foundIntraAreaRoute = true;
2737  break;
2738  }
2739  }
2740  if (foundIntraAreaRoute) {
2741  continue;
2742  }
2743  }
2744 
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)
2750  break;
2751  }
2752  if (linkLSA != nullptr) {
2753  // The routingEntry describes a route to an other area -> look for the border router originating it
2754  for (j = 0; j < routeCount; j++) {
2755  // (4) N == destination, BR == borderRouterEntry
2756  Ospfv3RoutingTableEntry *routingEntry = newTableIPv6[j];
2757 
2758  EV_DEBUG << "\n";
2759  for (size_t pfxs = 0; pfxs < linkLSA->getPrefixesArraySize(); pfxs++) {
2760  const Ospfv3LsaHeader header = routingEntry->getLinkStateOrigin()->getHeader();
2761 
2762  // ak mamu seba LSA 9 v ramci rovnakej area s IPckou aku obsahuje novy routingEntry zaznam, tak...
2763  if ((routingEntry->getArea() == areaID) &&
2764  (((routingEntry->getDestinationType() & Ospfv3RoutingTableEntry::AREA_BORDER_ROUTER_DESTINATION) != 0) ||
2765  ((routingEntry->getDestinationType() & Ospfv3RoutingTableEntry::AS_BOUNDARY_ROUTER_DESTINATION) != 0)) &&
2766  (header.getAdvertisingRouter() == linkLSA->getHeader().getAdvertisingRouter()) &&
2767  (routingEntry->getDestPrefix() == linkLSA->getPrefixes(pfxs).addressPrefix.toIpv6()))
2768  {
2769  borderRouterEntry = routingEntry;
2770  break;
2771  }
2772  }
2773  if (borderRouterEntry != nullptr)
2774  break;
2775  }
2776  }
2777  else {
2778  // in LinkLSA found nothing, check Intra-Area-Prefix-LSA
2779  // find Router LSA for originate router of Inter Area Prefix LSA
2780  RouterLSA *routerLSA = findRouterLSA(originatingRouter);
2781 
2782  if (routerLSA == nullptr) {
2783  continue;
2784  }
2785  // if founded RouterLSA has no valuable information.
2786  if (routerLSA->getRoutersArraySize() < 1) {
2787  continue;
2788  }
2789  for (size_t ro = 0; ro < routerLSA->getRoutersArraySize(); ro++) {
2790  LSAKeyType lsaKey;
2791  lsaKey.advertisingRouter = routerLSA->getRouters(ro).neighborRouterID;
2792  lsaKey.linkStateID = Ipv4Address(routerLSA->getRouters(ro).neighborInterfaceID);
2793  lsaKey.LSType = routerLSA->getRouters(ro).type;
2794 
2795  Ospfv3IntraAreaPrefixLsa *iapLSA = findIntraAreaPrefixLSAByReference(lsaKey);
2796  if (iapLSA == nullptr)
2797  continue;
2798  // The routingEntry describes a route to an other area -> look for the border router originating it
2799  for (j = 0; j < routeCount; j++) {
2800  // (4) N == destination, BR == borderRouterEntry
2801  Ospfv3RoutingTableEntry *routingEntry = newTableIPv6[j];
2802 
2803  EV_DEBUG << "\n";
2804  for (size_t pfxs = 0; pfxs < iapLSA->getPrefixesArraySize(); pfxs++) {
2805  const Ospfv3LsaHeader header = routingEntry->getLinkStateOrigin()->getHeader();
2806 
2807  // ak mamu seba LSA 9 v ramci rovnakej area s IPckou aku obsahuje novy routingEntry zaznam, tak...
2808  if ((routingEntry->getArea() == areaID) &&
2809  (((routingEntry->getDestinationType() & Ospfv3RoutingTableEntry::AREA_BORDER_ROUTER_DESTINATION) != 0) ||
2810  ((routingEntry->getDestinationType() & Ospfv3RoutingTableEntry::AS_BOUNDARY_ROUTER_DESTINATION) != 0)) &&
2811  (header.getAdvertisingRouter() == iapLSA->getHeader().getAdvertisingRouter()) &&
2812  (routingEntry->getDestPrefix() == iapLSA->getPrefixes(pfxs).addressPrefix.toIpv6()))
2813  {
2814  borderRouterEntry = routingEntry;
2815  break;
2816  }
2817  }
2818  if (borderRouterEntry != nullptr)
2819  break;
2820  }
2821  if (borderRouterEntry != nullptr)
2822  break;
2823  }
2824  }
2825 
2826  if (borderRouterEntry == nullptr) {
2827  continue;
2828  }
2829  else {
2830  // (5)
2831  /* "Else, this LSA describes an inter-area path to destination N,
2832  * whose cost is the distance to BR plus the cost specified in the LSA.
2833  * Call the cost of this inter-area path IAC."
2834  */
2835  bool destinationInRoutingTable = true;
2836  EV_DEBUG << "\n";
2837  unsigned short currentCost = routeCost + borderRouterEntry->getCost();
2838  std::list<Ospfv3RoutingTableEntry *> sameOrWorseCost;
2839 
2840  if (findSameOrWorseCostRoute(newTableIPv6,
2841  *currentLSA,
2842  currentCost,
2843  destinationInRoutingTable,
2844  sameOrWorseCost))
2845  {
2846  continue;
2847  }
2848 
2849  if (destinationInRoutingTable && (sameOrWorseCost.size() > 0)) {
2850  Ospfv3RoutingTableEntry *equalEntry = nullptr;
2851 
2852  /* Look for an equal cost entry in the sameOrWorseCost list, and
2853  * also clear the more expensive entries from the newTable.
2854  */
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);
2860  break;
2861  }
2862  }
2863  }
2864  else { // EntryCost == currentCost
2865  equalEntry = checkedEntry; // should be only one - if there are more they are ignored
2866  }
2867  }
2868  unsigned long nextHopCount = borderRouterEntry->getNextHopCount();
2869  if (equalEntry != nullptr) {
2870  /* Add the next hops of the border router advertising this destination
2871  * to the equal entry.
2872  */
2873  for (unsigned long j = 0; j < nextHopCount; j++) {
2874  equalEntry->addNextHop(borderRouterEntry->getNextHop(j));
2875  }
2876  }
2877  else {
2878  Ospfv3RoutingTableEntry *newEntry = createRoutingTableEntryFromInterAreaPrefixLSA(*currentLSA, currentCost, *borderRouterEntry);
2879  ASSERT(newEntry != nullptr);
2880  newTableIPv6.push_back(newEntry);
2881  }
2882  }
2883  else {
2884  Ospfv3RoutingTableEntry *newEntry = createRoutingTableEntryFromInterAreaPrefixLSA(*currentLSA, currentCost, *borderRouterEntry);
2885  ASSERT(newEntry != nullptr);
2886  newTableIPv6.push_back(newEntry);
2887  }
2888  }
2889  } // end of if AF ipv6
2890  else { // IPv4 AF
2891  unsigned long routeCount = newTableIPv4.size();
2892  Ipv4AddressRange destination;
2893 
2894  // get Prefix and Prefix length from LSA 3
2895  destination.address = currentLSA->getPrefix().addressPrefix.toIpv4();
2896  destination.mask = destination.address.makeNetmask(currentLSA->getPrefix().prefixLen);
2897 
2898  if ((lsType == INTER_AREA_PREFIX_LSA) && (this->getInstance()->getProcess()->hasAddressRange(destination))) { // (3)
2899  bool foundIntraAreaRoute = false;
2900  // look for an "Active" INTRAAREA route
2901  for (j = 0; j < routeCount; j++) {
2902  Ospfv3Ipv4RoutingTableEntry *routingEntry = newTableIPv4[j];
2903 
2904  if ((routingEntry->getDestinationType() == Ospfv3Ipv4RoutingTableEntry::NETWORK_DESTINATION) &&
2905  (routingEntry->getPathType() == Ospfv3Ipv4RoutingTableEntry::INTRAAREA) &&
2906  destination.containedByRange(routingEntry->getDestination(), routingEntry->getNetmask()))
2907  {
2908  foundIntraAreaRoute = true;
2909  break;
2910  }
2911  }
2912  if (foundIntraAreaRoute) {
2913  continue;
2914  }
2915  }
2916 
2917  Ospfv3Ipv4RoutingTableEntry *borderRouterEntry = nullptr;
2918  // find Router LSA for originate router of Inter Area Prefix LSA
2919  RouterLSA *routerLSA = findRouterLSA(originatingRouter);
2920 
2921  // if founded RouterLSA has no valuable information.
2922  if (routerLSA == nullptr) {
2923  continue;
2924  }
2925  if (routerLSA->getRoutersArraySize() < 1) {
2926  continue;
2927  }
2928  // from Router LSA routers search for Intra Area Prefix LSA
2929  Ospfv3IntraAreaPrefixLsa *iapLSA = nullptr;
2930  for (size_t rIndex = 0; rIndex < routerLSA->getRoutersArraySize(); rIndex++) {
2931  LSAKeyType lsaKey;
2932  lsaKey.linkStateID = (Ipv4Address)routerLSA->getRouters(rIndex).neighborInterfaceID;
2933  lsaKey.advertisingRouter = routerLSA->getRouters(rIndex).neighborRouterID;
2934  lsaKey.LSType = NETWORK_LSA;
2935 
2936  iapLSA = findIntraAreaPrefixLSAByReference(lsaKey);
2937  if (iapLSA == nullptr)
2938  continue;
2939  }
2940 
2941  if (iapLSA == nullptr)
2942  continue;
2943 
2944  // The routingEntry describes a route to an other area -> look for the border router originating it
2945  for (j = 0; j < routeCount; j++) { // (4) N == destination, BR == borderRouterEntry
2946  Ospfv3Ipv4RoutingTableEntry *routingEntry = newTableIPv4[j];
2947  for (size_t pfxs = 0; pfxs < iapLSA->getPrefixesArraySize(); pfxs++) {
2948  // if I have LSA type 9 in same area with IP same as in new calculated routingEntry, then...
2949  if ((routingEntry->getArea() == areaID) &&
2950  (((routingEntry->getDestinationType() & Ospfv3Ipv4RoutingTableEntry::AREA_BORDER_ROUTER_DESTINATION) != 0) ||
2951  ((routingEntry->getDestinationType() & Ospfv3Ipv4RoutingTableEntry::AS_BOUNDARY_ROUTER_DESTINATION) != 0)) &&
2952  (routingEntry->getDestination() == iapLSA->getPrefixes(pfxs).addressPrefix.toIpv4()))
2953  {
2954  borderRouterEntry = routingEntry;
2955  break;
2956  }
2957  }
2958  if (borderRouterEntry != nullptr)
2959  break;
2960  }
2961 
2962  if (borderRouterEntry == nullptr) {
2963  continue;
2964  }
2965  else {
2966  // (5)
2967  /* "Else, this LSA describes an inter-area path to destination N,
2968  * whose cost is the distance to BR plus the cost specified in the LSA.
2969  * Call the cost of this inter-area path IAC."
2970  */
2971  bool destinationInRoutingTable = true;
2972  unsigned short currentCost = routeCost + borderRouterEntry->getCost();
2973  std::list<Ospfv3Ipv4RoutingTableEntry *> sameOrWorseCost;
2974 
2975  if (findSameOrWorseCostRoute(newTableIPv4,
2976  *currentLSA,
2977  currentCost,
2978  destinationInRoutingTable,
2979  sameOrWorseCost))
2980  {
2981  continue;
2982  }
2983 
2984  if (destinationInRoutingTable && (sameOrWorseCost.size() > 0)) {
2985  Ospfv3Ipv4RoutingTableEntry *equalEntry = nullptr;
2986 
2987  /* Look for an equal cost entry in the sameOrWorseCost list, and
2988  * also clear the more expensive entries from the newTable.
2989  */
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);
2995  break;
2996  }
2997  }
2998  }
2999  else { // EntryCost == currentCost
3000  equalEntry = checkedEntry; // should be only one - if there are more they are ignored
3001  }
3002  }
3003  unsigned long nextHopCount = borderRouterEntry->getNextHopCount();
3004 
3005  if (equalEntry != nullptr) {
3006  /* Add the next hops of the border router advertising this destination
3007  * to the equal entry.
3008  */
3009  for (unsigned long j = 0; j < nextHopCount; j++) {
3010  equalEntry->addNextHop(borderRouterEntry->getNextHop(j));
3011  }
3012  }
3013  else {
3014  Ospfv3Ipv4RoutingTableEntry *newEntry = createRoutingTableEntryFromInterAreaPrefixLSA(*currentLSA, currentCost, *borderRouterEntry);
3015  ASSERT(newEntry != nullptr);
3016  newTableIPv4.push_back(newEntry);
3017  }
3018  }
3019  else {
3020  Ospfv3Ipv4RoutingTableEntry *newEntry = createRoutingTableEntryFromInterAreaPrefixLSA(*currentLSA, currentCost, *borderRouterEntry);
3021  ASSERT(newEntry != nullptr);
3022  newTableIPv4.push_back(newEntry);
3023  }
3024  }
3025  }
3026  }
3027 }

Referenced by inet::ospfv3::Ospfv3Process::rebuildRoutingTable().

◆ calculateNextHops()

std::vector< NextHop > * inet::ospfv3::Ospfv3Area::calculateNextHops ( Ospfv3Lsa destination,
Ospfv3Lsa parent 
) const
3099 {
3100  EV_DEBUG << "Calculating Next Hops\n";
3101  std::vector<NextHop> *hops = new std::vector<NextHop>;
3102  unsigned long i, j;
3103  RouterLSA *routerLSA = dynamic_cast<RouterLSA *>(parent);
3104  if (routerLSA != nullptr) { // if parrent is ROUTER_LSA
3105  if (routerLSA != spfTreeRoot) {
3106  unsigned int nextHopCount = routerLSA->getNextHopCount();
3107  for (i = 0; i < nextHopCount; i++) {
3108  if (!this->nextHopAlreadyExists(hops, routerLSA->getNextHop(i)))
3109  hops->push_back(routerLSA->getNextHop(i));
3110  }
3111  return hops;
3112  }
3113  else {
3114  RouterLSA *destinationRouterLSA = dynamic_cast<RouterLSA *>(destination);
3115  if (destinationRouterLSA != nullptr) { // if destination is ROUTER_LSA
3116  unsigned long interfaceNum = interfaceList.size();
3117  for (i = 0; i < interfaceNum; i++) {
3118  Ospfv3Interface::Ospfv3InterfaceType intfType = interfaceList[i]->getType();
3119 
3120  // if its P2P interface, set one neighbor and if it is destination too, set one nexthop and store it into hosts
3121  if ((intfType == Ospfv3Interface::POINTTOPOINT_TYPE) ||
3122  ((intfType == Ospfv3Interface::VIRTUAL_TYPE) &&
3124  {
3125 
3126  Ospfv3Neighbor *ptpNeighbor = interfaceList[i]->getNeighborCount() > 0 ? interfaceList[i]->getNeighbor(0) : nullptr;
3127  // by neighbor find appropriate Link LSA
3128  if (ptpNeighbor != nullptr) {
3129  NextHop nextHop;
3130  LSAKeyType lsaKey;
3131  lsaKey.linkStateID = Ipv4Address(ptpNeighbor->getNeighborInterfaceID());
3132  lsaKey.advertisingRouter = ptpNeighbor->getNeighborID();
3133  lsaKey.LSType = LINK_LSA;
3134  LinkLSA *linklsa = interfaceList[i]->getLinkLSAbyKey(lsaKey);
3135 
3136  if (linklsa != nullptr) {
3137  nextHop.ifIndex = interfaceList[i]->getInterfaceId();
3138  nextHop.hopAddress = linklsa->getLinkLocalInterfaceAdd();
3139  nextHop.advertisingRouter = destinationRouterLSA->getHeader().getAdvertisingRouter();
3140 
3141  if (!this->nextHopAlreadyExists(hops, nextHop))
3142  hops->push_back(nextHop);
3143 
3144  break;
3145  }
3146  }
3147  }
3148  if (intfType == Ospfv3Interface::POINTTOMULTIPOINT_TYPE) {
3149  throw cRuntimeError("P2MP in in next hop calculation not implemented yet");
3150  }
3151  } // for ()
3152  }
3153  else { // else destination is NETWORK_LSA
3154  NetworkLSA *destinationNetworkLSA = dynamic_cast<NetworkLSA *>(destination);
3155  if (destinationNetworkLSA != nullptr) {
3156  Ipv4Address networkDesignatedRouter = destinationNetworkLSA->getHeader().getAdvertisingRouter();
3157  Ipv4Address networkDRintID = destinationNetworkLSA->getHeader().getLinkStateID();
3158  unsigned long interfaceNum = interfaceList.size();
3159  for (i = 0; i < interfaceNum; i++) {
3160  Ospfv3Interface::Ospfv3InterfaceType intfType = interfaceList[i]->getType();
3161  if (((intfType == Ospfv3Interface::BROADCAST_TYPE) ||
3162  (intfType == Ospfv3Interface::NBMA_TYPE)) &&
3163  (interfaceList[i]->getDesignatedID() == networkDesignatedRouter)
3164  && ((Ipv4Address)interfaceList[i]->getDesignatedIntID() == networkDRintID))
3165  {
3166  NextHop nextHop;
3167  nextHop.ifIndex = interfaceList[i]->getInterfaceId();
3168  if (v6)
3169  nextHop.hopAddress = Ipv6Address::UNSPECIFIED_ADDRESS;
3170  else
3171  nextHop.hopAddress = Ipv4Address::UNSPECIFIED_ADDRESS;
3172  nextHop.advertisingRouter = destinationNetworkLSA->getHeader().getAdvertisingRouter();
3173  if (!this->nextHopAlreadyExists(hops, nextHop))
3174  hops->push_back(nextHop);
3175  }
3176  }
3177  }
3178  }
3179  }
3180  }
3181  else { // if parent is NETWORK_LSA
3182  NetworkLSA *networkLSA = dynamic_cast<NetworkLSA *>(parent);
3183  if (networkLSA != nullptr) {
3184  if (networkLSA->getParent() != spfTreeRoot) { // if i am network and my parent is not spfTreeRoot, return all nextHops
3185  unsigned int nextHopCount = networkLSA->getNextHopCount();
3186  for (i = 0; i < nextHopCount; i++) {
3187  if (!this->nextHopAlreadyExists(hops, networkLSA->getNextHop(i)))
3188  hops->push_back(networkLSA->getNextHop(i));
3189  }
3190  return hops;
3191  }
3192  else {
3193  // for Network-LSA, Link State ID is ID of interface by which it is connected into network
3194  Ipv4Address parentLinkStateID = parent->getHeader().getAdvertisingRouter();
3195 
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);
3202  NextHop nextHop;
3203 
3204  if (((link.type == TRANSIT_NETWORK) &&
3205  (link.neighborRouterID == parentLinkStateID))
3206 // || ((link.getType() == STUB_LINK) &&
3207 // ((link.getLinkID() & Ipv4Address(link.getLinkData())) == (parentLinkStateID & networkLSA->getNetworkMask())))
3208  )
3209  {
3210  unsigned long interfaceNum = interfaceList.size();
3211  for (j = 0; j < interfaceNum; j++) {
3212  Ospfv3Interface::Ospfv3InterfaceType intfType = interfaceList[j]->getType();
3213  if (((intfType == Ospfv3Interface::BROADCAST_TYPE) ||
3214  (intfType == Ospfv3Interface::NBMA_TYPE)) &&
3215  (interfaceList[j]->getDesignatedID() == parentLinkStateID))
3216  {
3217  Ospfv3Neighbor *nextHopNeighbor = interfaceList[j]->getNeighborById(destinationRouterID);
3218 
3219  // by neighbor find appropriate Link LSA
3220  if (nextHopNeighbor != nullptr) {
3221  LSAKeyType lsaKey;
3222  lsaKey.linkStateID = Ipv4Address(nextHopNeighbor->getNeighborInterfaceID());
3223  lsaKey.advertisingRouter = nextHopNeighbor->getNeighborID();
3224  lsaKey.LSType = LINK_LSA;
3225 
3226  LinkLSA *linklsa = interfaceList[j]->getLinkLSAbyKey(lsaKey);
3227 
3228  if (linklsa != nullptr) {
3229  nextHop.ifIndex = interfaceList[j]->getInterfaceId();
3230  nextHop.hopAddress = linklsa->getLinkLocalInterfaceAdd();
3231  nextHop.advertisingRouter = destinationRouterLSA->getHeader().getAdvertisingRouter();
3232  if (!this->nextHopAlreadyExists(hops, nextHop))
3233  hops->push_back(nextHop);
3234  }
3235  }
3236  }
3237  }
3238  }
3239  }
3240  }
3241  // else Destination is Router - should not be possible
3242  }
3243  }
3244  }
3245  return hops;
3246 }

◆ calculateShortestPathTree()

void inet::ospfv3::Ospfv3Area::calculateShortestPathTree ( std::vector< Ospfv3RoutingTableEntry * > &  newTableIPv6,
std::vector< Ospfv3Ipv4RoutingTableEntry * > &  newTableIPv4 
)
1999 {
2000  EV_DEBUG << "Calculating SPF Tree for area " << this->getAreaID() << "\n";
2001  /*1)Initialize the algorithm's data structures. Clear the list
2002  of candidate vertices. Initialize the shortest-path tree to
2003  only the root (which is the router doing the calculation).
2004  */
2005  Ipv4Address routerID = this->getInstance()->getProcess()->getRouterID();
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;
2012 
2013  if (spfTreeRoot == nullptr) {
2014  RouterLSA *routerLSA = findRouterLSA(routerID);
2015  if (routerLSA == nullptr) {
2016  RouterLSA *newLSA = originateRouterLSA();
2017  if (installRouterLSA(newLSA)) {
2018  routerLSA = findRouterLSA(routerID);
2019  spfTreeRoot = routerLSA;
2020  floodLSA(newLSA); // spread LSA to whole network
2021  }
2022  delete newLSA;
2023  }
2024  else
2025  spfTreeRoot = routerLSA;
2026 
2027  }
2028  if (spfTreeRoot == nullptr)
2029  return;
2030 
2031  lsaCount = routerLSAList.size();
2032  for (i = 0; i < lsaCount; i++) {
2033  routerLSAList[i]->clearNextHops();
2034  }
2035  lsaCount = networkLSAList.size();
2036  for (i = 0; i < lsaCount; i++) {
2037  networkLSAList[i]->clearNextHops();
2038  }
2039 
2041  treeVertices.push_back(spfTreeRoot); // root is first vertex in dijkstra alg
2042  justAddedVertex = spfTreeRoot; // (1)
2043 
2044  do {
2045  Ospfv3LsaFunctionCode vertexType = static_cast<Ospfv3LsaFunctionCode>(justAddedVertex->getHeader().getLsaType());
2046  if (vertexType == ROUTER_LSA) {
2047  RouterLSA *routerVertex = check_and_cast<RouterLSA *>(justAddedVertex);
2048  if (routerVertex->getVBit()) {
2049  transitCapability = true;
2050  }
2051 
2052  int testCount = routerVertex->getRoutersArraySize();
2053  for (int iteration = 0; iteration < testCount; iteration++) {
2054  Ospfv3RouterLsaBody router = routerVertex->getRouters(iteration);
2055  Ospfv3Lsa *joiningVertex; // joiningVertex is source vertex
2056  Ospfv3LsaFunctionCode joiningVertexType;
2057  /*The Vertex ID for a router is the OSPF Router ID. The Vertex ID
2058  for a transit network is a combination of the Interface ID and
2059  OSPF Router ID of the network's Designated Router.*/
2060  if (router.type == TRANSIT_NETWORK) {
2061  joiningVertex = findNetworkLSA(router.neighborInterfaceID, router.neighborRouterID);
2062  joiningVertexType = NETWORK_LSA;
2063  }
2064  else { // P2P
2065  joiningVertex = findRouterLSA(router.neighborRouterID);
2066  }
2067 
2068  if ((joiningVertex == nullptr) ||
2069  (joiningVertex->getHeader().getLsaAge() == MAX_AGE)
2070  || (!hasLink(joiningVertex, justAddedVertex))) // (from, to) (2) (b)
2071  {
2072  continue;
2073  }
2074 
2075  unsigned int treeSize = treeVertices.size(); // already visited vertices (at the beginning, only root)
2076  bool alreadyOnTree = false;
2077 
2078  for (j = 0; j < treeSize; j++) { // if vertex, which was found is already in set of visited vertices, go to another one
2079  if (treeVertices[j] == joiningVertex) {
2080  alreadyOnTree = true;
2081  break;
2082  }
2083  }
2084  if (alreadyOnTree) { // (2) (c)
2085 // EV_DEBUG << "continue\n";
2086  continue;
2087  }
2088 
2089  unsigned long linkStateCost = routerVertex->getDistance() + routerVertex->getRouters(iteration).metric;
2090  unsigned int candidateCount = candidateVertices.size(); // candidateVertices is zero at the beginning
2091  Ospfv3Lsa *candidate = nullptr;
2092 
2093  for (j = 0; j < candidateCount; j++) {
2094  if (candidateVertices[j] == joiningVertex) {
2095  candidate = candidateVertices[j];
2096  }
2097  }
2098  if (candidate != nullptr) { // (2) (d) // first iteration, candidate is nullptr
2099  RoutingInfo *routingInfo = check_and_cast<RoutingInfo *>(candidate);
2100  unsigned long candidateDistance = routingInfo->getDistance();
2101 
2102  if (linkStateCost > candidateDistance) {
2103  continue;
2104  }
2105  if (linkStateCost < candidateDistance) {
2106  routingInfo->setDistance(linkStateCost);
2107  routingInfo->clearNextHops();
2108  }
2109  std::vector<NextHop> *newNextHops = calculateNextHops(joiningVertex, justAddedVertex); // (destination, parent)
2110  unsigned int nextHopCount = newNextHops->size();
2111  for (k = 0; k < nextHopCount; k++) {
2112  routingInfo->addNextHop((*newNextHops)[k]);
2113  }
2114  delete newNextHops;
2115  }
2116  else {
2117  if (joiningVertexType == ROUTER_LSA) {
2118  RouterLSA *joiningRouterVertex = check_and_cast<RouterLSA *>(joiningVertex);
2119  joiningRouterVertex->setDistance(linkStateCost);
2120  std::vector<NextHop> *newNextHops = calculateNextHops(joiningVertex, justAddedVertex); // (destination, parent)
2121  unsigned int nextHopCount = newNextHops->size();
2122  for (k = 0; k < nextHopCount; k++) {
2123  joiningRouterVertex->addNextHop((*newNextHops)[k]);
2124  }
2125  delete newNextHops;
2126  RoutingInfo *vertexRoutingInfo = check_and_cast<RoutingInfo *>(joiningRouterVertex);
2127  vertexRoutingInfo->setParent(justAddedVertex);
2128 
2129  candidateVertices.push_back(joiningRouterVertex);
2130  }
2131  else { // joiningVertexType == NETWORK_LSA
2132  NetworkLSA *joiningNetworkVertex = check_and_cast<NetworkLSA *>(joiningVertex);
2133  joiningNetworkVertex->setDistance(linkStateCost);
2134  std::vector<NextHop> *newNextHops = calculateNextHops(joiningVertex, justAddedVertex); // (destination, parent)
2135 
2136  unsigned int nextHopCount = newNextHops->size();
2137  for (k = 0; k < nextHopCount; k++) {
2138  joiningNetworkVertex->addNextHop((*newNextHops)[k]);
2139  }
2140  delete newNextHops;
2141  // justAdded is source vertex
2142  // joining is destination vertex
2143  // joiningNetworkVertex == joiningVertex
2144  RoutingInfo *vertexRoutingInfo = check_and_cast<RoutingInfo *>(joiningNetworkVertex);
2145  vertexRoutingInfo->setParent(justAddedVertex);
2146 
2147  candidateVertices.push_back(joiningNetworkVertex);
2148  }
2149  }
2150  } // end of for
2151  } // (vertexType == ROUTER_LSA)
2152 
2153  if (vertexType == NETWORK_LSA) {
2154  NetworkLSA *networkVertex = check_and_cast<NetworkLSA *>(justAddedVertex);
2155  unsigned int routerCount = networkVertex->getAttachedRouterArraySize();
2156  for (i = 0; i < routerCount; i++) { // (2)
2157  RouterLSA *joiningVertex = findRouterLSA(networkVertex->getAttachedRouter(i));
2158  if ((joiningVertex == nullptr) ||
2159  (joiningVertex->getHeader().getLsaAge() == MAX_AGE) ||
2160  (!hasLink(joiningVertex, justAddedVertex))) // (from, to) (2) (b)
2161  {
2162  continue;
2163  }
2164  unsigned int treeSize = treeVertices.size();
2165  bool alreadyOnTree = false;
2166 
2167  for (j = 0; j < treeSize; j++) {
2168  if (treeVertices[j] == joiningVertex) {
2169  alreadyOnTree = true;
2170  break;
2171  }
2172  }
2173  if (alreadyOnTree) { // (2) (c) already on tree, continue
2174  continue;
2175  }
2176 
2177  unsigned long linkStateCost = networkVertex->getDistance(); // link cost from network to router is always 0
2178  unsigned int candidateCount = candidateVertices.size();
2179  Ospfv3Lsa *candidate = nullptr;
2180 
2181  for (j = 0; j < candidateCount; j++) {
2182  if (candidateVertices[j] == joiningVertex) {
2183  candidate = candidateVertices[j];
2184  }
2185  }
2186  if (candidate != nullptr) { // (2) (d)
2187  RoutingInfo *routingInfo = check_and_cast<RoutingInfo *>(candidate);
2188  unsigned long candidateDistance = routingInfo->getDistance();
2189 
2190  if (linkStateCost > candidateDistance) {
2191  continue;
2192  }
2193  if (linkStateCost < candidateDistance) {
2194  routingInfo->setDistance(linkStateCost);
2195  routingInfo->clearNextHops();
2196  }
2197  std::vector<NextHop> *newNextHops = calculateNextHops(joiningVertex, justAddedVertex); // (destination, parent)
2198  unsigned int nextHopCount = newNextHops->size();
2199  for (k = 0; k < nextHopCount; k++) {
2200  routingInfo->addNextHop((*newNextHops)[k]);
2201  }
2202  delete newNextHops;
2203  }
2204  else {
2205  joiningVertex->setDistance(linkStateCost);
2206  std::vector<NextHop> *newNextHops = calculateNextHops(joiningVertex, justAddedVertex); // (destination, parent)
2207 
2208  unsigned int nextHopCount = newNextHops->size();
2209  for (k = 0; k < nextHopCount; k++) {
2210  joiningVertex->addNextHop((*newNextHops)[k]);
2211  }
2212  delete newNextHops;
2213  RoutingInfo *vertexRoutingInfo = check_and_cast<RoutingInfo *>(joiningVertex);
2214  vertexRoutingInfo->setParent(justAddedVertex);
2215 
2216  candidateVertices.push_back(joiningVertex);
2217  }
2218  }
2219  }
2220 
2221  if (candidateVertices.empty()) { // (3)
2222  finished = true;
2223  }
2224  else {
2225  unsigned int candidateCount = candidateVertices.size();
2226  unsigned long minDistance = LS_INFINITY;
2227  Ospfv3Lsa *closestVertex = candidateVertices[0];
2228 
2229  // this for-cycle edit distane from source vertex to all others adjacent vertices by dijstra algorithm
2230  for (i = 0; i < candidateCount; i++) {
2231  RoutingInfo *routingInfo = check_and_cast<RoutingInfo *>(candidateVertices[i]);
2232  unsigned long currentDistance = routingInfo->getDistance();
2233 
2234  if (currentDistance < minDistance) {
2235  closestVertex = candidateVertices[i];
2236  minDistance = currentDistance;
2237  }
2238  else {
2239  if (currentDistance == minDistance) {
2240  if ((closestVertex->getHeader().getLsaType() == ROUTER_LSA) &&
2241  (candidateVertices[i]->getHeader().getLsaType() == NETWORK_LSA))
2242  {
2243  closestVertex = candidateVertices[i];
2244  }
2245  }
2246  }
2247  }
2248 
2249  treeVertices.push_back(closestVertex); // treeVertices is the main SPF tree
2250  // delete selected closestVertex from candidateVertices
2251  for (auto it = candidateVertices.begin(); it != candidateVertices.end(); it++) {
2252  if ((*it) == closestVertex) {
2253  candidateVertices.erase(it);
2254  break;
2255  }
2256  }
2257  if (closestVertex->getHeader().getLsaType() == ROUTER_LSA) {
2258  RouterLSA *routerLSA = check_and_cast<RouterLSA *>(closestVertex);
2259 
2260  size_t arrSiz = routerLSA->getRoutersArraySize();
2261  // find intraAreaPrefix LSA for this vertex
2262  if ((routerLSA->getBBit() || routerLSA->getEBit()) &&
2263  (routerLSA->getHeader().getAdvertisingRouter() != this->getInstance()->getProcess()->getRouterID())) // in broadcast network, only if this is ABR or ASBR
2264  {
2265  int attached = -1; // find out which route from Router_LSA is already in treeVertices
2266 
2267  // check routeCounts and if it is more than 1, visited Vertex take bigger priority
2268  if (arrSiz > 1) {
2269  size_t tree = treeVertices.size(); // already visited vertices (at the beginning, only root)
2270 
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) {
2274  attached = r;
2275  break;
2276  }
2277  }
2278  if (attached >= 0) // found match
2279  break;
2280  }
2281  }
2282 
2283  if (attached < 0) // if no match was found, use first in routerArray of this router-LSA
2284  attached = 0;
2285 
2286  if (arrSiz > 0) {
2287  LSAKeyType lsaKey;
2288  if (routerLSA->getRouters(attached).type == POINT_TO_POINT) {
2289  lsaKey.linkStateID = (Ipv4Address)routerLSA->getHeader().getLinkStateID();
2290  lsaKey.advertisingRouter = routerLSA->getHeader().getAdvertisingRouter();
2291  }
2292  else if (routerLSA->getRouters(attached).type == TRANSIT_NETWORK) { // link is connected into BROADCAST network
2293  lsaKey.linkStateID = (Ipv4Address)routerLSA->getRouters(attached).neighborInterfaceID;
2294  lsaKey.advertisingRouter = routerLSA->getRouters(attached).neighborRouterID;
2295  }
2296  else
2297  continue;
2298  lsaKey.LSType = routerLSA->getRouters(attached).type;
2299  addRouterEntry(routerLSA, lsaKey, newTableIPv6, newTableIPv4);
2300  }
2301  }
2302 
2303  // check if router has any host networks
2304  if (routerLSA->getHeader().getAdvertisingRouter() != this->getInstance()->getProcess()->getRouterID()) {
2305  LSAKeyType lsaKey;
2306  lsaKey.linkStateID = (Ipv4Address)routerLSA->getHeader().getLinkStateID();
2307  lsaKey.advertisingRouter = routerLSA->getHeader().getAdvertisingRouter();
2308  lsaKey.LSType = ROUTER_LSA;
2309  addRouterEntry(routerLSA, lsaKey, newTableIPv6, newTableIPv4);
2310  }
2311  }
2312 
2313  if (closestVertex->getHeader().getLsaType() == NETWORK_LSA) {
2314  NetworkLSA *networkLSA = check_and_cast<NetworkLSA *>(closestVertex);
2315 
2316  // address is extracted from Intra-Area-Prefix-LSA
2317  LSAKeyType lsaKey;
2318  lsaKey.linkStateID = networkLSA->getHeader().getLinkStateID();
2319  lsaKey.advertisingRouter = networkLSA->getHeader().getAdvertisingRouter();
2320  lsaKey.LSType = NETWORK_LSA; // navyse
2321 
2322  L3Address destinationID;
2323  uint8_t prefixLen;
2324  Ospfv3IntraAreaPrefixLsa *iapLSA = findIntraAreaPrefixLSAByReference(lsaKey);
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;
2331  if (destinationID.getType() == L3Address::IPv6) { // for ipv6 AF
2332  Ospfv3RoutingTableEntry *entry = nullptr;
2333  size_t routeCount = newTableIPv6.size();
2334  Ipv6Address longestMatch(Ipv6Address::UNSPECIFIED_ADDRESS);
2335 
2336  for (size_t rt = 0; rt < routeCount; rt++) {
2337  if (newTableIPv6[rt]->getDestinationType() == Ospfv3RoutingTableEntry::NETWORK_DESTINATION) {
2338  Ospfv3RoutingTableEntry *routingEntry = newTableIPv6[rt];
2339  Ipv6Address entryAddress = routingEntry->getDestPrefix();
2340 
2341  if (entryAddress == destinationID.toIpv6()) {
2342  if (destinationID.toIpv6() > longestMatch) {
2343  longestMatch = destinationID.toIpv6();
2344  entry = routingEntry;
2345  }
2346  }
2347  }
2348  }
2349  if (entry != nullptr) {
2350  const Ospfv3Lsa *entryOrigin = entry->getLinkStateOrigin();
2351  if ((entry->getCost() != networkLSA->getDistance()) ||
2352  (entryOrigin->getHeader().getLinkStateID() >= networkLSA->getHeader().getLinkStateID()))
2353  {
2354  overWrite = true;
2355  }
2356  }
2357 
2358  if ((entry == nullptr) || (overWrite)) {
2359  if (entry == nullptr) {
2360  entry = new Ospfv3RoutingTableEntry(this->getInstance()->ift, destinationID.toIpv6(), prefixLen, IRoute::OSPF);
2361  }
2362  entry->setLinkStateOrigin(networkLSA);
2363  entry->setArea(areaID);
2364  entry->setPathType(Ospfv3RoutingTableEntry::INTRAAREA);
2365  entry->setCost(networkLSA->getDistance());
2366  entry->setDestinationType(Ospfv3RoutingTableEntry::NETWORK_DESTINATION);
2367  entry->setOptionalCapabilities(networkLSA->getOspfOptions());
2368 
2369  for (unsigned int j = 0; j < nextHopCount; j++) {
2370  entry->addNextHop(networkLSA->getNextHop(j));
2371  }
2372  if (!overWrite) {
2373  newTableIPv6.push_back(entry);
2374  }
2375  }
2376  }
2377  else { // for IPv4 AF
2378  Ospfv3Ipv4RoutingTableEntry *entry = nullptr;
2379  size_t routeCount = newTableIPv4.size();
2380  Ipv4Address longestMatch(Ipv4Address::UNSPECIFIED_ADDRESS);
2381 
2382  for (size_t rt = 0; rt < routeCount; rt++) {
2383  if (newTableIPv4[rt]->getDestinationType() == Ospfv3Ipv4RoutingTableEntry::NETWORK_DESTINATION) {
2384  Ospfv3Ipv4RoutingTableEntry *routingEntry = newTableIPv4[rt];
2385  Ipv4Address entryAddress = routingEntry->getDestination();
2386 
2387  if (entryAddress == destinationID.toIpv4()) {
2388  if (destinationID.toIpv4() > longestMatch) {
2389  longestMatch = destinationID.toIpv4();
2390  entry = routingEntry;
2391  }
2392  }
2393  }
2394  }
2395  if (entry != nullptr) {
2396  const Ospfv3Lsa *entryOrigin = entry->getLinkStateOrigin();
2397  if ((entry->getCost() != networkLSA->getDistance()) ||
2398  (entryOrigin->getHeader().getLinkStateID() >= networkLSA->getHeader().getLinkStateID()))
2399  {
2400  overWrite = true;
2401  }
2402  }
2403 
2404  if ((entry == nullptr) || (overWrite)) {
2405  if (entry == nullptr) {
2406  entry = new Ospfv3Ipv4RoutingTableEntry(this->getInstance()->ift, destinationID.toIpv4(), prefixLen, IRoute::OSPF);
2407  }
2408  entry->setLinkStateOrigin(networkLSA);
2409  entry->setArea(areaID);
2410  entry->setPathType(Ospfv3Ipv4RoutingTableEntry::INTRAAREA);
2411  entry->setCost(networkLSA->getDistance());
2412  entry->setDestinationType(Ospfv3Ipv4RoutingTableEntry::NETWORK_DESTINATION);
2413  entry->setOptionalCapabilities(networkLSA->getOspfOptions());
2414  for (unsigned int j = 0; j < nextHopCount; j++) {
2415  entry->addNextHop(networkLSA->getNextHop(j)); // tu mi to vklada IPv6 next hop pre IPv4 AF
2416  }
2417 
2418  if (!overWrite)
2419  newTableIPv4.push_back(entry);
2420  }
2421  }
2422  }
2423  }
2424  else {
2425  continue; // there is no LSA type 9 which would care a IP addresses for this calculating route, so skip to next one.
2426  }
2427  }
2428  justAddedVertex = closestVertex;
2429  } // end of else not empty()
2430  } while (!finished);
2431 }

Referenced by inet::ospfv3::Ospfv3Process::rebuildRoutingTable().

◆ createRoutingTableEntryFromInterAreaPrefixLSA() [1/2]

Ospfv3Ipv4RoutingTableEntry * inet::ospfv3::Ospfv3Area::createRoutingTableEntryFromInterAreaPrefixLSA ( const InterAreaPrefixLSA interAreaPrefixLSA,
unsigned short  entryCost,
const Ospfv3Ipv4RoutingTableEntry borderRouterEntry 
) const
2665 {
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);
2670 
2671  if (interAreaPrefixLSA.getHeader().getLsaType() == INTER_AREA_PREFIX_LSA)
2672  newEntry->setDestinationType(Ospfv3Ipv4RoutingTableEntry::NETWORK_DESTINATION);
2673  else
2675 
2676  newEntry->setLinkStateOrigin(&interAreaPrefixLSA);
2677  newEntry->setArea(areaID);
2678  newEntry->setPathType(Ospfv3Ipv4RoutingTableEntry::INTERAREA);
2679  newEntry->setCost(entryCost);
2680 
2681  unsigned int nextHopCount = borderRouterEntry.getNextHopCount();
2682  for (unsigned int j = 0; j < nextHopCount; j++) {
2683  newEntry->addNextHop(borderRouterEntry.getNextHop(j));
2684  }
2685 
2686  return newEntry;
2687 }

◆ createRoutingTableEntryFromInterAreaPrefixLSA() [2/2]

Ospfv3RoutingTableEntry * inet::ospfv3::Ospfv3Area::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.

2634 {
2635  Ipv6AddressRange destination;
2636 
2637  destination.prefix = interAreaPrefixLSA.getPrefix().addressPrefix.toIpv6();
2638  destination.prefixLength = interAreaPrefixLSA.getPrefix().prefixLen;
2639  // TODO AS boundary is not implemented
2640  Ospfv3RoutingTableEntry *newEntry = new Ospfv3RoutingTableEntry(this->getInstance()->ift, destination.prefix, destination.prefixLength, IRoute::OSPF);
2641 
2642  if (interAreaPrefixLSA.getHeader().getLsaType() == INTER_AREA_PREFIX_LSA) {
2643  newEntry->setDestinationType(Ospfv3RoutingTableEntry::NETWORK_DESTINATION);
2644  }
2645  else {
2646  newEntry->setDestinationType(Ospfv3RoutingTableEntry::AS_BOUNDARY_ROUTER_DESTINATION);
2647  }
2648  newEntry->setLinkStateOrigin(&interAreaPrefixLSA);
2649  newEntry->setArea(areaID);
2650  newEntry->setPathType(Ospfv3RoutingTableEntry::INTERAREA);
2651  newEntry->setCost(entryCost);
2652 
2653  unsigned int nextHopCount = borderRouterEntry.getNextHopCount();
2654  for (unsigned int j = 0; j < nextHopCount; j++) {
2655  newEntry->addNextHop(borderRouterEntry.getNextHop(j));
2656  }
2657 
2658  return newEntry;
2659 }

◆ debugDump()

void inet::ospfv3::Ospfv3Area::debugDump ( )
3506 {
3507  for (auto it = this->interfaceList.begin(); it != this->interfaceList.end(); it++)
3508  EV_DEBUG << "\t\tinterface id: " << (*it)->getIntName() << "\n";
3509 } // debugDump

◆ deleteRouterLSA()

void inet::ospfv3::Ospfv3Area::deleteRouterLSA ( int  index)
884  {
885  RouterLSA *delRouter = this->routerLSAList.at(index);
886  const Ospfv3LsaHeader& routerHeader = delRouter->getHeader();
887 
888  int prefixCount = this->intraAreaPrefixLSAList.size();
889  for (int i = 0; i < prefixCount; i++) {
890  Ospfv3IntraAreaPrefixLsa *lsa = this->intraAreaPrefixLSAList.at(i);
891 
892  // remove Intra-area-prefix LSA which corespond with removed Router LSA
893  if (lsa->getReferencedAdvRtr() == routerHeader.getAdvertisingRouter() &&
894  lsa->getReferencedLSID() == routerHeader.getLinkStateID() &&
895  lsa->getReferencedLSType() == ROUTER_LSA)
896  {
897  IntraAreaPrefixLSA *prefLSA = this->intraAreaPrefixLSAList[i];
898  prefLSA->getHeaderForUpdate().setLsaAge(MAX_AGE);
899  this->floodLSA(prefLSA);
900  EV_DEBUG << "Deleting old Router-LSA, set age of appropriate Intra-Area-Prefix-LSA to MAX_AGE\n";
901  break;
902  }
903  }
904  delete delRouter;
905  this->routerLSAList.erase(this->routerLSAList.begin() + index);
906 }

Referenced by inet::ospfv3::Ospfv3InterfaceState::changeState().

◆ detailedInfo()

std::string inet::ospfv3::Ospfv3Area::detailedInfo ( ) const
3512 {
3513  std::stringstream out;
3514 
3515  out << "Ospfv3 1 address-family ";
3516  if (this->getInstance()->getAddressFamily() == IPV4INSTANCE)
3517  out << "ipv4 (router-id ";
3518  else
3519  out << "ipv6 (router-id ";
3520 
3521  out << this->getInstance()->getProcess()->getRouterID();
3522  out << ")\n\n";
3523 
3524  if (this->routerLSAList.size() > 0) {
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"; // link Count
3533  if ((*it)->getNtBit()) {
3534  out << "Nt ";
3535  bitsEmpty = false;
3536  }
3537  if ((*it)->getXBit()) {
3538  out << "x ";
3539  bitsEmpty = false;
3540  }
3541  if ((*it)->getVBit()) {
3542  out << "V ";
3543  bitsEmpty = false;
3544  }
3545  if ((*it)->getEBit()) {
3546  out << "E ";
3547  bitsEmpty = false;
3548  }
3549  if ((*it)->getBBit()) {
3550  out << "B";
3551  bitsEmpty = false;
3552  }
3553  if (bitsEmpty)
3554  out << "None";
3555 
3556  out << endl;
3557  }
3558  }
3559 
3560  if (this->networkLSAList.size() > 0) {
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";
3567  }
3568  }
3569 
3570  if (this->interAreaPrefixLSAList.size() > 0) {
3571  out << "\nInter Area Prefix Link States (Area " << this->getAreaID().str(false) << ")\n";
3572  out << "ADV Router\tAge\tSeq#\t\tPrefix\n";
3573  for (auto it = this->interAreaPrefixLSAList.begin(); it != this->interAreaPrefixLSAList.end(); it++) {
3574  Ospfv3LsaHeader& header = (*it)->getHeaderForUpdate();
3575  out << header.getAdvertisingRouter() << "\t\t";
3576  out << header.getLsaAge() << "\t0x" << std::hex << header.getLsaSequenceNumber() << std::dec << "\t";
3577 
3578  L3Address addrPref = (*it)->getPrefix().addressPrefix;
3579  if (this->getInstance()->getAddressFamily() == IPV4INSTANCE) {
3580  out << (*it)->getPrefix().addressPrefix.str() << "/" << (int)(*it)->getPrefix().prefixLen << endl;
3581  }
3582  else if (this->getInstance()->getAddressFamily() == IPV6INSTANCE) {
3583  Ipv6Address ipv6addr = addrPref.toIpv6();
3584  ipv6addr = ipv6addr.getPrefix((*it)->getPrefix().prefixLen);
3585  if (ipv6addr == Ipv6Address::UNSPECIFIED_ADDRESS)
3586  out << "::/0" << endl;
3587  else
3588  out << ipv6addr.str() << "/" << (int)(*it)->getPrefix().prefixLen << endl;
3589  }
3590  }
3591  }
3592 
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";
3601  }
3602  }
3603 
3604  if (this->intraAreaPrefixLSAList.size() > 0) {
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";
3607  for (auto it = this->intraAreaPrefixLSAList.begin(); it != this->intraAreaPrefixLSAList.end(); it++) {
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";
3612  else
3613  out << header.getLsaAge() << "\t0x" << std::hex << header.getLsaSequenceNumber() << std::dec << "\t" << header.getLinkStateID().str(false) << "\t\t0x200" << (*it)->getReferencedLSType() << "\t\t0\n\n";
3614  }
3615  }
3616 
3617  // out stream with detail for every LSA (for Debug)
3618  /* out << "ROUTER LSA LIST .size = " << routerLSAList.size() << "\n";
3619  for (auto it=this->routerLSAList.begin(); it!=this->routerLSAList.end(); it++) {
3620  Ospfv3LsaHeader& header = (*it)->getHeaderForUpdate();
3621  out << "AdvertisingRouter =\t" << header.getAdvertisingRouter()<< endl;
3622  out << "LinkStateID =\t\t" << header.getLinkStateID() << endl;
3623  out << "Age = \t\t\t" << header.getLsaAge() << endl;
3624  out << "type\t\tinterfaceID\t\tneighborIntID\t\tneighborRouterID\n";
3625  for (int i = 0; i < (*it)->getRoutersArraySize(); i++)
3626  out << (int)(*it)->getRouters(i).type << "\t\t" << (*it)->getRouters(i).interfaceID << "\t\t\t" << (*it)->getRouters(i).neighborInterfaceID << "\t\t\t" << (*it)->getRouters(i).neighborRouterID << "\n";
3627  out << endl;
3628  }
3629 
3630  out << endl;
3631 
3632  out << "NETWORK LSA LIST .size() = " << networkLSAList.size() << endl;
3633  for (auto it=this->networkLSAList.begin(); it!=this->networkLSAList.end(); it++) {
3634  Ospfv3LsaHeader& header = (*it)->getHeaderForUpdate();
3635  out << "AdvertisingRouter =\t" << header.getAdvertisingRouter()<< endl;
3636  out << "LinkStateID =\t\t" << header.getLinkStateID() << endl;
3637  out << "Age = \t\t\t" << header.getLsaAge() << endl;
3638  out << "Attached Router:" << endl;
3639  for (int i = 0; i < (*it)->getAttachedRouterArraySize(); i++)
3640  out << (*it)->getAttachedRouter(i) << endl;
3641  }
3642  out << endl;
3643 
3644  for (int itf = 0; itf < this->getInterfaceCount() ; itf++ )
3645  {
3646  Ospfv3Interface *iface = this->getInterface(itf);
3647  out << "IFACE = " << iface->getIntName() << "\nLINK LSA LIST = " << iface->getLinkLSACount() << "\n";
3648  for (int ix = 0; ix < iface->getLinkLSACount(); ix++)
3649  {
3650  Ospfv3LsaHeader& header = iface->getLinkLSA(ix)->getHeaderForUpdate();
3651  out << "AdvertisingRouter =\t" << header.getAdvertisingRouter()<< "\n";
3652  out << "LinkStateID =\t\t" << header.getLinkStateID() << "\n";
3653  out << "Age = \t\t\t" << header.getLsaAge() << endl;
3654 
3655  out << "link-local add = " << iface->getLinkLSA(ix)->getLinkLocalInterfaceAdd() << "\n";
3656  out << "prefixes = " << iface->getLinkLSA(ix)->getPrefixesArraySize() << "\n";
3657 
3658  for (int d = 0 ; d < iface->getLinkLSA(ix)->getPrefixesArraySize(); d++)
3659  {
3660  if (iface->getLinkLSA(ix)->getPrefixes(d).addressPrefix.getType() == L3Address::IPv4) // je to ipv6
3661  {
3662  out << "\t" <<iface->getLinkLSA(ix)->getPrefixes(d).addressPrefix.toIpv4().str() << "/" << (int)iface->getLinkLSA(ix)->getPrefixes(d).prefixLen << "\n";
3663 
3664  }
3665  else
3666  {
3667  out << "\t" << iface->getLinkLSA(ix)->getPrefixes(d).addressPrefix.toIpv6().str() << "/" << (int) iface->getLinkLSA(ix)->getPrefixes(d).prefixLen << "\n";
3668 
3669  }
3670  }
3671  out << "\n";
3672  }
3673  }
3674 
3675  out << "INTER AREA LSA LIST = " << interAreaPrefixLSAList.size() << "\n";
3676  for (auto it=this->interAreaPrefixLSAList.begin(); it!=this->interAreaPrefixLSAList.end(); it++) {
3677  Ospfv3LsaHeader& header = (*it)->getHeaderForUpdate();
3678  out << "AdvertisingRouter =\t" << header.getAdvertisingRouter()<< "\n";
3679  out << "LinkStateID =\t\t" << header.getLinkStateID() << "\n";
3680  out << "Age = \t\t\t" << header.getLsaAge() << endl;
3681  out << "prefix =\t\t " << (*it)->getPrefix() << "\n";
3682  out << "prefixLen =\t\t " << (int)(*it)->getPrefixLen() << "\n";
3683  out << "metric =\t\t " << (int)(*it)->getMetric() << "\n";
3684  }
3685  out << endl;
3686  out << "INTRA AREA PREFIX = " << intraAreaPrefixLSAList.size() << "\n";
3687  for (auto it=this->intraAreaPrefixLSAList.begin(); it!=this->intraAreaPrefixLSAList.end(); it++) {
3688  Ospfv3LsaHeader& header = (*it)->getHeaderForUpdate();
3689  out << "AdvertisingRouter =\t" << header.getAdvertisingRouter()<< "\n";
3690  out << "LinkStateID =\t\t" << header.getLinkStateID() << "\n";
3691  out << "Age = \t\t\t" << header.getLsaAge() << endl;
3692  out << "getPrefixesArraySize = " << (*it)->getPrefixesArraySize() << "\n";
3693  out << "getReferencedLSType = " << (*it)->getReferencedLSType() << "\n";
3694  out << "getReferencedLSID = " << (*it)->getReferencedLSID() << "\n";
3695  out << "getReferencedAdvRtr = " << (*it)->getReferencedAdvRtr() << "\n";
3696  out << "prefixes :" << "\n";
3697  for (int i = 0; i < (*it)->getPrefixesArraySize(); i++) {
3698 
3699  out << "addressPrefix = "<< (*it)->getPrefixes(i).addressPrefix << "/" << int((*it)->getPrefixes(i).prefixLen) << "\n";
3700  out << "metric = "<< int((*it)->getPrefixes(i).metric) << "\n";
3701  }
3702  out << "\n";
3703  }
3704  out << "\n\n";
3705 */
3706 
3707  return out.str();
3708 } // detailedInfo

Referenced by inet::ospfv3::operator<<().

◆ findInterAreaPrefixLSAbyAddress()

InterAreaPrefixLSA * inet::ospfv3::Ospfv3Area::findInterAreaPrefixLSAbyAddress ( const L3Address  address,
int  prefixLen 
)
1371 {
1372  for (auto it = this->interAreaPrefixLSAList.begin(); it != this->interAreaPrefixLSAList.end(); it++) {
1373  if ((*it)->getPrefix().addressPrefix == address && (*it)->getPrefix().prefixLen == prefixLen) {
1374  return *it;
1375  }
1376  }
1377  return nullptr;
1378 }

Referenced by ageDatabase(), and originateInterAreaPrefixLSA().

◆ findIntraAreaPrefixByAddress()

IntraAreaPrefixLSA * inet::ospfv3::Ospfv3Area::findIntraAreaPrefixByAddress ( L3Address  address,
int  prefix 
)
1808 {
1809  for (auto it = this->intraAreaPrefixLSAList.begin(); it != this->intraAreaPrefixLSAList.end(); it++) {
1810  for (size_t i = 0; i < (*it)->getPrefixesArraySize(); i++) {
1811  if ((*it)->getPrefixes(i).addressPrefix == address && (*it)->getPrefixes(i).prefixLen == prefix)
1812  return *it;
1813  }
1814  }
1815  return nullptr;
1816 }

Referenced by ageDatabase().

◆ findIntraAreaPrefixLSAByReference()

IntraAreaPrefixLSA * inet::ospfv3::Ospfv3Area::findIntraAreaPrefixLSAByReference ( LSAKeyType  lsaKey)
1819 {
1820  for (auto it = this->intraAreaPrefixLSAList.begin(); it != this->intraAreaPrefixLSAList.end(); it++) {
1821  if (((*it)->getReferencedLSType() == lsaKey.LSType) && ((*it)->getReferencedLSID() == lsaKey.linkStateID) && ((*it)->getReferencedAdvRtr() == lsaKey.advertisingRouter)) {
1822  return *it;
1823  }
1824  }
1825  return nullptr;
1826 }

◆ findLSA()

const Ospfv3LsaHeader * inet::ospfv3::Ospfv3Area::findLSA ( LSAKeyType  lsaKey)
141 {
142  switch (lsaKey.LSType) {
143  case ROUTER_LSA: {
144  RouterLSA *lsa = this->getRouterLSAbyKey(lsaKey);
145  if (lsa == nullptr) {
146  return nullptr;
147  }
148  else {
149  const Ospfv3LsaHeader *lsaHeader = &(lsa->getHeader());
150  return lsaHeader;
151  }
152  }
153  break;
154  case NETWORK_LSA: {
155  NetworkLSA *lsa = this->getNetworkLSAbyKey(lsaKey);
156  if (lsa == nullptr) {
157  return nullptr;
158  }
159  else {
160  const Ospfv3LsaHeader *lsaHeader = &(lsa->getHeader());
161  return lsaHeader;
162  }
163  }
164  break;
165 // case INTER_AREA_PREFIX_LSA:
166 // case INTER_AREA_ROUTER_LSA:
167 // case LINK_LSA:
168 // case AS_EXTERNAL_LSA:
169 
170  default:
171 // ASSERT(false);
172  break;
173  }
174  return nullptr;
175 }

Referenced by inet::ospfv3::Ospfv3Interface::preProcessDDPacket().

◆ findNetworkLSA()

NetworkLSA * inet::ospfv3::Ospfv3Area::findNetworkLSA ( uint32_t  intID,
Ipv4Address  routerID 
)
1097 {
1098  for (auto it = this->networkLSAList.begin(); it != this->networkLSAList.end(); it++) {
1099  if (((*it)->getHeader().getAdvertisingRouter() == routerID) && ((*it)->getHeader().getLinkStateID() == (Ipv4Address)intID)) {
1100  return *it;
1101  }
1102  }
1103  return nullptr;
1104 }

Referenced by inet::ospfv3::Ospfv3InterfaceState::changeState().

◆ findNetworkLSAByLSID()

NetworkLSA * inet::ospfv3::Ospfv3Area::findNetworkLSAByLSID ( Ipv4Address  linkStateID)
1107 {
1108  for (auto it = this->networkLSAList.begin(); it != this->networkLSAList.end(); it++) {
1109  if ((*it)->getHeader().getLinkStateID() == linkStateID) {
1110  return *it;
1111  }
1112  }
1113  return nullptr;
1114 }

Referenced by inet::ospfv3::Ospfv3NeighborState::changeState(), and inet::ospfv3::Ospfv3InterfaceState::changeState().

◆ findRouterLSA()

RouterLSA * inet::ospfv3::Ospfv3Area::findRouterLSA ( Ipv4Address  routerID)
963 {
964  for (auto it = this->routerLSAList.begin(); it != this->routerLSAList.end(); it++) {
965  if ((*it)->getHeader().getAdvertisingRouter() == routerID) {
966  return *it;
967  }
968  }
969  return nullptr;
970 }

Referenced by inet::ospfv3::Ospfv3NeighborState::changeState(), and inet::ospfv3::Ospfv3InterfaceState::changeState().

◆ findRouterLSAByID()

RouterLSA * inet::ospfv3::Ospfv3Area::findRouterLSAByID ( Ipv4Address  linkStateID)
973 {
974  for (auto it = this->routerLSAList.begin(); it != this->routerLSAList.end(); it++) {
975  if ((*it)->getHeader().getLinkStateID() == linkStateID) {
976  return *it;
977  }
978  }
979  return nullptr;
980 }

◆ findSameOrWorseCostRoute() [1/2]

bool inet::ospfv3::Ospfv3Area::findSameOrWorseCostRoute ( const std::vector< Ospfv3Ipv4RoutingTableEntry * > &  newTable,
const InterAreaPrefixLSA interAreaPrefixLSA,
unsigned short  currentCost,
bool &  destinationInRoutingTable,
std::list< Ospfv3Ipv4RoutingTableEntry * > &  sameOrWorseCost 
) const
2570 {
2571  destinationInRoutingTable = false;
2572  sameOrWorseCost.clear();
2573 
2574  long routeCount = newTable.size();
2575  Ipv4AddressRange destination;
2576  destination.address = interAreaPrefixLSA.getPrefix().addressPrefix.toIpv4();
2577  destination.mask = destination.address.makeNetmask(interAreaPrefixLSA.getPrefix().prefixLen);
2578 
2579  for (long j = 0; j < routeCount; j++) {
2580  Ospfv3Ipv4RoutingTableEntry *routingEntry = newTable[j];
2581  bool foundMatching = false;
2582 
2583  if (interAreaPrefixLSA.getHeader().getLsaType() == INTER_AREA_PREFIX_LSA) {
2584  if ((routingEntry->getDestinationType() == Ospfv3Ipv4RoutingTableEntry::NETWORK_DESTINATION) &&
2585  isSameNetwork(destination.address, destination.mask, routingEntry->getDestination(), routingEntry->getNetmask()))
2586  {
2587  foundMatching = true;
2588  }
2589  }
2590  else {
2591  if ((((routingEntry->getDestinationType() & Ospfv3Ipv4RoutingTableEntry::AREA_BORDER_ROUTER_DESTINATION) != 0) ||
2592  ((routingEntry->getDestinationType() & Ospfv3Ipv4RoutingTableEntry::AS_BOUNDARY_ROUTER_DESTINATION) != 0)) &&
2593  (destination.address == routingEntry->getDestination()) &&
2594  (destination.mask == routingEntry->getNetmask()))
2595  {
2596  foundMatching = true;
2597  }
2598  }
2599 
2600  if (foundMatching) {
2601  destinationInRoutingTable = true;
2602 
2603  /* If the matching entry is an INTRAAREA getRoute(intra-area paths are
2604  * always preferred to other paths of any cost), or it's a cheaper INTERAREA
2605  * route, then skip this LSA.
2606  */
2607  if ((routingEntry->getPathType() == Ospfv3Ipv4RoutingTableEntry::INTRAAREA) ||
2608  ((routingEntry->getPathType() == Ospfv3Ipv4RoutingTableEntry::INTERAREA) &&
2609  (routingEntry->getCost() < currentCost)))
2610  {
2611  return true;
2612  }
2613  else {
2614  // if it's an other INTERAREA path
2615  if ((routingEntry->getPathType() == Ospfv3Ipv4RoutingTableEntry::INTERAREA) &&
2616  (routingEntry->getCost() >= currentCost))
2617  {
2618  sameOrWorseCost.push_back(routingEntry);
2619  } // else it's external -> same as if not in the table
2620  }
2621  }
2622  }
2623  return false;
2624 }

◆ findSameOrWorseCostRoute() [2/2]

bool inet::ospfv3::Ospfv3Area::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.

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.

2509 {
2510  destinationInRoutingTable = false;
2511  sameOrWorseCost.clear();
2512 
2513  long routeCount = newTable.size();
2514  Ipv6AddressRange destination;
2515  destination.prefix = interAreaPrefixLSA.getPrefix().addressPrefix.toIpv6();
2516  destination.prefixLength = interAreaPrefixLSA.getPrefix().prefixLen;
2517 
2518  for (long j = 0; j < routeCount; j++) {
2519  Ospfv3RoutingTableEntry *routingEntry = newTable[j];
2520  bool foundMatching = false;
2521  if (interAreaPrefixLSA.getHeader().getLsaType() == INTER_AREA_PREFIX_LSA) {
2522  if ((routingEntry->getDestinationType() == Ospfv3RoutingTableEntry::NETWORK_DESTINATION) &&
2523  isSameNetwork(destination.prefix, destination.prefixLength, routingEntry->getDestPrefix(), routingEntry->getPrefixLength()))
2524  {
2525  foundMatching = true;
2526  }
2527  }
2528  else {
2529  if ((((routingEntry->getDestinationType() & Ospfv3RoutingTableEntry::AREA_BORDER_ROUTER_DESTINATION) != 0) ||
2530  ((routingEntry->getDestinationType() & Ospfv3RoutingTableEntry::AS_BOUNDARY_ROUTER_DESTINATION) != 0)) &&
2531  (destination.prefix == routingEntry->getDestPrefix()) &&
2532  (destination.prefixLength == routingEntry->getPrefixLength()))
2533  {
2534  foundMatching = true;
2535  }
2536  }
2537 
2538  if (foundMatching) {
2539  destinationInRoutingTable = true;
2540 
2541  /* If the matching entry is an INTRAAREA getRoute(intra-area paths are
2542  * always preferred to other paths of any cost), or it's a cheaper INTERAREA
2543  * route, then skip this LSA.
2544  */
2545  if ((routingEntry->getPathType() == Ospfv3RoutingTableEntry::INTRAAREA) ||
2546  ((routingEntry->getPathType() == Ospfv3RoutingTableEntry::INTERAREA) &&
2547  (routingEntry->getCost() < currentCost)))
2548  {
2549  return true;
2550  }
2551  else {
2552  // if it's an other INTERAREA path
2553  if ((routingEntry->getPathType() == Ospfv3RoutingTableEntry::INTERAREA) &&
2554  (routingEntry->getCost() >= currentCost))
2555  {
2556  sameOrWorseCost.push_back(routingEntry);
2557  } // else it's external -> same as if not in the table
2558  }
2559  }
2560  }
2561  return false;
2562 }

◆ findVirtualLink()

Ospfv3Interface * inet::ospfv3::Ospfv3Area::findVirtualLink ( Ipv4Address  routerID)
115 {
116  int interfaceNum = this->interfaceList.size();
117  for (int i = 0; i < interfaceNum; i++) {
118  if ((interfaceList.at(i)->getType() == Ospfv3Interface::VIRTUAL_TYPE) &&
119  (interfaceList.at(i)->getNeighborById(routerID) != nullptr))
120  {
121  return interfaceList.at(i);
122  }
123  }
124  return nullptr;
125 }

Referenced by inet::ospfv3::Ospfv3Instance::processPacket().

◆ floodLSA()

bool inet::ospfv3::Ospfv3Area::floodLSA ( const Ospfv3Lsa lsa,
Ospfv3Interface interface = nullptr,
Ospfv3Neighbor neighbor = nullptr 
)
909 {
910  EV_DEBUG << "Flooding from Area to all interfaces\n";
911 // std::cout << this->getInstance()->getProcess()->getRouterID() << " - FLOOD LSA AREA!!" << endl;
912  bool floodedBackOut = false;
913  long interfaceCount = this->interfaceList.size();
914 
915  for (long i = 0; i < interfaceCount; i++) {
916  if (interfaceList.at(i)->floodLSA(lsa, interface, neighbor)) {
917  floodedBackOut = true;
918  }
919  }
920  return floodedBackOut;
921 }

Referenced by ageDatabase(), inet::ospfv3::Ospfv3NeighborState::changeState(), inet::ospfv3::Ospfv3InterfaceState::changeState(), inet::ospfv3::Ospfv3Process::floodLSA(), and originateInterAreaPrefixLSA().

◆ getAreaID()

◆ getAreaType()

Ospfv3AreaType inet::ospfv3::Ospfv3Area::getAreaType ( ) const
inline
33 { return this->areaType; }

◆ getCurrentInterAreaPrefixSequence()

uint32_t inet::ospfv3::Ospfv3Area::getCurrentInterAreaPrefixSequence ( )
inline

◆ getCurrentIntraAreaPrefixSequence()

uint32_t inet::ospfv3::Ospfv3Area::getCurrentIntraAreaPrefixSequence ( )
inline
124 { return this->intraAreaPrefixLSASequenceNumber; }

◆ getCurrentNetworkSequence()

uint32_t inet::ospfv3::Ospfv3Area::getCurrentNetworkSequence ( )
inline
90 { return this->networkLSASequenceNumber; }

◆ getCurrentRouterSequence()

uint32_t inet::ospfv3::Ospfv3Area::getCurrentRouterSequence ( )
inline
72 { return this->routerLSASequenceNumber; }

◆ getExternalRoutingCapability()

bool inet::ospfv3::Ospfv3Area::getExternalRoutingCapability ( )
inline

◆ getInstance()

Ospfv3Instance* inet::ospfv3::Ospfv3Area::getInstance ( ) const
inline
41 { return this->containingInstance; }

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
39 { return this->instanceType; }

◆ getInterAreaPrefixLSA()

InterAreaPrefixLSA* inet::ospfv3::Ospfv3Area::getInterAreaPrefixLSA ( int  i)
inline

◆ getInterAreaPrefixLSACount()

int inet::ospfv3::Ospfv3Area::getInterAreaPrefixLSACount ( )
inline

◆ getInterface()

Ospfv3Interface* inet::ospfv3::Ospfv3Area::getInterface ( int  i) const
inline
52 { return this->interfaceList.at(i); }

◆ getInterfaceById()

Ospfv3Interface * inet::ospfv3::Ospfv3Area::getInterfaceById ( int  id)
85 {
86  auto interfaceIt = this->interfaceById.find(id);
87  return (interfaceIt == this->interfaceById.end()) ? nullptr : interfaceIt->second;
88 }

Referenced by inet::ospfv3::Ospfv3Instance::processPacket().

◆ getInterfaceByIndex() [1/2]

Ospfv3Interface * inet::ospfv3::Ospfv3Area::getInterfaceByIndex ( int  id)
102 {
103  auto interfaceIt = this->interfaceByIndex.find(id);
104  return (interfaceIt == this->interfaceByIndex.end()) ? nullptr : interfaceIt->second;
105 }

◆ getInterfaceByIndex() [2/2]

Ospfv3Interface * inet::ospfv3::Ospfv3Area::getInterfaceByIndex ( Ipv4Address  address)
128 {
129  int interfaceNum = interfaceList.size();
130  for (int i = 0; i < interfaceNum; i++) {
131  if ((interfaceList[i]->getType() != Ospfv3Interface::VIRTUAL_TYPE) &&
132  (Ipv4Address(interfaceList[i]->getInterfaceIndex()) == LinkStateID))
133  {
134  return interfaceList[i];
135  }
136  }
137  return nullptr;
138 }

◆ getInterfaceCount()

int inet::ospfv3::Ospfv3Area::getInterfaceCount ( ) const
inline
54 { return this->interfaceList.size(); }

◆ getIntraAreaPrefixLSA()

IntraAreaPrefixLSA* inet::ospfv3::Ospfv3Area::getIntraAreaPrefixLSA ( int  i)
inline

◆ getIntraAreaPrefixLSACount()

int inet::ospfv3::Ospfv3Area::getIntraAreaPrefixLSACount ( )
inline

◆ getLSAbyKey()

Ospfv3Lsa * inet::ospfv3::Ospfv3Area::getLSAbyKey ( LSAKeyType  lsaKey)
1829 {
1830  switch (LSAKey.LSType) {
1831  case ROUTER_LSA:
1832  for (auto it = this->routerLSAList.begin(); it != this->routerLSAList.end(); it++) {
1833  if (((*it)->getHeader().getAdvertisingRouter() == LSAKey.advertisingRouter) && (*it)->getHeader().getLinkStateID() == LSAKey.linkStateID) {
1834  return *it;
1835  }
1836  }
1837  break;
1838 
1839  case NETWORK_LSA:
1840  for (auto it = this->networkLSAList.begin(); it != this->networkLSAList.end(); it++) {
1841  if (((*it)->getHeader().getAdvertisingRouter() == LSAKey.advertisingRouter) && (*it)->getHeader().getLinkStateID() == LSAKey.linkStateID) {
1842  return *it;
1843  }
1844  }
1845  break;
1846 
1847  case INTER_AREA_PREFIX_LSA:
1848  for (auto it = this->interAreaPrefixLSAList.begin(); it != this->interAreaPrefixLSAList.end(); it++) {
1849  if (((*it)->getHeader().getAdvertisingRouter() == LSAKey.advertisingRouter) && (*it)->getHeader().getLinkStateID() == LSAKey.linkStateID) {
1850  return *it;
1851  }
1852  }
1853  break;
1854 
1855  case INTER_AREA_ROUTER_LSA:
1856  for (auto it = this->routerLSAList.begin(); it != this->routerLSAList.end(); it++) {
1857  if (((*it)->getHeader().getAdvertisingRouter() == LSAKey.advertisingRouter) && (*it)->getHeader().getLinkStateID() == LSAKey.linkStateID) {
1858  return *it;
1859  }
1860  }
1861  break;
1862 
1863  case NSSA_LSA:
1864  for (auto it = this->routerLSAList.begin(); it != this->routerLSAList.end(); it++) {
1865  if (((*it)->getHeader().getAdvertisingRouter() == LSAKey.advertisingRouter) && (*it)->getHeader().getLinkStateID() == LSAKey.linkStateID) {
1866  return *it;
1867  }
1868  }
1869  break;
1870 
1871  case INTRA_AREA_PREFIX_LSA:
1872  for (auto it = this->intraAreaPrefixLSAList.begin(); it != this->intraAreaPrefixLSAList.end(); it++) {
1873  if (((*it)->getHeader().getAdvertisingRouter() == LSAKey.advertisingRouter) && (*it)->getHeader().getLinkStateID() == LSAKey.linkStateID) {
1874  return *it;
1875  }
1876  }
1877  break;
1878 
1879  case LINK_LSA:
1880  for (auto it = this->interfaceList.begin(); it != this->interfaceList.end(); it++) {
1881  LinkLSA *lsa = (*it)->getLinkLSAbyKey(LSAKey);
1882  if (lsa != nullptr)
1883  return lsa;
1884  }
1885  break;
1886  }
1887  return nullptr;
1888 }

Referenced by inet::ospfv3::Ospfv3Process::findLSA().

◆ getNetIntraAreaPrefixLSA()

IntraAreaPrefixLSA* inet::ospfv3::Ospfv3Area::getNetIntraAreaPrefixLSA ( L3Address  prefix,
int  prefLen 
)

◆ getNetworkLinkStateID()

Ipv4Address inet::ospfv3::Ospfv3Area::getNetworkLinkStateID ( )
inline
89 { return this->networkLsID; }

◆ getNetworkLSA()

NetworkLSA* inet::ospfv3::Ospfv3Area::getNetworkLSA ( int  i)
inline
84 { return this->networkLSAList.at(i); }

Referenced by inet::ospfv3::Ospfv3Neighbor::createDatabaseSummary().

◆ getNetworkLSAbyKey()

NetworkLSA * inet::ospfv3::Ospfv3Area::getNetworkLSAbyKey ( LSAKeyType  LSAKey)
1024 {
1025  for (auto it = this->networkLSAList.begin(); it != this->networkLSAList.end(); it++) {
1026  if (((*it)->getHeader().getAdvertisingRouter() == LSAKey.advertisingRouter) && (*it)->getHeader().getLinkStateID() == LSAKey.linkStateID) {
1027  return *it;
1028  }
1029  }
1030  return nullptr;
1031 } // getRouterLSAByKey

◆ getNetworkLSACount()

int inet::ospfv3::Ospfv3Area::getNetworkLSACount ( )
inline
83 { return this->networkLSAList.size(); }

Referenced by inet::ospfv3::Ospfv3Neighbor::createDatabaseSummary().

◆ getNetworkLSAInterface()

Ospfv3Interface * inet::ospfv3::Ospfv3Area::getNetworkLSAInterface ( Ipv4Address  id)
91 {
92 
93  for (auto it = this->interfaceList.begin(); it != this->interfaceList.end(); it++) {
94  if (Ipv4Address((*it)->getInterfaceId()) == id)
95  return *it;
96  }
97 
98  return nullptr;
99 } // getInterfaceById

◆ getNewInterAreaPrefixLinkStateID()

Ipv4Address inet::ospfv3::Ospfv3Area::getNewInterAreaPrefixLinkStateID ( )

◆ getNewIntraAreaPrefixLinkStateID()

Ipv4Address inet::ospfv3::Ospfv3Area::getNewIntraAreaPrefixLinkStateID ( )
1793 {
1794  Ipv4Address currIP = this->intraAreaPrefixLsID;
1795  int newIP = currIP.getInt() + 1;
1796  this->intraAreaPrefixLsID = Ipv4Address(newIP);
1797  return currIP;
1798 } // getNewIntraAreaPrefixStateID

◆ getNewNetworkLinkStateID()

Ipv4Address inet::ospfv3::Ospfv3Area::getNewNetworkLinkStateID ( )
1089 {
1090  Ipv4Address currIP = this->networkLsID;
1091  int newIP = currIP.getInt() + 1;
1092  this->networkLsID = Ipv4Address(newIP);
1093  return currIP;
1094 } // getNewNetworkLinkStateID

◆ getNewRouterLinkStateID()

Ipv4Address inet::ospfv3::Ospfv3Area::getNewRouterLinkStateID ( )
178 {
179  Ipv4Address currIP = this->routerLsID;
180  int newIP = currIP.getInt() + 1;
181  this->routerLsID = Ipv4Address(newIP);
182  return currIP;
183 }

◆ getRouterLinkStateID()

Ipv4Address inet::ospfv3::Ospfv3Area::getRouterLinkStateID ( )
inline
71 { return this->routerLsID; }

◆ getRouterLSA()

RouterLSA* inet::ospfv3::Ospfv3Area::getRouterLSA ( int  i)
inline

◆ getRouterLSAbyKey()

RouterLSA * inet::ospfv3::Ospfv3Area::getRouterLSAbyKey ( LSAKeyType  lsaKey)
800 {
801  for (auto it = this->routerLSAList.begin(); it != this->routerLSAList.end(); it++) {
802  if (((*it)->getHeader().getAdvertisingRouter() == LSAKey.advertisingRouter) && (*it)->getHeader().getLinkStateID() == LSAKey.linkStateID)
803  return *it;
804  }
805 
806  return nullptr;
807 }

Referenced by inet::ospfv3::Ospfv3InterfaceState::changeState().

◆ getRouterLSACount()

int inet::ospfv3::Ospfv3Area::getRouterLSACount ( )
inline

◆ getStubDefaultCost()

int inet::ospfv3::Ospfv3Area::getStubDefaultCost ( )
inline
49 { return this->stubDefaultCost; }

◆ getTransitCapability()

bool inet::ospfv3::Ospfv3Area::getTransitCapability ( )
inline

◆ hasAddressRange() [1/2]

bool inet::ospfv3::Ospfv3Area::hasAddressRange ( Ipv4AddressRange  addressRange) const
1988 {
1989  int addressRangeNum = IPv4areaAddressRanges.size();
1990  for (int i = 0; i < addressRangeNum; i++) {
1991  if (IPv4areaAddressRanges[i] == addressRange) {
1992  return true;
1993  }
1994  }
1995  return false;
1996 }

◆ hasAddressRange() [2/2]

bool inet::ospfv3::Ospfv3Area::hasAddressRange ( Ipv6AddressRange  addressRange) const
1934 {
1935  int addressRangeNum = IPv6areaAddressRanges.size();
1936  for (int i = 0; i < addressRangeNum; i++) {
1937  if (IPv6areaAddressRanges[i] == addressRange) {
1938  return true;
1939  }
1940  }
1941  return false;
1942 }

◆ hasAnyNeighborInStates()

bool inet::ospfv3::Ospfv3Area::hasAnyNeighborInStates ( int  state) const
924 {
925  long interfaceCount = this->interfaceList.size();
926  for (long i = 0; i < interfaceCount; i++) {
927  if (interfaceList.at(i)->hasAnyNeighborInState(states))
928  return true;
929  }
930  return false;
931 }

◆ hasAnyPassiveInterface()

bool inet::ospfv3::Ospfv3Area::hasAnyPassiveInterface ( ) const
934 {
935  long interfaceCount = this->interfaceList.size();
936  for (long i = 0; i < interfaceCount; i++) {
937  if (interfaceList.at(i)->isInterfacePassive())
938  return true;
939  }
940  return false;
941 }

Referenced by inet::ospfv3::Ospfv3InterfaceState::changeState().

◆ hasInterface()

bool inet::ospfv3::Ospfv3Area::hasInterface ( std::string  interfaceName)
80 {
81  return containsKey(this->interfaceByName, interfaceName);
82 } // hasArea

Referenced by inet::ospfv3::Ospfv3Process::parseConfig().

◆ hasLink()

bool inet::ospfv3::Ospfv3Area::hasLink ( Ospfv3Lsa fromLSA,
Ospfv3Lsa toLSA 
) const
3031 {
3032  unsigned int i;
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);
3040  Ospfv3RouterLsaType linkType = static_cast<Ospfv3RouterLsaType>(link.type);
3041 
3042  if (((linkType == POINT_TO_POINT) ||
3043  (linkType == VIRTUAL_LINK)) &&
3044  (link.neighborRouterID == toRouterLSA->getHeader().getAdvertisingRouter()))
3045  {
3046  return true;
3047  }
3048  }
3049  }
3050  else {
3051  NetworkLSA *toNetworkLSA = dynamic_cast<NetworkLSA *>(toLSA);
3052  if (toNetworkLSA != nullptr) {
3053  for (i = 0; i < linkCount; i++) {
3054  Ospfv3RouterLsaBody& link = fromRouterLSA->getRoutersForUpdate(i);
3055 
3056  if ((link.type == TRANSIT_NETWORK) &&
3057  (link.neighborRouterID == toNetworkLSA->getHeader().getAdvertisingRouter()))
3058  {
3059  return true;
3060  }
3061  if (link.type == RESERVED) {
3062  return true;
3063  }
3064  }
3065  }
3066  }
3067  }
3068  else {
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()) {
3076  return true;
3077  }
3078  }
3079  }
3080  }
3081  }
3082 
3083  return false;
3084 }

◆ incrementInterAreaPrefixSequence()

void inet::ospfv3::Ospfv3Area::incrementInterAreaPrefixSequence ( )
inline

◆ incrementIntraAreaPrefixSequence()

void inet::ospfv3::Ospfv3Area::incrementIntraAreaPrefixSequence ( )
inline

◆ incrementNetworkSequence()

void inet::ospfv3::Ospfv3Area::incrementNetworkSequence ( )
inline
91 { this->networkLSASequenceNumber++; }

◆ incrementRouterSequence()

void inet::ospfv3::Ospfv3Area::incrementRouterSequence ( )
inline
73 { this->routerLSASequenceNumber++; }

◆ init()

void inet::ospfv3::Ospfv3Area::init ( )
56 {
57  if (this->getInstance()->getAddressFamily() == IPV6INSTANCE) // if this instance is a part of IPv6 AF process, set v6 to true, otherwise, set v6 to false
58  v6 = true;
59  else
60  v6 = false;
61 
62  for (auto it = this->interfaceList.begin(); it != this->interfaceList.end(); it++) {
63  (*it)->setInterfaceIndex(this->getInstance()->getUniqueId());
64  this->interfaceByIndex[(*it)->getInterfaceIndex()] = (*it);
65  (*it)->processEvent(Ospfv3Interface::INTERFACE_UP_EVENT);
66  }
67 
68  Ospfv3IntraAreaPrefixLsa *prefixLsa = this->originateIntraAreaPrefixLSA();
69  EV_DEBUG << "Creating InterAreaPrefixLSA from IntraAreaPrefixLSA\n";
70  if (prefixLsa != nullptr) {
71  this->installIntraAreaPrefixLSA(prefixLsa); // INTRA !!!
72  delete prefixLsa;
73  }
74 
75  if ((this->getAreaType() == Ospfv3AreaType::STUB) && (this->getInstance()->getAreaCount() > 1))
77 }

◆ installInterAreaPrefixLSA()

bool inet::ospfv3::Ospfv3Area::installInterAreaPrefixLSA ( const Ospfv3InterAreaPrefixLsa lsaC)
1288 {
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;
1292 
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)
1296  EV_DEBUG << "DN ";
1297  if (lsa->getPrefix().laBit)
1298  EV_DEBUG << "LA ";
1299  if (lsa->getPrefix().nuBit)
1300  EV_DEBUG << "NU ";
1301  if (lsa->getPrefix().pBit)
1302  EV_DEBUG << "P ";
1303  if (lsa->getPrefix().xBit)
1304  EV_DEBUG << "X ";
1305 
1306  EV_DEBUG << ", Metric: " << lsa->getMetric() << "\n";
1307 
1308  LSAKeyType lsaKey;
1309  lsaKey.linkStateID = lsa->getHeader().getLinkStateID();
1310  lsaKey.advertisingRouter = lsa->getHeader().getAdvertisingRouter();
1311  lsaKey.LSType = lsa->getHeader().getLsaType();
1312 // InterAreaPrefixLSA* lsaInDatabase = (InterAreaPrefixLSA*)this->getLSAbyKey(lsaKey);
1313 
1314  InterAreaPrefixLSA *lsaInDatabase = this->InterAreaPrefixLSAAlreadyExists(lsa);
1315 
1316  if (lsaInDatabase != nullptr) {
1317  this->removeFromAllRetransmissionLists(lsaKey);
1318  EV_DEBUG << "Only updating\n";
1319  return this->updateInterAreaPrefixLSA(lsaInDatabase, lsa);
1320  }
1321  else {
1322  InterAreaPrefixLSA *lsaCopy = new InterAreaPrefixLSA(*lsa);
1323  this->interAreaPrefixLSAList.push_back(lsaCopy);
1324  EV_DEBUG << "creating new one\n";
1325  return true;
1326  }
1327 }

Referenced by originateDefaultInterAreaPrefixLSA(), and originateInterAreaPrefixLSA().

◆ installIntraAreaPrefixLSA()

bool inet::ospfv3::Ospfv3Area::installIntraAreaPrefixLSA ( const Ospfv3IntraAreaPrefixLsa lsaC)
1615 {
1616  const Ospfv3LsaHeader& header = lsa->getHeader();
1617 
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();
1620 
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);
1625  if (prefix.dnBit)
1626  EV_DEBUG << "DN ";
1627  if (prefix.laBit)
1628  EV_DEBUG << "LA ";
1629  if (prefix.nuBit)
1630  EV_DEBUG << "NU ";
1631  if (prefix.pBit)
1632  EV_DEBUG << "P ";
1633  if (prefix.xBit)
1634  EV_DEBUG << "X ";
1635 
1636  EV_DEBUG << ", Metric: " << prefix.metric << "\n";
1637  }
1638 
1639  LSAKeyType lsaKey;
1640  lsaKey.linkStateID = lsa->getHeader().getLinkStateID();
1641  lsaKey.advertisingRouter = lsa->getHeader().getAdvertisingRouter();
1642  lsaKey.LSType = lsa->getHeader().getLsaType();
1643 
1644  if (lsa->getReferencedLSType() == NETWORK_LSA) {
1645  size_t intraPrefCnt = this->intraAreaPrefixLSAList.size();
1646  size_t in = 0;
1647  while (in < intraPrefCnt) {
1648  IntraAreaPrefixLSA *prefLSA = this->getIntraAreaPrefixLSA(in);
1649  bool erase = false;
1650 
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;
1658 
1659  // if router recieve LSA type 9 from DR with IPv6 which roter have stored aj LSType 1, delete this old LSA and install new one
1660  if (routerPref.getPrefix(routerPrefixLen) == netPref.getPrefix(netPrefixLen)) {
1661  EV_DEBUG << "Deleting old IntraAreaPrefixLSA, install new one IntraAreaPrefixLSA\n";
1662  delete intraAreaPrefixLSAList.at(in);
1663  this->intraAreaPrefixLSAList.erase(this->intraAreaPrefixLSAList.begin() + in);
1664  erase = true;
1665  break;
1666  }
1667  }
1668  }
1669 
1670  if (erase)
1671  break;
1672  }
1673  // if something was deleted, go through whole cycle once again
1674  if (intraPrefCnt == this->intraAreaPrefixLSAList.size())
1675  in++;
1676  else {
1677  intraPrefCnt = this->intraAreaPrefixLSAList.size();
1678  in = 0;
1679  }
1680  }
1681  }
1682 
1683  if (lsa->getReferencedLSType() == ROUTER_LSA) {
1684  int intraPrefCnt = this->getIntraAreaPrefixLSACount();
1685  for (int i = 0; i < intraPrefCnt; i++) {
1686  Ospfv3IntraAreaPrefixLsa *prefLSA = this->getIntraAreaPrefixLSA(i);
1687  if (prefLSA->getReferencedLSType() == NETWORK_LSA) {
1688  for (size_t prefR = 0; prefR < lsa->getPrefixesArraySize(); prefR++) { // prefixes of incoming LSA
1689  L3Address routerPref = lsa->getPrefixes(prefR).addressPrefix;
1690  short routerPrefixLen = lsa->getPrefixes(prefR).prefixLen;
1691  for (size_t prefN = 0; prefN < prefLSA->getPrefixesArraySize(); prefN++) { // prefixes of stored LSA
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";
1696  // TODOThis become relevant when there will be support for active changing of type of link
1697  }
1698  }
1699  }
1700  }
1701  }
1702  }
1703  // check if this is not same LSA as router already know
1704  IntraAreaPrefixLSA *lsaInDatabase = (IntraAreaPrefixLSA *)this->getLSAbyKey(lsaKey);
1705  if (lsaInDatabase == nullptr)
1706  lsaInDatabase = IntraAreaPrefixLSAAlreadyExists(lsa);
1707 
1708  for (auto it = this->intraAreaPrefixLSAList.begin(); it != this->intraAreaPrefixLSAList.end(); it++) {
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))
1714  { // this is newer LSA type 9 with different number of ref prefixes
1715  lsaInDatabase = (*it);
1716  break;
1717  }
1718  }
1719 
1720  if (lsaInDatabase != nullptr) {
1721  if (lsaInDatabase->getHeader().getLsaSequenceNumber() <= lsa->getHeader().getLsaSequenceNumber()) {
1722  this->removeFromAllRetransmissionLists(lsaKey);
1723  return this->updateIntraAreaPrefixLSA(lsaInDatabase, lsa);
1724  }
1725  }
1726  else if (lsa->getReferencedLSType() == NETWORK_LSA || lsa->getReferencedLSType() == ROUTER_LSA) {
1727  IntraAreaPrefixLSA *lsaCopy = new IntraAreaPrefixLSA(*lsa);
1728  this->intraAreaPrefixLSAList.push_back(lsaCopy);
1729 
1730  if (this->getInstance()->getAreaCount() > 1)
1731  originateInterAreaPrefixLSA(lsaCopy, this, false);
1732 
1733  return true;
1734  }
1735  return false;
1736 } // installIntraAreaPrefixLSA

Referenced by inet::ospfv3::Ospfv3InterfaceState::changeState(), and inet::ospfv3::Ospfv3InterfaceStateDown::processEvent().

◆ installNetworkLSA()

bool inet::ospfv3::Ospfv3Area::installNetworkLSA ( const Ospfv3NetworkLsa lsaC)
1034 {
1035  LSAKeyType lsaKey;
1036  lsaKey.linkStateID = lsa->getHeader().getLinkStateID();
1037  lsaKey.advertisingRouter = lsa->getHeader().getAdvertisingRouter();
1038  lsaKey.LSType = lsa->getHeader().getLsaType();
1039 
1040  NetworkLSA *lsaInDatabase = (NetworkLSA *)this->getLSAbyKey(lsaKey);
1041  if (lsaInDatabase != nullptr) {
1042  this->removeFromAllRetransmissionLists(lsaKey);
1043  return this->updateNetworkLSA(lsaInDatabase, lsa);
1044  }
1045  else {
1046  NetworkLSA *lsaCopy = new NetworkLSA(*lsa);
1047  this->networkLSAList.push_back(lsaCopy);
1048  return true;
1049  }
1050 } // installNetworkLSA

Referenced by inet::ospfv3::Ospfv3InterfaceState::changeState().

◆ installRouterLSA()

bool inet::ospfv3::Ospfv3Area::installRouterLSA ( const Ospfv3RouterLsa lsaC)
811 {
812  LSAKeyType lsaKey;
813  lsaKey.linkStateID = lsa->getHeader().getLinkStateID();
814  lsaKey.advertisingRouter = lsa->getHeader().getAdvertisingRouter();
815  lsaKey.LSType = lsa->getHeader().getLsaType();
816 
817  RouterLSA *lsaInDatabase = (RouterLSA *)this->getLSAbyKey(lsaKey);
818  if (lsaInDatabase != nullptr) {
819  this->removeFromAllRetransmissionLists(lsaKey);
820  return this->updateRouterLSA(lsaInDatabase, lsa);
821  }
822  else {
823  RouterLSA *lsaCopy = new RouterLSA(*lsa);
824  EV_DEBUG << "RouterLSA was added to routerLSAList\n";
825  this->routerLSAList.push_back(lsaCopy);
826  return true;
827  }
828 } // installRouterLSA

Referenced by inet::ospfv3::Ospfv3InterfaceState::changeState().

◆ InterAreaPrefixLSAAlreadyExists()

InterAreaPrefixLSA * inet::ospfv3::Ospfv3Area::InterAreaPrefixLSAAlreadyExists ( const Ospfv3InterAreaPrefixLsa newLsa)
1358 {
1359  for (auto it = this->interAreaPrefixLSAList.begin(); it != this->interAreaPrefixLSAList.end(); it++) {
1360  if ((*it)->getHeader().getAdvertisingRouter() == newLsa->getHeader().getAdvertisingRouter() &&
1361  (*it)->getPrefix().addressPrefix == newLsa->getPrefix().addressPrefix &&
1362  (*it)->getPrefix().prefixLen == newLsa->getPrefix().prefixLen)
1363  {
1364  return *it;
1365  }
1366  }
1367  return nullptr;
1368 }

Referenced by originateInterAreaPrefixLSA().

◆ interAreaPrefixLSADiffersFrom()

bool inet::ospfv3::Ospfv3Area::interAreaPrefixLSADiffersFrom ( Ospfv3InterAreaPrefixLsa currentLsa,
const Ospfv3InterAreaPrefixLsa newLsa 
)
1339 {
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;
1346 
1347  if (!differentHeader) {
1348  differentBody = (
1349  (currentLsa->getPrefix() != newLsa->getPrefix()) ||
1350  (currentLsa->getMetric() != newLsa->getMetric()));
1351  }
1352 
1353  return differentHeader || differentBody;
1354 }

◆ IntraAreaPrefixLSAAlreadyExists()

IntraAreaPrefixLSA * inet::ospfv3::Ospfv3Area::IntraAreaPrefixLSAAlreadyExists ( const Ospfv3IntraAreaPrefixLsa newLsa)
1580 {
1581  for (auto it = this->intraAreaPrefixLSAList.begin(); it != this->intraAreaPrefixLSAList.end(); it++) {
1582  if ((*it)->getHeader().getAdvertisingRouter() == newLsa->getHeader().getAdvertisingRouter() &&
1583  (*it)->getHeader().getLsaAge() != MAX_AGE)
1584  {
1585  if ((*it)->getReferencedLSType() == newLsa->getReferencedLSType()) {
1586  if ((*it)->getPrefixesArraySize() == newLsa->getPrefixesArraySize()) { // or use snumPrefixes ?
1587  bool same = false;
1588  for (size_t x = 0; x < newLsa->getPrefixesArraySize(); x++) { // prefixCount is count of just created LSA
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))
1597  {
1598  same = true;
1599  }
1600  else
1601  same = false;
1602  }
1603  if (same) {
1604  // return existing LSA type 9
1605  return *it;
1606  }
1607  }
1608  }
1609  }
1610  }
1611  return nullptr;
1612 }

◆ intraAreaPrefixLSADiffersFrom()

bool inet::ospfv3::Ospfv3Area::intraAreaPrefixLSADiffersFrom ( Ospfv3IntraAreaPrefixLsa currentLsa,
const Ospfv3IntraAreaPrefixLsa newLsa 
)
1753 {
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;
1760 
1761  if (!differentHeader) {
1762  differentBody = ((currentLsa->getNumPrefixes() != newLsa->getNumPrefixes()) ||
1763  (currentLsa->getReferencedLSType() != newLsa->getReferencedLSType()) ||
1764  (currentLsa->getReferencedLSID() != newLsa->getReferencedLSID()) ||
1765  (currentLsa->getReferencedAdvRtr() != newLsa->getReferencedAdvRtr()));
1766 
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));
1780 
1781  if (differentLink) {
1782  differentBody = true;
1783  break;
1784  }
1785  }
1786  }
1787  }
1788 
1789  return differentHeader || differentBody;
1790 } // intraAreaPrefixLSADiffersFrom

◆ isOnAnyRetransmissionList()

bool inet::ospfv3::Ospfv3Area::isOnAnyRetransmissionList ( LSAKeyType  lsaKey) const
952 {
953  long interfaceCount = this->interfaceList.size();
954  for (long i = 0; i < interfaceCount; i++) {
955  if (interfaceList.at(i)->isOnAnyRetransmissionList(lsaKey)) {
956  return true;
957  }
958  }
959  return false;
960 }

◆ networkLSADiffersFrom()

bool inet::ospfv3::Ospfv3Area::networkLSADiffersFrom ( Ospfv3NetworkLsa currentLsa,
const Ospfv3NetworkLsa newLsa 
)
1062 {
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;
1069 
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));
1076 
1077  if (differentLink) {
1078  differentBody = true;
1079  break;
1080  }
1081  }
1082  }
1083  }
1084 
1085  return differentHeader || differentBody;
1086 } // networkLSADiffersFrom

◆ nextHopAlreadyExists()

bool inet::ospfv3::Ospfv3Area::nextHopAlreadyExists ( std::vector< NextHop > *  hops,
NextHop  nextHop 
) const
3087 {
3088 
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)
3093  return true;
3094  }
3095  return false;
3096 }

◆ originateDefaultInterAreaPrefixLSA()

void inet::ospfv3::Ospfv3Area::originateDefaultInterAreaPrefixLSA ( Ospfv3Area toArea)
1249 {
1251 // int prefixCount = 0;
1252 
1253  // Only one Inter-Area-Prefix LSA for an area so only one header will suffice
1254  InterAreaPrefixLSA *newLsa = new InterAreaPrefixLSA();
1255  Ospfv3LsaHeader& newHeader = newLsa->getHeaderForUpdate();
1256  newHeader.setLsaAge(0);
1257  newHeader.setLsaType(INTER_AREA_PREFIX_LSA);
1258  newHeader.setLinkStateID(toArea->getInstance()->getNewInterAreaPrefixLinkStateID());
1259  newHeader.setAdvertisingRouter(this->getInstance()->getProcess()->getRouterID());
1260  newHeader.setLsaSequenceNumber(toArea->getCurrentInterAreaPrefixSequence());
1261  toArea->incrementInterAreaPrefixSequence();
1262 
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;
1271 
1272  if (this->getInstance()->getAddressFamily() == IPV4INSTANCE) {
1273  Ipv4Address defaultPref = Ipv4Address("0.0.0.0");
1274  newPrefix.addressPrefix = defaultPref;
1275  packetLength += B(0) + OSPFV3_LSA_PREFIX_HEADER_LENGTH; // 4B PrefixLength + PrefixOptions + Metric; 0B Address Prefix
1276  }
1277  else {
1278  Ipv6Address defaultPref = Ipv6Address("::");
1279  newPrefix.addressPrefix = defaultPref;
1280  packetLength += B(4 * ((0 + 31) / 32)) + OSPFV3_LSA_PREFIX_HEADER_LENGTH;
1281  }
1282  newHeader.setLsaLength(calculateLSASize(newLsa).get());
1283  toArea->installInterAreaPrefixLSA(newLsa);
1284  delete newLsa;
1285 }

◆ originateInterAreaPrefixLSA() [1/2]

void inet::ospfv3::Ospfv3Area::originateInterAreaPrefixLSA ( const Ospfv3Lsa prefLsa,
Ospfv3Area fromArea 
)
1184 {
1185  LSAKeyType lsaKey;
1186  lsaKey.linkStateID = prefLsa->getHeader().getLinkStateID();
1187  lsaKey.advertisingRouter = prefLsa->getHeader().getAdvertisingRouter();
1188  lsaKey.LSType = prefLsa->getHeader().getLsaType();
1189 
1190  for (int i = 0; i < this->getInstance()->getAreaCount(); i++) {
1191  Ospfv3Area *area = this->getInstance()->getArea(i);
1192  if (area->getAreaID() == fromArea->getAreaID())
1193  continue;
1194 
1195  // cast unspecified LSA into InterAreaPrefix LSA
1196  const Ospfv3InterAreaPrefixLsa *lsa = check_and_cast<const Ospfv3InterAreaPrefixLsa *>(prefLsa);
1197 
1198  // find out wheter such LSA in actual area exists
1199  InterAreaPrefixLSA *lsaInDatabase = area->findInterAreaPrefixLSAbyAddress(lsa->getPrefix().addressPrefix, lsa->getPrefix().prefixLen);
1200 
1201 // B packetLength = OSPFV3_LSA_HEADER_LENGTH + OSPFV3_INTER_AREA_PREFIX_LSA_HEADER_LENGTH;
1202 // int prefixCount = 0;
1203 
1204  InterAreaPrefixLSA *newLsa = new InterAreaPrefixLSA();
1205 
1206  // this part of code was put aside because it was hard work with memory correctly
1207  if (lsaInDatabase != nullptr) // I've probably made already LSA type 3 from this prefLsa
1208  (*newLsa) = (*lsaInDatabase);
1209 // for (int inter = 0; inter < area->getInterAreaPrefixLSACount(); inter++)
1210 // {
1211 // InterAreaPrefixLSA* iterLsa = area->getInterAreaPrefixLSA(inter);
1212 // if ((iterLsa->getHeader().getAdvertisingRouter() == this->getInstance()->getProcess()->getRouterID()) &&
1213 // (iterLsa->getPrefix() == lsa->getPrefix()) &&
1214 // (iterLsa->getPrefixLen() == lsa->getPrefixLen()))
1215 // {
1216 // // this have already been processed. So update old one and flood it away
1217 // (*newLsa) = (*iterLsa);
1218 // break;
1219 // }
1220 //
1221 // }
1222  else { // (newLsa == nullptr)
1223  // Only one Inter-Area-Prefix LSA for an area so only one header will suffice
1224 // newLsa = new InterAreaPrefixLSA();
1225  Ospfv3LsaHeader& newHeader = newLsa->getHeaderForUpdate();
1226  newHeader.setLsaType(INTER_AREA_PREFIX_LSA);
1227  newHeader.setLinkStateID(area->getInstance()->getNewInterAreaPrefixLinkStateID());
1228  newHeader.setAdvertisingRouter(this->getInstance()->getProcess()->getRouterID());
1229  newHeader.setLsaSequenceNumber(area->getCurrentInterAreaPrefixSequence());
1230  area->incrementInterAreaPrefixSequence();
1231  }
1232  Ospfv3LsaHeader& newHeader2 = newLsa->getHeaderForUpdate();
1233  if (prefLsa->getHeader().getLsaAge() == MAX_AGE) // if this processed LSA is flooded for its invalidation
1234  newHeader2.setLsaAge(MAX_AGE);
1235  else
1236  newHeader2.setLsaAge(0);
1237  newLsa->setPrefix(lsa->getPrefix());
1238  newLsa->setMetric(lsa->getMetric());
1239 
1240  newHeader2.setLsaLength(calculateLSASize(newLsa).get());
1241  if (area->installInterAreaPrefixLSA(newLsa))
1242  area->floodLSA(newLsa);
1243 
1244  delete newLsa;
1245  }
1246 }

◆ originateInterAreaPrefixLSA() [2/2]

void inet::ospfv3::Ospfv3Area::originateInterAreaPrefixLSA ( Ospfv3IntraAreaPrefixLsa lsa,
Ospfv3Area fromArea,
bool  checkDuplicate 
)
1118 {
1119 // int packetLength = OSPFV3_LSA_HEADER_LENGTH+OSPFV3_INTER_AREA_PREFIX_LSA_HEADER_LENGTH;
1120 // int prefixCount = 0;
1121 
1122  // Separated Inter Area Prefix LSA is made for every prefix inside of Intra Area Prefix LSA
1123  for (size_t ref = 0; ref < lsa->getPrefixesArraySize(); ref++) {
1124  InterAreaPrefixLSA *newLsa = new InterAreaPrefixLSA();
1125  Ospfv3LsaHeader& newHeader = newLsa->getHeaderForUpdate();
1126  newHeader.setLsaAge(0);
1127  newHeader.setLsaType(INTER_AREA_PREFIX_LSA);
1128  newHeader.setLinkStateID(this->getInstance()->getNewInterAreaPrefixLinkStateID());
1129  newHeader.setAdvertisingRouter(this->getInstance()->getProcess()->getRouterID());
1130  newHeader.setLsaSequenceNumber(this->getCurrentInterAreaPrefixSequence());
1131 
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;
1142 
1143  B packetLength = calculateLSASize(newLsa);
1144  newHeader.setLsaLength(packetLength.get());
1145 
1146  int duplicateForArea = 0;
1147  for (int i = 0; i < this->getInstance()->getAreaCount(); i++) {
1148  Ospfv3Area *area = this->getInstance()->getArea(i);
1149  if (area->getAreaID() == fromArea->getAreaID())
1150  continue;
1151 
1152  if (checkDuplicate) {
1153  InterAreaPrefixLSA *lsaDuplicate = area->InterAreaPrefixLSAAlreadyExists(newLsa);
1154  if (lsaDuplicate != nullptr && lsaDuplicate->getHeader().getLsaAge() != MAX_AGE) { // LSA like this already exist
1155  duplicateForArea++;
1156  }
1157  else {
1159  if (area->installInterAreaPrefixLSA(newLsa))
1160  area->floodLSA(newLsa);
1161 // newLsa->getHeaderForUpdate().setLinkStateID(lsaDuplicate->getHeader().getLinkStateID());
1162 // if (area->installInterAreaPrefixLSA(newLsa))
1163 // area->floodLSA(newLsa);
1164  }
1165  }
1166  else {
1167 // if (area->installInterAreaPrefixLSA(newLsa))
1168 // area->floodLSA(newLsa);
1169  area->installInterAreaPrefixLSA(newLsa);
1170  area->floodLSA(newLsa);
1171  }
1172 // delete newLsa;
1173 
1174  }
1175  if (duplicateForArea == this->getInstance()->getAreaCount() - 1) {
1176  // new LSA was not installed anywhere, so subtract LinkStateID counter
1178  }
1179  delete newLsa;
1180  }
1181 }

Referenced by ageDatabase(), and inet::ospfv3::Ospfv3Interface::processLSU().

◆ originateIntraAreaPrefixLSA()

IntraAreaPrefixLSA * inet::ospfv3::Ospfv3Area::originateIntraAreaPrefixLSA ( )
1382 {
1384  int prefixCount = 0;
1385 
1386  // Only one Inter-Area-Prefix LSA for an area so only one header will suffice
1387  IntraAreaPrefixLSA *newLsa = new IntraAreaPrefixLSA();
1388  Ospfv3LsaHeader& newHeader = newLsa->getHeaderForUpdate();
1389  newHeader.setLsaAge(0);
1390  newHeader.setLsaType(INTRA_AREA_PREFIX_LSA);
1391  newHeader.setLinkStateID(this->getNewIntraAreaPrefixLinkStateID());
1392  newHeader.setAdvertisingRouter(this->getInstance()->getProcess()->getRouterID());
1393  newHeader.setLsaSequenceNumber(this->getCurrentIntraAreaPrefixSequence());
1394 
1395  // for each Router LSA there is a corresponding Intra-Area-Prefix LSA
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()) {
1399  continue;
1400  }
1401  else {
1402  newLsa->setReferencedLSType(ROUTER_LSA);
1403  newLsa->setReferencedLSID(routerHeader.getLinkStateID());
1404  newLsa->setReferencedAdvRtr(routerHeader.getAdvertisingRouter());
1405  }
1406  }
1407 
1408  int currentPrefix = 1;
1409  for (auto it = this->interfaceList.begin(); it != this->interfaceList.end(); it++) {
1410  // if interface is not transit (not in state DR, BDR or DRother) or has no neighbour in FULL STATE than continue
1411  if ((*it)->getTransitNetInt() == false || !(*it)->hasAnyNeighborInState(Ospfv3Neighbor::FULL_STATE)) {
1412  NetworkInterface *ie = CHK(this->getInstance()->getProcess()->ift->findInterfaceByName((*it)->getIntName().c_str()));
1413  const auto& ipv6int = ie->findProtocolData<Ipv6InterfaceData>();
1414 
1415  int numPrefixes;
1416  if (!v6) // is this LSA for IPv4 or Ipv6 AF ?
1417  numPrefixes = 1;
1418  else {
1419  numPrefixes = ipv6int->getNumAddresses();
1420  }
1421 
1422  for (int i = 0; i < numPrefixes; i++) {
1423  if (this->getInstance()->getAddressFamily() == IPV4INSTANCE) {
1424  const auto& ipv4Data = ie->getProtocolData<Ipv4InterfaceData>();
1425  Ipv4Address ipAdd = ipv4Data->getIPAddress();
1426  Ospfv3LsaPrefixMetric prefix;
1427  prefix.prefixLen = ipv4Data->getNetmask().getNetmaskLength();
1428  prefix.metric = METRIC;
1429  prefix.addressPrefix = L3Address(ipAdd.getPrefix(prefix.prefixLen));
1430  newLsa->setPrefixesArraySize(currentPrefix);
1431  newLsa->setPrefixes(currentPrefix - 1, prefix);
1432  prefixCount++;
1433  currentPrefix++;
1434  packetLength += B(4) + OSPFV3_LSA_PREFIX_HEADER_LENGTH;
1435  }
1436  else {
1437  Ipv6Address ipv6 = ipv6int->getAddress(i);
1438  if (ipv6.isGlobal()) { // Only all the global prefixes belong to the Intra-Area-Prefix LSA
1439  Ospfv3LsaPrefixMetric prefix;
1440  int rIndex = this->getInstance()->getProcess()->isInRoutingTable6(this->getInstance()->getProcess()->rt6, ipv6);
1441  if (rIndex >= 0)
1442  prefix.prefixLen = this->getInstance()->getProcess()->rt6->getRoute(rIndex)->getPrefixLength();
1443  else {
1444  // network is in routing table no more. There is so far no other way to get prefixLen just from config.xml
1445  // LSA with this ip will be removed
1446  continue;
1447  }
1448 
1449  prefix.metric = METRIC;
1450  // TODO addressPrefix SHOULD be in multiples of 32-bit words, based on prefixLen ((PrefixLength + 31) / 32) 32-bit words as stated in https://tools.ietf.org/html/rfc5340#appendix-A.4.1
1451  prefix.addressPrefix = ipv6.getPrefix(prefix.prefixLen);
1452 
1453  newLsa->setPrefixesArraySize(currentPrefix);
1454  newLsa->setPrefixes(currentPrefix - 1, prefix);
1455  prefixCount++;
1456  currentPrefix++;
1457 
1458  packetLength += B(4 * ((prefix.prefixLen + 31) / 32)) + OSPFV3_LSA_PREFIX_HEADER_LENGTH; // the prefix is multiples of 32bits
1459  }
1460  }
1461  }
1462  }
1463  }
1464 
1465  newHeader.setLsaLength(packetLength.get());
1466  newLsa->setNumPrefixes(prefixCount);
1467 
1468  if (prefixCount == 0) { // check if this LSA is not without prefixes
1469  delete newLsa;
1470 
1471  // there will be probably some old Intra-Area-Prefix LSAs, which need to be invalidated
1472  for (auto it = this->intraAreaPrefixLSAList.begin(); it != this->intraAreaPrefixLSAList.end(); it++) {
1473  if ((*it)->getHeader().getAdvertisingRouter() == this->getInstance()->getProcess()->getRouterID() &&
1474  (*it)->getReferencedLSType() == ROUTER_LSA &&
1475  (*it)->getHeader().getLsaAge() != MAX_AGE)
1476  {
1477  (*it)->getHeaderForUpdate().setLsaAge(MAX_AGE);
1478  this->floodLSA((*it));
1479  }
1480  }
1481  return nullptr;
1482  }
1483 
1484  // check if this LSA has not been already created (code was commented beacause of correct work with memory)
1485 // IntraAreaPrefixLSA* prefixLsa = IntraAreaPrefixLSAAlreadyExists(newLsa);
1486 // if (prefixLsa != nullptr)
1487 // {
1488 // this->subtractIntraAreaPrefixLinkStateID();
1489 // delete newLsa;
1490 // return prefixLsa;
1491 // }
1493  return newLsa;
1494 } // originateIntraAreaPrefixLSA

Referenced by inet::ospfv3::Ospfv3InterfaceState::changeState(), and inet::ospfv3::Ospfv3InterfaceStateDown::processEvent().

◆ originateNetIntraAreaPrefixLSA()

IntraAreaPrefixLSA * inet::ospfv3::Ospfv3Area::originateNetIntraAreaPrefixLSA ( NetworkLSA networkLSA,
Ospfv3Interface interface,
bool  checkDuplicate 
)
1497 {
1498  EV_DEBUG << "Originate New NETWORK INTRA AREA LSA\n";
1500 
1501  // get IPv6 data
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();
1505 
1506  IntraAreaPrefixLSA *newLsa = new IntraAreaPrefixLSA();
1507  Ospfv3LsaHeader& newHeader = newLsa->getHeaderForUpdate();
1508  newHeader.setLsaAge(0);
1509  newHeader.setLsaType(INTRA_AREA_PREFIX_LSA);
1510  newHeader.setLinkStateID(this->getNewIntraAreaPrefixLinkStateID());
1511  newHeader.setAdvertisingRouter(this->getInstance()->getProcess()->getRouterID());
1512  newHeader.setLsaSequenceNumber(this->getCurrentIntraAreaPrefixSequence());
1513 
1514  newLsa->setReferencedLSType(NETWORK_LSA);
1515  newLsa->setReferencedLSID(header.getLinkStateID());
1516  newLsa->setReferencedAdvRtr(header.getAdvertisingRouter());
1517 
1518  int numPrefixes;
1519  if (!v6) // if this is not IPV6INSTANCE
1520  numPrefixes = 1;
1521  else {
1522  numPrefixes = ipv6int->getNumAddresses();
1523  }
1524  int currentPrefix = 1;
1525  int prefixCount = 0;
1526  for (int i = 0; i < numPrefixes; i++) {
1527  if (this->getInstance()->getAddressFamily() == IPV4INSTANCE) {
1528  const auto& ipv4Data = ie->getProtocolData<Ipv4InterfaceData>();
1529  Ipv4Address ipAdd = ipv4Data->getIPAddress();
1530  Ospfv3LsaPrefixMetric prefix;
1531  prefix.prefixLen = ipv4Data->getNetmask().getNetmaskLength();
1532  prefix.metric = METRIC;
1533  prefix.addressPrefix = L3Address(ipAdd.getPrefix(prefix.prefixLen));
1534  newLsa->setPrefixesArraySize(currentPrefix);
1535  newLsa->setPrefixes(currentPrefix - 1, prefix);
1536  prefixCount++;
1537  currentPrefix++;
1538  packetLength += B(4) + OSPFV3_LSA_PREFIX_HEADER_LENGTH;
1539  }
1540  else {
1541  Ipv6Address ipv6 = ipv6int->getAddress(i);
1542 // Ipv6Address ipv6 = ipv6int->getAdvPrefix(i).prefix;
1543  if (ipv6.isGlobal()) { // Only all the global prefixes belong to the Intra-Area-Prefix LSA
1544  Ospfv3LsaPrefixMetric prefix;
1545  int rIndex = this->getInstance()->getProcess()->isInRoutingTable6(this->getInstance()->getProcess()->rt6, ipv6);
1546  if (rIndex >= 0)
1547  prefix.prefixLen = this->getInstance()->getProcess()->rt6->getRoute(rIndex)->getPrefixLength();
1548  else
1549  prefix.prefixLen = 64;
1550  prefix.metric = METRIC;
1551  prefix.addressPrefix = ipv6.getPrefix(prefix.prefixLen);
1552 
1553  newLsa->setPrefixesArraySize(currentPrefix);
1554  newLsa->setPrefixes(currentPrefix - 1, prefix);
1555  prefixCount++;
1556  currentPrefix++;
1557  packetLength += B(4 * ((prefix.prefixLen + 31) / 32)) + OSPFV3_LSA_PREFIX_HEADER_LENGTH; // the prefix is aligned 32bits
1558  }
1559  }
1560  }
1561 
1562  newLsa->setNumPrefixes(prefixCount);
1563  newHeader.setLsaLength(packetLength.get());
1564 
1565  // check if created LSA type 9 would be other or same as previous
1566  if (checkDuplicate) {
1567  IntraAreaPrefixLSA *prefixLsa = IntraAreaPrefixLSAAlreadyExists(newLsa);
1568  if (prefixLsa != nullptr) {
1570  delete newLsa;
1571  return prefixLsa;
1572  }
1573  }
1575  return newLsa;
1576 }

Referenced by inet::ospfv3::Ospfv3InterfaceState::changeState().

◆ originateNetworkLSA()

NetworkLSA * inet::ospfv3::Ospfv3Area::originateNetworkLSA ( Ospfv3Interface interface)
984 {
985  if (interface->hasAnyNeighborInState(Ospfv3Neighbor::FULL_STATE)) {
986  NetworkLSA *networkLsa = new NetworkLSA();
987  Ospfv3LsaHeader& lsaHeader = networkLsa->getHeaderForUpdate();
988  Ospfv3Options lsOptions;
989  // TODO - LSA Options for NetworkLSA is not set.
990 
991  // First set the LSA Header
992  lsaHeader.setLsaAge(0);
993  // The LSA Type is 0x2002
994  lsaHeader.setLsaType(NETWORK_LSA);
995  lsaHeader.setLinkStateID(Ipv4Address(interface->getInterfaceId()));
996  lsaHeader.setAdvertisingRouter(this->getInstance()->getProcess()->getRouterID());
997  lsaHeader.setLsaSequenceNumber(this->getCurrentNetworkSequence());
998  this->incrementNetworkSequence();
999  uint16_t packetLength = OSPFV3_LSA_HEADER_LENGTH.get() + 4; // 4 for options field
1000 
1001  // body
1002  networkLsa->setOspfOptions(lsOptions);
1003  int attachedCount = interface->getNeighborCount(); // +1 for this router
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());
1009  packetLength += 4;
1010  }
1011  networkLsa->setAttachedRouter(attachedCount, this->getInstance()->getProcess()->getRouterID());
1012  packetLength += 4;
1013  }
1014 
1015  lsaHeader.setLsaLength(packetLength);
1016  return networkLsa;
1017  }
1018  else {
1019  return nullptr;
1020  }
1021 } // originateNetworkLSA

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.
679 {
680  EV_DEBUG << "Originating RouterLSA (Router-LSA)\n";
681  RouterLSA *routerLSA = new RouterLSA;
682  Ospfv3LsaHeader& lsaHeader = routerLSA->getHeaderForUpdate();
683  long interfaceCount = this->interfaceList.size();
684  Ospfv3Options lsOptions;
685 
686  // First set the LSA Header
687  lsaHeader.setLsaAge(0);
688  // The LSA Type is 0x2001
689  lsaHeader.setLsaType(ROUTER_LSA);
690  lsaHeader.setLinkStateID(this->getInstance()->getProcess()->getRouterID()); // TODO Link State ID depend on number of originated Router-LSA by this process. For now, there is always only one Router-LSA from one process
691  lsaHeader.setAdvertisingRouter(this->getInstance()->getProcess()->getRouterID());
692  lsaHeader.setLsaSequenceNumber(this->getCurrentRouterSequence());
693 
694  if (this->getInstance()->getAreaCount() > 1)
695  routerLSA->setBBit(true);
696  // TODO - LSA Options for RouterLSA is not set.
697 
698  for (int i = 0; i < interfaceCount; i++) {
699  Ospfv3Interface *intf = this->interfaceList.at(i);
700 
701  if (intf->getState() == Ospfv3Interface::INTERFACE_STATE_DOWN ||
702 // !intf->hasAnyNeighborInState(Ospfv3Neighbor::INIT_STATE
703  intf->hasAnyNeighborInState(Ospfv3Neighbor::ATTEMPT_STATE) ||
704  intf->hasAnyNeighborInState(Ospfv3Neighbor::DOWN_STATE))
705  {
706  continue;
707  }
708 
709  Ospfv3RouterLsaBody routerLSABody;
710 
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";
716 
717  if ((neighbor != nullptr) && (neighbor->getState() == Ospfv3Neighbor::FULL_STATE)) {
718  routerLSABody.type = POINT_TO_POINT;
719  routerLSABody.interfaceID = intf->getInterfaceId();
720  routerLSABody.metric = METRIC;
721  routerLSABody.neighborInterfaceID = neighbor->getNeighborInterfaceID();
722  routerLSABody.neighborRouterID = neighbor->getNeighborID();
723 
724  routerLSA->setRoutersArraySize(i + 1);
725  routerLSA->setRouters(i, routerLSABody);
726  }
727  }
728  break;
729  }
730 
732  routerLSABody.type = TRANSIT_NETWORK;
733  Ospfv3Neighbor *DRouter = intf->getNeighborById(intf->getDesignatedID());
734 
735  if (((DRouter != nullptr) && (DRouter->getState() == Ospfv3Neighbor::FULL_STATE)) ||
736  ((intf->getDesignatedID() == this->getInstance()->getProcess()->getRouterID()) &&
737  intf->getNeighborCount() > 0))
738  {
739  routerLSABody.interfaceID = intf->getInterfaceId(); // id of interface
740  routerLSABody.metric = METRIC;
741 
742  routerLSABody.neighborInterfaceID = intf->getDesignatedIntID();
743  routerLSABody.neighborRouterID = intf->getDesignatedID();
744 
745  routerLSA->setRoutersArraySize(i + 1);
746  routerLSA->setRouters(i, routerLSABody);
747  }
748  break;
749  }
750 
752  routerLSABody.type = VIRTUAL_LINK;
753  break;
756  EV_DEBUG << "NBMA and P2MP for interface type is not in originate Router-LSA ymplemented yet\n";
758  default:
759  break;
760  }
761  }
762 
763  this->incrementRouterSequence();
764  return routerLSA;
765 } // originateRouterLSA

Referenced by inet::ospfv3::Ospfv3NeighborState::changeState(), and inet::ospfv3::Ospfv3InterfaceState::changeState().

◆ recheckInterAreaPrefixLSAs() [1/2]

void inet::ospfv3::Ospfv3Area::recheckInterAreaPrefixLSAs ( std::vector< Ospfv3Ipv4RoutingTableEntry * > &  newTableIPv4)
3378 {
3379  unsigned long i = 0;
3380  unsigned long j = 0;
3381  unsigned long lsaCount = interAreaPrefixLSAList.size();
3382 
3383  for (i = 0; i < lsaCount; i++) {
3384  InterAreaPrefixLSA *currentLSA = interAreaPrefixLSAList[i];
3385  const Ospfv3LsaHeader& currentHeader = currentLSA->getHeader();
3386 
3387  unsigned long routeCost = currentLSA->getMetric();
3388  unsigned short lsAge = currentHeader.getLsaAge();
3389  Ipv4Address originatingRouter = currentHeader.getAdvertisingRouter();
3390  bool selfOriginated = (originatingRouter == this->getInstance()->getProcess()->getRouterID());
3391 
3392  if ((routeCost == LS_INFINITY) || (lsAge == MAX_AGE) || (selfOriginated)) { // (1) and(2)
3393  continue;
3394  }
3395 
3396  unsigned long routeCount = newTableIPv4.size();
3397  char lsaType = currentHeader.getLsaType();
3398  Ospfv3Ipv4RoutingTableEntry *destinationEntry = nullptr;
3399  Ipv4AddressRange destination;
3400 
3401  destination.address = currentLSA->getPrefix().addressPrefix.toIpv4(); // from LSA type 3
3402  destination.mask = destination.address.makeNetmask(currentLSA->getPrefix().prefixLen);
3403 
3404  for (j = 0; j < routeCount; j++) { // (3)
3405  Ospfv3Ipv4RoutingTableEntry *routingEntry = newTableIPv4[j];
3406  bool foundMatching = false;
3407 
3408  if (lsaType == INTER_AREA_PREFIX_LSA) {
3409  if ((routingEntry->getDestinationType() == Ospfv3Ipv4RoutingTableEntry::NETWORK_DESTINATION) &&
3410  (destination.address == routingEntry->getDestination()) &&
3411  (destination.mask == routingEntry->getDestination().makeNetmask(routingEntry->getPrefixLength())))
3412  {
3413  foundMatching = true;
3414  }
3415  }
3416  else {
3417  if ((((routingEntry->getDestinationType() & Ospfv3Ipv4RoutingTableEntry::AREA_BORDER_ROUTER_DESTINATION) != 0) ||
3418  ((routingEntry->getDestinationType() & Ospfv3Ipv4RoutingTableEntry::AS_BOUNDARY_ROUTER_DESTINATION) != 0)) &&
3419  (destination.address == routingEntry->getDestination()) &&
3420  (destination.mask == routingEntry->getDestination().makeNetmask(routingEntry->getPrefixLength())))
3421  {
3422  foundMatching = true;
3423  }
3424  }
3425 
3426  if (foundMatching) {
3427  Ospfv3Ipv4RoutingTableEntry::RoutingPathType pathType = routingEntry->getPathType();
3428  if ((pathType == Ospfv3Ipv4RoutingTableEntry::TYPE1_EXTERNAL) ||
3430  (routingEntry->getArea() != BACKBONE_AREAID))
3431  {
3432  break;
3433  }
3434  else {
3435  destinationEntry = routingEntry;
3436  break;
3437  }
3438  }
3439  }
3440  if (destinationEntry == nullptr) {
3441  continue;
3442  }
3443 
3444  Ospfv3Ipv4RoutingTableEntry *borderRouterEntry = nullptr;
3445  unsigned short currentCost = routeCost;
3446 
3447  RouterLSA *routerLSA = findRouterLSA(originatingRouter);
3448 
3449  // if founded RouterLSA has no valuable information.
3450  if (routerLSA == nullptr) {
3451  continue;
3452  }
3453  if (routerLSA->getRoutersArraySize() < 1) {
3454  continue;
3455  }
3456  // from Router LSA routers search for Intra Area Prefix LSA
3457  Ospfv3IntraAreaPrefixLsa *iapLSA = nullptr;
3458  for (size_t rIndex = 0; rIndex < routerLSA->getRoutersArraySize(); rIndex++) {
3459  LSAKeyType lsaKey;
3460  lsaKey.linkStateID = (Ipv4Address)routerLSA->getRouters(rIndex).neighborInterfaceID;
3461  lsaKey.advertisingRouter = routerLSA->getRouters(rIndex).neighborRouterID;
3462  lsaKey.LSType = routerLSA->getRouters(rIndex).type;
3463 
3464  iapLSA = findIntraAreaPrefixLSAByReference(lsaKey);
3465  if (iapLSA == nullptr)
3466  continue;
3467  }
3468 
3469  if (iapLSA == nullptr)
3470  continue;
3471 
3472  for (j = 0; j < routeCount; j++) { // (4) BR == borderRouterEntry
3473  Ospfv3Ipv4RoutingTableEntry *routingEntry = newTableIPv4[j];
3474  for (size_t pfxs = 0; pfxs < iapLSA->getPrefixesArraySize(); pfxs++) {
3475  if ((routingEntry->getArea() == areaID) &&
3476  (((routingEntry->getDestinationType() & Ospfv3Ipv4RoutingTableEntry::AREA_BORDER_ROUTER_DESTINATION) != 0) ||
3477  ((routingEntry->getDestinationType() & Ospfv3Ipv4RoutingTableEntry::AS_BOUNDARY_ROUTER_DESTINATION) != 0)) &&
3478  (routingEntry->getDestination() == iapLSA->getPrefixes(pfxs).addressPrefix.toIpv4())) // check wheter destination is a originating router of this LSA 3
3479  {
3480  borderRouterEntry = routingEntry;
3481  currentCost += borderRouterEntry->getCost();
3482  break;
3483  }
3484  }
3485  }
3486  if (borderRouterEntry == nullptr) {
3487  continue;
3488  }
3489  else { // (5)
3490  if (currentCost <= destinationEntry->getCost()) {
3491  if (currentCost < destinationEntry->getCost()) {
3492  destinationEntry->clearNextHops();
3493  }
3494 
3495  unsigned long nextHopCount = borderRouterEntry->getNextHopCount();
3496 
3497  for (j = 0; j < nextHopCount; j++) {
3498  destinationEntry->addNextHop(borderRouterEntry->getNextHop(j));
3499  }
3500  }
3501  }
3502  }
3503 }

◆ recheckInterAreaPrefixLSAs() [2/2]

void inet::ospfv3::Ospfv3Area::recheckInterAreaPrefixLSAs ( std::vector< Ospfv3RoutingTableEntry * > &  newTableIPv6)
3249 {
3250  unsigned long i = 0;
3251  unsigned long j = 0;
3252  unsigned long lsaCount = interAreaPrefixLSAList.size();
3253 
3254  for (i = 0; i < lsaCount; i++) {
3255  InterAreaPrefixLSA *currentLSA = interAreaPrefixLSAList[i];
3256  const Ospfv3LsaHeader& currentHeader = currentLSA->getHeader();
3257 
3258  unsigned long routeCost = currentLSA->getMetric();
3259  unsigned short lsAge = currentHeader.getLsaAge();
3260  Ipv4Address originatingRouter = currentHeader.getAdvertisingRouter();
3261  bool selfOriginated = (originatingRouter == this->getInstance()->getProcess()->getRouterID());
3262 
3263  if ((routeCost == LS_INFINITY) || (lsAge == MAX_AGE) || (selfOriginated)) { // (1) and(2)
3264  continue;
3265  }
3266 
3267  unsigned long routeCount = newTableIPv6.size();
3268  char lsaType = currentHeader.getLsaType();
3269  Ospfv3RoutingTableEntry *destinationEntry = nullptr;
3270  Ipv6AddressRange destination;
3271 
3272  destination.prefix = currentLSA->getPrefix().addressPrefix.toIpv6(); // from LSA type 3
3273  destination.prefixLength = currentLSA->getPrefix().prefixLen;
3274 
3275  for (j = 0; j < routeCount; j++) { // (3)
3276  Ospfv3RoutingTableEntry *routingEntry = newTableIPv6[j];
3277  bool foundMatching = false;
3278 
3279  if (lsaType == INTER_AREA_PREFIX_LSA) {
3280  if ((routingEntry->getDestinationType() == Ospfv3RoutingTableEntry::NETWORK_DESTINATION) &&
3281  (destination.prefix == routingEntry->getDestPrefix()) &&
3282  (destination.prefixLength == routingEntry->getPrefixLength()))
3283  {
3284  foundMatching = true;
3285  }
3286  }
3287  else {
3288  if ((((routingEntry->getDestinationType() & Ospfv3RoutingTableEntry::AREA_BORDER_ROUTER_DESTINATION) != 0) ||
3289  ((routingEntry->getDestinationType() & Ospfv3RoutingTableEntry::AS_BOUNDARY_ROUTER_DESTINATION) != 0)) &&
3290  (destination.prefix == routingEntry->getDestPrefix()) &&
3291  (destination.prefixLength == routingEntry->getPrefixLength()))
3292  {
3293  foundMatching = true;
3294  }
3295  }
3296 
3297  if (foundMatching) {
3298  Ospfv3RoutingTableEntry::RoutingPathType pathType = routingEntry->getPathType();
3299 
3300  if ((pathType == Ospfv3RoutingTableEntry::TYPE1_EXTERNAL) ||
3302  (routingEntry->getArea() != BACKBONE_AREAID))
3303  {
3304  break;
3305  }
3306  else {
3307  destinationEntry = routingEntry;
3308  break;
3309  }
3310  }
3311  }
3312  if (destinationEntry == nullptr) {
3313  continue;
3314  }
3315 
3316  Ospfv3RoutingTableEntry *borderRouterEntry = nullptr;
3317  unsigned short currentCost = routeCost;
3318 
3319  RouterLSA *routerLSA = findRouterLSA(originatingRouter);
3320 
3321  // if founded RouterLSA has no valuable information.
3322  if (routerLSA == nullptr) {
3323  continue;
3324  }
3325  if (routerLSA->getRoutersArraySize() < 1) {
3326  continue;
3327  }
3328  // from Router LSA routers search for Intra Area Prefix LSA
3329  Ospfv3IntraAreaPrefixLsa *iapLSA = nullptr;
3330  for (size_t rIndex = 0; rIndex < routerLSA->getRoutersArraySize(); rIndex++) {
3331  LSAKeyType lsaKey;
3332  lsaKey.linkStateID = (Ipv4Address)routerLSA->getRouters(rIndex).neighborInterfaceID;
3333  lsaKey.advertisingRouter = routerLSA->getRouters(rIndex).neighborRouterID;
3334  lsaKey.LSType = routerLSA->getRouters(rIndex).type;
3335 
3336  iapLSA = findIntraAreaPrefixLSAByReference(lsaKey);
3337  if (iapLSA == nullptr)
3338  continue;
3339  }
3340 
3341  if (iapLSA == nullptr)
3342  continue;
3343 
3344  for (j = 0; j < routeCount; j++) { // (4) BR == borderRouterEntry
3345  Ospfv3RoutingTableEntry *routingEntry = newTableIPv6[j];
3346  for (size_t pfxs = 0; pfxs < iapLSA->getPrefixesArraySize(); pfxs++) {
3347  if ((routingEntry->getArea() == areaID) &&
3348  (((routingEntry->getDestinationType() & Ospfv3RoutingTableEntry::AREA_BORDER_ROUTER_DESTINATION) != 0) ||
3349  ((routingEntry->getDestinationType() & Ospfv3RoutingTableEntry::AS_BOUNDARY_ROUTER_DESTINATION) != 0)) &&
3350  (routingEntry->getDestPrefix() == iapLSA->getPrefixes(pfxs).addressPrefix.toIpv6())) // find out, whether destination is router who originated this LSA type 3
3351  {
3352  borderRouterEntry = routingEntry;
3353  currentCost += borderRouterEntry->getCost();
3354  break;
3355  }
3356  }
3357  }
3358  if (borderRouterEntry == nullptr) {
3359  continue;
3360  }
3361  else { // (5)
3362  if (currentCost <= destinationEntry->getCost()) {
3363  if (currentCost < destinationEntry->getCost()) {
3364  destinationEntry->clearNextHops();
3365  }
3366 
3367  unsigned long nextHopCount = borderRouterEntry->getNextHopCount();
3368 
3369  for (j = 0; j < nextHopCount; j++) {
3370  destinationEntry->addNextHop(borderRouterEntry->getNextHop(j));
3371  }
3372  }
3373  }
3374  }
3375 }

◆ removeFromAllRetransmissionLists()

void inet::ospfv3::Ospfv3Area::removeFromAllRetransmissionLists ( LSAKeyType  lsaKey)
944 {
945  long interfaceCount = this->interfaceList.size();
946  for (long i = 0; i < interfaceCount; i++) {
947  this->interfaceList.at(i)->removeFromAllRetransmissionLists(lsaKey);
948  }
949 }

Referenced by inet::ospfv3::Ospfv3Interface::installLinkLSA().

◆ routerLSAAlreadyExists()

RouterLSA * inet::ospfv3::Ospfv3Area::routerLSAAlreadyExists ( RouterLSA newLsa)
768 {
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)
774  {
775  if ((*it)->getRoutersArraySize() == newLsa->getRoutersArraySize()) {
776  bool same = false;
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)
783  {
784  same = true;
785  }
786  else {
787  same = false;
788  break;
789  }
790  }
791  if (same)
792  return *it;
793  }
794  }
795  }
796  return nullptr;
797 }

◆ routerLSADiffersFrom()

bool inet::ospfv3::Ospfv3Area::routerLSADiffersFrom ( Ospfv3RouterLsa currentLsa,
const Ospfv3RouterLsa newLsa 
)
846 {
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;
853 
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()));
861 
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));
872 
873  if (differentLink) {
874  differentBody = true;
875  break;
876  }
877  }
878  }
879  }
880 
881  return differentHeader || differentBody;
882 } // routerLSADiffersFrom

◆ setExternalRoutingCapability()

void inet::ospfv3::Ospfv3Area::setExternalRoutingCapability ( bool  capable)
inline
42 { this->externalRoutingCapability = capable; }

◆ setiInstanceType()

void inet::ospfv3::Ospfv3Area::setiInstanceType ( int  type)
inline
40 { this->instanceType = type; }

◆ setSpfTreeRoot()

void inet::ospfv3::Ospfv3Area::setSpfTreeRoot ( RouterLSA routerLSA)
inline

◆ setStubDefaultCost()

void inet::ospfv3::Ospfv3Area::setStubDefaultCost ( int  newCost)
inline
43 { this->stubDefaultCost = newCost; }

◆ setTransitCapability()

void inet::ospfv3::Ospfv3Area::setTransitCapability ( bool  capable)
inline
44 { this->transitCapability = capable; }

◆ subtractIntraAreaPrefixLinkStateID()

void inet::ospfv3::Ospfv3Area::subtractIntraAreaPrefixLinkStateID ( )
1801 {
1802  Ipv4Address currIP = this->intraAreaPrefixLsID;
1803  int newIP = currIP.getInt() - 1;
1804  this->intraAreaPrefixLsID = Ipv4Address(newIP);
1805 } // getNewIntraAreaPrefixStateID

◆ updateInterAreaPrefixLSA()

bool inet::ospfv3::Ospfv3Area::updateInterAreaPrefixLSA ( InterAreaPrefixLSA currentLsa,
const Ospfv3InterAreaPrefixLsa newLsa 
)
1330 {
1331  bool different = interAreaPrefixLSADiffersFrom(currentLsa, newLsa);
1332  (*currentLsa) = (*newLsa);
1333 // currentLsa->getHeaderForUpdate().setLsaAge(0); //reset the age
1334  currentLsa->resetInstallTime();
1335  return different;
1336 }

◆ updateIntraAreaPrefixLSA()

bool inet::ospfv3::Ospfv3Area::updateIntraAreaPrefixLSA ( IntraAreaPrefixLSA currentLsa,
const Ospfv3IntraAreaPrefixLsa newLsa 
)
1739 {
1740  bool different = intraAreaPrefixLSADiffersFrom(currentLsa, newLsa);
1741  *currentLsa = *newLsa;
1742 // currentLsa->resetInstallTime();
1743 // currentLsa->getHeaderForUpdate().setLsaAge(0); //reset the age
1744  if (different) {
1745  return true;
1746  }
1747  else {
1748  return false;
1749  }
1750 } // updateIntraAreaPrefixLSA

◆ updateNetworkLSA()

bool inet::ospfv3::Ospfv3Area::updateNetworkLSA ( NetworkLSA currentLsa,
const Ospfv3NetworkLsa newLsa 
)
1053 {
1054  bool different = networkLSADiffersFrom(currentLsa, newLsa);
1055  (*currentLsa) = (*newLsa);
1056 // currentLsa->resetInstallTime();
1057 // delete currentLsa;
1058  return different;
1059 } // updateNetworkLSA

Referenced by inet::ospfv3::Ospfv3NeighborState::changeState().

◆ updateRouterLSA()

bool inet::ospfv3::Ospfv3Area::updateRouterLSA ( RouterLSA currentLsa,
const Ospfv3RouterLsa newLsa 
)
831 {
832  bool different = routerLSADiffersFrom(currentLsa, newLsa);
833  (*currentLsa) = (*newLsa);
834 // currentLsa = new RouterLSA(* newLsa);
835 // currentLsa->resetInstallTime();
836 // currentLsa->getHeaderForUpdate().setLsaAge(0); //reset the age
837  if (different) {
838  return true;
839  }
840  else {
841  return false;
842  }
843 } // updateRouterLSA

Referenced by inet::ospfv3::Ospfv3NeighborState::changeState().

Member Data Documentation

◆ areaID

Ipv4Address inet::ospfv3::Ospfv3Area::areaID
private

◆ areaType

Ospfv3AreaType inet::ospfv3::Ospfv3Area::areaType
private

◆ containingInstance

Ospfv3Instance* inet::ospfv3::Ospfv3Area::containingInstance
private

◆ externalRoutingCapability

bool inet::ospfv3::Ospfv3Area::externalRoutingCapability = false
private

◆ instanceType

int inet::ospfv3::Ospfv3Area::instanceType
private

◆ interAreaPrefixLSAByID

std::map<Ipv4Address, InterAreaPrefixLSA *> inet::ospfv3::Ospfv3Area::interAreaPrefixLSAByID
private

◆ interAreaPrefixLSAList

std::vector<InterAreaPrefixLSA *> inet::ospfv3::Ospfv3Area::interAreaPrefixLSAList
private

◆ interAreaPrefixLSASequenceNumber

uint32_t inet::ospfv3::Ospfv3Area::interAreaPrefixLSASequenceNumber = INITIAL_SEQUENCE_NUMBER
private

◆ interfaceById

std::map<int, Ospfv3Interface *> inet::ospfv3::Ospfv3Area::interfaceById
private

◆ interfaceByIndex

std::map<int, Ospfv3Interface *> inet::ospfv3::Ospfv3Area::interfaceByIndex
private

◆ interfaceByName

std::map<std::string, Ospfv3Interface *> inet::ospfv3::Ospfv3Area::interfaceByName
private

◆ interfaceList

std::vector<Ospfv3Interface *> inet::ospfv3::Ospfv3Area::interfaceList
private

◆ intraAreaPrefixLSAByID

std::map<Ipv4Address, IntraAreaPrefixLSA *> inet::ospfv3::Ospfv3Area::intraAreaPrefixLSAByID
private

◆ intraAreaPrefixLSAList

std::vector<IntraAreaPrefixLSA *> inet::ospfv3::Ospfv3Area::intraAreaPrefixLSAList
private

◆ intraAreaPrefixLSASequenceNumber

uint32_t inet::ospfv3::Ospfv3Area::intraAreaPrefixLSASequenceNumber = INITIAL_SEQUENCE_NUMBER
private

◆ intraAreaPrefixLsID

Ipv4Address inet::ospfv3::Ospfv3Area::intraAreaPrefixLsID = (Ipv4Address)1
private

◆ IPv4advertiseAddressRanges

std::map<Ipv4AddressRange, bool> inet::ospfv3::Ospfv3Area::IPv4advertiseAddressRanges
private

◆ IPv4areaAddressRanges

std::vector<Ipv4AddressRange> inet::ospfv3::Ospfv3Area::IPv4areaAddressRanges
private

◆ IPv6advertiseAddressRanges

std::map<Ipv6AddressRange, bool> inet::ospfv3::Ospfv3Area::IPv6advertiseAddressRanges
private

◆ IPv6areaAddressRanges

std::vector<Ipv6AddressRange> inet::ospfv3::Ospfv3Area::IPv6areaAddressRanges
private

◆ networkLSAList

std::vector<NetworkLSA *> inet::ospfv3::Ospfv3Area::networkLSAList
private

◆ networkLSAsByID

std::map<Ipv4Address, NetworkLSA *> inet::ospfv3::Ospfv3Area::networkLSAsByID
private

◆ networkLSASequenceNumber

uint32_t inet::ospfv3::Ospfv3Area::networkLSASequenceNumber = INITIAL_SEQUENCE_NUMBER
private

◆ networkLsID

Ipv4Address inet::ospfv3::Ospfv3Area::networkLsID = Ipv4Address::UNSPECIFIED_ADDRESS
private

◆ routerLSAList

std::vector<RouterLSA *> inet::ospfv3::Ospfv3Area::routerLSAList
private

◆ routerLSAsByID

std::map<Ipv4Address, RouterLSA *> inet::ospfv3::Ospfv3Area::routerLSAsByID
private

◆ routerLSASequenceNumber

uint32_t inet::ospfv3::Ospfv3Area::routerLSASequenceNumber = INITIAL_SEQUENCE_NUMBER
private

◆ routerLsID

Ipv4Address inet::ospfv3::Ospfv3Area::routerLsID = Ipv4Address::UNSPECIFIED_ADDRESS
private

◆ 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:
inet::ospfv3::Ospfv3Area::transitCapability
bool transitCapability
Definition: Ospfv3Area.h:190
CHK
#define CHK(x)
Definition: INETDefs.h:87
inet::ospfv3::Ospfv3Area::networkLSAList
std::vector< NetworkLSA * > networkLSAList
Definition: Ospfv3Area.h:201
inet::ospfv3::Ospfv3LsaFunctionCode
Ospfv3LsaFunctionCode
Enum generated from inet/routing/ospfv3/Ospfv3Packet.msg:103 by opp_msgtool.
Definition: Ospfv3Packet_m.h:395
inet::ospfv3::Ospfv3Area::installIntraAreaPrefixLSA
bool installIntraAreaPrefixLSA(const Ospfv3IntraAreaPrefixLsa *lsaC)
Definition: Ospfv3Area.cc:1614
inet::ospfv3::NULL_IPV4ADDRESSRANGE
const Ipv4AddressRange NULL_IPV4ADDRESSRANGE(Ipv4Address(0, 0, 0, 0), Ipv4Address(0, 0, 0, 0))
inet::ospfv3::Ospfv3Area::v6
bool v6
Definition: Ospfv3Area.h:171
inet::Ipv4Address::getInt
uint32_t getInt() const
Returns the address as an uint32_t in host byte order (e.g.
Definition: Ipv4Address.h:186
inet::ospfv3::Ospfv3Area::hasLink
bool hasLink(Ospfv3Lsa *fromLSA, Ospfv3Lsa *toLSA) const
Definition: Ospfv3Area.cc:3030
inet::ospfv3::Ospfv3Area::findSameOrWorseCostRoute
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
inet::ospfv3::Ospfv3Neighbor::FULL_STATE
@ FULL_STATE
Definition: Ospfv3Neighbor.h:50
inet::ospfv3::Ospfv3Interface::NBMA_TYPE
@ NBMA_TYPE
Definition: Ospfv3Interface.h:54
inet::ospfv3::Ospfv3Area::intraAreaPrefixLSAList
std::vector< IntraAreaPrefixLSA * > intraAreaPrefixLSAList
Definition: Ospfv3Area.h:208
inet::ospfv3::Ospfv3Area::interfaceByName
std::map< std::string, Ospfv3Interface * > interfaceByName
Definition: Ospfv3Area.h:183
inet::ospfv3::Ospfv3Area::intraAreaPrefixLSASequenceNumber
uint32_t intraAreaPrefixLSASequenceNumber
Definition: Ospfv3Area.h:210
inet::ospfv3::Ospfv3Lsa::getHeader
virtual const Ospfv3LsaHeader & getHeader() const
inet::ospfv3::Ospfv3Interface::BROADCAST_TYPE
@ BROADCAST_TYPE
Definition: Ospfv3Interface.h:53
inet::ospfv3::Ospfv3Area::findRouterLSA
RouterLSA * findRouterLSA(Ipv4Address routerID)
Definition: Ospfv3Area.cc:962
MAX_SEQUENCE_NUMBER
#define MAX_SEQUENCE_NUMBER
Definition: Ospfv2Common.h:34
inet::ospfv3::Ospfv3Area::Ospfv3Area
Ospfv3Area(Ipv4Address areaID, Ospfv3Instance *containingInstance, Ospfv3AreaType type)
Definition: Ospfv3Area.cc:15
inet::ospfv3::Ospfv3Interface::Ospfv3InterfaceType
Ospfv3InterfaceType
Definition: Ospfv3Interface.h:50
inet::ospfv3::Ospfv3Neighbor::DOWN_STATE
@ DOWN_STATE
Definition: Ospfv3Neighbor.h:43
inet::ospfv3::Ospfv3Area::findIntraAreaPrefixByAddress
IntraAreaPrefixLSA * findIntraAreaPrefixByAddress(L3Address address, int prefix)
Definition: Ospfv3Area.cc:1807
inet::ospfv3::Ospfv3Instance::getProcess
Ospfv3Process * getProcess() const
Definition: Ospfv3Instance.h:32
inet::ospfv3::Ospfv3Instance::subtractInterAreaPrefixLinkStateID
void subtractInterAreaPrefixLinkStateID()
Definition: Ospfv3Instance.cc:176
inet::ospfv3::Ospfv3Area::networkLSASequenceNumber
uint32_t networkLSASequenceNumber
Definition: Ospfv3Area.h:203
inet::bgp::NextHop
Ipv4Address NextHop
Definition: BgpCommon.h:50
inet::ospfv3::Ospfv3Lsa::getHeaderForUpdate
virtual Ospfv3LsaHeader & getHeaderForUpdate()
Definition: Ospfv3Packet_m.h:370
inet::ospfv3::Ospfv3Instance::getAreaCount
int getAreaCount()
Definition: Ospfv3Instance.h:43
inet::utils::hex
std::string hex(uint16_t l)
Definition: INETUtils.cc:28
inet::ospfv3::Ospfv3Area::externalRoutingCapability
bool externalRoutingCapability
Definition: Ospfv3Area.h:188
inet::ospfv3::Ospfv3Area::interAreaPrefixLSADiffersFrom
bool interAreaPrefixLSADiffersFrom(Ospfv3InterAreaPrefixLsa *currentLsa, const Ospfv3InterAreaPrefixLsa *newLsa)
Definition: Ospfv3Area.cc:1338
inet::ospfv3::Ospfv3Area::incrementInterAreaPrefixSequence
void incrementInterAreaPrefixSequence()
Definition: Ospfv3Area.h:108
inet::ospfv3::Ospfv3Area::InterAreaPrefixLSAAlreadyExists
InterAreaPrefixLSA * InterAreaPrefixLSAAlreadyExists(const Ospfv3InterAreaPrefixLsa *newLsa)
Definition: Ospfv3Area.cc:1357
inet::ospfv3::Ospfv3Ipv4RoutingTableEntry::RoutingPathType
RoutingPathType
Definition: Ospfv3RoutingTableEntry.h:80
inet::ospfv3::Ospfv3Area::isOnAnyRetransmissionList
bool isOnAnyRetransmissionList(LSAKeyType lsaKey) const
Definition: Ospfv3Area.cc:951
inet::ospfv3::Ospfv3Area::routerLSADiffersFrom
bool routerLSADiffersFrom(Ospfv3RouterLsa *currentLsa, const Ospfv3RouterLsa *newLsa)
Definition: Ospfv3Area.cc:845
inet::ospfv3::Ospfv3Area::stubDefaultCost
int stubDefaultCost
Definition: Ospfv3Area.h:189
inet::ospfv3::Ospfv3Neighbor::ATTEMPT_STATE
@ ATTEMPT_STATE
Definition: Ospfv3Neighbor.h:44
inet::ospfv3::Ospfv3Interface::INTERFACE_STATE_LOOPBACK
@ INTERFACE_STATE_LOOPBACK
Definition: Ospfv3Interface.h:28
inet::ospfv3::Ospfv3Area::routerLSASequenceNumber
uint32_t routerLSASequenceNumber
Definition: Ospfv3Area.h:199
inet::ospfv3::Ospfv3Area::networkLsID
Ipv4Address networkLsID
Definition: Ospfv3Area.h:202
inet::ospfv3::Ospfv3Area::updateRouterLSA
bool updateRouterLSA(RouterLSA *currentLsa, const Ospfv3RouterLsa *newLsa)
Definition: Ospfv3Area.cc:830
inet::ospfv3::POINT_TO_POINT
@ POINT_TO_POINT
Definition: Ospfv3Packet_m.h:507
inet::ospfv3::TRANSIT_NETWORK
@ TRANSIT_NETWORK
Definition: Ospfv3Packet_m.h:508
inet::ospfv3::Ospfv3Area::installRouterLSA
bool installRouterLSA(const Ospfv3RouterLsa *lsaC)
Definition: Ospfv3Area.cc:810
inet::ospfv3::Ospfv3Process::isInRoutingTable6
int isInRoutingTable6(Ipv6RoutingTable *rtTable, Ipv6Address addr)
Definition: Ospfv3Process.cc:104
inet::ospfv3::Ospfv3Area::routerLSAsByID
std::map< Ipv4Address, RouterLSA * > routerLSAsByID
Definition: Ospfv3Area.h:192
inet::ospfv3::Ospfv3Area::originateIntraAreaPrefixLSA
IntraAreaPrefixLSA * originateIntraAreaPrefixLSA()
Definition: Ospfv3Area.cc:1381
inet::ospfv3::Ospfv3Ipv4RoutingTableEntry::AREA_BORDER_ROUTER_DESTINATION
static const unsigned char AREA_BORDER_ROUTER_DESTINATION
Definition: Ospfv3RoutingTableEntry.h:91
MAX_AGE
#define MAX_AGE
Definition: Ospfv2Common.h:27
inet::ospfv3::Ospfv3Area::getCurrentIntraAreaPrefixSequence
uint32_t getCurrentIntraAreaPrefixSequence()
Definition: Ospfv3Area.h:124
inet::ospfv3::Ospfv3Area::incrementNetworkSequence
void incrementNetworkSequence()
Definition: Ospfv3Area.h:91
inet::ospfv3::Ospfv3RoutingTableEntry::INTERAREA
@ INTERAREA
Definition: Ospfv3RoutingTableEntry.h:21
inet::ospfv3::INTRA_AREA_PREFIX_LSA
@ INTRA_AREA_PREFIX_LSA
Definition: Ospfv3Packet_m.h:404
inet::ospfv3::Ospfv3Area::spfTreeRoot
RouterLSA * spfTreeRoot
Definition: Ospfv3Area.h:212
inet::ospfv3::OSPFV3_INTRA_AREA_PREFIX_LSA_HEADER_LENGTH
const B OSPFV3_INTRA_AREA_PREFIX_LSA_HEADER_LENGTH
Definition: Ospfv3Common.h:71
inet::ospfv3::NETWORK_LSA
@ NETWORK_LSA
Definition: Ospfv3Packet_m.h:397
inet::ospfv3::Ospfv3Process::rebuildRoutingTable
void rebuildRoutingTable()
Definition: Ospfv3Process.cc:840
inet::ospfv3::STUB
@ STUB
Definition: Ospfv3Area.h:21
inet::ospfv3::Ospfv3Process::hasAddressRange
bool hasAddressRange(const Ipv6AddressRange &addressRange) const
Definition: Ospfv3Process.cc:478
inet::ospfv3::Ospfv3Area::intraAreaPrefixLSAByID
std::map< Ipv4Address, IntraAreaPrefixLSA * > intraAreaPrefixLSAByID
Definition: Ospfv3Area.h:195
inet::ospfv3::Ospfv3Area::IntraAreaPrefixLSAAlreadyExists
IntraAreaPrefixLSA * IntraAreaPrefixLSAAlreadyExists(const Ospfv3IntraAreaPrefixLsa *newLsa)
Definition: Ospfv3Area.cc:1579
inet::ospfv3::Ospfv3RoutingTableEntry::RoutingPathType
RoutingPathType
Definition: Ospfv3RoutingTableEntry.h:19
inet::ospfv3::Ospfv3Area::getInstance
Ospfv3Instance * getInstance() const
Definition: Ospfv3Area.h:41
inet::ospfv3::LINK_LSA
@ LINK_LSA
Definition: Ospfv3Packet_m.h:403
inet::ospfv3::Ospfv3Area::getAreaType
Ospfv3AreaType getAreaType() const
Definition: Ospfv3Area.h:33
IPV4INSTANCE
#define IPV4INSTANCE
Definition: Ospfv3Common.h:20
inet::ospfv3::Ospfv3Area::calculateNextHops
std::vector< NextHop > * calculateNextHops(Ospfv3Lsa *destination, Ospfv3Lsa *parent) const
Definition: Ospfv3Area.cc:3098
inet::ospfv3::Ospfv3Area::getNewIntraAreaPrefixLinkStateID
Ipv4Address getNewIntraAreaPrefixLinkStateID()
Definition: Ospfv3Area.cc:1792
INITIAL_SEQUENCE_NUMBER
#define INITIAL_SEQUENCE_NUMBER
Definition: Ospfv2Common.h:33
inet::ospfv3::Ospfv3Area::interAreaPrefixLSAByID
std::map< Ipv4Address, InterAreaPrefixLSA * > interAreaPrefixLSAByID
Definition: Ospfv3Area.h:194
inet::ospfv3::Ospfv3Area::hasAnyNeighborInStates
bool hasAnyNeighborInStates(int state) const
Definition: Ospfv3Area.cc:923
inet::ospfv3::Ospfv3Area::findIntraAreaPrefixLSAByReference
IntraAreaPrefixLSA * findIntraAreaPrefixLSAByReference(LSAKeyType lsaKey)
Definition: Ospfv3Area.cc:1818
inet::ospfv3::BACKBONE_AREAID
const Ipv4Address BACKBONE_AREAID(0, 0, 0, 0)
inet::ospfv3::Ospfv3LsaHeader::getLinkStateID
virtual const ::inet::Ipv4Address & getLinkStateID() const
inet::ospfv3::Ospfv3Instance::getAddressFamily
int getAddressFamily()
Definition: Ospfv3Instance.h:31
inet::ospfv3::Ospfv3Area::nextHopAlreadyExists
bool nextHopAlreadyExists(std::vector< NextHop > *hops, NextHop nextHop) const
Definition: Ospfv3Area.cc:3086
inet::ospfv3::Ospfv3Area::intraAreaPrefixLsID
Ipv4Address intraAreaPrefixLsID
Definition: Ospfv3Area.h:209
inet::ospfv3::Ospfv3Area::findInterAreaPrefixLSAbyAddress
InterAreaPrefixLSA * findInterAreaPrefixLSAbyAddress(const L3Address address, int prefixLen)
Definition: Ospfv3Area.cc:1370
inet::ospfv3::Ospfv3Interface::INTERFACE_STATE_DOWN
@ INTERFACE_STATE_DOWN
Definition: Ospfv3Interface.h:27
inet::ospfv3::Ospfv3Area::routerLsID
Ipv4Address routerLsID
Definition: Ospfv3Area.h:198
inet::ospfv3::Ospfv3Area::incrementIntraAreaPrefixSequence
void incrementIntraAreaPrefixSequence()
Definition: Ospfv3Area.h:125
inet::ospfv3::Ospfv3Process::getRouterID
Ipv4Address getRouterID()
Definition: Ospfv3Process.h:40
inet::units::units::B
intscale< b, 1, 8 > B
Definition: Units.h:1168
inet::ospfv3::Ospfv3Interface::INTERFACE_UP_EVENT
@ INTERFACE_UP_EVENT
Definition: Ospfv3Interface.h:38
inet::ospfv3::Ospfv3Area::interAreaPrefixLSAList
std::vector< InterAreaPrefixLSA * > interAreaPrefixLSAList
Definition: Ospfv3Area.h:205
inet::ospfv3::Ospfv3RoutingTableEntry::AS_BOUNDARY_ROUTER_DESTINATION
static const unsigned char AS_BOUNDARY_ROUTER_DESTINATION
Definition: Ospfv3RoutingTableEntry.h:31
inet::ospfv3::NSSA_LSA
@ NSSA_LSA
Definition: Ospfv3Packet_m.h:402
inet::ospfv3::calculateLSASize
B calculateLSASize(const Ospfv3RouterLsa *routerLSA)
Definition: Ospfv3Lsa.cc:19
inet::IRoute::OSPF
@ OSPF
managed by the given routing protocol
Definition: IRoute.h:35
inet::Ipv6Address::UNSPECIFIED_ADDRESS
static const Ipv6Address UNSPECIFIED_ADDRESS
The unspecified address.
Definition: Ipv6Address.h:54
inet::ospfv3::Ospfv3Area::containingInstance
Ospfv3Instance * containingInstance
Definition: Ospfv3Area.h:187
inet::ospfv3::Ospfv3Area::areaID
Ipv4Address areaID
Definition: Ospfv3Area.h:173
inet::ospfv3::Ospfv3Interface::POINTTOMULTIPOINT_TYPE
@ POINTTOMULTIPOINT_TYPE
Definition: Ospfv3Interface.h:55
inet::erase
void erase(std::vector< T > &v, int pos)
Definition: stlutils.h:101
inet::ospfv3::Ospfv3LsaHeader::setLsaAge
virtual void setLsaAge(unsigned short lsaAge)
inet::ospfv3::RESERVED
@ RESERVED
Definition: Ospfv3Packet_m.h:509
type
removed type
Definition: IUdp-gates.txt:7
IPV6INSTANCE
#define IPV6INSTANCE
Definition: Ospfv3Common.h:21
inet::ospfv3::Ospfv3Instance::getArea
Ospfv3Area * getArea(int i)
Definition: Ospfv3Instance.h:37
inet::ospfv3::Ospfv3Area::floodLSA
bool floodLSA(const Ospfv3Lsa *lsa, Ospfv3Interface *interface=nullptr, Ospfv3Neighbor *neighbor=nullptr)
Definition: Ospfv3Area.cc:908
inet::ospfv3::OSPFV3_LSA_HEADER_LENGTH
const B OSPFV3_LSA_HEADER_LENGTH
Definition: Ospfv3Common.h:59
inet::ospfv3::Ospfv3Area::getNetworkLSAbyKey
NetworkLSA * getNetworkLSAbyKey(LSAKeyType LSAKey)
Definition: Ospfv3Area.cc:1023
inet::ospfv3::Ospfv3RoutingTableEntry::AREA_BORDER_ROUTER_DESTINATION
static const unsigned char AREA_BORDER_ROUTER_DESTINATION
Definition: Ospfv3RoutingTableEntry.h:30
inet::ospfv3::Ospfv3Ipv4RoutingTableEntry::INTRAAREA
@ INTRAAREA
Definition: Ospfv3RoutingTableEntry.h:81
inet::ospfv3::OSPFV3_INTER_AREA_PREFIX_LSA_HEADER_LENGTH
const B OSPFV3_INTER_AREA_PREFIX_LSA_HEADER_LENGTH
Definition: Ospfv3Common.h:67
inet::ospfv3::Ospfv3RoutingTableEntry::INTRAAREA
@ INTRAAREA
Definition: Ospfv3RoutingTableEntry.h:20
inet::ospfv3::Ospfv3Interface::POINTTOPOINT_TYPE
@ POINTTOPOINT_TYPE
Definition: Ospfv3Interface.h:52
inet::ospfv3::Ospfv3RoutingTableEntry::TYPE1_EXTERNAL
@ TYPE1_EXTERNAL
Definition: Ospfv3RoutingTableEntry.h:22
inet::ospfv3::VIRTUAL_LINK
@ VIRTUAL_LINK
Definition: Ospfv3Packet_m.h:510
inet::ospfv3::Ospfv3Area::originateNetIntraAreaPrefixLSA
IntraAreaPrefixLSA * originateNetIntraAreaPrefixLSA(NetworkLSA *networkLSA, Ospfv3Interface *interface, bool checkDuplicate)
Definition: Ospfv3Area.cc:1496
inet::ospfv3::Ospfv3Area::instanceType
int instanceType
Definition: Ospfv3Area.h:186
inet::ospfv3::Ospfv3RoutingTableEntry::TYPE2_EXTERNAL
@ TYPE2_EXTERNAL
Definition: Ospfv3RoutingTableEntry.h:23
inet::Ipv4Address::str
std::string str(bool printUnspec=true) const
Returns the string representation of the address (e.g.
Definition: Ipv4Address.cc:98
inet::ospfv3::INTER_AREA_PREFIX_LSA
@ INTER_AREA_PREFIX_LSA
Definition: Ospfv3Packet_m.h:398
inet::ospfv3::Ospfv3Area::IPv6advertiseAddressRanges
std::map< Ipv6AddressRange, bool > IPv6advertiseAddressRanges
Definition: Ospfv3Area.h:179
inet::ospfv3::Ospfv3Area::originateRouterLSA
RouterLSA * originateRouterLSA()
----------------------------------— Router LSA -----------------------------------—//
Definition: Ospfv3Area.cc:678
inet::ospfv3::Ospfv3RoutingTableEntry::RoutingDestinationType
unsigned char RoutingDestinationType
Definition: Ospfv3RoutingTableEntry.h:26
inet::ospfv3::Ospfv3Area::updateInterAreaPrefixLSA
bool updateInterAreaPrefixLSA(InterAreaPrefixLSA *currentLsa, const Ospfv3InterAreaPrefixLsa *newLsa)
Definition: Ospfv3Area.cc:1329
inet::ospfv3::Ospfv3Area::originateDefaultInterAreaPrefixLSA
void originateDefaultInterAreaPrefixLSA(Ospfv3Area *toArea)
Definition: Ospfv3Area.cc:1248
inet::ospfv3::Ospfv3Area::removeFromAllRetransmissionLists
void removeFromAllRetransmissionLists(LSAKeyType lsaKey)
Definition: Ospfv3Area.cc:943
CHECK_AGE
#define CHECK_AGE
Definition: Ospfv2Common.h:28
inet::ospfv3::Ospfv3Area::interfaceList
std::vector< Ospfv3Interface * > interfaceList
Definition: Ospfv3Area.h:175
inet::ospfv3::Ospfv3RoutingTableEntry::NETWORK_DESTINATION
static const unsigned char NETWORK_DESTINATION
Definition: Ospfv3RoutingTableEntry.h:29
inet::ospfv3::RoutingInfo::setDistance
void setDistance(unsigned long d)
Definition: Ospfv3Lsa.h:53
inet::ospfv3::Ospfv3Area::originateNetworkLSA
NetworkLSA * originateNetworkLSA(Ospfv3Interface *interface)
Definition: Ospfv3Area.cc:983
inet::physicallayer::k
const double k
Definition: Qam1024Modulation.cc:14
inet::ospfv3::Ospfv3Area::findNetworkLSA
NetworkLSA * findNetworkLSA(uint32_t intID, Ipv4Address routerID)
Definition: Ospfv3Area.cc:1096
inet::ospfv3::Ospfv3Area::updateNetworkLSA
bool updateNetworkLSA(NetworkLSA *currentLsa, const Ospfv3NetworkLsa *newLsa)
Definition: Ospfv3Area.cc:1052
inet::ospfv3::Ospfv3RouterLsaType
Ospfv3RouterLsaType
Enum generated from inet/routing/ospfv3/Ospfv3Packet.msg:188 by opp_msgtool.
Definition: Ospfv3Packet_m.h:506
inet::ospfv3::Ospfv3Area::subtractIntraAreaPrefixLinkStateID
void subtractIntraAreaPrefixLinkStateID()
Definition: Ospfv3Area.cc:1800
inet::ospfv3::Ospfv3Area::getLSAbyKey
Ospfv3Lsa * getLSAbyKey(LSAKeyType lsaKey)
Definition: Ospfv3Area.cc:1828
inet::L3Address::IPv6
@ IPv6
Definition: L3Address.h:36
inet::ospfv3::Ospfv3Area::interfaceByIndex
std::map< int, Ospfv3Interface * > interfaceByIndex
Definition: Ospfv3Area.h:185
inet::ospfv3::Ospfv3Ipv4RoutingTableEntry::TYPE1_EXTERNAL
@ TYPE1_EXTERNAL
Definition: Ospfv3RoutingTableEntry.h:83
inet::ospfv3::Ospfv3Interface::VIRTUAL_TYPE
@ VIRTUAL_TYPE
Definition: Ospfv3Interface.h:56
inet::ospfv3::Ospfv3Area::getNetworkLSAInterface
Ospfv3Interface * getNetworkLSAInterface(Ipv4Address id)
Definition: Ospfv3Area.cc:90
inet::ospfv3::Ospfv3Area::originateInterAreaPrefixLSA
void originateInterAreaPrefixLSA(Ospfv3IntraAreaPrefixLsa *lsa, Ospfv3Area *fromArea, bool checkDuplicate)
Definition: Ospfv3Area.cc:1117
inet::ospfv3::Ospfv3Process::rt6
ModuleRefByPar< Ipv6RoutingTable > rt6
Definition: Ospfv3Process.h:72
inet::ospfv3::Ospfv3Area::createRoutingTableEntryFromInterAreaPrefixLSA
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
LS_INFINITY
#define LS_INFINITY
Definition: Ted.cc:23
inet::Ipv4Address::UNSPECIFIED_ADDRESS
static const Ipv4Address UNSPECIFIED_ADDRESS
0.0.0.0
Definition: Ipv4Address.h:91
METRIC
#define METRIC
Definition: Ospfv3Common.h:12
inet::units::value::get
const value_type & get() const
Definition: Units.h:108
inet::ospfv3::Ospfv3Neighbor::EXCHANGE_STATE
@ EXCHANGE_STATE
Definition: Ospfv3Neighbor.h:48
inet::ospfv3::Ospfv3Area::IPv6areaAddressRanges
std::vector< Ipv6AddressRange > IPv6areaAddressRanges
Definition: Ospfv3Area.h:178
inet::ospfv3::Ospfv3Ipv4RoutingTableEntry::NETWORK_DESTINATION
static const unsigned char NETWORK_DESTINATION
Definition: Ospfv3RoutingTableEntry.h:90
inet::ospfv3::Ospfv3Area::IPv4advertiseAddressRanges
std::map< Ipv4AddressRange, bool > IPv4advertiseAddressRanges
Definition: Ospfv3Area.h:181
inet::ospfv3::Ospfv3Area::addRouterEntry
void addRouterEntry(RouterLSA *routerLSA, LSAKeyType lsaKey, std::vector< Ospfv3RoutingTableEntry * > &newTableIPv6, std::vector< Ospfv3Ipv4RoutingTableEntry * > &newTableIPv4)
Definition: Ospfv3Area.cc:2434
inet::ospfv3::INTER_AREA_ROUTER_LSA
@ INTER_AREA_ROUTER_LSA
Definition: Ospfv3Packet_m.h:399
inet::ospfv3::Ospfv3Area::getRouterLSAbyKey
RouterLSA * getRouterLSAbyKey(LSAKeyType lsaKey)
Definition: Ospfv3Area.cc:799
inet::ospfv3::Ospfv3Area::getCurrentInterAreaPrefixSequence
uint32_t getCurrentInterAreaPrefixSequence()
Definition: Ospfv3Area.h:107
inet::ospfv3::Ospfv3Area::interAreaPrefixLSASequenceNumber
uint32_t interAreaPrefixLSASequenceNumber
Definition: Ospfv3Area.h:206
inet::ospfv3::Ospfv3Ipv4RoutingTableEntry::TYPE2_EXTERNAL
@ TYPE2_EXTERNAL
Definition: Ospfv3RoutingTableEntry.h:84
inet::ospfv3::Ospfv3Area::IPv4areaAddressRanges
std::vector< Ipv4AddressRange > IPv4areaAddressRanges
Definition: Ospfv3Area.h:180
inet::ospfv3::isSameNetwork
bool isSameNetwork(Ipv6Address address1, int prefixLen1, Ipv6Address address2, int prefixLen2)
Definition: Ospfv3Common.h:145
inet::ospfv3::NULL_IPV6ADDRESSRANGE
const Ipv6AddressRange NULL_IPV6ADDRESSRANGE(Ipv6Address(0, 0, 0, 0), 0)
inet::ospfv3::Ospfv3Area::areaType
Ospfv3AreaType areaType
Definition: Ospfv3Area.h:174
inet::ospfv3::Ospfv3Ipv4RoutingTableEntry::AS_BOUNDARY_ROUTER_DESTINATION
static const unsigned char AS_BOUNDARY_ROUTER_DESTINATION
Definition: Ospfv3RoutingTableEntry.h:92
inet::units::values::m
value< double, units::m > m
Definition: Units.h:1233
inet::ospfv3::OSPFV3_LSA_PREFIX_HEADER_LENGTH
const B OSPFV3_LSA_PREFIX_HEADER_LENGTH
Definition: Ospfv3Common.h:77
inet::ospfv3::Ospfv3Area::hasAddressRange
bool hasAddressRange(Ipv6AddressRange addressRange) const
Definition: Ospfv3Area.cc:1933
inet::ospfv3::Ospfv3Area::networkLSADiffersFrom
bool networkLSADiffersFrom(Ospfv3NetworkLsa *currentLsa, const Ospfv3NetworkLsa *newLsa)
Definition: Ospfv3Area.cc:1061
LS_REFRESH_TIME
#define LS_REFRESH_TIME
Definition: Ospfv2Common.h:24
inet::ospfv3::ROUTER_LSA
@ ROUTER_LSA
Definition: Ospfv3Packet_m.h:396
inet::ospfv3::Ospfv3Area::routerLSAList
std::vector< RouterLSA * > routerLSAList
Definition: Ospfv3Area.h:197
inet::ospfv3::Ospfv3Area::intraAreaPrefixLSADiffersFrom
bool intraAreaPrefixLSADiffersFrom(Ospfv3IntraAreaPrefixLsa *currentLsa, const Ospfv3IntraAreaPrefixLsa *newLsa)
Definition: Ospfv3Area.cc:1752
inet::ospfv3::Ospfv3Area::getAreaID
Ipv4Address getAreaID() const
Definition: Ospfv3Area.h:32
inet::ospfv3::Ospfv3Area::incrementRouterSequence
void incrementRouterSequence()
Definition: Ospfv3Area.h:73
inet::ospfv3::Ospfv3Area::updateIntraAreaPrefixLSA
bool updateIntraAreaPrefixLSA(IntraAreaPrefixLSA *currentLsa, const Ospfv3IntraAreaPrefixLsa *newLsa)
Definition: Ospfv3Area.cc:1738
inet::ospfv3::Ospfv3Area::getCurrentNetworkSequence
uint32_t getCurrentNetworkSequence()
Definition: Ospfv3Area.h:90
inet::ospfv3::Ospfv3Ipv4RoutingTableEntry::INTERAREA
@ INTERAREA
Definition: Ospfv3RoutingTableEntry.h:82
inet::ospfv3::Ospfv3Area::getIntraAreaPrefixLSACount
int getIntraAreaPrefixLSACount()
Definition: Ospfv3Area.h:116
inet::ospfv3::Ospfv3Area::networkLSAsByID
std::map< Ipv4Address, NetworkLSA * > networkLSAsByID
Definition: Ospfv3Area.h:193
inet::ospfv3::Ospfv3Area::getNewInterAreaPrefixLinkStateID
Ipv4Address getNewInterAreaPrefixLinkStateID()
inet::containsKey
bool containsKey(const std::map< K, V, _C > &m, const Tk &a)
Definition: stlutils.h:80
inet::ospfv3::Ospfv3Area::interfaceById
std::map< int, Ospfv3Interface * > interfaceById
Definition: Ospfv3Area.h:184
inet::ospfv3::Ospfv3Interface::UNKNOWN_TYPE
@ UNKNOWN_TYPE
Definition: Ospfv3Interface.h:51
inet::ospfv3::Ospfv3Neighbor::LOADING_STATE
@ LOADING_STATE
Definition: Ospfv3Neighbor.h:49
inet::ospfv3::Ospfv3Interface::INTERFACE_STATE_DESIGNATED
@ INTERFACE_STATE_DESIGNATED
Definition: Ospfv3Interface.h:33
inet::ospfv3::Ospfv3Area::getIntraAreaPrefixLSA
IntraAreaPrefixLSA * getIntraAreaPrefixLSA(int i)
Definition: Ospfv3Area.h:117
inet::ospfv3::Ospfv3Area::getCurrentRouterSequence
uint32_t getCurrentRouterSequence()
Definition: Ospfv3Area.h:72
inet::ospfv3::Ospfv3Area::getRouterLSACount
int getRouterLSACount()
Definition: Ospfv3Area.h:64