|
INET Framework for OMNeT++/OMNEST
|
#include <ansaOspfRouter6.h>
Definition at line 28 of file ansaOspfRouter6.h.
| AnsaOspf6::Router::Router | ( | ProcessID | pid, |
| RouterID | id, | ||
| cSimpleModule * | containingModule | ||
| ) |
Constructor. Initializes internal variables, adds a MessageHandler and starts the Database Age timer.
Definition at line 22 of file ansaOspfRouter6.cc.
:
routerID(id),
processID(pid){
messageHandler = new AnsaOspf6::MessageHandler(this, containingModule);
/*
ageTimer = new OspfTimer6;
ageTimer->setTimerKind(DatabaseAgeTimer);
ageTimer->setContextPointer(this);
ageTimer->setName("AnsaOspf6::Router::DatabaseAgeTimer");
messageHandler->StartTimer(ageTimer, 1.0);
*/
}
| AnsaOspf6::Router::~Router | ( | void | ) | [virtual] |
Destructor. Clears all LSA lists and kills the Database Age timer.
Definition at line 40 of file ansaOspfRouter6.cc.
{
long areaCount = areas.size();
for (long i = 0; i < areaCount; i++){
delete areas[i];
}
long lsaCount = asExternalLSAs.size();
for (long j = 0; j < lsaCount; j++){
delete asExternalLSAs[j];
}
long routeCount = routingTable.size();
for (long k = 0; k < routeCount; k++){
delete routingTable[k];
}
/* TODO
messageHandler->ClearTimer(ageTimer);
delete ageTimer;
*/
delete messageHandler;
}
| void AnsaOspf6::Router::AddArea | ( | AnsaOspf6::Area * | area | ) |
Adds a new Area to the Area list.
| area | [in] The Area to add. |
Definition at line 66 of file ansaOspfRouter6.cc.
Referenced by AnsaOspfRouting6::loadInterfaceConfig().
| void AnsaOspf6::Router::AddRoutingTableEntry | ( | RoutingTableEntry * | entry | ) | [inline] |
Definition at line 62 of file ansaOspfRouter6.h.
{ routingTable.push_back(entry); }
| void AnsaOspf6::Router::AgeDatabase | ( | void | ) |
Ages the LSAs in the Router's database. This method is called on every firing of the DatabaseAgeTimer(every second).
Definition at line 311 of file ansaOspfRouter6.cc.
{
}
| AnsaOspf6::AsExternalLsa * AnsaOspf6::Router::FindASExternalLSA | ( | AnsaOspf6::LsaKeyType6 | lsaKey | ) | [private] |
Find the AS External LSA identified by the input lsaKey in the database.
| lsaKey | [in] Look for the AS External LSA which is identified by this key. |
Definition at line 384 of file ansaOspfRouter6.cc.
{
std::map<AnsaOspf6::LsaKeyType6, AnsaOspf6::AsExternalLsa*, AnsaOspf6::LsaKeyType6_Less>
::iterator lsaIt = asExternalLSAsByID.find(lsaKey);
if (lsaIt != asExternalLSAsByID.end()){
return lsaIt->second;
}else{
return NULL;
}
}
| const AnsaOspf6::AsExternalLsa * AnsaOspf6::Router::FindASExternalLSA | ( | AnsaOspf6::LsaKeyType6 | lsaKey | ) | const [private] |
Find the AS External LSA identified by the input lsaKey in the database.
| lsaKey | [in] Look for the AS External LSA which is identified by this key. |
Definition at line 400 of file ansaOspfRouter6.cc.
{
std::map<AnsaOspf6::LsaKeyType6, AnsaOspf6::AsExternalLsa*, AnsaOspf6::LsaKeyType6_Less>
::const_iterator lsaIt = asExternalLSAsByID.find(lsaKey);
if (lsaIt != asExternalLSAsByID.end()){
return lsaIt->second;
}else{
return NULL;
}
}
| OspfLsa6 * AnsaOspf6::Router::FindLSA | ( | LsaType6 | lsaType, |
| AnsaOspf6::LsaKeyType6 | lsaKey, | ||
| AnsaOspf6::AreaID | areaID | ||
| ) |
Definition at line 269 of file ansaOspfRouter6.cc.
{
/*
switch (lsaType){
case RouterLSAType: {
std::map<AnsaOspf6::AreaID, AnsaOspf6::Area*>::iterator areaIt = areasByID.find(areaID);
if (areaIt != areasByID.end()){
return areaIt->second->FindRouterLSA(lsaKey.linkStateID);
}
}
break;
case NetworkLSAType: {
std::map<AnsaOspf6::AreaID, AnsaOspf6::Area*>::iterator areaIt = areasByID.find(areaID);
if (areaIt != areasByID.end()){
return areaIt->second->FindNetworkLSA(lsaKey.linkStateID);
}
}
break;
case SummaryLSA_NetworksType:
case SummaryLSA_ASBoundaryRoutersType: {
std::map<AnsaOspf6::AreaID, AnsaOspf6::Area*>::iterator areaIt = areasByID.find(areaID);
if (areaIt != areasByID.end()){
return areaIt->second->FindSummaryLSA(lsaKey);
}
}
break;
case ASExternalLSAType: {
return FindASExternalLSA(lsaKey);
}
break;
default:
ASSERT(false);
break;
}
return NULL;
*/
}
| bool AnsaOspf6::Router::FloodLSA | ( | OspfLsa6 * | lsa, |
| AnsaOspf6::AreaID | areaID = BackboneAreaID, |
||
| AnsaOspf6::Interface * | intf = NULL, |
||
| AnsaOspf6::Neighbor * | neighbor = NULL |
||
| ) |
Floods out the input lsa on a set of Interfaces.
| lsa | [in] The LSA to be flooded out. |
| areaID | [in] If the lsa is a Router, Network or Summary LSA, then flood it only in this Area. |
| intf | [in] The Interface this LSA arrived on. |
| neighbor | [in] The Nieghbor this LSA arrived from. |
Definition at line 366 of file ansaOspfRouter6.cc.
{
}
Returns the pointer to the Area identified by the input areaID, if it's on the Area list, NULL otherwise.
| areaID | [in] The Area identifier. |
Definition at line 78 of file ansaOspfRouter6.cc.
Referenced by AnsaOspfRouting6::loadInterfaceConfig().
| Area* AnsaOspf6::Router::GetArea | ( | IPv6Address | address | ) |
| AnsaOspf6::Area * AnsaOspf6::Router::GetAreaByIndex | ( | int | index | ) |
Definition at line 87 of file ansaOspfRouter6.cc.
Referenced by operator<<().
| unsigned long AnsaOspf6::Router::GetAreaCount | ( | void | ) | const [inline] |
Definition at line 51 of file ansaOspfRouter6.h.
Referenced by operator<<().
{ return areas.size(); }
| bool AnsaOspf6::Router::GetASBoundaryRouter | ( | void | ) | const [inline] |
Definition at line 58 of file ansaOspfRouter6.h.
{ return (externalRoutes.size() > 0); }
| AsExternalLsa* AnsaOspf6::Router::GetASExternalLSA | ( | unsigned long | i | ) | [inline] |
Definition at line 56 of file ansaOspfRouter6.h.
Referenced by AnsaOspf6::Neighbor::CreateDatabaseSummary().
{ return asExternalLSAs[i]; }
| const AsExternalLsa* AnsaOspf6::Router::GetASExternalLSA | ( | unsigned long | i | ) | const [inline] |
Definition at line 57 of file ansaOspfRouter6.h.
{ return asExternalLSAs[i]; }
| unsigned long AnsaOspf6::Router::GetASExternalLSACount | ( | void | ) | const [inline] |
Definition at line 55 of file ansaOspfRouter6.h.
Referenced by AnsaOspf6::Neighbor::CreateDatabaseSummary().
{ return asExternalLSAs.size(); }
| MessageHandler* AnsaOspf6::Router::GetMessageHandler | ( | void | ) | [inline] |
Definition at line 53 of file ansaOspfRouter6.h.
Referenced by AnsaOspfRouting6::handleMessage(), AnsaOspf6::NeighborStateTwoWay::ProcessEvent(), AnsaOspf6::NeighborStateDown::ProcessEvent(), AnsaOspf6::NeighborStateExchange::ProcessEvent(), AnsaOspf6::NeighborStateExchangeStart::ProcessEvent(), AnsaOspf6::NeighborStateFull::ProcessEvent(), AnsaOspf6::NeighborStateAttempt::ProcessEvent(), AnsaOspf6::NeighborStateLoading::ProcessEvent(), AnsaOspf6::NeighborStateInit::ProcessEvent(), AnsaOspf6::InterfaceStateDesignatedRouter::ProcessEvent(), AnsaOspf6::InterfaceStatePointToPoint::ProcessEvent(), AnsaOspf6::InterfaceStateWaiting::ProcessEvent(), AnsaOspf6::InterfaceStateDown::ProcessEvent(), AnsaOspf6::InterfaceStateNotDesignatedRouter::ProcessEvent(), and AnsaOspf6::InterfaceStateBackup::ProcessEvent().
{ return messageHandler; }
| AnsaOspf6::Interface * AnsaOspf6::Router::GetNonVirtualInterface | ( | unsigned char | ifIndex | ) |
Returns the pointer of the physical Interface identified by the input interface index, NULL if the Router doesn't have such an interface.
| ifIndex | [in] The interface index to look for. |
Definition at line 102 of file ansaOspfRouter6.cc.
Referenced by AnsaOspfRouting6::initialize().
| ProcessID AnsaOspf6::Router::GetProcessID | ( | void | ) | const [inline] |
Definition at line 50 of file ansaOspfRouter6.h.
{ return processID; }
| RouterID AnsaOspf6::Router::GetRouterID | ( | void | ) | const [inline] |
Definition at line 48 of file ansaOspfRouter6.h.
Referenced by AnsaOspf6::InterfaceState::CalculateDesignatedRouter(), and operator<<().
{ return routerID; }
| RoutingTableEntry* AnsaOspf6::Router::GetRoutingTableEntry | ( | unsigned long | i | ) | [inline] |
Definition at line 60 of file ansaOspfRouter6.h.
{ return routingTable[i]; }
| const RoutingTableEntry* AnsaOspf6::Router::GetRoutingTableEntry | ( | unsigned long | i | ) | const [inline] |
Definition at line 61 of file ansaOspfRouter6.h.
{ return routingTable[i]; }
| unsigned long AnsaOspf6::Router::GetRoutingTableEntryCount | ( | void | ) | const [inline] |
Definition at line 59 of file ansaOspfRouter6.h.
{ return routingTable.size(); }
| bool AnsaOspf6::Router::HasAnyNeighborInStates | ( | int | states | ) | const |
Returns true if any Neighbor on any Interface in any of the Router's Areas is in any of the input states, false otherwise.
| states | [in] A bitfield combination of NeighborStateType values. |
Definition at line 320 of file ansaOspfRouter6.cc.
| bool AnsaOspf6::Router::InstallASExternalLSA | ( | OspfAsExternalLsa6 * | lsa | ) | [private] |
Definition at line 375 of file ansaOspfRouter6.cc.
{
}
| bool AnsaOspf6::Router::InstallLSA | ( | OspfLsa6 * | lsa, |
| AnsaOspf6::AreaID | areaID = BackboneAreaID |
||
| ) |
Installs a new LSA into the Router database. Checks the input LSA's type and installs it into either the selected Area's database, or if it's an AS External LSA then into the Router's common asExternalLSAs list.
| lsa | [in] The LSA to install. It will be copied into the database. |
| areaID | [in] Identifies the input Router, Network and Summary LSA's Area. |
Definition at line 122 of file ansaOspfRouter6.cc.
{
switch (lsa->getHeader().getLsType()){
case RouterLsaType: {
std::map<AnsaOspf6::AreaID, AnsaOspf6::Area*>::iterator areaIt = areasByID.find(areaID);
if (areaIt != areasByID.end()){
OspfRouterLsa6* ospfRouterLSA = check_and_cast<OspfRouterLsa6*> (lsa);
return areaIt->second->InstallRouterLSA(ospfRouterLSA);
}
}
break;
case NetworkLsaType: {
std::map<AnsaOspf6::AreaID, AnsaOspf6::Area*>::iterator areaIt = areasByID.find(areaID);
if (areaIt != areasByID.end()){
OspfNetworkLsa6* ospfNetworkLSA = check_and_cast<OspfNetworkLsa6*> (lsa);
return areaIt->second->InstallNetworkLSA(ospfNetworkLSA);
}
}
case InterAreaPrefixLsaType: {
std::map<AnsaOspf6::AreaID, AnsaOspf6::Area*>::iterator areaIt = areasByID.find(areaID);
if (areaIt != areasByID.end()){
OspfInterAreaPrefixLsa6* ospfInterAreaPrefixLSA = check_and_cast<OspfInterAreaPrefixLsa6*> (lsa);
return areaIt->second->InstallInterAreaPrefixLSA(ospfInterAreaPrefixLSA);
}
}
case InterAreaRouterLsaType: {
std::map<AnsaOspf6::AreaID, AnsaOspf6::Area*>::iterator areaIt = areasByID.find(areaID);
if (areaIt != areasByID.end()){
OspfInterAreaRouterLsa6* ospfInterAreaRouterLSA = check_and_cast<OspfInterAreaRouterLsa6*> (lsa);
return areaIt->second->InstallInterAreaRouterLSA(ospfInterAreaRouterLSA);
}
}
case AsExternalLsaType: {
OspfAsExternalLsa6* ospfASExternalLSA = check_and_cast<OspfAsExternalLsa6*> (lsa);
return InstallASExternalLSA(ospfASExternalLSA);
}
case LinkLsaType: {
// TODO
}
case IntraAreaPrefixLsaType: {
std::map<AnsaOspf6::AreaID, AnsaOspf6::Area*>::iterator areaIt = areasByID.find(areaID);
if (areaIt != areasByID.end()){
OspfIntraAreaPrefixLsa6* ospfIntraAreaPrefixLSA = check_and_cast<OspfIntraAreaPrefixLsa6*> (lsa);
return areaIt->second->InstallIntraAreaPrefixLSA(ospfIntraAreaPrefixLSA);
}
}
}
return false;
}
| bool AnsaOspf6::Router::IsDestinationUnreachable | ( | OspfLsa6 * | lsa | ) | const |
Definition at line 370 of file ansaOspfRouter6.cc.
{
}
| bool AnsaOspf6::Router::IsOnAnyRetransmissionList | ( | AnsaOspf6::LsaKeyType6 | lsaKey | ) | const |
Returns true if there's at least one LSA on any Neighbor's retransmission list identified by the input lsaKey, false otherwise.
| lsaKey | [in] Identifies the LSAs to look for on the retransmission lists. |
Definition at line 347 of file ansaOspfRouter6.cc.
| void AnsaOspf6::Router::RebuildRoutingTable | ( | void | ) |
Rebuilds the routing table from scratch(based on the LSA database).
Definition at line 182 of file ansaOspfRouter6.cc.
{
/*
unsigned long areaCount = areas.size();
bool hasTransitAreas = false;
std::vector<AnsaOspf6::RoutingTableEntry*> newTable;
unsigned long i;
EV << "Rebuilding routing table:\n";
for (i = 0; i < areaCount; i++) {
areas[i]->CalculateShortestPathTree(newTable);
if (areas[i]->GetTransitCapability()) {
hasTransitAreas = true;
}
}
if (areaCount > 1) {
AnsaOspf6::Area* backbone = GetArea(AnsaOspf6::BackboneAreaID);
if (backbone != NULL) {
backbone->CalculateInterAreaRoutes(newTable);
}
} else {
if (areaCount == 1) {
areas[0]->CalculateInterAreaRoutes(newTable);
}
}
if (hasTransitAreas) {
for (i = 0; i < areaCount; i++) {
if (areas[i]->GetTransitCapability()) {
areas[i]->ReCheckSummaryLSAs(newTable);
}
}
}
CalculateASExternalRoutes(newTable);
// backup the routing table
unsigned long routeCount = routingTable.size();
std::vector<AnsaOspf6::RoutingTableEntry*> oldTable;
oldTable.assign(routingTable.begin(), routingTable.end());
routingTable.clear();
routingTable.assign(newTable.begin(), newTable.end());
RoutingTableAccess routingTableAccess;
std::vector<const IPRoute*> eraseEntries;
IRoutingTable* simRoutingTable = routingTableAccess.get();
unsigned long routingEntryNumber = simRoutingTable->getNumRoutes();
// remove entries from the IP routing table inserted by the OSPF module
for (i = 0; i < routingEntryNumber; i++) {
const IPRoute *entry = simRoutingTable->getRoute(i);
const AnsaOspf6::RoutingTableEntry* ospfEntry = dynamic_cast<const AnsaOspf6::RoutingTableEntry*>(entry);
if (ospfEntry != NULL) {
eraseEntries.push_back(entry);
}
}
unsigned int eraseCount = eraseEntries.size();
for (i = 0; i < eraseCount; i++) {
simRoutingTable->deleteRoute(eraseEntries[i]);
}
// add the new routing entries
routeCount = routingTable.size();
for (i = 0; i < routeCount; i++) {
if (routingTable[i]->GetDestinationType() == AnsaOspf6::RoutingTableEntry::NetworkDestination) {
simRoutingTable->addRoute(new AnsaOspf6::RoutingTableEntry(*(routingTable[i])));
}
}
NotifyAboutRoutingTableChanges(oldTable);
routeCount = oldTable.size();
for (i = 0; i < routeCount; i++) {
delete(oldTable[i]);
}
EV << "Routing table was rebuilt.\n"
<< "Results:\n";
routeCount = routingTable.size();
for (i = 0; i < routeCount; i++) {
EV << *routingTable[i]
<< "\n";
}
*/
}
Removes all LSAs from all Neighbor's retransmission lists which are identified by the input lsaKey.
| lsaKey | [in] Identifies the LSAs to remove from the retransmission lists. |
Definition at line 335 of file ansaOspfRouter6.cc.
| void AnsaOspf6::Router::SetProcessID | ( | ProcessID | pid | ) | [inline] |
Definition at line 49 of file ansaOspfRouter6.h.
{ processID = pid; }
| void AnsaOspf6::Router::SetRouterID | ( | RouterID | id | ) | [inline] |
Definition at line 47 of file ansaOspfRouter6.h.
{ routerID = id; }
OspfTimer6* AnsaOspf6::Router::ageTimer [private] |
Definition at line 37 of file ansaOspfRouter6.h.
std::vector<Area*> AnsaOspf6::Router::areas [private] |
Definition at line 33 of file ansaOspfRouter6.h.
Referenced by GetAreaCount().
std::map<AreaID, Area*> AnsaOspf6::Router::areasByID [private] |
Definition at line 32 of file ansaOspfRouter6.h.
std::vector<AsExternalLsa*> AnsaOspf6::Router::asExternalLSAs [private] |
Definition at line 35 of file ansaOspfRouter6.h.
Referenced by GetASExternalLSA(), and GetASExternalLSACount().
std::map<LsaKeyType6, AsExternalLsa*, LsaKeyType6_Less> AnsaOspf6::Router::asExternalLSAsByID [private] |
Definition at line 34 of file ansaOspfRouter6.h.
std::map<IPv6Address, OspfAsExternalLsa6, IPv6Address_Less> AnsaOspf6::Router::externalRoutes [private] |
Definition at line 36 of file ansaOspfRouter6.h.
Referenced by GetASBoundaryRouter().
MessageHandler* AnsaOspf6::Router::messageHandler [private] |
Definition at line 39 of file ansaOspfRouter6.h.
Referenced by GetMessageHandler(), and Router().
ProcessID AnsaOspf6::Router::processID [private] |
Definition at line 31 of file ansaOspfRouter6.h.
Referenced by GetProcessID(), and SetProcessID().
RouterID AnsaOspf6::Router::routerID [private] |
Definition at line 30 of file ansaOspfRouter6.h.
Referenced by GetRouterID(), and SetRouterID().
std::vector<RoutingTableEntry*> AnsaOspf6::Router::routingTable [private] |
Definition at line 38 of file ansaOspfRouter6.h.
Referenced by AddRoutingTableEntry(), GetRoutingTableEntry(), and GetRoutingTableEntryCount().
Definition at line 41 of file ansaOspfRouter6.h.