INET Framework for OMNeT++/OMNEST
inet::ospf::InterfaceStateDown Class Reference

#include <OSPFInterfaceStateDown.h>

Inheritance diagram for inet::ospf::InterfaceStateDown:
inet::ospf::InterfaceState

Public Member Functions

virtual void processEvent (Interface *intf, Interface::InterfaceEventType event) override
 
virtual Interface::InterfaceStateType getState () const override
 
- Public Member Functions inherited from inet::ospf::InterfaceState
virtual ~InterfaceState ()
 

Additional Inherited Members

- Protected Member Functions inherited from inet::ospf::InterfaceState
void changeState (Interface *intf, InterfaceState *newState, InterfaceState *currentState)
 
void calculateDesignatedRouter (Interface *intf)
 

Member Function Documentation

virtual Interface::InterfaceStateType inet::ospf::InterfaceStateDown::getState ( ) const
inlineoverridevirtual

Implements inet::ospf::InterfaceState.

32 { return Interface::DOWN_STATE; }
Definition: OSPFInterface.h:64
void inet::ospf::InterfaceStateDown::processEvent ( Interface intf,
Interface::InterfaceEventType  event 
)
overridevirtual

Implements inet::ospf::InterfaceState.

33 {
34  if (event == Interface::INTERFACE_UP) {
35  MessageHandler *messageHandler = intf->getArea()->getRouter()->getMessageHandler();
36  messageHandler->startTimer(intf->getHelloTimer(), RNGCONTEXT truncnormal(0.1, 0.01)); // add some deviation to avoid startup collisions
37  messageHandler->startTimer(intf->getAcknowledgementTimer(), intf->getAcknowledgementDelay());
38  switch (intf->getType()) {
41  case Interface::VIRTUAL:
42  changeState(intf, new InterfaceStatePointToPoint, this);
43  break;
44 
45  case Interface::NBMA:
46  if (intf->getRouterPriority() == 0) {
47  changeState(intf, new InterfaceStateNotDesignatedRouter, this);
48  }
49  else {
50  changeState(intf, new InterfaceStateWaiting, this);
51  messageHandler->startTimer(intf->getWaitTimer(), intf->getRouterDeadInterval());
52 
53  long neighborCount = intf->getNeighborCount();
54  for (long i = 0; i < neighborCount; i++) {
55  Neighbor *neighbor = intf->getNeighbor(i);
56  if (neighbor->getPriority() > 0) {
57  neighbor->processEvent(Neighbor::START);
58  }
59  }
60  }
61  break;
62 
64  if (intf->getRouterPriority() == 0) {
65  changeState(intf, new InterfaceStateNotDesignatedRouter, this);
66  }
67  else {
68  changeState(intf, new InterfaceStateWaiting, this);
69  messageHandler->startTimer(intf->getWaitTimer(), intf->getRouterDeadInterval());
70  }
71  break;
72 
73  default:
74  break;
75  }
76  }
77  if (event == Interface::LOOP_INDICATION) {
78  intf->reset();
79  changeState(intf, new InterfaceStateLoopback, this);
80  }
81 }
Definition: OSPFInterface.h:60
#define RNGCONTEXT
Definition: INETDefs.h:85
Definition: OSPFInterface.h:56
Definition: OSPFInterface.h:58
Definition: OSPFInterface.h:57
Definition: OSPFInterface.h:59
Definition: OSPFNeighbor.h:43
Definition: OSPFInterface.h:43
void changeState(Interface *intf, InterfaceState *newState, InterfaceState *currentState)
Definition: OSPFInterfaceState.cc:33
Definition: OSPFInterface.h:49

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