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

#include <Ospfv3Process.h>

Inheritance diagram for inet::ospfv3::Ospfv3Process:

Public Member Functions

 Ospfv3Process ()
 
virtual ~Ospfv3Process ()
 
int getProcessID () const
 
Ipv4Address getRouterID ()
 
bool isActivated ()
 
void activateProcess ()
 
void setTimer (cMessage *msg, double delay)
 
void clearTimer (cMessage *msg)
 
Ospfv3InstancegetInstanceById (int instanceId)
 
void addInstance (Ospfv3Instance *newInstance)
 
void sendPacket (Packet *packet, Ipv6Address destination, const char *ifName, short hopLimit=1)
 
Ospfv3LsafindLSA (LSAKeyType lsaKey, Ipv4Address areaID, int instanceID)
 
bool floodLSA (const Ospfv3Lsa *lsa, Ipv4Address areaID=Ipv4Address::UNSPECIFIED_ADDRESS, Ospfv3Interface *intf=nullptr, Ospfv3Neighbor *neighbor=nullptr)
 
bool installLSA (const Ospfv3Lsa *lsaC, int instanceID, Ipv4Address areaID=Ipv4Address::UNSPECIFIED_ADDRESS, Ospfv3Interface *intf=nullptr)
 
void rebuildRoutingTable ()
 
void calculateASExternalRoutes (std::vector< Ospfv3RoutingTableEntry * > newTableIPv6, std::vector< Ospfv3Ipv4RoutingTableEntry * > newTableIPv4)
 
void ageDatabase ()
 
cMessage * getAgeTimer ()
 
int isInRoutingTable (IIpv4RoutingTable *rtTable, Ipv4Address addr)
 Returns true if one of the Router's Areas the same address range configured as the input address , false otherwise. More...
 
int isInRoutingTable6 (Ipv6RoutingTable *rtTable, Ipv6Address addr)
 
int isInInterfaceTable (IInterfaceTable *ifTable, Ipv4Address addr)
 
int isInInterfaceTable6 (IInterfaceTable *ifTable, Ipv6Address addr)
 
bool hasAddressRange (const Ipv6AddressRange &addressRange) const
 
bool hasAddressRange (const Ipv4AddressRange &addressRange) const
 

Public Attributes

ModuleRefByPar< IInterfaceTableift
 
ModuleRefByPar< Ipv6RoutingTablert6
 
ModuleRefByPar< IIpv4RoutingTablert4
 
opp_component_ptr< cModule > containingModule
 

Protected Member Functions

virtual void initialize (int stage) override
 
virtual void handleMessage (cMessage *msg) override
 
virtual int numInitStages () const override
 
void parseConfig (cXMLElement *areaConfig)
 

Private Member Functions

void handleTimer (cMessage *msg)
 
void debugDump ()
 

Private Attributes

std::vector< Ospfv3Instance * > instances
 
std::map< int, Ospfv3Instance * > instancesById
 
int processID = 0
 
Ipv4Address routerID
 
bool isActive = false
 
std::vector< Ospfv3RoutingTableEntry * > routingTableIPv6
 
std::vector< Ospfv3Ipv4RoutingTableEntry * > routingTableIPv4
 
cMessage * ageTimer = nullptr
 

Constructor & Destructor Documentation

◆ Ospfv3Process()

inet::ospfv3::Ospfv3Process::Ospfv3Process ( )
11 {
12 // this->processID = processID;
13 }

◆ ~Ospfv3Process()

inet::ospfv3::Ospfv3Process::~Ospfv3Process ( )
virtual
16 {
17  long instanceCount = instances.size();
18  for (long i = 0; i < instanceCount; i++) {
19  delete instances[i];
20  }
21  long routeCount = routingTableIPv4.size();
22  for (long k = 0; k < routeCount; k++) {
23  delete routingTableIPv4[k];
24  }
25  routeCount = routingTableIPv6.size();
26  for (long k = 0; k < routeCount; k++) {
27  delete routingTableIPv6[k];
28  }
29 
30  this->clearTimer(ageTimer);
31  delete ageTimer;
32 }

Member Function Documentation

◆ activateProcess()

void inet::ospfv3::Ospfv3Process::activateProcess ( )
660 {
661  Enter_Method("activateProcess");
662  this->isActive = true;
663  cMessage *init = new cMessage();
664  init->setKind(HELLO_TIMER_INIT);
665  scheduleAfter(SIMTIME_ZERO, init);
666 } // activateProcess

◆ addInstance()

void inet::ospfv3::Ospfv3Process::addInstance ( Ospfv3Instance newInstance)
682 {
683  Ospfv3Instance *check = this->getInstanceById(newInstance->getInstanceID());
684  if (check == nullptr) {
685  this->instances.push_back(newInstance);
686  this->instancesById[newInstance->getInstanceID()] = newInstance;
687  }
688 }

Referenced by parseConfig().

◆ ageDatabase()

void inet::ospfv3::Ospfv3Process::ageDatabase ( )
462 {
463  bool shouldRebuildRoutingTable = false;
464 
465  long instanceCount = instances.size();
466  for (long i = 0; i < instanceCount; i++) {
467  long areaCount = instances[i]->getAreaCount();
468 
469  for (long j = 0; j < areaCount; j++)
470  instances[i]->getArea(j)->ageDatabase();
471 
472  if (shouldRebuildRoutingTable)
474  }
475 } // ageDatabase

Referenced by handleTimer().

◆ calculateASExternalRoutes()

void inet::ospfv3::Ospfv3Process::calculateASExternalRoutes ( std::vector< Ospfv3RoutingTableEntry * >  newTableIPv6,
std::vector< Ospfv3Ipv4RoutingTableEntry * >  newTableIPv4 
)
836 {
837  EV_DEBUG << "Calculating AS External Routes (Not ymplemented yet)\n";
838 }

◆ clearTimer()

◆ debugDump()

void inet::ospfv3::Ospfv3Process::debugDump ( )
private
669 {
670  EV_DEBUG << "Process " << this->getProcessID() << "\n";
671  for (auto it = this->instances.begin(); it != this->instances.end(); it++)
672  (*it)->debugDump();
673 } // debugDump

Referenced by handleTimer().

◆ findLSA()

Ospfv3Lsa * inet::ospfv3::Ospfv3Process::findLSA ( LSAKeyType  lsaKey,
Ipv4Address  areaID,
int  instanceID 
)
745 {
746  Ospfv3Instance *instance = this->getInstanceById(instanceID);
747  Ospfv3Area *area = instance->getAreaById(areaID);
748  return area->getLSAbyKey(lsaKey);
749 }

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

◆ floodLSA()

bool inet::ospfv3::Ospfv3Process::floodLSA ( const Ospfv3Lsa lsa,
Ipv4Address  areaID = Ipv4Address::UNSPECIFIED_ADDRESS,
Ospfv3Interface intf = nullptr,
Ospfv3Neighbor neighbor = nullptr 
)
752 {
753  EV_DEBUG << "Flooding LSA from router " << lsa->getHeader().getAdvertisingRouter() << " with ID " << lsa->getHeader().getLinkStateID() << "\n";
754  bool floodedBackOut = false;
755 
756  if (lsa != nullptr) {
757  Ospfv3Instance *instance = interface->getArea()->getInstance();
758  if (lsa->getHeader().getLsaType() == AS_EXTERNAL_LSA) {
759  long areaCount = instance->getAreaCount();
760  for (long i = 0; i < areaCount; i++) {
761  Ospfv3Area *area = instance->getArea(i);
762  if (area->getExternalRoutingCapability()) {
763  if (area->floodLSA(lsa, interface, neighbor)) {
764  floodedBackOut = true;
765  }
766  }
767  }
768  }
769  else {
770  if (Ospfv3Area *area = instance->getAreaById(areaID)) {
771  floodedBackOut = area->floodLSA(lsa, interface, neighbor);
772  }
773  }
774  }
775 
776  return floodedBackOut;
777 }

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

◆ getAgeTimer()

cMessage* inet::ospfv3::Ospfv3Process::getAgeTimer ( )
inline
55 { return this->ageTimer; }

◆ getInstanceById()

Ospfv3Instance * inet::ospfv3::Ospfv3Process::getInstanceById ( int  instanceId)
676 {
677  auto instIt = this->instancesById.find(instanceId);
678  return (instIt == this->instancesById.end()) ? nullptr : instIt->second;
679 }

Referenced by addInstance(), findLSA(), handleMessage(), installLSA(), and parseConfig().

