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

#include <Ospfv3InterfaceStateDr.h>

Inheritance diagram for inet::ospfv3::Ospfv3InterfaceStateDr:
inet::ospfv3::Ospfv3InterfaceState

Public Member Functions

 ~Ospfv3InterfaceStateDr ()
 
virtual void processEvent (Ospfv3Interface *intf, Ospfv3Interface::Ospfv3InterfaceEvent event) override
 
virtual Ospfv3Interface::Ospfv3InterfaceFaState getState () const override
 
virtual 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

◆ ~Ospfv3InterfaceStateDr()

inet::ospfv3::Ospfv3InterfaceStateDr::~Ospfv3InterfaceStateDr ( )
inline
19 {};

Member Function Documentation

◆ getInterfaceStateString()

virtual std::string inet::ospfv3::Ospfv3InterfaceStateDr::getInterfaceStateString ( ) const
inlineoverridevirtual

Implements inet::ospfv3::Ospfv3InterfaceState.

22 { return std::string("Ospfv3InterfaceStateDr"); }

Referenced by processEvent().

◆ getState()

virtual Ospfv3Interface::Ospfv3InterfaceFaState inet::ospfv3::Ospfv3InterfaceStateDr::getState ( ) const
inlineoverridevirtual

◆ processEvent()

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

Implements inet::ospfv3::Ospfv3InterfaceState.

12 {
13  /*
14  * HELLO_TIMER - watch for changes in DR, BDR or priority!!
15  * NEIGHBOR_CHANGE
16  * -bidirectional comm established
17  * -no longer bidirectional comm
18  * -one of the neighbors declared itself DR or BDR
19  * -one of the neighbors is no londer declaring itself DR or BDR
20  * -advertised priority of neighbot has changed
21  * INTERFACE_DOWN or LOOPBACK_IND - DOWN or LOOPBACK
22  */
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  EV_DEBUG << "Sending Hello to all in " << this->getInterfaceStateString() << "\n";
37  Packet *hello = interface->prepareHello();
38  interface->getArea()->getInstance()->getProcess()->sendPacket(hello, Ipv6Address::ALL_OSPF_ROUTERS_MCAST, interface->getIntName().c_str());
39  }
40  else { // Interface::NBMA
41  EV_DEBUG << "Sending Hello to all NBMA neighbors in " << this->getInterfaceStateString() << "\n";
42  unsigned long neighborCount = interface->getNeighborCount();
43  int hopLimit = (interface->getType() == Ospfv3Interface::VIRTUAL_TYPE) ? VIRTUAL_LINK_TTL : 1;
44  for (unsigned long i = 0; i < neighborCount; i++) {
45  Packet *hello = interface->prepareHello();
46  Ipv6Address dest = interface->getNeighbor(i)->getNeighborIP();
47  interface->getArea()->getInstance()->getProcess()->sendPacket(hello, dest, interface->getIntName().c_str(), hopLimit);
48  }
49  }
50  interface->getArea()->getInstance()->getProcess()->setTimer(interface->getHelloTimer(), interface->getHelloInterval());
51  }
53  EV_DEBUG << "Sending delayed ACK in " << this->getInterfaceStateString() << "\n";
54  interface->sendDelayedAcknowledgements();
55  }
57  changeState(interface, new Ospfv3InterfaceStateWaiting, this);
58  interface->getArea()->getInstance()->getProcess()->setTimer(interface->getWaitTimer(), interface->getDeadInterval());
59  }
60 } // 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::Ospfv3Interface::NEIGHBOR_CHANGE_EVENT
@ NEIGHBOR_CHANGE_EVENT
Definition: Ospfv3Interface.h:42
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::NEIGHBOR_REVIVED_EVENT
@ NEIGHBOR_REVIVED_EVENT
Definition: Ospfv3Interface.h:47
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::Ospfv3InterfaceStateDr::getInterfaceStateString
virtual std::string getInterfaceStateString() const override
Definition: Ospfv3InterfaceStateDr.h:22
inet::ospfv3::Ospfv3Interface::ACKNOWLEDGEMENT_TIMER_EVENT
@ ACKNOWLEDGEMENT_TIMER_EVENT
Definition: Ospfv3Interface.h:46
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::Ipv6Address::ALL_OSPF_ROUTERS_MCAST
static const Ipv6Address ALL_OSPF_ROUTERS_MCAST
OSPF multicast address for listening.
Definition: Ipv6Address.h:84
inet::ospfv3::Ospfv3Interface::INTERFACE_STATE_DESIGNATED
@ INTERFACE_STATE_DESIGNATED
Definition: Ospfv3Interface.h:33