|
INET Framework for OMNeT++/OMNEST
|
#include <AnsaOSPFArea.h>
Definition at line 15 of file AnsaOSPFArea.h.
Definition at line 6 of file AnsaOSPFArea.cc.
:
areaID(id),
transitCapability(false),
externalRoutingCapability(true),
stubDefaultCost(1),
spfTreeRoot(NULL),
parentRouter(NULL)
{
}
| AnsaOSPF::Area::~Area | ( | void | ) | [virtual] |
Definition at line 16 of file AnsaOSPFArea.cc.
{
int interfaceNum = associatedInterfaces.size();
for (int i = 0; i < interfaceNum; i++) {
delete(associatedInterfaces[i]);
}
long lsaCount = routerLSAs.size();
for (long j = 0; j < lsaCount; j++) {
delete routerLSAs[j];
}
routerLSAs.clear();
lsaCount = networkLSAs.size();
for (long k = 0; k < lsaCount; k++) {
delete networkLSAs[k];
}
networkLSAs.clear();
lsaCount = summaryLSAs.size();
for (long m = 0; m < lsaCount; m++) {
delete summaryLSAs[m];
}
summaryLSAs.clear();
}
| void AnsaOSPF::Area::AddAddressRange | ( | IPv4AddressRange | addressRange, |
| bool | advertise | ||
| ) | [inline] |
Definition at line 40 of file AnsaOSPFArea.h.
Referenced by AnsaOSPFRouting::AnsaLoadInterface(), and AnsaOSPFRouting::LoadAreaFromXML().
{ areaAddressRanges.push_back(addressRange); advertiseAddressRanges[addressRange] = advertise; }
| void AnsaOSPF::Area::AddHostRoute | ( | HostRouteParameters & | hostRouteParameters | ) | [inline] |
Definition at line 43 of file AnsaOSPFArea.h.
Referenced by AnsaOSPFRouting::LoadHostRoute().
{ hostRoutes.push_back(hostRouteParameters); }
| void AnsaOSPF::Area::AddInterface | ( | AnsaOSPF::Interface * | intf | ) |
Definition at line 39 of file AnsaOSPFArea.cc.
Referenced by AnsaOSPFRouting::AnsaLoadInterface(), AnsaOSPFRouting::LoadInterfaceParameters(), and AnsaOSPFRouting::LoadVirtualLink().
{
intf->SetArea(this);
associatedInterfaces.push_back(intf);
}
| void AnsaOSPF::Area::AgeDatabase | ( | void | ) |
Definition at line 371 of file AnsaOSPFArea.cc.
{
long lsaCount = routerLSAs.size();
bool rebuildRoutingTable = false;
long i;
IPAddress routerId(GetRouter()->GetRouterID());
EV << routerId.str();
for (i = 0; i < lsaCount; i++) {
unsigned short lsAge = routerLSAs[i]->getHeader().getLsAge();
bool selfOriginated = (routerLSAs[i]->getHeader().getAdvertisingRouter().getInt() == parentRouter->GetRouterID());
bool unreachable = parentRouter->IsDestinationUnreachable(routerLSAs[i]);
AnsaOSPF::RouterLSA* lsa = routerLSAs[i];
char addressString[16];
unsigned int linkCount = lsa->getLinksArraySize();
for (unsigned int j = 0; j < linkCount; j++) {
const Link& link = lsa->getLinks(j);
EV << " ID="
<< AddressStringFromULong(addressString, sizeof(addressString), link.getLinkID().getInt())
<< ",";
EV << " data="
<< AddressStringFromULong(addressString, sizeof(addressString), link.getLinkData())
<< ", type=";
switch (link.getType()) {
case PointToPointLink: EV << "PointToPoint"; break;
case TransitLink: EV << "Transit"; break;
case StubLink: EV << "Stub"; break;
case VirtualLink: EV << "Virtual"; break;
default: EV << "Unknown"; break;
}
EV << ", cost="
<< link.getLinkCost()
<< "\n";
}
if ((selfOriginated && (lsAge < (LS_REFRESH_TIME - 1))) || (!selfOriginated && (lsAge < (MAX_AGE - 1)))) {
lsa->getHeader().setLsAge(lsAge + 1);
if ((lsAge + 1) % CHECK_AGE == 0) {
if (!lsa->ValidateLSChecksum()) {
EV << "Invalid LS checksum. Memory error detected!\n";
}
}
lsa->IncrementInstallTime();
}
if (selfOriginated && (lsAge == (LS_REFRESH_TIME - 1))) {
if (unreachable) {
lsa->getHeader().setLsAge(MAX_AGE);
FloodLSA(lsa);
lsa->IncrementInstallTime();
} else {
long sequenceNumber = lsa->getHeader().getLsSequenceNumber();
if (sequenceNumber == MAX_SEQUENCE_NUMBER) {
lsa->getHeader().setLsAge(MAX_AGE);
FloodLSA(lsa);
lsa->IncrementInstallTime();
} else {
AnsaOSPF::RouterLSA* newLSA = OriginateRouterLSA();
newLSA->getHeader().setLsSequenceNumber(sequenceNumber + 1);
newLSA->getHeader().setLsChecksum(0); // TODO: calculate correct LS checksum
rebuildRoutingTable |= lsa->Update(newLSA);
delete newLSA;
FloodLSA(lsa);
}
}
}
if (!selfOriginated && (lsAge == MAX_AGE - 1)) {
lsa->getHeader().setLsAge(MAX_AGE);
FloodLSA(lsa);
lsa->IncrementInstallTime();
}
if (lsAge == MAX_AGE) {
AnsaOSPF::LSAKeyType lsaKey;
lsaKey.linkStateID = lsa->getHeader().getLinkStateID();
lsaKey.advertisingRouter = lsa->getHeader().getAdvertisingRouter().getInt();
if (!IsOnAnyRetransmissionList(lsaKey) &&
!HasAnyNeighborInStates(AnsaOSPF::Neighbor::ExchangeState | AnsaOSPF::Neighbor::LoadingState))
{
if (!selfOriginated || unreachable) {
routerLSAsByID.erase(lsa->getHeader().getLinkStateID());
delete lsa;
routerLSAs[i] = NULL;
rebuildRoutingTable = true;
} else {
AnsaOSPF::RouterLSA* newLSA = OriginateRouterLSA();
long sequenceNumber = lsa->getHeader().getLsSequenceNumber();
newLSA->getHeader().setLsSequenceNumber((sequenceNumber == MAX_SEQUENCE_NUMBER) ? INITIAL_SEQUENCE_NUMBER : sequenceNumber + 1);
newLSA->getHeader().setLsChecksum(0); // TODO: calculate correct LS checksum
rebuildRoutingTable |= lsa->Update(newLSA);
delete newLSA;
FloodLSA(lsa);
}
}
}
}
std::vector<RouterLSA*>::iterator routerIt = routerLSAs.begin();
while (routerIt != routerLSAs.end()) {
if ((*routerIt) == NULL) {
routerIt = routerLSAs.erase(routerIt);
} else {
routerIt++;
}
}
lsaCount = networkLSAs.size();
for (i = 0; i < lsaCount; i++) {
unsigned short lsAge = networkLSAs[i]->getHeader().getLsAge();
bool unreachable = parentRouter->IsDestinationUnreachable(networkLSAs[i]);
AnsaOSPF::NetworkLSA* lsa = networkLSAs[i];
AnsaOSPF::Interface* localIntf = GetInterface(IPv4AddressFromULong(lsa->getHeader().getLinkStateID()));
bool selfOriginated = false;
if ((localIntf != NULL) &&
(localIntf->GetState() == AnsaOSPF::Interface::DesignatedRouterState) &&
(localIntf->GetNeighborCount() > 0) &&
(localIntf->HasAnyNeighborInStates(AnsaOSPF::Neighbor::FullState)))
{
selfOriginated = true;
}
if ((selfOriginated && (lsAge < (LS_REFRESH_TIME - 1))) || (!selfOriginated && (lsAge < (MAX_AGE - 1)))) {
lsa->getHeader().setLsAge(lsAge + 1);
if ((lsAge + 1) % CHECK_AGE == 0) {
if (!lsa->ValidateLSChecksum()) {
EV << "Invalid LS checksum. Memory error detected!\n";
}
}
lsa->IncrementInstallTime();
}
if (selfOriginated && (lsAge == (LS_REFRESH_TIME - 1))) {
if (unreachable) {
lsa->getHeader().setLsAge(MAX_AGE);
FloodLSA(lsa);
lsa->IncrementInstallTime();
} else {
long sequenceNumber = lsa->getHeader().getLsSequenceNumber();
if (sequenceNumber == MAX_SEQUENCE_NUMBER) {
lsa->getHeader().setLsAge(MAX_AGE);
FloodLSA(lsa);
lsa->IncrementInstallTime();
} else {
AnsaOSPF::NetworkLSA* newLSA = OriginateNetworkLSA(localIntf);
if (newLSA != NULL) {
newLSA->getHeader().setLsSequenceNumber(sequenceNumber + 1);
newLSA->getHeader().setLsChecksum(0); // TODO: calculate correct LS checksum
rebuildRoutingTable |= lsa->Update(newLSA);
delete newLSA;
} else { // no neighbors on the network -> old NetworkLSA must be flushed
lsa->getHeader().setLsAge(MAX_AGE);
lsa->IncrementInstallTime();
}
FloodLSA(lsa);
}
}
}
if (!selfOriginated && (lsAge == MAX_AGE - 1)) {
lsa->getHeader().setLsAge(MAX_AGE);
FloodLSA(lsa);
lsa->IncrementInstallTime();
}
if (lsAge == MAX_AGE) {
AnsaOSPF::LSAKeyType lsaKey;
lsaKey.linkStateID = lsa->getHeader().getLinkStateID();
lsaKey.advertisingRouter = lsa->getHeader().getAdvertisingRouter().getInt();
if (!IsOnAnyRetransmissionList(lsaKey) &&
!HasAnyNeighborInStates(AnsaOSPF::Neighbor::ExchangeState | AnsaOSPF::Neighbor::LoadingState))
{
if (!selfOriginated || unreachable) {
networkLSAsByID.erase(lsa->getHeader().getLinkStateID());
RemoveParentFromRoutingInfo(check_and_cast<OSPFLSA*> (lsa));
delete lsa;
networkLSAs[i] = NULL;
rebuildRoutingTable = true;
} else {
AnsaOSPF::NetworkLSA* newLSA = OriginateNetworkLSA(localIntf);
long sequenceNumber = lsa->getHeader().getLsSequenceNumber();
if (newLSA != NULL) {
newLSA->getHeader().setLsSequenceNumber((sequenceNumber == MAX_SEQUENCE_NUMBER) ? INITIAL_SEQUENCE_NUMBER : sequenceNumber + 1);
newLSA->getHeader().setLsChecksum(0); // TODO: calculate correct LS checksum
rebuildRoutingTable |= lsa->Update(newLSA);
delete newLSA;
FloodLSA(lsa);
} else { // no neighbors on the network -> old NetworkLSA must be deleted
delete networkLSAs[i];
}
}
}
}
}
std::vector<NetworkLSA*>::iterator networkIt = networkLSAs.begin();
while (networkIt != networkLSAs.end()) {
if ((*networkIt) == NULL) {
networkIt = networkLSAs.erase(networkIt);
} else {
networkIt++;
}
}
lsaCount = summaryLSAs.size();
for (i = 0; i < lsaCount; i++) {
unsigned short lsAge = summaryLSAs[i]->getHeader().getLsAge();
bool selfOriginated = (summaryLSAs[i]->getHeader().getAdvertisingRouter().getInt() == parentRouter->GetRouterID());
bool unreachable = parentRouter->IsDestinationUnreachable(summaryLSAs[i]);
AnsaOSPF::SummaryLSA* lsa = summaryLSAs[i];
if ((selfOriginated && (lsAge < (LS_REFRESH_TIME - 1))) || (!selfOriginated && (lsAge < (MAX_AGE - 1)))) {
lsa->getHeader().setLsAge(lsAge + 1);
if ((lsAge + 1) % CHECK_AGE == 0) {
if (!lsa->ValidateLSChecksum()) {
EV << "Invalid LS checksum. Memory error detected!\n";
}
}
lsa->IncrementInstallTime();
}
if (selfOriginated && (lsAge == (LS_REFRESH_TIME - 1))) {
if (unreachable) {
lsa->getHeader().setLsAge(MAX_AGE);
FloodLSA(lsa);
lsa->IncrementInstallTime();
} else {
long sequenceNumber = lsa->getHeader().getLsSequenceNumber();
if (sequenceNumber == MAX_SEQUENCE_NUMBER) {
lsa->getHeader().setLsAge(MAX_AGE);
FloodLSA(lsa);
lsa->IncrementInstallTime();
} else {
AnsaOSPF::SummaryLSA* newLSA = OriginateSummaryLSA(lsa);
if (newLSA != NULL) {
newLSA->getHeader().setLsSequenceNumber(sequenceNumber + 1);
newLSA->getHeader().setLsChecksum(0); // TODO: calculate correct LS checksum
rebuildRoutingTable |= lsa->Update(newLSA);
delete newLSA;
FloodLSA(lsa);
} else {
lsa->getHeader().setLsAge(MAX_AGE);
FloodLSA(lsa);
lsa->IncrementInstallTime();
}
}
}
}
if (!selfOriginated && (lsAge == MAX_AGE - 1)) {
lsa->getHeader().setLsAge(MAX_AGE);
FloodLSA(lsa);
lsa->IncrementInstallTime();
}
if (lsAge == MAX_AGE) {
AnsaOSPF::LSAKeyType lsaKey;
lsaKey.linkStateID = lsa->getHeader().getLinkStateID();
lsaKey.advertisingRouter = lsa->getHeader().getAdvertisingRouter().getInt();
if (!IsOnAnyRetransmissionList(lsaKey) &&
!HasAnyNeighborInStates(AnsaOSPF::Neighbor::ExchangeState | AnsaOSPF::Neighbor::LoadingState))
{
if (!selfOriginated || unreachable) {
summaryLSAsByID.erase(lsaKey);
delete lsa;
summaryLSAs[i] = NULL;
rebuildRoutingTable = true;
} else {
AnsaOSPF::SummaryLSA* newLSA = OriginateSummaryLSA(lsa);
if (newLSA != NULL) {
long sequenceNumber = lsa->getHeader().getLsSequenceNumber();
newLSA->getHeader().setLsSequenceNumber((sequenceNumber == MAX_SEQUENCE_NUMBER) ? INITIAL_SEQUENCE_NUMBER : sequenceNumber + 1);
newLSA->getHeader().setLsChecksum(0); // TODO: calculate correct LS checksum
rebuildRoutingTable |= lsa->Update(newLSA);
delete newLSA;
FloodLSA(lsa);
} else {
summaryLSAsByID.erase(lsaKey);
delete lsa;
summaryLSAs[i] = NULL;
rebuildRoutingTable = true;
}
}
}
}
}
std::vector<SummaryLSA*>::iterator summaryIt = summaryLSAs.begin();
while (summaryIt != summaryLSAs.end()) {
if ((*summaryIt) == NULL) {
summaryIt = summaryLSAs.erase(summaryIt);
} else {
summaryIt++;
}
}
long interfaceCount = associatedInterfaces.size();
for (long m = 0; m < interfaceCount; m++) {
associatedInterfaces[m]->AgeTransmittedLSALists();
}
if (rebuildRoutingTable) {
parentRouter->RebuildRoutingTable();
}
}
| void AnsaOSPF::Area::CalculateInterAreaRoutes | ( | std::vector< RoutingTableEntry * > & | newRoutingTable | ) |
Referenced by AnsaOSPF::Router::RebuildRoutingTable().
| std::vector< AnsaOSPF::NextHop > * AnsaOSPF::Area::CalculateNextHops | ( | OSPFLSA * | destination, |
| OSPFLSA * | parent | ||
| ) | const [private] |
Definition at line 1871 of file AnsaOSPFArea.cc.
{
std::vector<AnsaOSPF::NextHop>* hops = new std::vector<AnsaOSPF::NextHop>;
unsigned long i, j;
AnsaOSPF::RouterLSA* routerLSA = dynamic_cast<AnsaOSPF::RouterLSA*> (parent);
if (routerLSA != NULL) {
if (routerLSA != spfTreeRoot) {
unsigned int nextHopCount = routerLSA->GetNextHopCount();
for (i = 0; i < nextHopCount; i++) {
hops->push_back(routerLSA->GetNextHop(i));
}
return hops;
} else {
AnsaOSPF::RouterLSA* destinationRouterLSA = dynamic_cast<AnsaOSPF::RouterLSA*> (destination);
if (destinationRouterLSA != NULL) {
unsigned long interfaceNum = associatedInterfaces.size();
for (i = 0; i < interfaceNum; i++) {
AnsaOSPF::Interface::OSPFInterfaceType intfType = associatedInterfaces[i]->GetType();
if ((intfType == AnsaOSPF::Interface::PointToPoint) ||
((intfType == AnsaOSPF::Interface::Virtual) &&
(associatedInterfaces[i]->GetState() > AnsaOSPF::Interface::LoopbackState)))
{
AnsaOSPF::Neighbor* ptpNeighbor = associatedInterfaces[i]->GetNeighborCount() > 0 ? associatedInterfaces[i]->GetNeighbor(0) : NULL;
if (ptpNeighbor != NULL) {
if (ptpNeighbor->GetNeighborID() == destinationRouterLSA->getHeader().getLinkStateID()) {
NextHop nextHop;
nextHop.ifIndex = associatedInterfaces[i]->GetIfIndex();
nextHop.hopAddress = ptpNeighbor->GetAddress();
nextHop.advertisingRouter = destinationRouterLSA->getHeader().getAdvertisingRouter().getInt();
hops->push_back(nextHop);
break;
}
}
}
if (intfType == AnsaOSPF::Interface::PointToMultiPoint) {
AnsaOSPF::Neighbor* ptmpNeighbor = associatedInterfaces[i]->GetNeighborByID(destinationRouterLSA->getHeader().getLinkStateID());
if (ptmpNeighbor != NULL) {
unsigned int linkCount = destinationRouterLSA->getLinksArraySize();
AnsaOSPF::RouterID rootID = parentRouter->GetRouterID();
for (j = 0; j < linkCount; j++) {
Link& link = destinationRouterLSA->getLinks(j);
if (link.getLinkID() == rootID) {
NextHop nextHop;
nextHop.ifIndex = associatedInterfaces[i]->GetIfIndex();
nextHop.hopAddress = IPv4AddressFromULong(link.getLinkData());
nextHop.advertisingRouter = destinationRouterLSA->getHeader().getAdvertisingRouter().getInt();
hops->push_back(nextHop);
}
}
break;
}
}
}
} else {
AnsaOSPF::NetworkLSA* destinationNetworkLSA = dynamic_cast<AnsaOSPF::NetworkLSA*> (destination);
if (destinationNetworkLSA != NULL) {
AnsaOSPF::IPv4Address networkDesignatedRouter = IPv4AddressFromULong(destinationNetworkLSA->getHeader().getLinkStateID());
unsigned long interfaceNum = associatedInterfaces.size();
for (i = 0; i < interfaceNum; i++) {
AnsaOSPF::Interface::OSPFInterfaceType intfType = associatedInterfaces[i]->GetType();
if (((intfType == AnsaOSPF::Interface::Broadcast) ||
(intfType == AnsaOSPF::Interface::NBMA)) &&
(associatedInterfaces[i]->GetDesignatedRouter().ipInterfaceAddress == networkDesignatedRouter))
{
AnsaOSPF::IPv4AddressRange range = associatedInterfaces[i]->GetAddressRange();
NextHop nextHop;
nextHop.ifIndex = associatedInterfaces[i]->GetIfIndex();
nextHop.hopAddress = (range.address & range.mask);
nextHop.advertisingRouter = destinationNetworkLSA->getHeader().getAdvertisingRouter().getInt();
hops->push_back(nextHop);
}
}
}
}
}
} else {
AnsaOSPF::NetworkLSA* networkLSA = dynamic_cast<AnsaOSPF::NetworkLSA*> (parent);
if (networkLSA != NULL) {
if (networkLSA->GetParent() != spfTreeRoot) {
unsigned int nextHopCount = networkLSA->GetNextHopCount();
for (i = 0; i < nextHopCount; i++) {
hops->push_back(networkLSA->GetNextHop(i));
}
return hops;
} else {
unsigned long parentLinkStateID = parent->getHeader().getLinkStateID();
AnsaOSPF::RouterLSA* destinationRouterLSA = dynamic_cast<AnsaOSPF::RouterLSA*> (destination);
if (destinationRouterLSA != NULL) {
AnsaOSPF::RouterID destinationRouterID = destinationRouterLSA->getHeader().getLinkStateID();
unsigned int linkCount = destinationRouterLSA->getLinksArraySize();
for (i = 0; i < linkCount; i++) {
Link& link = destinationRouterLSA->getLinks(i);
NextHop nextHop;
if (((link.getType() == TransitLink) &&
(link.getLinkID().getInt() == parentLinkStateID)) ||
((link.getType() == StubLink) &&
((link.getLinkID().getInt() & link.getLinkData()) == (parentLinkStateID & networkLSA->getNetworkMask().getInt()))))
{
unsigned long interfaceNum = associatedInterfaces.size();
for (j = 0; j < interfaceNum; j++) {
AnsaOSPF::Interface::OSPFInterfaceType intfType = associatedInterfaces[j]->GetType();
if (((intfType == AnsaOSPF::Interface::Broadcast) ||
(intfType == AnsaOSPF::Interface::NBMA)) &&
(associatedInterfaces[j]->GetDesignatedRouter().ipInterfaceAddress == IPv4AddressFromULong(parentLinkStateID)))
{
AnsaOSPF::Neighbor* nextHopNeighbor = associatedInterfaces[j]->GetNeighborByID(destinationRouterID);
if (nextHopNeighbor != NULL) {
nextHop.ifIndex = associatedInterfaces[j]->GetIfIndex();
nextHop.hopAddress = nextHopNeighbor->GetAddress();
nextHop.advertisingRouter = destinationRouterLSA->getHeader().getAdvertisingRouter().getInt();
hops->push_back(nextHop);
}
}
}
}
}
}
}
}
}
return hops;
}
| std::vector< AnsaOSPF::NextHop > * AnsaOSPF::Area::CalculateNextHops | ( | Link & | destination, |
| OSPFLSA * | parent | ||
| ) | const [private] |
Definition at line 1999 of file AnsaOSPFArea.cc.
{
std::vector<AnsaOSPF::NextHop>* hops = new std::vector<AnsaOSPF::NextHop>;
unsigned long i;
AnsaOSPF::RouterLSA* routerLSA = check_and_cast<AnsaOSPF::RouterLSA*> (parent);
if (routerLSA != spfTreeRoot) {
unsigned int nextHopCount = routerLSA->GetNextHopCount();
for (i = 0; i < nextHopCount; i++) {
hops->push_back(routerLSA->GetNextHop(i));
}
return hops;
} else {
unsigned long interfaceNum = associatedInterfaces.size();
for (i = 0; i < interfaceNum; i++) {
AnsaOSPF::Interface::OSPFInterfaceType intfType = associatedInterfaces[i]->GetType();
if ((intfType == AnsaOSPF::Interface::PointToPoint) ||
((intfType == AnsaOSPF::Interface::Virtual) &&
(associatedInterfaces[i]->GetState() > AnsaOSPF::Interface::LoopbackState)))
{
AnsaOSPF::Neighbor* neighbor = (associatedInterfaces[i]->GetNeighborCount() > 0) ? associatedInterfaces[i]->GetNeighbor(0) : NULL;
if (neighbor != NULL) {
AnsaOSPF::IPv4Address neighborAddress = neighbor->GetAddress();
if (((neighborAddress != AnsaOSPF::NullIPv4Address) &&
(ULongFromIPv4Address(neighborAddress) == destination.getLinkID().getInt())) ||
((neighborAddress == AnsaOSPF::NullIPv4Address) &&
(ULongFromIPv4Address(associatedInterfaces[i]->GetAddressRange().address) == destination.getLinkID().getInt()) &&
(ULongFromIPv4Address(associatedInterfaces[i]->GetAddressRange().mask) == destination.getLinkData())))
{
NextHop nextHop;
nextHop.ifIndex = associatedInterfaces[i]->GetIfIndex();
nextHop.hopAddress = neighborAddress;
nextHop.advertisingRouter = parentRouter->GetRouterID();
hops->push_back(nextHop);
break;
}
}
}
if ((intfType == AnsaOSPF::Interface::Broadcast) ||
(intfType == AnsaOSPF::Interface::NBMA))
{
if ((destination.getLinkID().getInt() == ULongFromIPv4Address(associatedInterfaces[i]->GetAddressRange().address & associatedInterfaces[i]->GetAddressRange().mask)) &&
(destination.getLinkData() == ULongFromIPv4Address(associatedInterfaces[i]->GetAddressRange().mask)))
{
NextHop nextHop;
nextHop.ifIndex = associatedInterfaces[i]->GetIfIndex();
nextHop.hopAddress = IPv4AddressFromULong(destination.getLinkID().getInt());
nextHop.advertisingRouter = parentRouter->GetRouterID();
hops->push_back(nextHop);
break;
}
}
if (intfType == AnsaOSPF::Interface::PointToMultiPoint) {
if (destination.getType() == StubLink) {
if (destination.getLinkID().getInt() == ULongFromIPv4Address(associatedInterfaces[i]->GetAddressRange().address)) {
// The link contains the router's own interface address and a full mask,
// so we insert a next hop pointing to the interface itself. Kind of pointless, but
// not much else we could do...
// TODO: check what other OSPF implementations do in this situation
NextHop nextHop;
nextHop.ifIndex = associatedInterfaces[i]->GetIfIndex();
nextHop.hopAddress = associatedInterfaces[i]->GetAddressRange().address;
nextHop.advertisingRouter = parentRouter->GetRouterID();
hops->push_back(nextHop);
break;
}
}
if (destination.getType() == PointToPointLink) {
AnsaOSPF::Neighbor* neighbor = associatedInterfaces[i]->GetNeighborByID(destination.getLinkID().getInt());
if (neighbor != NULL) {
NextHop nextHop;
nextHop.ifIndex = associatedInterfaces[i]->GetIfIndex();
nextHop.hopAddress = neighbor->GetAddress();
nextHop.advertisingRouter = parentRouter->GetRouterID();
hops->push_back(nextHop);
break;
}
}
}
// next hops for virtual links are generated later, after examining transit areas' SummaryLSAs
}
if (hops->size() == 0) {
unsigned long hostRouteCount = hostRoutes.size();
for (i = 0; i < hostRouteCount; i++) {
if ((destination.getLinkID().getInt() == ULongFromIPv4Address(hostRoutes[i].address)) &&
(destination.getLinkData() == 0xFFFFFFFF))
{
NextHop nextHop;
nextHop.ifIndex = hostRoutes[i].ifIndex;
nextHop.hopAddress = hostRoutes[i].address;
nextHop.advertisingRouter = parentRouter->GetRouterID();
hops->push_back(nextHop);
break;
}
}
}
}
return hops;
}
| void AnsaOSPF::Area::CalculateShortestPathTree | ( | std::vector< RoutingTableEntry * > & | newRoutingTable | ) |
| bool AnsaOSPF::Area::ContainsAddress | ( | AnsaOSPF::IPv4Address | address | ) | const |
Definition at line 98 of file AnsaOSPFArea.cc.
{
int addressRangeNum = areaAddressRanges.size();
for (int i = 0; i < addressRangeNum; i++) {
if ((areaAddressRanges[i].address & areaAddressRanges[i].mask) == (address & areaAddressRanges[i].mask)) {
return true;
}
}
return false;
}
| AnsaOSPF::RoutingTableEntry * AnsaOSPF::Area::CreateRoutingTableEntryFromSummaryLSA | ( | const AnsaOSPF::SummaryLSA & | summaryLSA, |
| unsigned short | entryCost, | ||
| const AnsaOSPF::RoutingTableEntry & | borderRouterEntry | ||
| ) | const [private] |
Returns a new RoutingTableEntry based on the input SummaryLSA, with the input cost and the borderRouterEntry's next hops.
Definition at line 2227 of file AnsaOSPFArea.cc.
{
AnsaOSPF::IPv4AddressRange destination;
destination.address = IPv4AddressFromULong(summaryLSA.getHeader().getLinkStateID());
destination.mask = IPv4AddressFromULong(summaryLSA.getNetworkMask().getInt());
AnsaOSPF::RoutingTableEntry* newEntry = new AnsaOSPF::RoutingTableEntry;
if (summaryLSA.getHeader().getLsType() == SummaryLSA_NetworksType) {
newEntry->SetDestinationID(ULongFromIPv4Address(destination.address & destination.mask));
newEntry->SetAddressMask(ULongFromIPv4Address(destination.mask));
newEntry->SetDestinationType(AnsaOSPF::RoutingTableEntry::NetworkDestination);
} else {
newEntry->SetDestinationID(ULongFromIPv4Address(destination.address));
newEntry->SetAddressMask(0xFFFFFFFF);
newEntry->SetDestinationType(AnsaOSPF::RoutingTableEntry::ASBoundaryRouterDestination);
}
newEntry->SetArea(areaID);
newEntry->SetPathType(AnsaOSPF::RoutingTableEntry::InterArea);
newEntry->SetCost(entryCost);
newEntry->SetOptionalCapabilities(summaryLSA.getHeader().getLsOptions());
newEntry->SetLinkStateOrigin(&summaryLSA);
unsigned int nextHopCount = borderRouterEntry.GetNextHopCount();
for (unsigned int j = 0; j < nextHopCount; j++) {
newEntry->AddNextHop(borderRouterEntry.GetNextHop(j));
}
return newEntry;
}
| std::string AnsaOSPF::Area::detailedInfo | ( | void | ) | const |
Definition at line 53 of file AnsaOSPFArea.cc.
Referenced by operator<<().
{
std::stringstream out;
char addressString[16];
int i;
out << "\n areaID: " << AddressStringFromULong(addressString, 16, areaID) << ", ";
out << "transitCapability: " << (transitCapability ? "true" : "false") << ", ";
out << "externalRoutingCapability: " << (externalRoutingCapability ? "true" : "false") << ", ";
out << "stubDefaultCost: " << stubDefaultCost << "\n";
int addressRangeNum = areaAddressRanges.size();
for (i = 0; i < addressRangeNum; i++) {
out << " addressRanges[" << i << "]: ";
out << AddressStringFromIPv4Address(addressString, 16, areaAddressRanges[i].address);
out << "/" << AddressStringFromIPv4Address(addressString, 16, areaAddressRanges[i].mask) << "\n";
}
int interfaceNum = associatedInterfaces.size();
for (i = 0; i < interfaceNum; i++) {
out << " interface[" << i << "]: addressRange: ";
out << AddressStringFromIPv4Address(addressString, 16, associatedInterfaces[i]->GetAddressRange().address);
out << "/" << AddressStringFromIPv4Address(addressString, 16, associatedInterfaces[i]->GetAddressRange().mask) << "\n";
}
out << "\n";
out << " Database:\n";
out << " RouterLSAs:\n";
long lsaCount = routerLSAs.size();
for (i = 0; i < lsaCount; i++) {
out << " " << *routerLSAs[i] << "\n";
}
out << " NetworkLSAs:\n";
lsaCount = networkLSAs.size();
for (i = 0; i < lsaCount; i++) {
out << " " << *networkLSAs[i] << "\n";
}
out << " SummaryLSAs:\n";
lsaCount = summaryLSAs.size();
for (i = 0; i < lsaCount; i++) {
out << " " << *summaryLSAs[i] << "\n";
}
out << "--------------------------------------------------------------------------------";
return out.str();
}
| AnsaOSPF::NetworkLSA * AnsaOSPF::Area::FindNetworkLSA | ( | AnsaOSPF::LinkStateID | linkStateID | ) |
Definition at line 285 of file AnsaOSPFArea.cc.
Referenced by AnsaOSPF::InterfaceState::ChangeState(), and AnsaOSPF::NeighborState::ChangeState().
{
std::map<AnsaOSPF::LinkStateID, AnsaOSPF::NetworkLSA*>::iterator lsaIt = networkLSAsByID.find(linkStateID);
if (lsaIt != networkLSAsByID.end()) {
return lsaIt->second;
} else {
return NULL;
}
}
| const AnsaOSPF::NetworkLSA * AnsaOSPF::Area::FindNetworkLSA | ( | AnsaOSPF::LinkStateID | linkStateID | ) | const |
Definition at line 295 of file AnsaOSPFArea.cc.
{
std::map<AnsaOSPF::LinkStateID, AnsaOSPF::NetworkLSA*>::const_iterator lsaIt = networkLSAsByID.find(linkStateID);
if (lsaIt != networkLSAsByID.end()) {
return lsaIt->second;
} else {
return NULL;
}
}
| AnsaOSPF::RouterLSA * AnsaOSPF::Area::FindRouterLSA | ( | AnsaOSPF::LinkStateID | linkStateID | ) |
Definition at line 265 of file AnsaOSPFArea.cc.
Referenced by AnsaOSPF::InterfaceState::ChangeState(), AnsaOSPF::NeighborState::ChangeState(), and AnsaOSPF::HelloHandler::ProcessPacket().
{
std::map<AnsaOSPF::LinkStateID, AnsaOSPF::RouterLSA*>::iterator lsaIt = routerLSAsByID.find(linkStateID);
if (lsaIt != routerLSAsByID.end()) {
return lsaIt->second;
} else {
return NULL;
}
}
| const AnsaOSPF::RouterLSA * AnsaOSPF::Area::FindRouterLSA | ( | AnsaOSPF::LinkStateID | linkStateID | ) | const |
Definition at line 275 of file AnsaOSPFArea.cc.
{
std::map<AnsaOSPF::LinkStateID, AnsaOSPF::RouterLSA*>::const_iterator lsaIt = routerLSAsByID.find(linkStateID);
if (lsaIt != routerLSAsByID.end()) {
return lsaIt->second;
} else {
return NULL;
}
}
| bool AnsaOSPF::Area::FindSameOrWorseCostRoute | ( | const std::vector< AnsaOSPF::RoutingTableEntry * > & | newRoutingTable, |
| const AnsaOSPF::SummaryLSA & | summaryLSA, | ||
| unsigned short | currentCost, | ||
| bool & | destinationInRoutingTable, | ||
| std::list< AnsaOSPF::RoutingTableEntry * > & | sameOrWorseCost | ||
| ) | const [private] |
Browse through the newRoutingTable 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.
Definition at line 2164 of file AnsaOSPFArea.cc.
{
destinationInRoutingTable = false;
sameOrWorseCost.clear();
long routeCount = newRoutingTable.size();
AnsaOSPF::IPv4AddressRange destination;
destination.address = IPv4AddressFromULong(summaryLSA.getHeader().getLinkStateID());
destination.mask = IPv4AddressFromULong(summaryLSA.getNetworkMask().getInt());
for (long j = 0; j < routeCount; j++) {
AnsaOSPF::RoutingTableEntry* routingEntry = newRoutingTable[j];
bool foundMatching = false;
if (summaryLSA.getHeader().getLsType() == SummaryLSA_NetworksType) {
if ((routingEntry->GetDestinationType() == AnsaOSPF::RoutingTableEntry::NetworkDestination) &&
(ULongFromIPv4Address(destination.address & destination.mask) == routingEntry->GetDestinationID().getInt()))
{
foundMatching = true;
}
} else {
if ((((routingEntry->GetDestinationType() & AnsaOSPF::RoutingTableEntry::AreaBorderRouterDestination) != 0) ||
((routingEntry->GetDestinationType() & AnsaOSPF::RoutingTableEntry::ASBoundaryRouterDestination) != 0)) &&
(ULongFromIPv4Address(destination.address) == routingEntry->GetDestinationID().getInt()))
{
foundMatching = true;
}
}
if (foundMatching) {
destinationInRoutingTable = true;
/* If the matching entry is an IntraArea getRoute(intra-area paths are
* always preferred to other paths of any cost), or it's a cheaper InterArea
* route, then skip this LSA.
*/
if ((routingEntry->GetPathType() == AnsaOSPF::RoutingTableEntry::IntraArea) ||
((routingEntry->GetPathType() == AnsaOSPF::RoutingTableEntry::InterArea) &&
(routingEntry->GetCost() < currentCost)))
{
return true;
} else {
// if it's an other InterArea path
if ((routingEntry->GetPathType() == AnsaOSPF::RoutingTableEntry::InterArea) &&
(routingEntry->GetCost() >= currentCost))
{
sameOrWorseCost.push_back(routingEntry);
} // else it's external -> same as if not in the table
}
}
}
return false;
}
Definition at line 305 of file AnsaOSPFArea.cc.
{
std::map<AnsaOSPF::LSAKeyType, AnsaOSPF::SummaryLSA*, AnsaOSPF::LSAKeyType_Less>::iterator lsaIt = summaryLSAsByID.find(lsaKey);
if (lsaIt != summaryLSAsByID.end()) {
return lsaIt->second;
} else {
return NULL;
}
}
| const AnsaOSPF::SummaryLSA * AnsaOSPF::Area::FindSummaryLSA | ( | AnsaOSPF::LSAKeyType | lsaKey | ) | const |
Definition at line 315 of file AnsaOSPFArea.cc.
{
std::map<AnsaOSPF::LSAKeyType, AnsaOSPF::SummaryLSA*, AnsaOSPF::LSAKeyType_Less>::const_iterator lsaIt = summaryLSAsByID.find(lsaKey);
if (lsaIt != summaryLSAsByID.end()) {
return lsaIt->second;
} else {
return NULL;
}
}
Definition at line 188 of file AnsaOSPFArea.cc.
Referenced by AnsaOSPF::MessageHandler::ProcessPacket().
{
int interfaceNum = associatedInterfaces.size();
for (int i = 0; i < interfaceNum; i++) {
if ((associatedInterfaces[i]->GetType() == AnsaOSPF::Interface::Virtual) &&
(associatedInterfaces[i]->GetNeighborByID(routerID) != NULL))
{
return associatedInterfaces[i];
}
}
return NULL;
}
| bool AnsaOSPF::Area::FloodLSA | ( | OSPFLSA * | lsa, |
| AnsaOSPF::Interface * | intf = NULL, |
||
| AnsaOSPF::Neighbor * | neighbor = NULL |
||
| ) |
Definition at line 723 of file AnsaOSPFArea.cc.
Referenced by AnsaOSPF::InterfaceState::ChangeState(), AnsaOSPF::NeighborState::ChangeState(), and AnsaOSPF::HelloHandler::ProcessPacket().
{
bool floodedBackOut = false;
long interfaceCount = associatedInterfaces.size();
for (long i = 0; i < interfaceCount; i++) {
if (associatedInterfaces[i]->FloodLSA(lsa, intf, neighbor)) {
floodedBackOut = true;
}
}
return floodedBackOut;
}
| IPv4AddressRange AnsaOSPF::Area::GetAddressRange | ( | unsigned int | index | ) | const [inline] |
Definition at line 42 of file AnsaOSPFArea.h.
{ return areaAddressRanges[index]; }
| unsigned int AnsaOSPF::Area::GetAddressRangeCount | ( | void | ) | const [inline] |
Definition at line 41 of file AnsaOSPFArea.h.
{ return areaAddressRanges.size(); }
| AreaID AnsaOSPF::Area::GetAreaID | ( | void | ) | const [inline] |
Definition at line 39 of file AnsaOSPFArea.h.
Referenced by AnsaOSPF::LinkStateUpdateHandler::AcknowledgeLSA(), AnsaOSPF::Router::AddArea(), AnsaOSPFRouting::AnsaLoadInterface(), AnsaOSPF::DatabaseDescriptionHandler::ProcessDDPacket(), and AnsaOSPF::LinkStateRequestHandler::ProcessPacket().
{ return areaID; }
| AnsaOSPF::IPv4AddressRange AnsaOSPF::Area::GetContainingAddressRange | ( | AnsaOSPF::IPv4AddressRange | addressRange, |
| bool * | advertise = NULL |
||
| ) | const |
Definition at line 122 of file AnsaOSPFArea.cc.
{
int addressRangeNum = areaAddressRanges.size();
for (int i = 0; i < addressRangeNum; i++) {
if ((areaAddressRanges[i].address & areaAddressRanges[i].mask) == (addressRange.address & areaAddressRanges[i].mask)) {
if (advertise != NULL) {
std::map<AnsaOSPF::IPv4AddressRange, bool, AnsaOSPF::IPv4AddressRange_Less>::const_iterator rangeIt = advertiseAddressRanges.find(areaAddressRanges[i]);
if (rangeIt != advertiseAddressRanges.end()) {
*advertise = rangeIt->second;
} else {
*advertise = true;
}
}
return areaAddressRanges[i];
}
}
if (advertise != NULL) {
*advertise = false;
}
return NullIPv4AddressRange;
}
| bool AnsaOSPF::Area::GetExternalRoutingCapability | ( | void | ) | const [inline] |
Definition at line 47 of file AnsaOSPFArea.h.
Referenced by AnsaOSPF::Neighbor::CreateDatabaseSummary(), AnsaOSPFRouting::LoadVirtualLink(), AnsaOSPF::DatabaseDescriptionHandler::ProcessDDPacket(), AnsaOSPF::HelloHandler::ProcessPacket(), and AnsaOSPF::LinkStateUpdateHandler::ProcessPacket().
{ return externalRoutingCapability; }
| AnsaOSPF::Interface * AnsaOSPF::Area::GetInterface | ( | unsigned char | ifIndex | ) |
Definition at line 144 of file AnsaOSPFArea.cc.
Referenced by AnsaOSPFRouting::AnsaLoadConfigFromXML(), and AnsaOSPF::MessageHandler::ProcessPacket().
{
int interfaceNum = associatedInterfaces.size();
for (int i = 0; i < interfaceNum; i++) {
if ((associatedInterfaces[i]->GetType() != AnsaOSPF::Interface::Virtual) &&
(associatedInterfaces[i]->GetIfIndex() == ifIndex))
{
return associatedInterfaces[i];
}
}
return NULL;
}
Definition at line 157 of file AnsaOSPFArea.cc.
{
int interfaceNum = associatedInterfaces.size();
for (int i = 0; i < interfaceNum; i++) {
if ((associatedInterfaces[i]->GetType() != AnsaOSPF::Interface::Virtual) &&
(associatedInterfaces[i]->GetAddressRange().address == address))
{
return associatedInterfaces[i];
}
}
return NULL;
}
| NetworkLSA* AnsaOSPF::Area::GetNetworkLSA | ( | unsigned long | i | ) | [inline] |
Definition at line 62 of file AnsaOSPFArea.h.
Referenced by AnsaOSPF::Neighbor::CreateDatabaseSummary().
{ return networkLSAs[i]; }
| const NetworkLSA* AnsaOSPF::Area::GetNetworkLSA | ( | unsigned long | i | ) | const [inline] |
Definition at line 63 of file AnsaOSPFArea.h.
{ return networkLSAs[i]; }
| unsigned long AnsaOSPF::Area::GetNetworkLSACount | ( | void | ) | const [inline] |
Definition at line 61 of file AnsaOSPFArea.h.
Referenced by AnsaOSPF::Neighbor::CreateDatabaseSummary().
{ return networkLSAs.size(); }
| Router* AnsaOSPF::Area::GetRouter | ( | void | ) | [inline] |
Definition at line 55 of file AnsaOSPFArea.h.
Referenced by AnsaOSPF::InterfaceState::CalculateDesignatedRouter(), AnsaOSPF::InterfaceState::ChangeState(), AnsaOSPF::NeighborState::ChangeState(), AnsaOSPF::Neighbor::CreateDatabaseSummary(), AnsaOSPF::NeighborStateFull::ProcessEvent(), AnsaOSPF::NeighborStateExchangeStart::ProcessEvent(), AnsaOSPF::NeighborStateExchange::ProcessEvent(), AnsaOSPF::NeighborStateDown::ProcessEvent(), AnsaOSPF::NeighborStateAttempt::ProcessEvent(), AnsaOSPF::InterfaceStateDown::ProcessEvent(), AnsaOSPF::InterfaceStateDesignatedRouter::ProcessEvent(), AnsaOSPF::InterfaceStateWaiting::ProcessEvent(), AnsaOSPF::InterfaceStatePointToPoint::ProcessEvent(), AnsaOSPF::InterfaceStateNotDesignatedRouter::ProcessEvent(), AnsaOSPF::NeighborStateTwoWay::ProcessEvent(), AnsaOSPF::NeighborStateLoading::ProcessEvent(), AnsaOSPF::InterfaceStateBackup::ProcessEvent(), and AnsaOSPF::NeighborStateInit::ProcessEvent().
{ return parentRouter; }
| const Router* AnsaOSPF::Area::GetRouter | ( | void | ) | const [inline] |
Definition at line 56 of file AnsaOSPFArea.h.
{ return parentRouter; }
| RouterLSA* AnsaOSPF::Area::GetRouterLSA | ( | unsigned long | i | ) | [inline] |
Definition at line 59 of file AnsaOSPFArea.h.
Referenced by AnsaOSPF::Neighbor::CreateDatabaseSummary().
{ return routerLSAs[i]; }
| const RouterLSA* AnsaOSPF::Area::GetRouterLSA | ( | unsigned long | i | ) | const [inline] |
Definition at line 60 of file AnsaOSPFArea.h.
{ return routerLSAs[i]; }
| unsigned long AnsaOSPF::Area::GetRouterLSACount | ( | void | ) | const [inline] |
Definition at line 58 of file AnsaOSPFArea.h.
Referenced by AnsaOSPF::Neighbor::CreateDatabaseSummary().
{ return routerLSAs.size(); }
| RouterLSA* AnsaOSPF::Area::GetSPFTreeRoot | ( | void | ) | [inline] |
Definition at line 51 of file AnsaOSPFArea.h.
{ return spfTreeRoot; }
| const RouterLSA* AnsaOSPF::Area::GetSPFTreeRoot | ( | void | ) | const [inline] |
Definition at line 52 of file AnsaOSPFArea.h.
{ return spfTreeRoot; }
| Metric AnsaOSPF::Area::GetStubDefaultCost | ( | void | ) | const [inline] |
Definition at line 49 of file AnsaOSPFArea.h.
{ return stubDefaultCost; }
| SummaryLSA* AnsaOSPF::Area::GetSummaryLSA | ( | unsigned long | i | ) | [inline] |
Definition at line 65 of file AnsaOSPFArea.h.
Referenced by AnsaOSPF::Neighbor::CreateDatabaseSummary().
{ return summaryLSAs[i]; }
| const SummaryLSA* AnsaOSPF::Area::GetSummaryLSA | ( | unsigned long | i | ) | const [inline] |
Definition at line 66 of file AnsaOSPFArea.h.
{ return summaryLSAs[i]; }
| unsigned long AnsaOSPF::Area::GetSummaryLSACount | ( | void | ) | const [inline] |
Definition at line 64 of file AnsaOSPFArea.h.
Referenced by AnsaOSPF::Neighbor::CreateDatabaseSummary().
{ return summaryLSAs.size(); }
| bool AnsaOSPF::Area::GetTransitCapability | ( | void | ) | const [inline] |
Definition at line 45 of file AnsaOSPFArea.h.
{ return transitCapability; }
| AnsaOSPF::LinkStateID AnsaOSPF::Area::GetUniqueLinkStateID | ( | AnsaOSPF::IPv4AddressRange | destination, |
| AnsaOSPF::Metric | destinationCost, | ||
| AnsaOSPF::SummaryLSA *& | lsaToReoriginate | ||
| ) | const [private] |
Returns a link state ID for the input destination. If this router hasn't originated a Summary LSA for the input destination then the function returs the destination address as link state ID. If it has originated a Summary LSA for the input destination then the function checks which LSA would contain the longer netmask. If the two masks are equal then this means thet we're updating an LSA already in the database, so the function returns the destination address as link state ID. If the input destination netmask is longer then the one already in the database, then the returned link state ID is the input destination address ORed together with the inverse of the input destination mask. If the input destination netmask is shorter, then the Summary LSA already in the database has to be replaced by the current destination. In this case the lsaToReoriginate parameter is filled with a copy of the Summary LSA in the database with it's mask replaced by the destination mask and the cost replaced by the input destination cost; the returned link state ID is the input destination address ORed together with the inverse of the mask stored in the Summary LSA in the database. This means that if the lsaToReoriginate parameter is not NULL on return then another lookup in the database is needed with the same LSAKey as used here(input destination address and the router's own routerID) and the resulting Summary LSA's link state ID should be changed to the one returned by this function.
Definition at line 1049 of file AnsaOSPFArea.cc.
{
if (lsaToReoriginate != NULL) {
delete lsaToReoriginate;
lsaToReoriginate = NULL;
}
AnsaOSPF::LSAKeyType lsaKey;
lsaKey.linkStateID = ULongFromIPv4Address(destination.address);
lsaKey.advertisingRouter = parentRouter->GetRouterID();
const AnsaOSPF::SummaryLSA* foundLSA = FindSummaryLSA(lsaKey);
if (foundLSA == NULL) {
return lsaKey.linkStateID;
} else {
AnsaOSPF::IPv4Address existingMask = IPv4AddressFromULong(foundLSA->getNetworkMask().getInt());
if (destination.mask == existingMask) {
return lsaKey.linkStateID;
} else {
if (destination.mask >= existingMask) {
return (lsaKey.linkStateID | (~(ULongFromIPv4Address(destination.mask))));
} else {
AnsaOSPF::SummaryLSA* summaryLSA = new AnsaOSPF::SummaryLSA(*foundLSA);
long sequenceNumber = summaryLSA->getHeader().getLsSequenceNumber();
summaryLSA->getHeader().setLsAge(0);
summaryLSA->getHeader().setLsSequenceNumber((sequenceNumber == MAX_SEQUENCE_NUMBER) ? INITIAL_SEQUENCE_NUMBER : sequenceNumber + 1);
summaryLSA->setNetworkMask(ULongFromIPv4Address(destination.mask));
summaryLSA->setRouteCost(destinationCost);
summaryLSA->getHeader().setLsChecksum(0); // TODO: calculate correct LS checksum
lsaToReoriginate = summaryLSA;
return (lsaKey.linkStateID | (~(ULongFromIPv4Address(existingMask))));
}
}
}
}
| bool AnsaOSPF::Area::HasAddressRange | ( | AnsaOSPF::IPv4AddressRange | addressRange | ) | const |
Definition at line 109 of file AnsaOSPFArea.cc.
{
int addressRangeNum = areaAddressRanges.size();
for (int i = 0; i < addressRangeNum; i++) {
if ((areaAddressRanges[i].address == addressRange.address) &&
(areaAddressRanges[i].mask == addressRange.mask))
{
return true;
}
}
return false;
}
| bool AnsaOSPF::Area::HasAnyNeighborInStates | ( | int | states | ) | const |
Definition at line 693 of file AnsaOSPFArea.cc.
{
long interfaceCount = associatedInterfaces.size();
for (long i = 0; i < interfaceCount; i++) {
if (associatedInterfaces[i]->HasAnyNeighborInStates(states)) {
return true;
}
}
return false;
}
| bool AnsaOSPF::Area::HasLink | ( | OSPFLSA * | fromLSA, |
| OSPFLSA * | toLSA | ||
| ) | const [private] |
Definition at line 2102 of file AnsaOSPFArea.cc.
{
unsigned int i;
AnsaOSPF::RouterLSA* fromRouterLSA = dynamic_cast<AnsaOSPF::RouterLSA*> (fromLSA);
if (fromRouterLSA != NULL) {
unsigned int linkCount = fromRouterLSA->getLinksArraySize();
AnsaOSPF::RouterLSA* toRouterLSA = dynamic_cast<AnsaOSPF::RouterLSA*> (toLSA);
if (toRouterLSA != NULL) {
for (i = 0; i < linkCount; i++) {
Link& link = fromRouterLSA->getLinks(i);
LinkType linkType = static_cast<LinkType> (link.getType());
if (((linkType == PointToPointLink) ||
(linkType == VirtualLink)) &&
(link.getLinkID().getInt() == toRouterLSA->getHeader().getLinkStateID()))
{
return true;
}
}
} else {
AnsaOSPF::NetworkLSA* toNetworkLSA = dynamic_cast<AnsaOSPF::NetworkLSA*> (toLSA);
if (toNetworkLSA != NULL) {
for (i = 0; i < linkCount; i++) {
Link& link = fromRouterLSA->getLinks(i);
if ((link.getType() == TransitLink) &&
(link.getLinkID().getInt() == toNetworkLSA->getHeader().getLinkStateID()))
{
return true;
}
if ((link.getType() == StubLink) &&
((link.getLinkID().getInt() & link.getLinkData()) == (toNetworkLSA->getHeader().getLinkStateID() & toNetworkLSA->getNetworkMask().getInt())))
{
return true;
}
}
}
}
} else {
AnsaOSPF::NetworkLSA* fromNetworkLSA = dynamic_cast<AnsaOSPF::NetworkLSA*> (fromLSA);
if (fromNetworkLSA != NULL) {
unsigned int routerCount = fromNetworkLSA->getAttachedRoutersArraySize();
AnsaOSPF::RouterLSA* toRouterLSA = dynamic_cast<AnsaOSPF::RouterLSA*> (toLSA);
if (toRouterLSA != NULL) {
for (i = 0; i < routerCount; i++) {
if (fromNetworkLSA->getAttachedRouters(i).getInt() == toRouterLSA->getHeader().getLinkStateID()) {
return true;
}
}
}
}
}
return false;
}
| bool AnsaOSPF::Area::HasVirtualLink | ( | AnsaOSPF::AreaID | withTransitArea | ) | const |
Definition at line 170 of file AnsaOSPFArea.cc.
Referenced by OriginateRouterLSA().
{
if ((areaID != AnsaOSPF::BackboneAreaID) || (withTransitArea == AnsaOSPF::BackboneAreaID)) {
return false;
}
int interfaceNum = associatedInterfaces.size();
for (int i = 0; i < interfaceNum; i++) {
if ((associatedInterfaces[i]->GetType() == AnsaOSPF::Interface::Virtual) &&
(associatedInterfaces[i]->GetTransitAreaID() == withTransitArea))
{
return true;
}
}
return false;
}
| void AnsaOSPF::Area::info | ( | char * | buffer | ) |
Definition at line 45 of file AnsaOSPFArea.cc.
{
std::stringstream out;
char areaString[16];
out << "areaID: " << AddressStringFromULong(areaString, 16, areaID);
strcpy(buffer, out.str().c_str());
}
| bool AnsaOSPF::Area::InstallNetworkLSA | ( | OSPFNetworkLSA * | lsa | ) |
Definition at line 221 of file AnsaOSPFArea.cc.
Referenced by AnsaOSPF::InterfaceState::ChangeState().
{
AnsaOSPF::LinkStateID linkStateID = lsa->getHeader().getLinkStateID();
std::map<AnsaOSPF::LinkStateID, AnsaOSPF::NetworkLSA*>::iterator lsaIt = networkLSAsByID.find(linkStateID);
if (lsaIt != networkLSAsByID.end()) {
AnsaOSPF::LSAKeyType lsaKey;
lsaKey.linkStateID = lsa->getHeader().getLinkStateID();
lsaKey.advertisingRouter = lsa->getHeader().getAdvertisingRouter().getInt();
RemoveFromAllRetransmissionLists(lsaKey);
return lsaIt->second->Update(lsa);
} else {
AnsaOSPF::NetworkLSA* lsaCopy = new AnsaOSPF::NetworkLSA(*lsa);
networkLSAsByID[linkStateID] = lsaCopy;
networkLSAs.push_back(lsaCopy);
return true;
}
}
| bool AnsaOSPF::Area::InstallRouterLSA | ( | OSPFRouterLSA * | lsa | ) |
Definition at line 201 of file AnsaOSPFArea.cc.
Referenced by AnsaOSPF::InterfaceState::ChangeState().
{
AnsaOSPF::LinkStateID linkStateID = lsa->getHeader().getLinkStateID();
std::map<AnsaOSPF::LinkStateID, AnsaOSPF::RouterLSA*>::iterator lsaIt = routerLSAsByID.find(linkStateID);
if (lsaIt != routerLSAsByID.end()) {
AnsaOSPF::LSAKeyType lsaKey;
lsaKey.linkStateID = lsa->getHeader().getLinkStateID();
lsaKey.advertisingRouter = lsa->getHeader().getAdvertisingRouter().getInt();
RemoveFromAllRetransmissionLists(lsaKey);
return lsaIt->second->Update(lsa);
} else {
AnsaOSPF::RouterLSA* lsaCopy = new AnsaOSPF::RouterLSA(*lsa);
routerLSAsByID[linkStateID] = lsaCopy;
routerLSAs.push_back(lsaCopy);
return true;
}
}
| bool AnsaOSPF::Area::InstallSummaryLSA | ( | OSPFSummaryLSA * | lsa | ) |
Definition at line 241 of file AnsaOSPFArea.cc.
{
AnsaOSPF::LSAKeyType lsaKey;
lsaKey.linkStateID = lsa->getHeader().getLinkStateID();
lsaKey.advertisingRouter = lsa->getHeader().getAdvertisingRouter().getInt();
std::map<AnsaOSPF::LSAKeyType, AnsaOSPF::SummaryLSA*, AnsaOSPF::LSAKeyType_Less>::iterator lsaIt = summaryLSAsByID.find(lsaKey);
if (lsaIt != summaryLSAsByID.end()) {
AnsaOSPF::LSAKeyType lsaKey;
lsaKey.linkStateID = lsa->getHeader().getLinkStateID();
lsaKey.advertisingRouter = lsa->getHeader().getAdvertisingRouter().getInt();
RemoveFromAllRetransmissionLists(lsaKey);
return lsaIt->second->Update(lsa);
} else {
AnsaOSPF::SummaryLSA* lsaCopy = new AnsaOSPF::SummaryLSA(*lsa);
summaryLSAsByID[lsaKey] = lsaCopy;
summaryLSAs.push_back(lsaCopy);
return true;
}
}
| bool AnsaOSPF::Area::IsLocalAddress | ( | AnsaOSPF::IPv4Address | address | ) | const |
Definition at line 737 of file AnsaOSPFArea.cc.
{
long interfaceCount = associatedInterfaces.size();
for (long i = 0; i < interfaceCount; i++) {
if (associatedInterfaces[i]->GetAddressRange().address == address) {
return true;
}
}
return false;
}
| bool AnsaOSPF::Area::IsOnAnyRetransmissionList | ( | AnsaOSPF::LSAKeyType | lsaKey | ) | const |
Definition at line 712 of file AnsaOSPFArea.cc.
{
long interfaceCount = associatedInterfaces.size();
for (long i = 0; i < interfaceCount; i++) {
if (associatedInterfaces[i]->IsOnAnyRetransmissionList(lsaKey)) {
return true;
}
}
return false;
}
| AnsaOSPF::NetworkLSA * AnsaOSPF::Area::OriginateNetworkLSA | ( | const Interface * | intf | ) |
Definition at line 989 of file AnsaOSPFArea.cc.
Referenced by AnsaOSPF::InterfaceState::ChangeState(), and AnsaOSPF::NeighborState::ChangeState().
{
if (intf->HasAnyNeighborInStates(AnsaOSPF::Neighbor::FullState)) {
AnsaOSPF::NetworkLSA* networkLSA = new AnsaOSPF::NetworkLSA;
OSPFLSAHeader& lsaHeader = networkLSA->getHeader();
long neighborCount = intf->GetNeighborCount();
OSPFOptions lsOptions;
lsaHeader.setLsAge(0);
memset(&lsOptions, 0, sizeof(OSPFOptions));
lsOptions.E_ExternalRoutingCapability = externalRoutingCapability;
lsaHeader.setLsOptions(lsOptions);
lsaHeader.setLsType(NetworkLSAType);
lsaHeader.setLinkStateID(ULongFromIPv4Address(intf->GetAddressRange().address));
lsaHeader.setAdvertisingRouter(parentRouter->GetRouterID());
lsaHeader.setLsSequenceNumber(INITIAL_SEQUENCE_NUMBER);
networkLSA->setNetworkMask(ULongFromIPv4Address(intf->GetAddressRange().mask));
for (long j = 0; j < neighborCount; j++) {
const AnsaOSPF::Neighbor* neighbor = intf->GetNeighbor(j);
if (neighbor->GetState() == AnsaOSPF::Neighbor::FullState) {
unsigned short netIndex = networkLSA->getAttachedRoutersArraySize();
networkLSA->setAttachedRoutersArraySize(netIndex + 1);
networkLSA->setAttachedRouters(netIndex, neighbor->GetNeighborID());
}
}
unsigned short netIndex = networkLSA->getAttachedRoutersArraySize();
networkLSA->setAttachedRoutersArraySize(netIndex + 1);
networkLSA->setAttachedRouters(netIndex, parentRouter->GetRouterID());
lsaHeader.setLsChecksum(0); // TODO: calculate correct LS checksum
return networkLSA;
} else {
return NULL;
}
}
Definition at line 748 of file AnsaOSPFArea.cc.
Referenced by AnsaOSPF::InterfaceState::ChangeState(), AnsaOSPF::NeighborState::ChangeState(), and AnsaOSPF::HelloHandler::ProcessPacket().
{
AnsaOSPF::RouterLSA* routerLSA = new AnsaOSPF::RouterLSA;
OSPFLSAHeader& lsaHeader = routerLSA->getHeader();
long interfaceCount = associatedInterfaces.size();
OSPFOptions lsOptions;
long i;
lsaHeader.setLsAge(0);
memset(&lsOptions, 0, sizeof(OSPFOptions));
lsOptions.E_ExternalRoutingCapability = externalRoutingCapability;
lsaHeader.setLsOptions(lsOptions);
lsaHeader.setLsType(RouterLSAType);
lsaHeader.setLinkStateID(parentRouter->GetRouterID());
lsaHeader.setAdvertisingRouter(parentRouter->GetRouterID());
lsaHeader.setLsSequenceNumber(INITIAL_SEQUENCE_NUMBER);
routerLSA->setB_AreaBorderRouter(parentRouter->GetAreaCount() > 1);
routerLSA->setE_ASBoundaryRouter((externalRoutingCapability && parentRouter->GetASBoundaryRouter()) ? true : false);
AnsaOSPF::Area* backbone = parentRouter->GetArea(AnsaOSPF::BackboneAreaID);
routerLSA->setV_VirtualLinkEndpoint((backbone == NULL) ? false : backbone->HasVirtualLink(areaID));
routerLSA->setNumberOfLinks(0);
routerLSA->setLinksArraySize(0);
for (i = 0; i < interfaceCount; i++) {
AnsaOSPF::Interface* intf = associatedInterfaces[i];
if (intf->GetState() == AnsaOSPF::Interface::DownState) {
continue;
}
if ((intf->GetState() == AnsaOSPF::Interface::LoopbackState) &&
((intf->GetType() != AnsaOSPF::Interface::PointToPoint) ||
(intf->GetAddressRange().address != AnsaOSPF::NullIPv4Address)))
{
Link stubLink;
stubLink.setType(StubLink);
stubLink.setLinkID(ULongFromIPv4Address(intf->GetAddressRange().address));
stubLink.setLinkData(0xFFFFFFFF);
stubLink.setLinkCost(0);
stubLink.setNumberOfTOS(0);
stubLink.setTosDataArraySize(0);
unsigned short linkIndex = routerLSA->getLinksArraySize();
routerLSA->setLinksArraySize(linkIndex + 1);
routerLSA->setNumberOfLinks(linkIndex + 1);
routerLSA->setLinks(linkIndex, stubLink);
}
if (intf->GetState() > AnsaOSPF::Interface::LoopbackState) {
switch (intf->GetType()) {
case AnsaOSPF::Interface::PointToPoint:
{
AnsaOSPF::Neighbor* neighbor = (intf->GetNeighborCount() > 0) ? intf->GetNeighbor(0) : NULL;
if (neighbor != NULL) {
if (neighbor->GetState() == AnsaOSPF::Neighbor::FullState) {
Link link;
link.setType(PointToPointLink);
link.setLinkID(neighbor->GetNeighborID());
if (intf->GetAddressRange().address != AnsaOSPF::NullIPv4Address) {
link.setLinkData(ULongFromIPv4Address(intf->GetAddressRange().address));
} else {
link.setLinkData(intf->GetIfIndex());
}
link.setLinkCost(intf->GetOutputCost());
link.setNumberOfTOS(0);
link.setTosDataArraySize(0);
unsigned short linkIndex = routerLSA->getLinksArraySize();
routerLSA->setLinksArraySize(linkIndex + 1);
routerLSA->setNumberOfLinks(linkIndex + 1);
routerLSA->setLinks(linkIndex, link);
}
if (intf->GetState() == AnsaOSPF::Interface::PointToPointState) {
if (neighbor->GetAddress() != AnsaOSPF::NullIPv4Address) {
Link stubLink;
stubLink.setType(StubLink);
stubLink.setLinkID(ULongFromIPv4Address(neighbor->GetAddress()));
stubLink.setLinkData(ULongFromIPv4Address(intf->GetAddressRange().mask));
stubLink.setLinkCost(intf->GetOutputCost());
stubLink.setNumberOfTOS(0);
stubLink.setTosDataArraySize(0);
unsigned short linkIndex = routerLSA->getLinksArraySize();
routerLSA->setLinksArraySize(linkIndex + 1);
routerLSA->setNumberOfLinks(linkIndex + 1);
routerLSA->setLinks(linkIndex, stubLink);
} else {
if (ULongFromIPv4Address(intf->GetAddressRange().mask) != 0xFFFFFFFF) {
Link stubLink;
stubLink.setType(StubLink);
stubLink.setLinkID(ULongFromIPv4Address(intf->GetAddressRange().address &
intf->GetAddressRange().mask));
stubLink.setLinkData(ULongFromIPv4Address(intf->GetAddressRange().mask));
stubLink.setLinkCost(intf->GetOutputCost());
stubLink.setNumberOfTOS(0);
stubLink.setTosDataArraySize(0);
unsigned short linkIndex = routerLSA->getLinksArraySize();
routerLSA->setLinksArraySize(linkIndex + 1);
routerLSA->setNumberOfLinks(linkIndex + 1);
routerLSA->setLinks(linkIndex, stubLink);
}
}
}
}
}
break;
case AnsaOSPF::Interface::Broadcast:
case AnsaOSPF::Interface::NBMA:
{
if (intf->GetState() == AnsaOSPF::Interface::WaitingState) {
Link stubLink;
stubLink.setType(StubLink);
stubLink.setLinkID(ULongFromIPv4Address(intf->GetAddressRange().address &
intf->GetAddressRange().mask));
stubLink.setLinkData(ULongFromIPv4Address(intf->GetAddressRange().mask));
stubLink.setLinkCost(intf->GetOutputCost());
stubLink.setNumberOfTOS(0);
stubLink.setTosDataArraySize(0);
unsigned short linkIndex = routerLSA->getLinksArraySize();
routerLSA->setLinksArraySize(linkIndex + 1);
routerLSA->setNumberOfLinks(linkIndex + 1);
routerLSA->setLinks(linkIndex, stubLink);
} else {
AnsaOSPF::Neighbor* dRouter = intf->GetNeighborByAddress(intf->GetDesignatedRouter().ipInterfaceAddress);
if (((dRouter != NULL) && (dRouter->GetState() == AnsaOSPF::Neighbor::FullState)) ||
((intf->GetDesignatedRouter().routerID == parentRouter->GetRouterID()) &&
(intf->HasAnyNeighborInStates(AnsaOSPF::Neighbor::FullState))))
{
Link link;
link.setType(TransitLink);
link.setLinkID(ULongFromIPv4Address(intf->GetDesignatedRouter().ipInterfaceAddress));
link.setLinkData(ULongFromIPv4Address(intf->GetAddressRange().address));
link.setLinkCost(intf->GetOutputCost());
link.setNumberOfTOS(0);
link.setTosDataArraySize(0);
unsigned short linkIndex = routerLSA->getLinksArraySize();
routerLSA->setLinksArraySize(linkIndex + 1);
routerLSA->setNumberOfLinks(linkIndex + 1);
routerLSA->setLinks(linkIndex, link);
} else {
Link stubLink;
stubLink.setType(StubLink);
stubLink.setLinkID(ULongFromIPv4Address(intf->GetAddressRange().address &
intf->GetAddressRange().mask));
stubLink.setLinkData(ULongFromIPv4Address(intf->GetAddressRange().mask));
stubLink.setLinkCost(intf->GetOutputCost());
stubLink.setNumberOfTOS(0);
stubLink.setTosDataArraySize(0);
unsigned short linkIndex = routerLSA->getLinksArraySize();
routerLSA->setLinksArraySize(linkIndex + 1);
routerLSA->setNumberOfLinks(linkIndex + 1);
routerLSA->setLinks(linkIndex, stubLink);
}
}
}
break;
case AnsaOSPF::Interface::Virtual:
{
AnsaOSPF::Neighbor* neighbor = (intf->GetNeighborCount() > 0) ? intf->GetNeighbor(0) : NULL;
if ((neighbor != NULL) && (neighbor->GetState() == AnsaOSPF::Neighbor::FullState)) {
Link link;
link.setType(VirtualLink);
link.setLinkID(neighbor->GetNeighborID());
link.setLinkData(ULongFromIPv4Address(intf->GetAddressRange().address));
link.setLinkCost(intf->GetOutputCost());
link.setNumberOfTOS(0);
link.setTosDataArraySize(0);
unsigned short linkIndex = routerLSA->getLinksArraySize();
routerLSA->setLinksArraySize(linkIndex + 1);
routerLSA->setNumberOfLinks(linkIndex + 1);
routerLSA->setLinks(linkIndex, link);
}
}
break;
case AnsaOSPF::Interface::PointToMultiPoint:
{
Link stubLink;
stubLink.setType(StubLink);
stubLink.setLinkID(ULongFromIPv4Address(intf->GetAddressRange().address));
stubLink.setLinkData(0xFFFFFFFF);
stubLink.setLinkCost(0);
stubLink.setNumberOfTOS(0);
stubLink.setTosDataArraySize(0);
unsigned short linkIndex = routerLSA->getLinksArraySize();
routerLSA->setLinksArraySize(linkIndex + 1);
routerLSA->setNumberOfLinks(linkIndex + 1);
routerLSA->setLinks(linkIndex, stubLink);
long neighborCount = intf->GetNeighborCount();
for (long i = 0; i < neighborCount; i++) {
AnsaOSPF::Neighbor* neighbor = intf->GetNeighbor(i);
if (neighbor->GetState() == AnsaOSPF::Neighbor::FullState) {
Link link;
link.setType(PointToPointLink);
link.setLinkID(neighbor->GetNeighborID());
link.setLinkData(ULongFromIPv4Address(intf->GetAddressRange().address));
link.setLinkCost(intf->GetOutputCost());
link.setNumberOfTOS(0);
link.setTosDataArraySize(0);
unsigned short linkIndex = routerLSA->getLinksArraySize();
routerLSA->setLinksArraySize(linkIndex + 1);
routerLSA->setNumberOfLinks(linkIndex + 1);
routerLSA->setLinks(linkIndex, stubLink);
}
}
}
break;
default: break;
}
}
}
long hostRouteCount = hostRoutes.size();
for (i = 0; i < hostRouteCount; i++) {
Link stubLink;
stubLink.setType(StubLink);
stubLink.setLinkID(ULongFromIPv4Address(hostRoutes[i].address));
stubLink.setLinkData(0xFFFFFFFF);
stubLink.setLinkCost(hostRoutes[i].linkCost);
stubLink.setNumberOfTOS(0);
stubLink.setTosDataArraySize(0);
unsigned short linkIndex = routerLSA->getLinksArraySize();
routerLSA->setLinksArraySize(linkIndex + 1);
routerLSA->setNumberOfLinks(linkIndex + 1);
routerLSA->setLinks(linkIndex, stubLink);
}
lsaHeader.setLsChecksum(0); // TODO: calculate correct LS checksum
routerLSA->SetSource(AnsaOSPF::LSATrackingInfo::Originated);
return routerLSA;
}
| SummaryLSA* AnsaOSPF::Area::OriginateSummaryLSA | ( | const RoutingTableEntry * | entry, |
| const std::map< LSAKeyType, bool, LSAKeyType_Less > & | originatedLSAs, | ||
| SummaryLSA *& | lsaToReoriginate | ||
| ) |
| AnsaOSPF::SummaryLSA * AnsaOSPF::Area::OriginateSummaryLSA | ( | const AnsaOSPF::SummaryLSA * | summaryLSA | ) | [private] |
Definition at line 1352 of file AnsaOSPFArea.cc.
{
const std::map<AnsaOSPF::LSAKeyType, bool, AnsaOSPF::LSAKeyType_Less> emptyMap;
AnsaOSPF::SummaryLSA* dontReoriginate = NULL;
const OSPFLSAHeader& lsaHeader = summaryLSA->getHeader();
unsigned long entryCount = parentRouter->GetRoutingTableEntryCount();
for (unsigned long i = 0; i < entryCount; i++) {
const AnsaOSPF::RoutingTableEntry* entry = parentRouter->GetRoutingTableEntry(i);
if ((lsaHeader.getLsType() == SummaryLSA_ASBoundaryRoutersType) &&
((((entry->GetDestinationType() & AnsaOSPF::RoutingTableEntry::AreaBorderRouterDestination) != 0) ||
((entry->GetDestinationType() & AnsaOSPF::RoutingTableEntry::ASBoundaryRouterDestination) != 0)) &&
((entry->GetDestinationID().getInt() == lsaHeader.getLinkStateID()) &&
(entry->GetAddressMask() == summaryLSA->getNetworkMask()))))
{
AnsaOSPF::SummaryLSA* returnLSA = OriginateSummaryLSA(entry, emptyMap, dontReoriginate);
if (dontReoriginate != NULL) {
delete dontReoriginate;
}
return returnLSA;
}
unsigned long lsaMask = summaryLSA->getNetworkMask().getInt();
if ((lsaHeader.getLsType() == SummaryLSA_NetworksType) &&
(entry->GetDestinationType() == AnsaOSPF::RoutingTableEntry::NetworkDestination) &&
(entry->GetAddressMask().getInt() == lsaMask) &&
((entry->GetDestinationID().getInt() & lsaMask) == (lsaHeader.getLinkStateID() & lsaMask)))
{
AnsaOSPF::SummaryLSA* returnLSA = OriginateSummaryLSA(entry, emptyMap, dontReoriginate);
if (dontReoriginate != NULL) {
delete dontReoriginate;
}
return returnLSA;
}
}
return NULL;
}
| void AnsaOSPF::Area::ReCheckSummaryLSAs | ( | std::vector< RoutingTableEntry * > & | newRoutingTable | ) |
Definition at line 704 of file AnsaOSPFArea.cc.
{
long interfaceCount = associatedInterfaces.size();
for (long i = 0; i < interfaceCount; i++) {
associatedInterfaces[i]->RemoveFromAllRetransmissionLists(lsaKey);
}
}
| void AnsaOSPF::Area::RemoveParentFromRoutingInfo | ( | OSPFLSA * | parent | ) |
Definition at line 325 of file AnsaOSPFArea.cc.
{
long lsaCount = routerLSAs.size();
long i;
for (i = 0; i < lsaCount; i++)
{
if(routerLSAs[i] != NULL)
{
AnsaOSPF::RouterLSA* routerLSA = routerLSAs[i];
AnsaOSPF::RoutingInfo* routingInfo = check_and_cast<AnsaOSPF::RoutingInfo*> (routerLSA);
if(routingInfo->GetParent() == parent)
routingInfo->SetParent(NULL);
}
}
lsaCount = networkLSAs.size();
for (i = 0; i < lsaCount; i++)
{
if(networkLSAs[i] != NULL)
{
AnsaOSPF::NetworkLSA* networkLSA = networkLSAs[i];
AnsaOSPF::RoutingInfo* routingInfo = check_and_cast<AnsaOSPF::RoutingInfo*> (networkLSA);
if(routingInfo->GetParent() == parent)
routingInfo->SetParent(NULL);
}
}
lsaCount = summaryLSAs.size();
for (i = 0; i < lsaCount; i++)
{
if(summaryLSAs[i] != NULL)
{
AnsaOSPF::SummaryLSA* summaryLSA = summaryLSAs[i];
AnsaOSPF::RoutingInfo* routingInfo = check_and_cast<AnsaOSPF::RoutingInfo*> (summaryLSA);
if(routingInfo->GetParent() == parent)
routingInfo->SetParent(NULL);
}
}
}
| void AnsaOSPF::Area::SetAreaID | ( | AreaID | areaId | ) | [inline] |
Definition at line 38 of file AnsaOSPFArea.h.
{ areaID = areaId; }
| void AnsaOSPF::Area::SetExternalRoutingCapability | ( | bool | flooded | ) | [inline] |
Definition at line 46 of file AnsaOSPFArea.h.
Referenced by AnsaOSPFRouting::AnsaLoadArea(), and AnsaOSPFRouting::LoadAreaFromXML().
{ externalRoutingCapability = flooded; }
| void AnsaOSPF::Area::SetRouter | ( | Router * | router | ) | [inline] |
Definition at line 54 of file AnsaOSPFArea.h.
Referenced by AnsaOSPF::Router::AddArea().
{ parentRouter = router; }
| void AnsaOSPF::Area::SetSPFTreeRoot | ( | RouterLSA * | root | ) | [inline] |
Definition at line 50 of file AnsaOSPFArea.h.
Referenced by AnsaOSPF::InterfaceState::ChangeState().
{ spfTreeRoot = root; }
| void AnsaOSPF::Area::SetStubDefaultCost | ( | Metric | cost | ) | [inline] |
Definition at line 48 of file AnsaOSPFArea.h.
Referenced by AnsaOSPFRouting::AnsaLoadArea(), and AnsaOSPFRouting::LoadAreaFromXML().
{ stubDefaultCost = cost; }
| void AnsaOSPF::Area::SetTransitCapability | ( | bool | transit | ) | [inline] |
Definition at line 44 of file AnsaOSPFArea.h.
{ transitCapability = transit; }
std::map<IPv4AddressRange, bool, IPv4AddressRange_Less> AnsaOSPF::Area::advertiseAddressRanges [private] |
Definition at line 18 of file AnsaOSPFArea.h.
Referenced by AddAddressRange().
std::vector<IPv4AddressRange> AnsaOSPF::Area::areaAddressRanges [private] |
Definition at line 19 of file AnsaOSPFArea.h.
Referenced by AddAddressRange(), GetAddressRange(), and GetAddressRangeCount().
AreaID AnsaOSPF::Area::areaID [private] |
Definition at line 17 of file AnsaOSPFArea.h.
Referenced by GetAreaID(), and SetAreaID().
std::vector<Interface*> AnsaOSPF::Area::associatedInterfaces [private] |
Definition at line 20 of file AnsaOSPFArea.h.
bool AnsaOSPF::Area::externalRoutingCapability [private] |
Definition at line 29 of file AnsaOSPFArea.h.
Referenced by GetExternalRoutingCapability(), and SetExternalRoutingCapability().
std::vector<HostRouteParameters> AnsaOSPF::Area::hostRoutes [private] |
Definition at line 21 of file AnsaOSPFArea.h.
Referenced by AddHostRoute().
std::vector<NetworkLSA*> AnsaOSPF::Area::networkLSAs [private] |
Definition at line 25 of file AnsaOSPFArea.h.
Referenced by GetNetworkLSA(), and GetNetworkLSACount().
std::map<LinkStateID, NetworkLSA*> AnsaOSPF::Area::networkLSAsByID [private] |
Definition at line 24 of file AnsaOSPFArea.h.
Router* AnsaOSPF::Area::parentRouter [private] |
Definition at line 33 of file AnsaOSPFArea.h.
Referenced by GetRouter(), and SetRouter().
std::vector<RouterLSA*> AnsaOSPF::Area::routerLSAs [private] |
Definition at line 23 of file AnsaOSPFArea.h.
Referenced by GetRouterLSA(), and GetRouterLSACount().
std::map<LinkStateID, RouterLSA*> AnsaOSPF::Area::routerLSAsByID [private] |
Definition at line 22 of file AnsaOSPFArea.h.
RouterLSA* AnsaOSPF::Area::spfTreeRoot [private] |
Definition at line 31 of file AnsaOSPFArea.h.
Referenced by GetSPFTreeRoot(), and SetSPFTreeRoot().
Metric AnsaOSPF::Area::stubDefaultCost [private] |
Definition at line 30 of file AnsaOSPFArea.h.
Referenced by GetStubDefaultCost(), and SetStubDefaultCost().
std::vector<SummaryLSA*> AnsaOSPF::Area::summaryLSAs [private] |
Definition at line 27 of file AnsaOSPFArea.h.
Referenced by GetSummaryLSA(), and GetSummaryLSACount().
std::map<LSAKeyType, SummaryLSA*, LSAKeyType_Less> AnsaOSPF::Area::summaryLSAsByID [private] |
Definition at line 26 of file AnsaOSPFArea.h.
bool AnsaOSPF::Area::transitCapability [private] |
Definition at line 28 of file AnsaOSPFArea.h.
Referenced by GetTransitCapability(), and SetTransitCapability().