◆ getProcessID()

◆ getRouterID()

◆ handleMessage()

void inet::ospfv3::Ospfv3Process::handleMessage ( cMessage *  msg)
overrideprotectedvirtual
63 {
64  if (msg->isSelfMessage()) {
65  this->handleTimer(msg);
66  }
67  else {
68  Packet *pk = check_and_cast<Packet *>(msg);
69  const auto& packet = pk->peekAtFront<Ospfv3Packet>();
70 
71  auto protocol = pk->getTag<PacketProtocolTag>()->getProtocol(); // check if this is ICMPv6 msg
72  if (protocol == &Protocol::icmpv6) {
73  EV_ERROR << "ICMPv6 error received -- discarding\n";
74  delete msg;
75  }
76 
77  if (packet->getRouterID() == this->getRouterID()) // is it this router who originated the message?
78  delete msg;
79  else {
80  Ospfv3Instance *instance = this->getInstanceById(packet->getInstanceID());
81  if (instance == nullptr) { // Is there an instance with this number?
82  EV_DEBUG << "Instance with this ID not found, dropping\n";
83  delete msg;
84  }
85  else {
86  instance->processPacket(pk);
87  }
88  }
89  }
90 } // handleMessage

◆ handleTimer()

void inet::ospfv3::Ospfv3Process::handleTimer ( cMessage *  msg)
private
509 {
510  switch (msg->getKind()) {
511  case INIT_PROCESS:
512  for (auto it = this->instances.begin(); it != this->instances.end(); it++)
513  (*it)->init();
514 
515  this->debugDump();
516  delete msg;
517  break;
518 
519  case HELLO_TIMER_INIT: // timer set by process, for initialisation of hello msgs
520  case HELLO_TIMER: // timer set by interface every 10 sec
521  {
522  Ospfv3Interface *interface;
523  if (!(interface = reinterpret_cast<Ospfv3Interface *>(msg->getContextPointer()))) {
524  // TODO - Print some error (?)
525  delete msg;
526  }
527  else {
528  EV_DEBUG << "Process received msg, sending event HELLO_TIMER_EVENT\n";
529  interface->processEvent(Ospfv3Interface::HELLO_TIMER_EVENT);
530  }
531  }
532  break;
533 
534  case WAIT_TIMER: {
535  Ospfv3Interface *interface;
536  if (!(interface = reinterpret_cast<Ospfv3Interface *>(msg->getContextPointer()))) {
537  // TODO - Print some error (?)
538  delete msg;
539  }
540  else {
541  EV_DEBUG << "Process received msg, sending event WAIT_TIMER_EVENT\n";
542  interface->processEvent(Ospfv3Interface::WAIT_TIMER_EVENT);
543  }
544  }
545  break;
546 
547  case ACKNOWLEDGEMENT_TIMER: {
548  Ospfv3Interface *intf;
549  if (!(intf = reinterpret_cast<Ospfv3Interface *>(msg->getContextPointer()))) {
550  // should not reach this point
551  EV_INFO << "Discarding invalid InterfaceAcknowledgementTimer.\n";
552  delete msg;
553  }
554  else {
556  }
557  }
558  break;
559 
561  Ospfv3Neighbor *neighbor;
562  if (!(neighbor = reinterpret_cast<Ospfv3Neighbor *>(msg->getContextPointer()))) {
563  // should not reach this point
564  EV_INFO << "Discarding invalid NeighborInactivityTimer.\n";
565  delete msg;
566  }
567  else {
568 // printEvent("Inactivity Timer expired", neighbor->getInterface(), neighbor);
569  neighbor->processEvent(Ospfv3Neighbor::INACTIVITY_TIMER);
570  Ospfv3Interface *intf = neighbor->getInterface();
571  int neighborCnt = intf->getNeighborCount();
572  for (int i = 0; i < neighborCnt; i++) {
573  Ospfv3Neighbor *currNei = intf->getNeighbor(i);
574  if (currNei->getNeighborID() == neighbor->getNeighborID()) {
575  intf->removeNeighborByID(neighbor->getNeighborID());
576  delete neighbor;
577  break;
578  }
579  }
580 
581  intf->processEvent(Ospfv3Interface::NEIGHBOR_CHANGE_EVENT);
582  }
583  }
584  break;
585 
586  case NEIGHBOR_POLL_TIMER: {
587  Ospfv3Neighbor *neighbor;
588  if (!(neighbor = reinterpret_cast<Ospfv3Neighbor *>(msg->getContextPointer()))) {
589  // should not reach this point
590  EV_INFO << "Discarding invalid NeighborInactivityTimer.\n";
591  delete msg;
592  }
593  else {
594 // printEvent("Poll Timer expired", neighbor->getInterface(), neighbor);
595  neighbor->processEvent(Ospfv3Neighbor::POLL_TIMER);
596  }
597  }
598  break;
599 
601  Ospfv3Neighbor *neighbor;
602  if (!(neighbor = reinterpret_cast<Ospfv3Neighbor *>(msg->getContextPointer()))) {
603  // should not reach this point
604  EV_INFO << "Discarding invalid NeighborDDRetransmissionTimer.\n";
605  delete msg;
606  }
607  else {
608 // printEvent("Database Description Retransmission Timer expired", neighbor->getInterface(), neighbor);
609  neighbor->processEvent(Ospfv3Neighbor::DD_RETRANSMISSION_TIMER);
610  }
611  }
612  break;
613 
615  Ospfv3Neighbor *neighbor;
616  if (!(neighbor = reinterpret_cast<Ospfv3Neighbor *>(msg->getContextPointer()))) {
617  // should not reach this point
618  EV_INFO << "Discarding invalid NeighborUpdateRetransmissionTimer.\n";
619  delete msg;
620  }
621  else {
622 // printEvent("Update Retransmission Timer expired", neighbor->getInterface(), neighbor);
623  neighbor->processEvent(Ospfv3Neighbor::UPDATE_RETRANSMISSION_TIMER);
624  }
625  }
626  break;
627 
629  Ospfv3Neighbor *neighbor;
630  if (!(neighbor = reinterpret_cast<Ospfv3Neighbor *>(msg->getContextPointer()))) {
631  // should not reach this point
632  EV_INFO << "Discarding invalid NeighborRequestRetransmissionTimer.\n";
633  delete msg;
634  }
635  else {
636 // printEvent("Request Retransmission Timer expired", neighbor->getInterface(), neighbor);
637  neighbor->processEvent(Ospfv3Neighbor::REQUEST_RETRANSMISSION_TIMER);
638  }
639  }
640  break;
641 
642  case DATABASE_AGE_TIMER: {
643  EV_DEBUG << "Ageing the database\n";
644  this->setTimer(ageTimer, 1.0);
645  this->ageDatabase();
646  }
647  break;
648 
649  default:
650  break;
651  }
652 }

Referenced by handleMessage().

◆ hasAddressRange() [1/2]

bool inet::ospfv3::Ospfv3Process::hasAddressRange ( const Ipv4AddressRange addressRange) const
494 {
495  long instanceCount = instances.size();
496  for (long i = 0; i < instanceCount; i++) {
497  long areaCount = instances[i]->getAreaCount();
498 
499  for (long j = 0; j < areaCount; j++) {
500  if (instances[i]->getArea(j)->hasAddressRange(addressRange)) {
501  return true;
502  }
503  }
504  }
505  return false;
506 }

◆ hasAddressRange() [2/2]

bool inet::ospfv3::Ospfv3Process::hasAddressRange ( const Ipv6AddressRange addressRange) const
479 {
480  long instanceCount = instances.size();
481  for (long i = 0; i < instanceCount; i++) {
482  long areaCount = instances[i]->getAreaCount();
483 
484  for (long j = 0; j < areaCount; j++) {
485  if (instances[i]->getArea(j)->hasAddressRange(addressRange))
486  return true;
487  }
488  }
489  return false;
490 }

Referenced by hasAddressRange().

◆ initialize()

