|
INET Framework for OMNeT++/OMNEST
|
00001 // 00002 // This program is free software: you can redistribute it and/or modify 00003 // it under the terms of the GNU Lesser General Public License as published by 00004 // the Free Software Foundation, either version 3 of the License, or 00005 // (at your option) any later version. 00006 // 00007 // This program is distributed in the hope that it will be useful, 00008 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00009 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00010 // GNU Lesser General Public License for more details. 00011 // 00012 // You should have received a copy of the GNU Lesser General Public License 00013 // along with this program. If not, see http://www.gnu.org/licenses/. 00014 // 00015 00016 #include "ansaOspfRouter6.h" 00017 00018 #include "ansaLinkStateAcknowledgementHandler6.h" 00019 00020 AnsaOspf6::LinkStateAcknowledgementHandler::LinkStateAcknowledgementHandler(AnsaOspf6::Router* containingRouter) : 00021 AnsaOspf6::IMessageHandler(containingRouter) { 00022 } 00023 00024 void AnsaOspf6::LinkStateAcknowledgementHandler::ProcessPacket(OspfPacket6* packet, AnsaOspf6::Interface* intf, AnsaOspf6::Neighbor* neighbor){ 00025 router->GetMessageHandler()->PrintEvent("Link State Acknowledgement packet received", intf, neighbor); 00026 00027 if (neighbor->GetState() >= AnsaOspf6::Neighbor::ExchangeState){ 00028 00029 OspfLinkStateAcknowledgementPacket6* lsAckPacket = check_and_cast<OspfLinkStateAcknowledgementPacket6*> (packet); 00030 int lsaCount = lsAckPacket->getLsaHeadersArraySize(); 00031 00032 EV<< " Processing packet contents:\n"; 00033 00034 for (int i = 0; i < lsaCount; i++){ 00035 OspfLsaHeader6& lsaHeader = lsAckPacket->getLsaHeaders(i); 00036 OspfLsa6* lsaOnRetransmissionList; 00037 AnsaOspf6::LsaKeyType6 lsaKey; 00038 00039 EV << " "; 00040 PrintLsaHeader6(lsaHeader, ev.getOStream()); 00041 EV << "\n"; 00042 00043 lsaKey.linkStateID = lsaHeader.getLinkStateID(); 00044 lsaKey.advertisingRouter = lsaHeader.getAdvertisingRouter(); 00045 00046 if ((lsaOnRetransmissionList = neighbor->FindOnRetransmissionList(lsaKey)) != NULL){ 00047 if (operator== (lsaHeader, lsaOnRetransmissionList->getHeader())) { 00048 neighbor->RemoveFromRetransmissionList(lsaKey); 00049 } else { 00050 EV << "Got an Acknowledgement packet for an unsent Update packet.\n"; 00051 } 00052 } 00053 } 00054 if (neighbor->IsLinkStateRetransmissionListEmpty()) { 00055 neighbor->ClearUpdateRetransmissionTimer(); 00056 } 00057 } 00058 } 00059