INET Framework for OMNeT++/OMNEST
inet::ospfv3::Ospfv3InterfaceStateWaiting Class Reference

#include <Ospfv3InterfaceStateWaiting.h>

Inheritance diagram for inet::ospfv3::Ospfv3InterfaceStateWaiting:
inet::ospfv3::Ospfv3InterfaceState

Public Member Functions

 ~Ospfv3InterfaceStateWaiting ()
 
void processEvent (Ospfv3Interface *intf, Ospfv3Interface::Ospfv3InterfaceEvent event) override
 
Ospfv3Interface::Ospfv3InterfaceFaState getState () const override
 
std::string getInterfaceStateString () const override
 
- Public Member Functions inherited from inet::ospfv3::Ospfv3InterfaceState
virtual ~Ospfv3InterfaceState ()
 

Additional Inherited Members

- Protected Member Functions inherited from inet::ospfv3::Ospfv3InterfaceState
void changeState (Ospfv3Interface *intf, Ospfv3InterfaceState *newState, Ospfv3InterfaceState *currentState)
 
void calculateDesignatedRouter (Ospfv3Interface *intf)
 

Constructor & Destructor Documentation

◆ ~Ospfv3InterfaceStateWaiting()

inet::ospfv3::Ospfv3InterfaceStateWaiting::~Ospfv3InterfaceStateWaiting ( )
inline
20 {};

Member Function Documentation

◆ getInterfaceStateString()

std::string inet::ospfv3::Ospfv3InterfaceStateWaiting::getInterfaceStateString ( ) const
inlineoverridevirtual

Implements inet::ospfv3::Ospfv3InterfaceState.

23 { return std::string("Ospfv3InterfaceStateWaiting"); }

◆ getState()

Ospfv3Interface::Ospfv3InterfaceFaState inet::ospfv3::Ospfv3InterfaceStateWaiting::getState ( ) const
inlineoverridevirtual

◆ processEvent()

void inet::ospfv3::Ospfv3InterfaceStateWaiting::processEvent ( Ospfv3Interface intf,
Ospfv3Interface::Ospfv3InterfaceEvent  event 
)
overridevirtual

Implements inet::ospfv3::Ospfv3InterfaceState.

12 {
13  /*
14  * HELLO_TIMER - for the time in wait timer it monitors hello packets
15  * WAIT_TIMER - election - it goes either into DR, BDR or DROther
16  * BACKUP_SEEN - end of waiting - either some router says it is the BDR or DR and the BDR is missing
17  * -either way the state is over
18  * INTERFACE_DOWN or LOOPBACK_IND - transit to DOWN
19  *
20  */
21  if ((event == Ospfv3Interface::BACKUP_SEEN_EVENT) ||
23  {
24  calculateDesignatedRouter(interface);
25  }
27  interface->reset();
28  changeState(interface, new Ospfv3InterfaceStateDown, this);
29  }
30  if (event == Ospfv3Interface::LOOP_IND_EVENT) {
31  interface->reset();
32  changeState(interface, new Ospfv3InterfaceStateLoopback, this);
33  }
35  if (interface->getType() == Ospfv3Interface::BROADCAST_TYPE) {
36  Packet *hello = interface->prepareHello();
37  interface->getArea()->getInstance()->getProcess()->sendPacket(hello, Ipv6Address::ALL_OSPF_ROUTERS_MCAST, interface->getIntName().c_str());
38  }
39  else { // Interface::NBMA
40  unsigned long neighborCount = interface->getNeighborCount();
41  int hopLimit = (interface->getType() == Ospfv3Interface::VIRTUAL_TYPE) ? VIRTUAL_LINK_TTL : 1;
42  for (unsigned long i = 0; i < neighborCount; i++) {
43  Ospfv3Neighbor *neighbor = interface->getNeighbor(i);
44  if (neighbor->getNeighborPriority() > 0) {
45  Packet *hello = interface->prepareHello();
46  Ipv6Address dest = neighbor->getNeighborIP();
47  interface->getArea()->getInstance()->getProcess()->sendPacket(hello, dest, interface->getIntName().c_str(), hopLimit);
48  }
49  }
50  }
51  interface->getArea()->getInstance()->getProcess()->setTimer(interface->getHelloTimer(), interface->getHelloInterval());
52  }
54  interface->sendDelayedAcknowledgements();
55  }
56 } // processEvent

The documentation for this class was generated from the following files:
VIRTUAL_LINK_TTL
#define VIRTUAL_LINK_TTL
Definition: Ospfv2Common.h:36
inet::ospfv3::Ospfv3InterfaceState::calculateDesignatedRouter
void calculateDesignatedRouter(Ospfv3Interface *intf)
Definition: Ospfv3InterfaceState.cc:203
inet::ospfv3::Ospfv3Interface::BROADCAST_TYPE
@ BROADCAST_TYPE
Definition: Ospfv3Interface.h:53
inet::ospfv3::Ospfv3Interface::INTERFACE_STATE_WAITING
@ INTERFACE_STATE_WAITING
Definition: Ospfv3Interface.h:29
inet::ospfv3::Ospfv3Interface::LOOP_IND_EVENT
@ LOOP_IND_EVENT
Definition: Ospfv3Interface.h:44
inet::ospfv3::Ospfv3Interface::HELLO_TIMER_EVENT
@ HELLO_TIMER_EVENT
Definition: Ospfv3Interface.h:45
inet::ospfv3::Ospfv3InterfaceState::changeState
void changeState(Ospfv3Interface *intf, Ospfv3InterfaceState *newState, Ospfv3InterfaceState *currentState)
Definition: Ospfv3InterfaceState.cc:10
inet::ospfv3::Ospfv3Interface::ACKNOWLEDGEMENT_TIMER_EVENT
@ ACKNOWLEDGEMENT_TIMER_EVENT
Definition: Ospfv3Interface.h:46
inet::ospfv3::Ospfv3Interface::BACKUP_SEEN_EVENT
@ BACKUP_SEEN_EVENT
Definition: Ospfv3Interface.h:41
inet::ospfv3::Ospfv3Interface::VIRTUAL_TYPE
@ VIRTUAL_TYPE
Definition: Ospfv3Interface.h:56
inet::ospfv3::Ospfv3Interface::INTERFACE_DOWN_EVENT
@ INTERFACE_DOWN_EVENT
Definition: Ospfv3Interface.h:43
inet::ospfv3::Ospfv3Interface::WAIT_TIMER_EVENT
@ WAIT_TIMER_EVENT
Definition: Ospfv3Interface.h:40
inet::Ipv6Address::ALL_OSPF_ROUTERS_MCAST
static const Ipv6Address ALL_OSPF_ROUTERS_MCAST
OSPF multicast address for listening.
Definition: Ipv6Address.h:84