void inet::ospfv3::Ospfv3Process::initialize ( int  stage)
overrideprotectedvirtual
35 {
36  if (stage == INITSTAGE_ROUTING_PROTOCOLS) {
38  ift.reference(this, "interfaceTableModule", true);
39  rt6.reference(this, "routingTableModule6", true);
40  rt4.reference(this, "routingTableModule", false);
41 
42  this->routerID = Ipv4Address(par("routerID").stringValue());
43  this->processID = (int)par("processID");
44  this->parseConfig(par("interfaceConfig"));
45 
46  registerProtocol(Protocol::ospf, gate("splitterOut"), gate("splitterIn"));
47 
48  cMessage *init = new cMessage();
49  init->setKind(INIT_PROCESS);
50  scheduleAfter(OSPFV3_START, init);
51  WATCH_PTRVECTOR(this->instances);
52  WATCH_PTRVECTOR(this->routingTableIPv6);
53  WATCH_PTRVECTOR(this->routingTableIPv4);
54 
55  ageTimer = new cMessage("Ospfv3Process::DatabaseAgeTimer", DATABASE_AGE_TIMER);
56  ageTimer->setContextPointer(this);
57 
58  this->setTimer(ageTimer, 1.0);
59  }
60 }

◆ installLSA()

bool inet::ospfv3::Ospfv3Process::installLSA ( const Ospfv3Lsa lsaC,
int  instanceID,
Ipv4Address  areaID = Ipv4Address::UNSPECIFIED_ADDRESS,
Ospfv3Interface intf = nullptr 
)
780 {
781  EV_DEBUG << "Ospfv3Process::installLSA\n";
782  switch (lsa->getHeader().getLsaType()) {
783  case ROUTER_LSA: {
784  Ospfv3Instance *instance = this->getInstanceById(instanceID);
785  if (Ospfv3Area *area = instance->getAreaById(areaID)) {
786  Ospfv3RouterLsa *ospfRouterLSA = check_and_cast<Ospfv3RouterLsa *>(const_cast<Ospfv3Lsa *>(lsa));
787  return area->installRouterLSA(ospfRouterLSA);
788  }
789  }
790  break;
791 
792  case NETWORK_LSA: {
793  Ospfv3Instance *instance = this->getInstanceById(instanceID);
794  if (Ospfv3Area *area = instance->getAreaById(areaID)) {
795  Ospfv3NetworkLsa *ospfNetworkLSA = check_and_cast<Ospfv3NetworkLsa *>(const_cast<Ospfv3Lsa *>(lsa));
796  return area->installNetworkLSA(ospfNetworkLSA);
797  }
798  }
799  break;
800 
801  case INTER_AREA_PREFIX_LSA: {
802  Ospfv3Instance *instance = this->getInstanceById(instanceID);
803  if (Ospfv3Area *area = instance->getAreaById(areaID)) {
804  Ospfv3InterAreaPrefixLsa *ospfInterAreaLSA = check_and_cast<Ospfv3InterAreaPrefixLsa *>(const_cast<Ospfv3Lsa *>(lsa));
805  return area->installInterAreaPrefixLSA(ospfInterAreaLSA);
806  }
807  }
808  break;
809 
810  case LINK_LSA: {
811  Ospfv3Instance *instance = this->getInstanceById(instanceID);
812  if (Ospfv3Area *area = instance->getAreaById(areaID)) {
813  (void)area; // FIXME set but unused 'area' variable
814  Ospfv3LinkLsa *ospfLinkLSA = check_and_cast<Ospfv3LinkLsa *>(const_cast<Ospfv3Lsa *>(lsa));
815  return intf->installLinkLSA(ospfLinkLSA);
816  }
817  }
818  break;
819 
820  case INTRA_AREA_PREFIX_LSA: {
821  Ospfv3Instance *instance = this->getInstanceById(instanceID);
822  if (Ospfv3Area *area = instance->getAreaById(areaID)) {
823  Ospfv3IntraAreaPrefixLsa *intraLSA = check_and_cast<Ospfv3IntraAreaPrefixLsa *>(const_cast<Ospfv3Lsa *>(lsa));
824  return area->installIntraAreaPrefixLSA(intraLSA);
825  }
826  }
827  break;
828  default:
829  ASSERT(false);
830  break;
831  }
832  return false;
833 }

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

◆ isActivated()

bool inet::ospfv3::Ospfv3Process::isActivated ( )
inline
41 { return this->isActive; };

◆ isInInterfaceTable()

int inet::ospfv3::Ospfv3Process::isInInterfaceTable ( IInterfaceTable ifTable,
Ipv4Address  addr 
)
116 {
117  for (int i = 0; i < ifTable->getNumInterfaces(); i++) {
118  if (auto ipv4Data = ifTable->getInterface(i)->findProtocolData<Ipv4InterfaceData>()) {
119  if (ipv4Data->getIPAddress() == addr)
120  return i;
121  }
122  }
123  return -1;
124 }

Referenced by parseConfig().

◆ isInInterfaceTable6()

int inet::ospfv3::Ospfv3Process::isInInterfaceTable6 ( IInterfaceTable ifTable,
Ipv6Address  addr 
)
127 {
128  for (int i = 0; i < ifTable->getNumInterfaces(); i++) {
129  for (int j = 0; j < ifTable->getInterface(i)->getProtocolData<Ipv6InterfaceData>()->getNumAddresses(); j++) {
130  if (ifTable->getInterface(i)->getProtocolData<Ipv6InterfaceData>()->getAddress(j) == addr) {
131  return i;
132  }
133  }
134  }
135  return -1;
136 }

Referenced by parseConfig().

◆ isInRoutingTable()

int inet::ospfv3::Ospfv3Process::isInRoutingTable ( IIpv4RoutingTable rtTable,
Ipv4Address  addr 
)

Returns true if one of the Router's Areas the same address range configured as the input address , false otherwise.

Parameters
addressRange[in] The IPv6 address to look for.
94 {
95  for (int i = 0; i < rtTable->getNumRoutes(); i++) {
96  const Ipv4Route *entry = rtTable->getRoute(i);
97  if (Ipv4Address::maskedAddrAreEqual(addr, entry->getDestination(), entry->getNetmask())) {
98  return i;
99  }
100  }
101  return -1;
102 }

Referenced by parseConfig().

◆ isInRoutingTable6()

int inet::ospfv3::Ospfv3Process::isInRoutingTable6 ( Ipv6RoutingTable rtTable,
Ipv6Address  addr 
)
105 {
106  for (int i = 0; i < rtTable->getNumRoutes(); i++) {
107  const Ipv6Route *entry = rtTable->getRoute(i);
108  if (addr.getPrefix(entry->getPrefixLength()) == entry->getDestPrefix().getPrefix(entry->getPrefixLength())) {
109  return i;
110  }
111  }
112  return -1;
113 }

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

◆ numInitStages()

virtual int inet::ospfv3::Ospfv3Process::numInitStages ( ) const
inlineoverrideprotectedvirtual
93 { return NUM_INIT_STAGES; }

◆ parseConfig()

