INET Framework for OMNeT++/OMNEST
ansaOspfInterfaceStatePointToPoint6.cc
Go to the documentation of this file.
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 "ansaOspfInterfaceStatePointToPoint6.h"
00022 
00023 void AnsaOspf6::InterfaceStatePointToPoint::ProcessEvent(AnsaOspf6::Interface* intf, AnsaOspf6::Interface::InterfaceEventType event){
00024 
00025    if (event == AnsaOspf6::Interface::InterfaceDown){
00026       intf->SetIsGoingDown(true);
00027       intf->Reset();
00028       ChangeState(intf, new AnsaOspf6::InterfaceStateDown, this);
00029       intf->SetIsGoingDown(false);
00030    }
00031 
00032    if (event == AnsaOspf6::Interface::LoopIndication){
00033       intf->Reset();
00034       ChangeState(intf, new AnsaOspf6::InterfaceStateLoopback, this);
00035    }
00036 
00037    if (event == AnsaOspf6::Interface::HelloTimer){
00038       if (intf->GetType() == AnsaOspf6::Interface::Virtual) {
00039          if (intf->GetNeighborCount() > 0) {
00040             intf->SendHelloPacket(intf->GetNeighbor(0)->GetAddress(), VIRTUAL_LINK_TTL);
00041          }
00042       } else {
00043          intf->SendHelloPacket(AnsaOspf6::AllSPFRouters);
00044       }
00045       intf->GetArea()->GetRouter()->GetMessageHandler()->StartTimer(intf->GetHelloTimer(), intf->GetHelloInterval());
00046    }
00047 
00048    if (event == AnsaOspf6::Interface::AcknowledgementTimer) {
00049       intf->SendDelayedAcknowledgements();
00050    }
00051 }