|
INET Framework for OMNeT++/OMNEST
|
#include <OSPFInterfaceStateDown.h>
Public Member Functions | |
| virtual void | ProcessEvent (Interface *intf, Interface::InterfaceEventType event) |
| virtual Interface::InterfaceStateType | GetState (void) const |
| virtual Interface::InterfaceStateType OSPF::InterfaceStateDown::GetState | ( | void | ) | const [inline, virtual] |
Implements OSPF::InterfaceState.
{ return Interface::DownState; }
| void OSPF::InterfaceStateDown::ProcessEvent | ( | OSPF::Interface * | intf, |
| Interface::InterfaceEventType | event | ||
| ) | [virtual] |
Implements OSPF::InterfaceState.
{
if (event == OSPF::Interface::InterfaceUp) {
OSPF::MessageHandler* messageHandler = intf->GetArea()->GetRouter()->GetMessageHandler();
messageHandler->StartTimer(intf->GetHelloTimer(), truncnormal(0.1, 0.01)); // add some deviation to avoid startup collisions
messageHandler->StartTimer(intf->GetAcknowledgementTimer(), intf->GetAcknowledgementDelay());
switch (intf->GetType()) {
case OSPF::Interface::PointToPoint:
case OSPF::Interface::PointToMultiPoint:
case OSPF::Interface::Virtual:
ChangeState(intf, new OSPF::InterfaceStatePointToPoint, this);
break;
case OSPF::Interface::NBMA:
if (intf->GetRouterPriority() == 0) {
ChangeState(intf, new OSPF::InterfaceStateNotDesignatedRouter, this);
} else {
ChangeState(intf, new OSPF::InterfaceStateWaiting, this);
messageHandler->StartTimer(intf->GetWaitTimer(), intf->GetRouterDeadInterval());
long neighborCount = intf->GetNeighborCount();
for (long i = 0; i < neighborCount; i++) {
OSPF::Neighbor* neighbor = intf->GetNeighbor(i);
if (neighbor->GetPriority() > 0) {
neighbor->ProcessEvent(OSPF::Neighbor::Start);
}
}
}
break;
case OSPF::Interface::Broadcast:
if (intf->GetRouterPriority() == 0) {
ChangeState(intf, new OSPF::InterfaceStateNotDesignatedRouter, this);
} else {
ChangeState(intf, new OSPF::InterfaceStateWaiting, this);
messageHandler->StartTimer(intf->GetWaitTimer(), intf->GetRouterDeadInterval());
}
break;
default:
break;
}
}
if (event == OSPF::Interface::LoopIndication) {
intf->Reset();
ChangeState(intf, new OSPF::InterfaceStateLoopback, this);
}
}