INET Framework for OMNeT++/OMNEST
inet::ospf::InterfaceStateNotDesignatedRouter Class Reference

#include <OSPFInterfaceStateNotDesignatedRouter.h>

Inheritance diagram for inet::ospf::InterfaceStateNotDesignatedRouter:
inet::ospf::InterfaceState

Public Member Functions

virtual void processEvent (Interface *intf, Interface::InterfaceEventType event) override
 
virtual Interface::InterfaceStateType getState () const override
 
- Public Member Functions inherited from inet::ospf::InterfaceState
virtual ~InterfaceState ()
 

Additional Inherited Members

- Protected Member Functions inherited from inet::ospf::InterfaceState
void changeState (Interface *intf, InterfaceState *newState, InterfaceState *currentState)
 
void calculateDesignatedRouter (Interface *intf)
 

Member Function Documentation

virtual Interface::InterfaceStateType inet::ospf::InterfaceStateNotDesignatedRouter::getState ( ) const
inlineoverridevirtual
void inet::ospf::InterfaceStateNotDesignatedRouter::processEvent ( Interface intf,
Interface::InterfaceEventType  event 
)
overridevirtual

Implements inet::ospf::InterfaceState.

31 {
32  if (event == Interface::NEIGHBOR_CHANGE) {
34  }
35  if (event == Interface::INTERFACE_DOWN) {
36  intf->reset();
37  changeState(intf, new InterfaceStateDown, this);
38  }
39  if (event == Interface::LOOP_INDICATION) {
40  intf->reset();
41  changeState(intf, new InterfaceStateLoopback, this);
42  }
43  if (event == Interface::HELLO_TIMER) {
44  if (intf->getType() == Interface::BROADCAST) {
45  intf->sendHelloPacket(IPv4Address::ALL_OSPF_ROUTERS_MCAST);
46  }
47  else { // Interface::NBMA
48  if (intf->getRouterPriority() > 0) {
49  unsigned long neighborCount = intf->getNeighborCount();
50  for (unsigned long i = 0; i < neighborCount; i++) {
51  const Neighbor *neighbor = intf->getNeighbor(i);
52  if (neighbor->getPriority() > 0) {
53  intf->sendHelloPacket(neighbor->getAddress());
54  }
55  }
56  }
57  else {
58  intf->sendHelloPacket(intf->getDesignatedRouter().ipInterfaceAddress);
59  intf->sendHelloPacket(intf->getBackupDesignatedRouter().ipInterfaceAddress);
60  }
61  }
62  intf->getArea()->getRouter()->getMessageHandler()->startTimer(intf->getHelloTimer(), intf->getHelloInterval());
63  }
64  if (event == Interface::ACKNOWLEDGEMENT_TIMER) {
65  intf->sendDelayedAcknowledgements();
66  }
67 }
Definition: OSPFInterface.h:48
Definition: OSPFInterface.h:46
Definition: OSPFInterface.h:57
Definition: OSPFInterface.h:44
void changeState(Interface *intf, InterfaceState *newState, InterfaceState *currentState)
Definition: OSPFInterfaceState.cc:33
void calculateDesignatedRouter(Interface *intf)
Definition: OSPFInterfaceState.cc:122
Definition: OSPFInterface.h:51
Definition: OSPFInterface.h:49
static const IPv4Address ALL_OSPF_ROUTERS_MCAST
224.0.0.5 All OSPF routers (DR Others)
Definition: IPv4Address.h:110

The documentation for this class was generated from the following files: