|
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 "ansaOspfArea6.h" 00017 #include "ansaOspfRouter6.h" 00018 00019 #include "ansaOspfInterfaceStateDown6.h" 00020 #include "ansaOspfInterfaceStateLoopback6.h" 00021 #include "ansaOspfInterfaceStateWaiting6.h" 00022 00023 void AnsaOspf6::InterfaceStateWaiting::ProcessEvent(AnsaOspf6::Interface* intf, AnsaOspf6::Interface::InterfaceEventType event){ 00024 00025 if ((event == AnsaOspf6::Interface::BackupSeen) || (event == AnsaOspf6::Interface::WaitTimer)){ 00026 CalculateDesignatedRouter(intf); 00027 } 00028 00029 if (event == AnsaOspf6::Interface::InterfaceDown){ 00030 intf->SetIsGoingDown(true); 00031 intf->Reset(); 00032 ChangeState(intf, new AnsaOspf6::InterfaceStateDown, this); 00033 intf->SetIsGoingDown(false); 00034 } 00035 00036 if (event == AnsaOspf6::Interface::LoopIndication){ 00037 intf->Reset(); 00038 ChangeState(intf, new AnsaOspf6::InterfaceStateLoopback, this); 00039 } 00040 00041 if (event == AnsaOspf6::Interface::HelloTimer){ 00042 if (intf->GetType() == AnsaOspf6::Interface::Broadcast){ 00043 intf->SendHelloPacket(AnsaOspf6::AllSPFRouters); 00044 }else{ // AnsaOspf6::Interface::NBMA 00045 unsigned long neighborCount = intf->GetNeighborCount(); 00046 int ttl = (intf->GetType() == AnsaOspf6::Interface::Virtual) ? VIRTUAL_LINK_TTL : 1; 00047 for (unsigned long i = 0; i < neighborCount; i++) { 00048 AnsaOspf6::Neighbor* neighbor = intf->GetNeighbor(i); 00049 if (neighbor->GetPriority() > 0){ 00050 intf->SendHelloPacket(neighbor->GetAddress(), ttl); 00051 } 00052 } 00053 } 00054 intf->GetArea()->GetRouter()->GetMessageHandler()->StartTimer(intf->GetHelloTimer(), intf->GetHelloInterval()); 00055 } 00056 00057 if (event == AnsaOspf6::Interface::AcknowledgementTimer){ 00058 intf->SendDelayedAcknowledgements(); 00059 } 00060 }