void inet::ospfv3::Ospfv3Process::parseConfig ( cXMLElement *  areaConfig)
protected
139 {
140  EV_DEBUG << "Parsing config on process " << this->processID << endl;
141  // Take each interface
142  cXMLElementList intList = interfaceConfig->getElementsByTagName("Interface");
143  for (auto interfaceIt = intList.begin(); interfaceIt != intList.end(); interfaceIt++) {
144  const char *interfaceName = (*interfaceIt)->getAttribute("name");
145  NetworkInterface *myInterface = CHK(ift->findInterfaceByName(interfaceName));
146 
147  if (rt4 != nullptr && myInterface->isLoopback()) {
148  static const Ipv4Address tmpipv4("127.0.0.0");
149 
150  int i = isInRoutingTable(rt4, tmpipv4);
151  if (i != -1) {
152  rt4->deleteRoute(rt4->getRoute(i));
153  }
154  }
155  // interface ipv6 configuration
156  cXMLElementList ipAddrList = (*interfaceIt)->getElementsByTagName("Ipv6Address");
157  for (auto& ipv6Rec : ipAddrList) {
158  const char *addr6c = ipv6Rec->getNodeValue();
159 
160  std::string add6 = addr6c;
161  std::string prefix6 = add6.substr(0, add6.find("/"));
162  auto intfData6 = myInterface->getProtocolDataForUpdate<Ipv6InterfaceData>();
163  int prefLength;
164  Ipv6Address address6;
165  if (!(address6.tryParseAddrWithPrefix(addr6c, prefLength)))
166  throw cRuntimeError("Cannot parse Ipv6 address: '%s", addr6c);
167 
168  address6 = Ipv6Address(prefix6.c_str());
169 
170  Ipv6InterfaceData::AdvPrefix p;
171  p.prefix = address6;
172  p.prefixLength = prefLength;
173 
174  if (isInInterfaceTable6(ift, address6) < 0) {
175  intfData6->assignAddress(address6, false, SIMTIME_ZERO, SIMTIME_ZERO);
176 
177  // add this routes to routing table
178  Ipv6Route *route = new Ipv6Route(p.prefix.getPrefix(prefLength), p.prefixLength, IRoute::IFACENETMASK);
179  route->setInterface(myInterface);
180  route->setExpiryTime(SIMTIME_ZERO);
181  route->setMetric(0);
182  route->setAdminDist(Ipv6Route::dDirectlyConnected);
183 
184  rt6->addRoutingProtocolRoute(route);
185  }
186  }
187 
188  // interface ipv4 configuration
189  bool alreadySet = false;
190 
191  cXMLElementList ipv4AddrList = (*interfaceIt)->getElementsByTagName("IPAddress");
192  if (ipv4AddrList.size() == 1) {
193  if (rt4 == nullptr)
194  throw cRuntimeError("ipv4 routing table required for current config");
195  Ipv4Address addr;
196  Ipv4Address mask;
197  auto intfData = myInterface->getProtocolDataForUpdate<Ipv4InterfaceData>();
198  for (auto& ipv4Rec : ipv4AddrList) {
199  const char *addr4c = ipv4Rec->getNodeValue(); // from string make ipv4 address and store to interface config
200  addr = (Ipv4Address(addr4c));
201  if (isInInterfaceTable(ift, addr) >= 0) { // prevention from seting same interface by second process
202  alreadySet = true;
203  continue;
204  }
205  intfData->setIPAddress(addr);
206  }
207  if (!alreadySet) {
208  cXMLElementList ipv4MaskList = (*interfaceIt)->getElementsByTagName("Mask");
209  if (ipv4MaskList.size() != 1)
210  throw cRuntimeError("Interface %s has more or less than one mask", interfaceName);
211 
212  for (auto& ipv4Rec : ipv4MaskList) {
213  const char *mask4c = ipv4Rec->getNodeValue();
214  mask = (Ipv4Address(mask4c));
215  intfData->setNetmask(mask);
216 
217  // add directly connected ip address to routing table
218  Ipv4Address networkAdd = (Ipv4Address((intfData->getIPAddress()).getInt() & (intfData->getNetmask()).getInt()));
219  Ipv4Route *entry = new Ipv4Route;
220 
221  entry->setDestination(networkAdd);
222  entry->setNetmask(intfData->getNetmask());
223  entry->setInterface(myInterface);
224  entry->setMetric(0);
225  entry->setSourceType(IRoute::IFACENETMASK);
226 
227  rt4->addRoute(entry);
228  }
229  }
230  }
231  else if (ipv4AddrList.size() > 1)
232  throw cRuntimeError("Interface %s has more than one IPv4 address ", interfaceName);
233 
234  const char *routerPriority = nullptr;
235  const char *helloInterval = nullptr;
236  const char *deadInterval = nullptr;
237  const char *interfaceCost = nullptr;
238  const char *interfaceType = nullptr;
239  Ospfv3Interface::Ospfv3InterfaceType interfaceTypeNum;
240  bool passiveInterface = false;
241 
242  cXMLElementList process = (*interfaceIt)->getElementsByTagName("Process");
243  if (process.size() > 2)
244  throw cRuntimeError("More than two processes configured for interface %s", (*interfaceIt)->getAttribute("name"));
245 
246  // Check whether it belongs to this process
247  int processCount = process.size();
248  for (int i = 0; i < processCount; i++) {
249  int procId = atoi(process.at(i)->getAttribute("id"));
250  if (procId != this->processID)
251  continue;
252 
253  EV_DEBUG << "Creating new interface " << interfaceName << " in process " << procId << endl;
254 
255  // Parsing instances
256  cXMLElementList instList = process.at(i)->getElementsByTagName("Instance");
257  for (auto instIt = instList.begin(); instIt != instList.end(); instIt++) {
258  const char *instId = (*instIt)->getAttribute("instanceID");
259  const char *addressFamily = (*instIt)->getAttribute("AF");
260 
261  // Get the router priority for this interface and instance
262  cXMLElementList interfaceOptions = (*instIt)->getElementsByTagName("RouterPriority");
263  if (interfaceOptions.size() > 1)
264  throw cRuntimeError("Multiple router priority is configured for interface %s", interfaceName);
265 
266  if (interfaceOptions.size() != 0)
267  routerPriority = interfaceOptions.at(0)->getNodeValue();
268 
269  // get the hello interval for this interface and instance
270  interfaceOptions = (*instIt)->getElementsByTagName("HelloInterval");
271  if (interfaceOptions.size() > 1)
272  throw cRuntimeError("Multiple HelloInterval value is configured for interface %s", interfaceName);
273 
274  if (interfaceOptions.size() != 0)
275  helloInterval = interfaceOptions.at(0)->getNodeValue();
276 
277  // get the dead interval for this interface and instance
278  interfaceOptions = (*instIt)->getElementsByTagName("DeadInterval");
279  if (interfaceOptions.size() > 1)
280  throw cRuntimeError("Multiple DeadInterval value is configured for interface %s", interfaceName);
281 
282  if (interfaceOptions.size() != 0)
283  deadInterval = interfaceOptions.at(0)->getNodeValue();
284 
285  // get the interface cost for this interface and instance
286  interfaceOptions = (*instIt)->getElementsByTagName("InterfaceCost");
287  if (interfaceOptions.size() > 1)
288  throw cRuntimeError("Multiple InterfaceCost value is configured for interface %s", interfaceName);
289 
290  if (interfaceOptions.size() != 0)
291  interfaceCost = interfaceOptions.at(0)->getNodeValue();
292 
293  // get the interface cost for this interface and instance
294  interfaceOptions = (*instIt)->getElementsByTagName("InterfaceType");
295  if (interfaceOptions.size() > 1)
296  throw cRuntimeError("Multiple InterfaceType value is configured for interface %s", interfaceName);
297 
298  if (interfaceOptions.size() != 0) {
299  interfaceType = interfaceOptions.at(0)->getNodeValue();
300  if (strcmp(interfaceType, "Broadcast") == 0)
301  interfaceTypeNum = Ospfv3Interface::BROADCAST_TYPE;
302  else if (strcmp(interfaceType, "PointToPoint") == 0)
303  interfaceTypeNum = Ospfv3Interface::POINTTOPOINT_TYPE;
304  else if (strcmp(interfaceType, "NBMA") == 0)
305  interfaceTypeNum = Ospfv3Interface::NBMA_TYPE;
306  else if (strcmp(interfaceType, "PointToMultipoint") == 0)
307  interfaceTypeNum = Ospfv3Interface::POINTTOMULTIPOINT_TYPE;
308  else if (strcmp(interfaceType, "Virtual") == 0)
309  interfaceTypeNum = Ospfv3Interface::VIRTUAL_TYPE;
310  else
311  interfaceTypeNum = Ospfv3Interface::UNKNOWN_TYPE;
312  }
313  else
314  throw cRuntimeError("Interface type needs to be specified for interface %s", interfaceName);
315 
316  // find out whether the interface is passive
317  interfaceOptions = (*instIt)->getElementsByTagName("PassiveInterface");
318  if (interfaceOptions.size() > 1)
319  throw cRuntimeError("Multiple PassiveInterface value is configured for interface %s", interfaceName);
320 
321  if (interfaceOptions.size() != 0) {
322  if (strcmp(interfaceOptions.at(0)->getNodeValue(), "True") == 0)
323  passiveInterface = true;
324  }
325 
326  int instIdNum;
327 
328  if (instId == nullptr) {
329  EV_DEBUG << "Address Family " << addressFamily << endl;
330  if (strcmp(addressFamily, "IPv4") == 0) {
331  EV_DEBUG << "IPv4 instance\n";
332  instIdNum = DEFAULT_IPV4_INSTANCE;
333  }
334  else if (strcmp(addressFamily, "IPv6") == 0) {
335  EV_DEBUG << "IPv6 instance\n";
336  instIdNum = DEFAULT_IPV6_INSTANCE;
337  }
338  else
339  throw cRuntimeError("Unknown address family in process %d", this->getProcessID());
340  }
341  else
342  instIdNum = atoi(instId);
343 
344  // TODO - check range of instance ID.
345  // check for multiple definition of one instance
346  Ospfv3Instance *instance = this->getInstanceById(instIdNum);
347 // if (instance != nullptr)
348 // throw cRuntimeError("Multiple Ospfv3 instance with the same instance ID configured for process %d on interface %s", this->getProcessID(), interfaceName);
349 
350  if (instance == nullptr) {
351  if (strcmp(addressFamily, "IPv4") == 0)
352  instance = new Ospfv3Instance(instIdNum, this, IPV4INSTANCE);
353  else
354  instance = new Ospfv3Instance(instIdNum, this, IPV6INSTANCE);
355 
356  EV_DEBUG << "Adding instance " << instIdNum << " to process " << this->processID << endl;
357  this->addInstance(instance);
358  }
359 
360  // multiarea configuration is not supported
361  cXMLElementList areasList = (*instIt)->getElementsByTagName("Area");
362  for (auto areasIt = areasList.begin(); areasIt != areasList.end(); areasIt++) {
363  const char *areaId = (*areasIt)->getNodeValue();
364  Ipv4Address areaIP = Ipv4Address(areaId);
365  const char *areaType = (*areasIt)->getAttribute("type");
367 
368  if (areaType != nullptr) {
369  if (strcmp(areaType, "stub") == 0)
370  type = STUB;
371  else if (strcmp(areaType, "nssa") == 0)
372  type = NSSA;
373  }
374 
375  const char *summary = (*areasIt)->getAttribute("summary");
376 
377  if (summary != nullptr) {
378  if (strcmp(summary, "no") == 0) {
379  if (type == STUB)
381  else if (type == NSSA)
383  }
384  }
385 
386  // insert area if it's not already there and assign this interface
387  Ospfv3Area *area;
388  if (!(instance->hasArea(areaIP))) {
389  area = new Ospfv3Area(areaIP, instance, type);
390  instance->addArea(area);
391  }
392  else
393  area = instance->getAreaById(areaIP);
394 
395  if (!area->hasInterface(std::string(interfaceName))) {
396  Ospfv3Interface *newInterface = new Ospfv3Interface(interfaceName, this->containingModule, this, interfaceTypeNum, passiveInterface);
397  if (helloInterval != nullptr)
398  newInterface->setHelloInterval(atoi(helloInterval));
399 
400  if (deadInterval != nullptr)
401  newInterface->setDeadInterval(atoi(deadInterval));
402 
403  if (interfaceCost != nullptr)
404  newInterface->setInterfaceCost(atoi(interfaceCost));
405 
406  if (routerPriority != nullptr) {
407  int rtrPrio = atoi(routerPriority);
408  if (rtrPrio < 0 || rtrPrio > 255)
409  throw cRuntimeError("Router priority out of range on interface %s", interfaceName);
410 
411  newInterface->setRouterPriority(rtrPrio);
412  }
413 
414  newInterface->setArea(area);
415 
416  cXMLElementList ipAddrList = (*interfaceIt)->getElementsByTagName("Ipv6Address");
417  for (auto& ipv6Rec : ipAddrList) {
418  const char *addr6c = ipv6Rec->getNodeValue();
419  std::string add6 = addr6c;
420  std::string prefix6 = add6.substr(0, add6.find("/"));
421  int prefLength;
422  Ipv6Address address6;
423  if (!(address6.tryParseAddrWithPrefix(addr6c, prefLength)))
424  throw cRuntimeError("Cannot parse Ipv6 address: '%s", addr6c);
425 
426  address6 = Ipv6Address(prefix6.c_str());
427 
428  Ipv6AddressRange ipv6addRange; // add directly networks into addressRange for given area
429  ipv6addRange.prefix = address6; // add only network prefix
430  ipv6addRange.prefixLength = prefLength;
431  area->addAddressRange(ipv6addRange, true);
432  // TODO Address added into Adressrange have Advertise always set to true. Exclude link-local (?)
433  }
434  cXMLElementList ipv4AddrList = (*interfaceIt)->getElementsByTagName("IPAddress");
435  if (ipv4AddrList.size() == 1) {
436  Ipv4AddressRange ipv4addRange; // also create addressRange for IPv4
437  for (auto& ipv4Rec : ipv4AddrList) {
438  const char *addr4c = ipv4Rec->getNodeValue(); // from string make ipv4 address and store to interface config
439  ipv4addRange.address = Ipv4Address(addr4c);
440  }
441 
442  cXMLElementList ipv4MaskList = (*interfaceIt)->getElementsByTagName("Mask");
443  if (ipv4MaskList.size() != 1)
444  throw cRuntimeError("Interface %s has more or less than one mask", interfaceName);
445 
446  for (auto& ipv4Rec : ipv4MaskList) {
447  const char *mask4c = ipv4Rec->getNodeValue();
448  ipv4addRange.mask = Ipv4Address(mask4c);
449  }
450  area->addAddressRange(ipv4addRange, true);
451  }
452  EV_DEBUG << "I am " << this->getOwner()->getOwner()->getName() << " on int " << newInterface->getInterfaceLLIP() << " with area " << area->getAreaID() << "\n";
453  area->addInterface(newInterface);
454  }
455  }
456  }
457  }
458  }
459 } // parseConfig

