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

#include <Ospfv3InterfaceStateDrOther.h>

Inheritance diagram for inet::ospfv3::Ospfv3InterfaceStateDrOther:
inet::ospfv3::Ospfv3InterfaceState

Public Member Functions

 ~Ospfv3InterfaceStateDrOther ()
 
virtual 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

◆ ~Ospfv3InterfaceStateDrOther()

inet::ospfv3::Ospfv3InterfaceStateDrOther::~Ospfv3InterfaceStateDrOther ( )
inline
19 {}

Member Function Documentation

◆ getInterfaceStateString()

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

Implements inet::ospfv3::Ospfv3InterfaceState.

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

Referenced by processEvent().

◆ getState()

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

◆ processEvent()

void inet::ospfv3::Ospfv3InterfaceStateDrOther::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  if (interface->getRouterPriority() > 0) {
42  unsigned long neighborCount = interface->getNeighborCount();
43  for (unsigned long i = 0; i < neighborCount; i++) {
44  Ospfv3Neighbor *neighbor = interface->getNeighbor(i);
45  if (neighbor->getNeighborPriority() > 0) {
46  Packet *hello = interface->prepareHello();
47  Ipv6Address dest = interface->getNeighbor(i)->getNeighborIP();
48  interface->getArea()->getInstance()->getProcess()->sendPacket(hello, dest, interface->getIntName().c_str());
49  }
50  }
51  }
52  else {
53  Packet *hello = interface->prepareHello();
54  interface->getArea()->getInstance()->getProcess()->sendPacket(hello, interface->getDesignatedIP(), interface->getIntName().c_str());
55  interface->getArea()->getInstance()->getProcess()->sendPacket(hello, interface->getBackupIP(), interface->getIntName().c_str());
56  }
57  }
58  interface->getArea()->getInstance()->getProcess()->setTimer(interface->getHelloTimer(), interface->getHelloInterval());
59  }
61  interface->sendDelayedAcknowledgements();
62  }
63 // if (event == Ospfv3Interface::NEIGHBOR_REVIVED_EVENT) {
64 // changeState(interface, new Ospfv3InterfaceStateWaiting, this);
65 // this->getArea()->getInstance()->getProcess()->setTimer(interface->getWaitTimer(), interface->getDeadInterval());
66 // }
67 } // processEvent

The documentation for this class was generated from the following files:
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::INTERFACE_STATE_DROTHER
@ INTERFACE_STATE_DROTHER
Definition: Ospfv3Interface.h:31
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::Ospfv3InterfaceStateDrOther::getInterfaceStateString
std::string getInterfaceStateString() const override
Definition: Ospfv3InterfaceStateDrOther.h:22
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