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

#include <Ospfv2InterfaceStateDesignatedRouter.h>

Inheritance diagram for inet::ospfv2::InterfaceStateDesignatedRouter:
inet::ospfv2::Ospfv2InterfaceState

Public Member Functions

virtual void processEvent (Ospfv2Interface *intf, Ospfv2Interface::Ospfv2InterfaceEventType event) override
 
virtual Ospfv2Interface::Ospfv2InterfaceStateType getState () const override
 
- Public Member Functions inherited from inet::ospfv2::Ospfv2InterfaceState
virtual ~Ospfv2InterfaceState ()
 

Additional Inherited Members

- Protected Member Functions inherited from inet::ospfv2::Ospfv2InterfaceState
void changeState (Ospfv2Interface *intf, Ospfv2InterfaceState *newState, Ospfv2InterfaceState *currentState)
 
void calculateDesignatedRouter (Ospfv2Interface *intf)
 
void printElectionResult (const Ospfv2Interface *onInterface, DesignatedRouterId DR, DesignatedRouterId BDR)
 

Member Function Documentation

◆ getState()

virtual Ospfv2Interface::Ospfv2InterfaceStateType inet::ospfv2::InterfaceStateDesignatedRouter::getState ( ) const
inlineoverridevirtual

◆ processEvent()

void inet::ospfv2::InterfaceStateDesignatedRouter::processEvent ( Ospfv2Interface intf,
Ospfv2Interface::Ospfv2InterfaceEventType  event 
)
overridevirtual

Implements inet::ospfv2::Ospfv2InterfaceState.

20 {
21  if (event == Ospfv2Interface::NEIGHBOR_CHANGE) {
23  }
24  else if (event == Ospfv2Interface::INTERFACE_DOWN) {
25  intf->reset();
26  changeState(intf, new InterfaceStateDown, this);
27  }
28  else if (event == Ospfv2Interface::LOOP_INDICATION) {
29  intf->reset();
30  changeState(intf, new InterfaceStateLoopback, this);
31  }
32  else if (event == Ospfv2Interface::HELLO_TIMER) {
33  if (intf->getType() == Ospfv2Interface::BROADCAST) {
34  intf->sendHelloPacket(Ipv4Address::ALL_OSPF_ROUTERS_MCAST);
35  }
36  else { // Ospfv2Interface::NBMA
37  unsigned long neighborCount = intf->getNeighborCount();
38  int ttl = (intf->getType() == Ospfv2Interface::VIRTUAL) ? VIRTUAL_LINK_TTL : 1;
39  for (unsigned long i = 0; i < neighborCount; i++) {
40  intf->sendHelloPacket(intf->getNeighbor(i)->getAddress(), ttl);
41  }
42  }
43  intf->getArea()->getRouter()->getMessageHandler()->startTimer(intf->getHelloTimer(), intf->getHelloInterval());
44  }
45  else if (event == Ospfv2Interface::ACKNOWLEDGEMENT_TIMER) {
46  intf->sendDelayedAcknowledgements();
47  }
48 }

The documentation for this class was generated from the following files:
VIRTUAL_LINK_TTL
#define VIRTUAL_LINK_TTL
Definition: Ospfv2Common.h:36
inet::ospfv2::Ospfv2InterfaceState::calculateDesignatedRouter
void calculateDesignatedRouter(Ospfv2Interface *intf)
Definition: Ospfv2InterfaceState.cc:111
inet::ospfv2::Ospfv2Interface::DESIGNATED_ROUTER_STATE
@ DESIGNATED_ROUTER_STATE
Definition: Ospfv2Interface.h:58
inet::ospfv2::Ospfv2Interface::NEIGHBOR_CHANGE
@ NEIGHBOR_CHANGE
Definition: Ospfv2Interface.h:45
inet::ospfv2::Ospfv2Interface::LOOP_INDICATION
@ LOOP_INDICATION
Definition: Ospfv2Interface.h:46
inet::ospfv2::Ospfv2Interface::ACKNOWLEDGEMENT_TIMER
@ ACKNOWLEDGEMENT_TIMER
Definition: Ospfv2Interface.h:43
inet::ospfv2::Ospfv2Interface::VIRTUAL
@ VIRTUAL
Definition: Ospfv2Interface.h:36
inet::ospfv2::Ospfv2Interface::HELLO_TIMER
@ HELLO_TIMER
Definition: Ospfv2Interface.h:41
inet::ospfv2::Ospfv2Interface::INTERFACE_DOWN
@ INTERFACE_DOWN
Definition: Ospfv2Interface.h:48
inet::ospfv2::Ospfv2Interface::BROADCAST
@ BROADCAST
Definition: Ospfv2Interface.h:33
inet::Ipv4Address::ALL_OSPF_ROUTERS_MCAST
static const Ipv4Address ALL_OSPF_ROUTERS_MCAST
224.0.0.5 All OSPF routers (DR Others)
Definition: Ipv4Address.h:99
inet::ospfv2::Ospfv2InterfaceState::changeState
void changeState(Ospfv2Interface *intf, Ospfv2InterfaceState *newState, Ospfv2InterfaceState *currentState)
Definition: Ospfv2InterfaceState.cc:22