INET Framework for OMNeT++/OMNEST
AnsaOspf6::InterfaceStateDown Class Reference

#include <ansaOspfInterfaceStateDown6.h>

Inheritance diagram for AnsaOspf6::InterfaceStateDown:
AnsaOspf6::InterfaceState

List of all members.

Public Member Functions

virtual void ProcessEvent (Interface *intf, Interface::InterfaceEventType event)
virtual
Interface::InterfaceStateType 
GetState (void) const

Detailed Description

Definition at line 23 of file ansaOspfInterfaceStateDown6.h.


Member Function Documentation

virtual Interface::InterfaceStateType AnsaOspf6::InterfaceStateDown::GetState ( void  ) const [inline, virtual]

Implements AnsaOspf6::InterfaceState.

Definition at line 26 of file ansaOspfInterfaceStateDown6.h.

Implements AnsaOspf6::InterfaceState.

Definition at line 25 of file ansaOspfInterfaceStateDown6.cc.

                                                                                                                  {

   if (event == AnsaOspf6::Interface::InterfaceUp){

      AnsaOspf6::MessageHandler* messageHandler = intf->GetArea()->GetRouter()->GetMessageHandler();

      // add some deviation to avoid startup collisions
      messageHandler->StartTimer(intf->GetHelloTimer(), truncnormal(0.1, 0.01));
      /* TODO
      messageHandler->StartTimer(intf->GetAcknowledgementTimer(), intf->GetAcknowledgementDelay());
      */

      switch (intf->GetType()){
         case AnsaOspf6::Interface::PointToPoint:
         case AnsaOspf6::Interface::PointToMultiPoint:
         case AnsaOspf6::Interface::Virtual:
            ChangeState(intf, new AnsaOspf6::InterfaceStatePointToPoint, this);
            break;

         case AnsaOspf6::Interface::NBMA:
            if (intf->GetRouterPriority() == 0){
               ChangeState(intf, new AnsaOspf6::InterfaceStateNotDesignatedRouter, this);
            }else{
               ChangeState(intf, new AnsaOspf6::InterfaceStateWaiting, this);
               messageHandler->StartTimer(intf->GetWaitTimer(), intf->GetRouterDeadInterval());

               long neighborCount = intf->GetNeighborCount();
               for (long i = 0; i < neighborCount; i++) {
                  AnsaOspf6::Neighbor* neighbor = intf->GetNeighbor(i);
                  if (neighbor->GetPriority() > 0) {
                     neighbor->ProcessEvent(AnsaOspf6::Neighbor::Start);
                  }
               }
            }
            break;

         case AnsaOspf6::Interface::Broadcast:
            if (intf->GetRouterPriority() == 0){
               ChangeState(intf, new AnsaOspf6::InterfaceStateNotDesignatedRouter, this);
            }else{
               ChangeState(intf, new AnsaOspf6::InterfaceStateWaiting, this);
               messageHandler->StartTimer(intf->GetWaitTimer(), intf->GetRouterDeadInterval());
            }
            break;

         default:
            break;
      }
   }

   if (event == AnsaOspf6::Interface::LoopIndication) {
      intf->Reset();
      ChangeState(intf, new AnsaOspf6::InterfaceStateLoopback, this);
   }
}

The documentation for this class was generated from the following files: