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

#include <LinkStateAcknowledgementHandler.h>

Inheritance diagram for inet::ospf::LinkStateAcknowledgementHandler:
inet::ospf::IMessageHandler

Public Member Functions

 LinkStateAcknowledgementHandler (Router *containingRouter)
 
void processPacket (OSPFPacket *packet, Interface *intf, Neighbor *neighbor) override
 
- Public Member Functions inherited from inet::ospf::IMessageHandler
 IMessageHandler (Router *containingRouter)
 
virtual ~IMessageHandler ()
 

Additional Inherited Members

- Protected Attributes inherited from inet::ospf::IMessageHandler
Routerrouter
 

Constructor & Destructor Documentation

inet::ospf::LinkStateAcknowledgementHandler::LinkStateAcknowledgementHandler ( Router containingRouter)
26  :
27  IMessageHandler(containingRouter)
28 {
29 }
IMessageHandler(Router *containingRouter)
Definition: IMessageHandler.h:38

Member Function Documentation

void inet::ospf::LinkStateAcknowledgementHandler::processPacket ( OSPFPacket packet,
Interface intf,
Neighbor neighbor 
)
overridevirtual

Implements inet::ospf::IMessageHandler.

Referenced by inet::ospf::MessageHandler::processPacket().

32 {
33  router->getMessageHandler()->printEvent("Link State Acknowledgement packet received", intf, neighbor);
34 
35  if (neighbor->getState() >= Neighbor::EXCHANGE_STATE) {
36  OSPFLinkStateAcknowledgementPacket *lsAckPacket = check_and_cast<OSPFLinkStateAcknowledgementPacket *>(packet);
37 
38  int lsaCount = lsAckPacket->getLsaHeadersArraySize();
39 
40  EV_DETAIL << " Processing packet contents:\n";
41 
42  for (int i = 0; i < lsaCount; i++) {
43  OSPFLSAHeader& lsaHeader = lsAckPacket->getLsaHeaders(i);
44  OSPFLSA *lsaOnRetransmissionList;
45  LSAKeyType lsaKey;
46 
47  EV_DETAIL << " " << lsaHeader << "\n";
48 
49  lsaKey.linkStateID = lsaHeader.getLinkStateID();
50  lsaKey.advertisingRouter = lsaHeader.getAdvertisingRouter();
51 
52  if ((lsaOnRetransmissionList = neighbor->findOnRetransmissionList(lsaKey)) != nullptr) {
53  if (operator==(lsaHeader, lsaOnRetransmissionList->getHeader())) {
54  neighbor->removeFromRetransmissionList(lsaKey);
55  }
56  else {
57  EV_INFO << "Got an Acknowledgement packet for an unsent Update packet.\n";
58  }
59  }
60  }
61  if (neighbor->isLinkStateRetransmissionListEmpty()) {
62  neighbor->clearUpdateRetransmissionTimer();
63  }
64  }
65 }
void printEvent(const char *eventString, const Interface *onInterface=nullptr, const Neighbor *forNeighbor=nullptr) const
Definition: MessageHandler.cc:377
Router * router
Definition: IMessageHandler.h:35
MessageHandler * getMessageHandler()
Definition: OSPFRouter.h:77
Definition: OSPFNeighbor.h:67

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