INET Framework for OMNeT++/OMNEST
inet::ospfv2::NeighborStateInit Class Reference

#include <Ospfv2NeighborStateInit.h>

Inheritance diagram for inet::ospfv2::NeighborStateInit:
inet::ospfv2::NeighborState

Public Member Functions

virtual void processEvent (Neighbor *neighbor, Neighbor::NeighborEventType event) override
 
virtual Neighbor::NeighborStateType getState () const override
 
- Public Member Functions inherited from inet::ospfv2::NeighborState
virtual ~NeighborState ()
 

Additional Inherited Members

- Protected Member Functions inherited from inet::ospfv2::NeighborState
void changeState (Neighbor *neighbor, NeighborState *newState, NeighborState *currentState)
 
bool updateLsa (Neighbor *neighbor)
 

Member Function Documentation

◆ getState()

virtual Neighbor::NeighborStateType inet::ospfv2::NeighborStateInit::getState ( ) const
inlineoverridevirtual

◆ processEvent()

void inet::ospfv2::NeighborStateInit::processEvent ( Neighbor neighbor,
Neighbor::NeighborEventType  event 
)
overridevirtual

Implements inet::ospfv2::NeighborState.

21 {
22  if ((event == Neighbor::KILL_NEIGHBOR) || (event == Neighbor::LINK_DOWN)) {
23  MessageHandler *messageHandler = neighbor->getInterface()->getArea()->getRouter()->getMessageHandler();
24  neighbor->reset();
25  messageHandler->clearTimer(neighbor->getInactivityTimer());
26  changeState(neighbor, new NeighborStateDown, this);
27  }
28  else if (event == Neighbor::INACTIVITY_TIMER) {
29  neighbor->reset();
30  if (neighbor->getInterface()->getType() == Ospfv2Interface::NBMA) {
31  MessageHandler *messageHandler = neighbor->getInterface()->getArea()->getRouter()->getMessageHandler();
32  messageHandler->startTimer(neighbor->getPollTimer(), neighbor->getInterface()->getPollInterval());
33  }
34  changeState(neighbor, new NeighborStateDown, this);
35  }
36  else if (event == Neighbor::HELLO_RECEIVED) {
37  MessageHandler *messageHandler = neighbor->getInterface()->getArea()->getRouter()->getMessageHandler();
38  messageHandler->clearTimer(neighbor->getInactivityTimer());
39  messageHandler->startTimer(neighbor->getInactivityTimer(), neighbor->getRouterDeadInterval());
40  }
41  else if (event == Neighbor::TWOWAY_RECEIVED) {
42  if (neighbor->needAdjacency()) {
43  MessageHandler *messageHandler = neighbor->getInterface()->getArea()->getRouter()->getMessageHandler();
44  if (!(neighbor->isFirstAdjacencyInited())) {
45  neighbor->initFirstAdjacency();
46  }
47  else {
48  neighbor->incrementDDSequenceNumber();
49  }
50  neighbor->sendDatabaseDescriptionPacket(true);
51  messageHandler->startTimer(neighbor->getDDRetransmissionTimer(), neighbor->getInterface()->getRetransmissionInterval());
52  changeState(neighbor, new NeighborStateExchangeStart, this);
53  }
54  else {
55  changeState(neighbor, new NeighborStateTwoWay, this);
56  }
57  }
58 }

The documentation for this class was generated from the following files:
inet::ospfv2::Neighbor::INIT_STATE
@ INIT_STATE
Definition: Ospfv2Neighbor.h:52
inet::ospfv2::Neighbor::LINK_DOWN
@ LINK_DOWN
Definition: Ospfv2Neighbor.h:43
inet::ospfv2::Neighbor::HELLO_RECEIVED
@ HELLO_RECEIVED
Definition: Ospfv2Neighbor.h:30
inet::ospfv2::NeighborState::changeState
void changeState(Neighbor *neighbor, NeighborState *newState, NeighborState *currentState)
Definition: Ospfv2NeighborState.cc:16
inet::ospfv2::Neighbor::INACTIVITY_TIMER
@ INACTIVITY_TIMER
Definition: Ospfv2Neighbor.h:41
inet::ospfv2::Ospfv2Interface::NBMA
@ NBMA
Definition: Ospfv2Interface.h:34
inet::ospfv2::Neighbor::TWOWAY_RECEIVED
@ TWOWAY_RECEIVED
Definition: Ospfv2Neighbor.h:32
inet::ospfv2::Neighbor::KILL_NEIGHBOR
@ KILL_NEIGHBOR
Definition: Ospfv2Neighbor.h:40