Referenced by initialize().

◆ rebuildRoutingTable()

void inet::ospfv3::Ospfv3Process::rebuildRoutingTable ( )
841 {
842  unsigned long instanceCount = this->instances.size();
843  std::vector<Ospfv3RoutingTableEntry *> newTableIPv6;
844  std::vector<Ospfv3Ipv4RoutingTableEntry *> newTableIPv4;
845 
846  for (unsigned int k = 0; k < instanceCount; k++) {
847  Ospfv3Instance *currInst = this->instances.at(k);
848  unsigned long areaCount = currInst->getAreaCount();
849  bool hasTransitAreas = false;
850  (void)hasTransitAreas; // FIXME set but not used variable
851  unsigned long i;
852 
853  EV_INFO << "Rebuilding routing table for instance " << this->instances.at(k)->getInstanceID() << ":\n";
854 
855  // 2) Intra area routes are calculated using SPF algo
856  for (i = 0; i < areaCount; i++) {
857  currInst->getArea(i)->calculateShortestPathTree(newTableIPv6, newTableIPv4);
858  if (currInst->getArea(i)->getTransitCapability()) {
859  hasTransitAreas = true;
860  }
861  }
862  // 3) Inter-area routes are calculated by examining summary-LSAs (on backbone only)
863  if (areaCount > 1) {
864  Ospfv3Area *backbone = currInst->getAreaById(BACKBONE_AREAID);
865  if (backbone != nullptr) {
866  backbone->calculateInterAreaRoutes(newTableIPv6, newTableIPv4);
867  }
868  }
869  else {
870  if (areaCount == 1) {
871  currInst->getArea(0)->calculateInterAreaRoutes(newTableIPv6, newTableIPv4);
872  }
873  }
874 
875  // 4) On BDR - Transit area LSAs(summary) are examined - find better paths then in 2) and 3) TODO - this part of protocol is not supported yet
876  /* if (hasTransitAreas) {
877  for (i = 0; i < areaCount; i++) {
878  if (currInst->getArea(i)->getTransitCapability()) {
879  if (currInst->getAddressFamily() == IPV6INSTANCE)
880  currInst->getArea(i)->recheckInterAreaPrefixLSAs(newTableIPv6);
881  else //IPV4INSTACE
882  currInst->getArea(i)->recheckInterAreaPrefixLSAs(newTableIPv4);
883  }
884  }
885  }*/
886 
887  //5) Routes to external destinations are calculated TODO - this part of protocol is not supported yet
888 // calculateASExternalRoutes(newTableIPv6, newTableIPv4);
889 
890  // backup the routing table
891  unsigned long routeCount = routingTableIPv6.size();
892  std::vector<Ospfv3RoutingTableEntry *> oldTableIPv6;
893  std::vector<Ospfv3Ipv4RoutingTableEntry *> oldTableIPv4;
894 
895  if (currInst->getAddressFamily() == IPV6INSTANCE) {
896  // IPv6 AF should not clear IPv4 Routing table and vice versa
897  oldTableIPv6.assign(routingTableIPv6.begin(), routingTableIPv6.end());
898  routingTableIPv6.clear();
899  routingTableIPv6.assign(newTableIPv6.begin(), newTableIPv6.end());
900 
901  std::vector<Ipv6Route *> eraseEntriesIPv6;
902  unsigned long routingEntryNumber = rt6->getNumRoutes();
903  // remove entries from the IPv6 routing table inserted by the OSPF module
904  for (i = 0; i < routingEntryNumber; i++) {
905  Ipv6Route *entry = rt6->getRoute(i);
906  if (entry->getSourceType() == IRoute::OSPF)
907  eraseEntriesIPv6.push_back(entry);
908  }
909  unsigned int eraseCount = eraseEntriesIPv6.size();
910  for (i = 0; i < eraseCount; i++) {
911  rt6->deleteRoute(eraseEntriesIPv6[i]);
912  }
913  }
914  else {
915  if (rt4 == nullptr)
916  throw cRuntimeError("ipv4 routing table required");
917  oldTableIPv4.assign(routingTableIPv4.begin(), routingTableIPv4.end());
918  routingTableIPv4.clear();
919  routingTableIPv4.assign(newTableIPv4.begin(), newTableIPv4.end());
920 
921  std::vector<Ipv4Route *> eraseEntriesIPv4;
922  unsigned long routingEntryNumber = rt4->getNumRoutes();
923  // remove entries from the IPv4 routing table inserted by the OSPF module
924  for (i = 0; i < routingEntryNumber; i++) {
925  Ipv4Route *entry = rt4->getRoute(i);
926  if (entry->getSourceType() == IRoute::OSPF)
927  eraseEntriesIPv4.push_back(entry);
928  }
929  unsigned int eraseCount = eraseEntriesIPv4.size();
930  for (i = 0; i < eraseCount; i++) {
931  rt4->deleteRoute(eraseEntriesIPv4[i]);
932  }
933  }
934 
935  // add the new routing entries
936  if (currInst->getAddressFamily() == IPV6INSTANCE) {
937  routeCount = routingTableIPv6.size();
938  EV_DEBUG << "rebuild , routeCount - " << routeCount << "\n";
939 
940  for (i = 0; i < routeCount; i++) {
941  if (routingTableIPv6[i]->getDestinationType() == Ospfv3RoutingTableEntry::NETWORK_DESTINATION) {
942  if (routingTableIPv6[i]->getNextHopCount() > 0) {
943  if (routingTableIPv6[i]->getNextHop(0).hopAddress != Ipv6Address::UNSPECIFIED_ADDRESS) {
944  Ipv6Route *route = new Ipv6Route(routingTableIPv6[i]->getDestinationAsGeneric().toIpv6(), routingTableIPv6[i]->getPrefixLength(), routingTableIPv6[i]->getSourceType());
945  route->setNextHop(routingTableIPv6[i]->getNextHop(0).hopAddress);
946  route->setMetric(routingTableIPv6[i]->getMetric());
947  route->setInterface(routingTableIPv6[i]->getInterface());
948  route->setExpiryTime(routingTableIPv6[i]->getExpiryTime());
949  route->setAdminDist(Ipv6Route::dOSPF);
950 
951  rt6->addRoutingProtocolRoute(route);
952  }
953  }
954  }
955  }
956 
957  routeCount = oldTableIPv6.size();
958  for (i = 0; i < routeCount; i++)
959  delete oldTableIPv6[i];
960  }
961  else {
962  if (rt4 == nullptr)
963  throw cRuntimeError("ipv4 routing table required");
964  routeCount = routingTableIPv4.size();
965  for (i = 0; i < routeCount; i++) {
966  if (routingTableIPv4[i]->getDestinationType() == Ospfv3Ipv4RoutingTableEntry::NETWORK_DESTINATION) {
967  if (routingTableIPv4[i]->getNextHopCount() > 0) {
968  if (routingTableIPv4[i]->getNextHop(0).hopAddress != Ipv4Address::UNSPECIFIED_ADDRESS) {
969  Ipv4Route *route = new Ipv4Route();
970  route->setDestination(routingTableIPv4[i]->getDestinationAsGeneric().toIpv4());
971  route->setNetmask(route->getDestination().makeNetmask(routingTableIPv4[i]->getPrefixLength()));
972  route->setSourceType(routingTableIPv4[i]->getSourceType());
973  route->setNextHop(routingTableIPv4[i]->getNextHop(0).hopAddress);
974  route->setMetric(routingTableIPv4[i]->getMetric());
975  route->setInterface(routingTableIPv4[i]->getInterface());
976  route->setAdminDist((Ipv4Route::dOSPF));
977  rt4->addRoute(route);
978  }
979  }
980  }
981  }
982 
983  routeCount = oldTableIPv4.size();
984  for (i = 0; i < routeCount; i++)
985  delete oldTableIPv4[i];
986  }
987 
988  if (currInst->getAddressFamily() == IPV6INSTANCE) {
989  EV_INFO << "Routing table was rebuilt.\n"
990  << "Results (IPv6):\n";
991 
992  routeCount = routingTableIPv6.size();
993  for (i = 0; i < routeCount; i++)
994  EV_INFO << *routingTableIPv6[i] << "\n";
995  }
996  else { // IPV4INSTANCE
997  EV_INFO << "Routing table was rebuilt.\n"
998  << "Results (IPv4):\n";
999 
1000  routeCount = routingTableIPv6.size();
1001  for (i = 0; i < routeCount; i++)
1002  EV_INFO << *routingTableIPv4[i] << "\n";
1003  }
1004  }
1005 } // end of rebuildRoutingTable

