INET Framework for OMNeT++/OMNEST
AnsaOSPFInterfaceStatePointToPoint.cc
Go to the documentation of this file.
00001 #include "AnsaOSPFInterfaceStatePointToPoint.h"
00002 #include "AnsaOSPFInterfaceStateDown.h"
00003 #include "AnsaOSPFInterfaceStateLoopback.h"
00004 #include "AnsaOSPFArea.h"
00005 #include "AnsaOSPFRouter.h"
00006 #include "AnsaMessageHandler.h"
00007 
00008 void AnsaOSPF::InterfaceStatePointToPoint::ProcessEvent(AnsaOSPF::Interface* intf, AnsaOSPF::Interface::InterfaceEventType event)
00009 {
00010     if (event == AnsaOSPF::Interface::InterfaceDown) {
00011         intf->SetIsGoingDown(true);
00012         intf->Reset();
00013         ChangeState(intf, new AnsaOSPF::InterfaceStateDown, this);
00014         intf->SetIsGoingDown(false);
00015     }
00016     if (event == AnsaOSPF::Interface::LoopIndication) {
00017         intf->Reset();
00018         ChangeState(intf, new AnsaOSPF::InterfaceStateLoopback, this);
00019     }
00020     if (event == AnsaOSPF::Interface::HelloTimer) {
00021         if (intf->GetType() == AnsaOSPF::Interface::Virtual) {
00022             if (intf->GetNeighborCount() > 0) {
00023                 intf->SendHelloPacket(intf->GetNeighbor(0)->GetAddress(), VIRTUAL_LINK_TTL);
00024             }
00025         } else {
00026             intf->SendHelloPacket(AnsaOSPF::AllSPFRouters);
00027         }
00028         intf->GetArea()->GetRouter()->GetMessageHandler()->StartTimer(intf->GetHelloTimer(), intf->GetHelloInterval());
00029     }
00030     if (event == AnsaOSPF::Interface::AcknowledgementTimer) {
00031         intf->SendDelayedAcknowledgements();
00032     }
00033 }
00034