#include <OSPFInterfaceStateDown.h>
Public Member Functions | |
virtual void | ProcessEvent (Interface *intf, Interface::InterfaceEventType event) |
virtual Interface::InterfaceStateType | GetState (void) const |
void OSPF::InterfaceStateDown::ProcessEvent | ( | OSPF::Interface * | intf, | |
Interface::InterfaceEventType | event | |||
) | [virtual] |
Implements OSPF::InterfaceState.
00028 { 00029 if (event == OSPF::Interface::InterfaceUp) { 00030 OSPF::MessageHandler* messageHandler = intf->GetArea()->GetRouter()->GetMessageHandler(); 00031 messageHandler->StartTimer(intf->GetHelloTimer(), truncnormal(0.1, 0.01)); // add some deviation to avoid startup collisions 00032 messageHandler->StartTimer(intf->GetAcknowledgementTimer(), intf->GetAcknowledgementDelay()); 00033 switch (intf->GetType()) { 00034 case OSPF::Interface::PointToPoint: 00035 case OSPF::Interface::PointToMultiPoint: 00036 case OSPF::Interface::Virtual: 00037 ChangeState(intf, new OSPF::InterfaceStatePointToPoint, this); 00038 break; 00039 00040 case OSPF::Interface::NBMA: 00041 if (intf->GetRouterPriority() == 0) { 00042 ChangeState(intf, new OSPF::InterfaceStateNotDesignatedRouter, this); 00043 } else { 00044 ChangeState(intf, new OSPF::InterfaceStateWaiting, this); 00045 messageHandler->StartTimer(intf->GetWaitTimer(), intf->GetRouterDeadInterval()); 00046 00047 long neighborCount = intf->GetNeighborCount(); 00048 for (long i = 0; i < neighborCount; i++) { 00049 OSPF::Neighbor* neighbor = intf->GetNeighbor(i); 00050 if (neighbor->GetPriority() > 0) { 00051 neighbor->ProcessEvent(OSPF::Neighbor::Start); 00052 } 00053 } 00054 } 00055 break; 00056 00057 case OSPF::Interface::Broadcast: 00058 if (intf->GetRouterPriority() == 0) { 00059 ChangeState(intf, new OSPF::InterfaceStateNotDesignatedRouter, this); 00060 } else { 00061 ChangeState(intf, new OSPF::InterfaceStateWaiting, this); 00062 messageHandler->StartTimer(intf->GetWaitTimer(), intf->GetRouterDeadInterval()); 00063 } 00064 break; 00065 00066 default: 00067 break; 00068 } 00069 } 00070 if (event == OSPF::Interface::LoopIndication) { 00071 intf->Reset(); 00072 ChangeState(intf, new OSPF::InterfaceStateLoopback, this); 00073 } 00074 }
virtual Interface::InterfaceStateType OSPF::InterfaceStateDown::GetState | ( | void | ) | const [inline, virtual] |