Referenced by ageDatabase(), inet::ospfv3::Ospfv3NeighborState::changeState(), inet::ospfv3::Ospfv3InterfaceState::changeState(), inet::ospfv3::Ospfv3Interface::processHelloPacket(), and inet::ospfv3::Ospfv3Interface::processLSU().

◆ sendPacket()

void inet::ospfv3::Ospfv3Process::sendPacket ( Packet packet,
Ipv6Address  destination,
const char *  ifName,
short  hopLimit = 1 
)
691 {
692  NetworkInterface *ie = CHK(this->ift->findInterfaceByName(ifName));
693  const auto& ipv6int = ie->getProtocolData<Ipv6InterfaceData>();
694 
695  packet->addTagIfAbsent<PacketProtocolTag>()->setProtocol(&Protocol::ospf);
696  packet->addTagIfAbsent<InterfaceReq>()->setInterfaceId(ie->getInterfaceId());
697  packet->addTagIfAbsent<L3AddressReq>()->setDestAddress(destination);
698  packet->addTagIfAbsent<L3AddressReq>()->setSrcAddress(ipv6int->getLinkLocalAddress());
699  packet->addTagIfAbsent<HopLimitReq>()->setHopLimit(hopLimit);
700  const auto& ospfPacket = packet->peekAtFront<Ospfv3Packet>();
701 
702  switch (ospfPacket->getType()) {
703  case ospf::HELLO_PACKET: {
704  packet->setName("Ospfv3_HelloPacket");
705 // const auto& helloPacket = packet->peekAtFront<Ospfv3HelloPacket>();
706 // printHelloPacket(helloPacket.get(), destination, outputIfIndex);
707  }
708  break;
710  packet->setName("Ospfv3_DDPacket");
711 // const auto& ddPacket = packet->peekAtFront<Ospfv3DatabaseDescription>();
712 // printDatabaseDescriptionPacket(ddPacket.get(), destination, outputIfIndex);
713  }
714  break;
715 
717  packet->setName("Ospfv3_LSRPacket");
718 // const auto& requestPacket = packet->peekAtFront<Ospfv3LinkStateRequest>();
719 // printLinkStateRequestPacket(requestPacket.get(), destination, outputIfIndex);
720  }
721  break;
722 
724  packet->setName("Ospfv3_LSUPacket");
725 // const auto& updatePacket = packet->peekAtFront<Ospfv3LsUpdate>();
726 // printLinkStateUpdatePacket(updatePacket.get(), destination, outputIfIndex);
727  }
728  break;
729 
731  packet->setName("Ospfv3_LSAckPacket");
732 // const auto& ackPacket = packet->peekAtFront<Ospfv3LsAck>();
733 // printLinkStateAcknowledgementPacket(ackPacket.get(), destination, outputIfIndex);
734  }
735  break;
736 
737  default:
738  break;
739  }
740  packet->addTagIfAbsent<DispatchProtocolReq>()->setProtocol(&Protocol::ipv6);
741  this->send(packet, "splitterOut");
742 } // sendPacket

Referenced by inet::ospfv3::Ospfv3Interface::acknowledgeLSA(), inet::ospfv3::Ospfv3Interface::floodLSA(), inet::ospfv3::Ospfv3NeighborStateDown::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::Ospfv3Neighbor::retransmitDatabaseDescriptionPacket(), inet::ospfv3::Ospfv3Neighbor::retransmitUpdatePacket(), inet::ospfv3::Ospfv3Neighbor::sendDDPacket(), inet::ospfv3::Ospfv3Interface::sendDelayedAcknowledgements(), inet::ospfv3::Ospfv3Neighbor::sendLinkStateRequestPacket(), and inet::ospfv3::Ospfv3Interface::sendLSAcknowledgement().

◆ setTimer()

Member Data Documentation

◆ ageTimer

cMessage* inet::ospfv3::Ospfv3Process::ageTimer = nullptr
private

◆ containingModule

opp_component_ptr<cModule> inet::ospfv3::Ospfv3Process::containingModule

Referenced by initialize(), and parseConfig().

◆ ift

◆ instances

std::vector<Ospfv3Instance *> inet::ospfv3::Ospfv3Process::instances
private

◆ instancesById

std::map<int, Ospfv3Instance *> inet::ospfv3::Ospfv3Process::instancesById
private

Referenced by addInstance(), and getInstanceById().

◆ isActive

bool inet::ospfv3::Ospfv3Process::isActive = false
private

Referenced by activateProcess().

◆ processID

int inet::ospfv3::Ospfv3Process::processID = 0
private

Referenced by initialize(), and parseConfig().

◆ routerID

Ipv4Address inet::ospfv3::Ospfv3Process::routerID
private

Referenced by initialize().

◆ routingTableIPv4

std::vector<Ospfv3Ipv4RoutingTableEntry *> inet::ospfv3::Ospfv3Process::routingTableIPv4
private

◆ routingTableIPv6

std::vector<Ospfv3RoutingTableEntry *> inet::ospfv3::Ospfv3Process::routingTableIPv6
private

◆ rt4

ModuleRefByPar<IIpv4RoutingTable> inet::ospfv3::Ospfv3Process::rt4

◆ rt6


The documentation for this class was generated from the following files:
CHK
#define CHK(x)
Definition: INETDefs.h:87
inet::findContainingNode
cModule * findContainingNode(const cModule *from)
Find the node containing the given module.
Definition: ModuleAccess.cc:31
inet::ospfv3::Ospfv3Process::isInRoutingTable
int isInRoutingTable(IIpv4RoutingTable *rtTable, Ipv4Address addr)
Returns true if one of the Router's Areas the same address range configured as the input address ,...
Definition: Ospfv3Process.cc:93
inet::ospfv3::Ospfv3Interface::NEIGHBOR_CHANGE_EVENT
@ NEIGHBOR_CHANGE_EVENT
Definition: Ospfv3Interface.h:42
inet::ospf::LINKSTATE_ACKNOWLEDGEMENT_PACKET
@ LINKSTATE_ACKNOWLEDGEMENT_PACKET
Definition: OspfPacketBase_m.h:69
inet::ospfv3::HELLO_TIMER_INIT
@ HELLO_TIMER_INIT
Definition: Ospfv3Timers.h:18
inet::ospfv3::Ospfv3Process::debugDump
void debugDump()
Definition: Ospfv3Process.cc:668
inet::ospfv3::Ospfv3Interface::NBMA_TYPE
@ NBMA_TYPE
Definition: Ospfv3Interface.h:54
inet::ospfv3::Ospfv3Process::parseConfig
void parseConfig(cXMLElement *areaConfig)
Definition: Ospfv3Process.cc:138
inet::ospfv3::Ospfv3Interface::BROADCAST_TYPE
@ BROADCAST_TYPE
Definition: Ospfv3Interface.h:53
protocol
removed DscpReq Ipv4ControlInfo Ipv6ControlInfo up L3AddressInd DispatchProtocolReq L4PortInd Ipv4ControlInfo Ipv6ControlInfo down protocol
Definition: IUdp-gates.txt:25
inet::ospfv3::NSSA
@ NSSA
Definition: Ospfv3Area.h:23
inet::ospfv3::Ospfv3Interface::Ospfv3InterfaceType
Ospfv3InterfaceType
Definition: Ospfv3Interface.h:50
inet::ospf::LINKSTATE_REQUEST_PACKET
@ LINKSTATE_REQUEST_PACKET
Definition: OspfPacketBase_m.h:67
inet::Ipv6Route::dDirectlyConnected
@ dDirectlyConnected
Definition: Ipv6Route.h:30
inet::ospfv3::Ospfv3Process::instancesById
std::map< int, Ospfv3Instance * > instancesById
Definition: Ospfv3Process.h:81
inet::Protocol::ipv6
static const Protocol ipv6
Definition: Protocol.h:94
inet::ospfv3::Ospfv3Process::routerID
Ipv4Address routerID
Definition: Ospfv3Process.h:83
inet::ospfv3::Ospfv3Process::containingModule
opp_component_ptr< cModule > containingModule
Definition: Ospfv3Process.h:74
inet::ospfv3::NEIGHBOR_UPDATE_RETRANSMISSION_TIMER
@ NEIGHBOR_UPDATE_RETRANSMISSION_TIMER
Definition: Ospfv3Timers.h:14
inet::ospfv3::NEIGHBOR_REQUEST_RETRANSMISSION_TIMER
@ NEIGHBOR_REQUEST_RETRANSMISSION_TIMER
Definition: Ospfv3Timers.h:15
InterfaceReq
removed InterfaceReq
Definition: IUdp-gates.txt:11
inet::ospfv3::Ospfv3Process::ift
ModuleRefByPar< IInterfaceTable > ift
Definition: Ospfv3Process.h:71
inet::ospfv3::Ospfv3Process::handleTimer
void handleTimer(cMessage *msg)
Definition: Ospfv3Process.cc:508
DispatchProtocolReq
removed DscpReq Ipv4ControlInfo Ipv6ControlInfo up L3AddressInd DispatchProtocolReq L4PortInd Ipv4ControlInfo Ipv6ControlInfo down DispatchProtocolReq
Definition: IUdp-gates.txt:25
inet::ospfv3::HELLO_TIMER
@ HELLO_TIMER
Definition: Ospfv3Timers.h:9
inet::ospfv3::NSSA_TOTALLY_STUB
@ NSSA_TOTALLY_STUB
Definition: Ospfv3Area.h:24
inet::ospfv3::Ospfv3Neighbor::INACTIVITY_TIMER
@ INACTIVITY_TIMER
Definition: Ospfv3Neighbor.h:34
inet::ospfv3::Ospfv3Process::addInstance
void addInstance(Ospfv3Instance *newInstance)
Definition: Ospfv3Process.cc:681
inet::ospfv3::INTRA_AREA_PREFIX_LSA
@ INTRA_AREA_PREFIX_LSA
Definition: Ospfv3Packet_m.h:404
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::ospf::HELLO_PACKET
@ HELLO_PACKET
Definition: OspfPacketBase_m.h:65
inet::Ipv6Route::dOSPF
@ dOSPF
Definition: Ipv6Route.h:36
inet::ospfv3::Ospfv3Process::getProcessID
int getProcessID() const
Definition: Ospfv3Process.h:39
inet::IRoute::dOSPF
@ dOSPF
Definition: IRoute.h:67
inet::ospfv3::ACKNOWLEDGEMENT_TIMER
@ ACKNOWLEDGEMENT_TIMER
Definition: Ospfv3Timers.h:16
inet::ospfv3::Ospfv3Process::hasAddressRange
bool hasAddressRange(const Ipv6AddressRange &addressRange) const
Definition: Ospfv3Process.cc:478
inet::ospf::LINKSTATE_UPDATE_PACKET
@ LINKSTATE_UPDATE_PACKET
Definition: OspfPacketBase_m.h:68
inet::ospfv3::LINK_LSA
@ LINK_LSA
Definition: Ospfv3Packet_m.h:403
IPV4INSTANCE
#define IPV4INSTANCE
Definition: Ospfv3Common.h:20
PacketProtocolTag
removed DscpReq Ipv4ControlInfo Ipv6ControlInfo up L3AddressInd DispatchProtocolReq L4PortInd Ipv4ControlInfo Ipv6ControlInfo down PacketProtocolTag
Definition: IUdp-gates.txt:25
inet::ospfv3::Ospfv3Neighbor::UPDATE_RETRANSMISSION_TIMER
@ UPDATE_RETRANSMISSION_TIMER
Definition: Ospfv3Neighbor.h:38
inet::ospfv3::BACKBONE_AREAID
const Ipv4Address BACKBONE_AREAID(0, 0, 0, 0)
inet::ospfv3::Ospfv3Process::isInInterfaceTable6
int isInInterfaceTable6(IInterfaceTable *ifTable, Ipv6Address addr)
Definition: Ospfv3Process.cc:126
inet::ospfv3::Ospfv3AreaType
Ospfv3AreaType
Definition: Ospfv3Area.h:19
inet::ospfv3::Ospfv3Interface::HELLO_TIMER_EVENT
@ HELLO_TIMER_EVENT
Definition: Ospfv3Interface.h:45
inet::ospfv3::Ospfv3Process::instances
std::vector< Ospfv3Instance * > instances
Definition: Ospfv3Process.h:80
inet::ospfv3::Ospfv3Process::routingTableIPv4
std::vector< Ospfv3Ipv4RoutingTableEntry * > routingTableIPv4
Definition: Ospfv3Process.h:87
inet::ospfv3::TOTALLY_STUBBY
@ TOTALLY_STUBBY
Definition: Ospfv3Area.h:22
DEFAULT_IPV4_INSTANCE
#define DEFAULT_IPV4_INSTANCE
Definition: Ospfv3Common.h:17
inet::ospfv3::Ospfv3Process::routingTableIPv6
std::vector< Ospfv3RoutingTableEntry * > routingTableIPv6
Definition: Ospfv3Process.h:86
inet::ospfv3::AS_EXTERNAL_LSA
@ AS_EXTERNAL_LSA
Definition: Ospfv3Packet_m.h:400
inet::IRoute::OSPF
@ OSPF
managed by the given routing protocol
Definition: IRoute.h:35
inet::ospfv3::Ospfv3Process::isActive
bool isActive
Definition: Ospfv3Process.h:84
inet::ospfv3::WAIT_TIMER
@ WAIT_TIMER
Definition: Ospfv3Timers.h:10
inet::Ipv6Address::UNSPECIFIED_ADDRESS
static const Ipv6Address UNSPECIFIED_ADDRESS
The unspecified address.
Definition: Ipv6Address.h:54
inet::ospf::DATABASE_DESCRIPTION_PACKET
@ DATABASE_DESCRIPTION_PACKET
Definition: OspfPacketBase_m.h:66
inet::Ipv4Address::maskedAddrAreEqual
static bool maskedAddrAreEqual(const Ipv4Address &addr1, const Ipv4Address &addr2, const Ipv4Address &netmask)
Test if the masked addresses (ie the mask is applied to addr1 and addr2) are equal.
Definition: Ipv4Address.cc:249
inet::ospfv3::Ospfv3Interface::POINTTOMULTIPOINT_TYPE
@ POINTTOMULTIPOINT_TYPE
Definition: Ospfv3Interface.h:55
HopLimitReq
removed HopLimitReq
Definition: IUdp-gates.txt:11
inet::ospfv3::NEIGHBOR_DD_RETRANSMISSION_TIMER
@ NEIGHBOR_DD_RETRANSMISSION_TIMER
Definition: Ospfv3Timers.h:13
type
removed type
Definition: IUdp-gates.txt:7
IPV6INSTANCE
#define IPV6INSTANCE
Definition: Ospfv3Common.h:21
DEFAULT_IPV6_INSTANCE
#define DEFAULT_IPV6_INSTANCE
Definition: Ospfv3Common.h:18
inet::ospfv3::Ospfv3Neighbor::REQUEST_RETRANSMISSION_TIMER
@ REQUEST_RETRANSMISSION_TIMER
Definition: Ospfv3Neighbor.h:39
inet::ospfv3::Ospfv3Interface::POINTTOPOINT_TYPE
@ POINTTOPOINT_TYPE
Definition: Ospfv3Interface.h:52
inet::ospfv3::DATABASE_AGE_TIMER
@ DATABASE_AGE_TIMER
Definition: Ospfv3Timers.h:17
inet::ospfv3::Ospfv3Process::rt4
ModuleRefByPar< IIpv4RoutingTable > rt4
Definition: Ospfv3Process.h:73
inet::ospfv3::INTER_AREA_PREFIX_LSA
@ INTER_AREA_PREFIX_LSA
Definition: Ospfv3Packet_m.h:398
inet::ospfv3::Ospfv3Process::setTimer
void setTimer(cMessage *msg, double delay)
Definition: Ospfv3Process.cc:654
NUM_INIT_STAGES
#define NUM_INIT_STAGES
Definition: InitStageRegistry.h:73
inet::ospfv3::Ospfv3Neighbor::POLL_TIMER
@ POLL_TIMER
Definition: Ospfv3Neighbor.h:35
inet::ospfv3::Ospfv3Interface::ACKNOWLEDGEMENT_TIMER_EVENT
@ ACKNOWLEDGEMENT_TIMER_EVENT
Definition: Ospfv3Interface.h:46
inet::ospfv3::Ospfv3RoutingTableEntry::NETWORK_DESTINATION
static const unsigned char NETWORK_DESTINATION
Definition: Ospfv3RoutingTableEntry.h:29
inet::physicallayer::k
const double k
Definition: Qam1024Modulation.cc:14
inet::ospfv3::NORMAL
@ NORMAL
Definition: Ospfv3Area.h:20
inet::Protocol::icmpv6
static const Protocol icmpv6
Definition: Protocol.h:72
inet::ospfv3::Ospfv3Interface::VIRTUAL_TYPE
@ VIRTUAL_TYPE
Definition: Ospfv3Interface.h:56
inet::Protocol::ospf
static const Protocol ospf
Definition: Protocol.h:102
inet::ospfv3::Ospfv3Process::rt6
ModuleRefByPar< Ipv6RoutingTable > rt6
Definition: Ospfv3Process.h:72
inet::Ipv4Address::UNSPECIFIED_ADDRESS
static const Ipv4Address UNSPECIFIED_ADDRESS
0.0.0.0
Definition: Ipv4Address.h:91
Enter_Method
#define Enter_Method(...)
Definition: SelfDoc.h:71
inet::ospfv3::NEIGHBOR_POLL_TIMER
@ NEIGHBOR_POLL_TIMER
Definition: Ospfv3Timers.h:12
inet::ospfv3::Ospfv3Ipv4RoutingTableEntry::NETWORK_DESTINATION
static const unsigned char NETWORK_DESTINATION
Definition: Ospfv3RoutingTableEntry.h:90
inet::ospfv3::INIT_PROCESS
@ INIT_PROCESS
Definition: Ospfv3Timers.h:8
inet::ospfv3::Ospfv3Interface::WAIT_TIMER_EVENT
@ WAIT_TIMER_EVENT
Definition: Ospfv3Interface.h:40
inet::ospfv3::Ospfv3Process::ageDatabase
void ageDatabase()
Definition: Ospfv3Process.cc:461
inet::ospfv3::Ospfv3Neighbor::DD_RETRANSMISSION_TIMER
@ DD_RETRANSMISSION_TIMER
Definition: Ospfv3Neighbor.h:37
inet::ospfv3::NEIGHBOR_INACTIVITY_TIMER
@ NEIGHBOR_INACTIVITY_TIMER
Definition: Ospfv3Timers.h:11
inet::ospfv3::Ospfv3Process::ageTimer
cMessage * ageTimer
Definition: Ospfv3Process.h:88
inet::ospfv3::Ospfv3Process::isInInterfaceTable
int isInInterfaceTable(IInterfaceTable *ifTable, Ipv4Address addr)
Definition: Ospfv3Process.cc:115
inet::ospfv3::Ospfv3Process::processID
int processID
Definition: Ospfv3Process.h:82
inet::registerProtocol
void registerProtocol(const Protocol &protocol, cGate *gate, ServicePrimitive servicePrimitive)
Registers a protocol primitive (PDU processing) at the given gate.
Definition: IProtocolRegistrationListener.cc:83
inet::ospfv3::ROUTER_LSA
@ ROUTER_LSA
Definition: Ospfv3Packet_m.h:396
inet::ospfv3::Ospfv3Process::clearTimer
void clearTimer(cMessage *msg)
Definition: Ospfv3Process.h:44
inet::IRoute::IFACENETMASK
@ IFACENETMASK
comes from an interface's netmask
Definition: IRoute.h:30
OSPFV3_START
#define OSPFV3_START
Definition: Ospfv3Common.h:11
inet::INITSTAGE_ROUTING_PROTOCOLS
INET_API InitStage INITSTAGE_ROUTING_PROTOCOLS
Initialization of routing protocols.
inet::ospfv3::Ospfv3Interface::UNKNOWN_TYPE
@ UNKNOWN_TYPE
Definition: Ospfv3Interface.h:51
inet::ospfv3::Ospfv3Process::getInstanceById
Ospfv3Instance * getInstanceById(int instanceId)
Definition: Ospfv3Process.cc:675