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

#include <LSA.h>

Inheritance diagram for inet::ospf::RouterLSA:
inet::ospf::OSPFRouterLSA inet::ospf::RoutingInfo inet::ospf::LSATrackingInfo inet::ospf::OSPFLSA

Public Member Functions

 RouterLSA ()
 
 RouterLSA (const OSPFRouterLSA &lsa)
 
 RouterLSA (const RouterLSA &lsa)
 
virtual ~RouterLSA ()
 
bool validateLSChecksum () const
 
bool update (const OSPFRouterLSA *lsa)
 
bool differsFrom (const OSPFRouterLSA *routerLSA) const
 
- Public Member Functions inherited from inet::ospf::OSPFRouterLSA
 OSPFRouterLSA ()
 
 OSPFRouterLSA (const OSPFRouterLSA &other)
 
virtual ~OSPFRouterLSA ()
 
OSPFRouterLSAoperator= (const OSPFRouterLSA &other)
 
virtual OSPFRouterLSAdup () const override
 
virtual void parsimPack (omnetpp::cCommBuffer *b) const override
 
virtual void parsimUnpack (omnetpp::cCommBuffer *b) override
 
virtual bool getV_VirtualLinkEndpoint () const
 
virtual void setV_VirtualLinkEndpoint (bool V_VirtualLinkEndpoint)
 
virtual bool getE_ASBoundaryRouter () const
 
virtual void setE_ASBoundaryRouter (bool E_ASBoundaryRouter)
 
virtual bool getB_AreaBorderRouter () const
 
virtual void setB_AreaBorderRouter (bool B_AreaBorderRouter)
 
virtual unsigned short getNumberOfLinks () const
 
virtual void setNumberOfLinks (unsigned short numberOfLinks)
 
virtual void setLinksArraySize (unsigned int size)
 
virtual unsigned int getLinksArraySize () const
 
virtual LinkgetLinks (unsigned int k)
 
virtual const LinkgetLinks (unsigned int k) const
 
virtual void setLinks (unsigned int k, const Link &links)
 
- Public Member Functions inherited from inet::ospf::OSPFLSA
 OSPFLSA ()
 
 OSPFLSA (const OSPFLSA &other)
 
virtual ~OSPFLSA ()
 
OSPFLSAoperator= (const OSPFLSA &other)
 
virtual OSPFLSAHeadergetHeader ()
 
virtual const OSPFLSAHeadergetHeader () const
 
virtual void setHeader (const OSPFLSAHeader &header)
 
- Public Member Functions inherited from inet::ospf::RoutingInfo
 RoutingInfo ()
 
 RoutingInfo (const RoutingInfo &routingInfo)
 
virtual ~RoutingInfo ()
 
void addNextHop (NextHop nextHop)
 
void clearNextHops ()
 
unsigned int getNextHopCount () const
 
NextHop getNextHop (unsigned int index) const
 
void setDistance (unsigned long d)
 
unsigned long getDistance () const
 
void setParent (OSPFLSA *p)
 
OSPFLSAgetParent () const
 
- Public Member Functions inherited from inet::ospf::LSATrackingInfo
 LSATrackingInfo ()
 
 LSATrackingInfo (const LSATrackingInfo &info)
 
void setSource (InstallSource installSource)
 
InstallSource getSource () const
 
void incrementInstallTime ()
 
void resetInstallTime ()
 
unsigned long getInstallTime () const
 

Additional Inherited Members

- Public Types inherited from inet::ospf::LSATrackingInfo
enum  InstallSource { ORIGINATED = 0, FLOODED = 1 }
 
- Protected Member Functions inherited from inet::ospf::OSPFRouterLSA
bool operator== (const OSPFRouterLSA &)
 
- Protected Member Functions inherited from inet::ospf::OSPFLSA
bool operator== (const OSPFLSA &)
 
- Protected Attributes inherited from inet::ospf::OSPFRouterLSA
bool V_VirtualLinkEndpoint
 
bool E_ASBoundaryRouter
 
bool B_AreaBorderRouter
 
unsigned short numberOfLinks
 
Linklinks
 
unsigned int links_arraysize
 
- Protected Attributes inherited from inet::ospf::OSPFLSA
OSPFLSAHeader header
 

Constructor & Destructor Documentation

inet::ospf::RouterLSA::RouterLSA ( )
inline
LSATrackingInfo()
Definition: LSA.h:74
RoutingInfo()
Definition: LSA.h:47
inet::ospf::RouterLSA::RouterLSA ( const OSPFRouterLSA lsa)
inline
LSATrackingInfo()
Definition: LSA.h:74
RoutingInfo()
Definition: LSA.h:47
inet::ospf::RouterLSA::RouterLSA ( const RouterLSA lsa)
inline
91 : OSPFRouterLSA(lsa), RoutingInfo(lsa), LSATrackingInfo(lsa) {}
LSATrackingInfo()
Definition: LSA.h:74
RoutingInfo()
Definition: LSA.h:47
virtual inet::ospf::RouterLSA::~RouterLSA ( )
inlinevirtual
92 {}

Member Function Documentation

bool inet::ospf::RouterLSA::differsFrom ( const OSPFRouterLSA routerLSA) const

Referenced by update().

39 {
40  const OSPFLSAHeader& thisHeader = getHeader();
41  const OSPFLSAHeader& lsaHeader = routerLSA->getHeader();
42  bool differentHeader = ((thisHeader.getLsOptions() != lsaHeader.getLsOptions()) ||
43  ((thisHeader.getLsAge() == MAX_AGE) && (lsaHeader.getLsAge() != MAX_AGE)) ||
44  ((thisHeader.getLsAge() != MAX_AGE) && (lsaHeader.getLsAge() == MAX_AGE)) ||
45  (thisHeader.getLsaLength() != lsaHeader.getLsaLength()));
46  bool differentBody = false;
47 
48  if (!differentHeader) {
49  differentBody = ((getV_VirtualLinkEndpoint() != routerLSA->getV_VirtualLinkEndpoint()) ||
50  (getE_ASBoundaryRouter() != routerLSA->getE_ASBoundaryRouter()) ||
51  (getB_AreaBorderRouter() != routerLSA->getB_AreaBorderRouter()) ||
52  (getNumberOfLinks() != routerLSA->getNumberOfLinks()) ||
53  (getLinksArraySize() != routerLSA->getLinksArraySize()));
54 
55  if (!differentBody) {
56  unsigned int linkCount = links_arraysize;
57  for (unsigned int i = 0; i < linkCount; i++) {
58  auto thisLink = getLinks(i);
59  auto lsaLink = routerLSA->getLinks(i);
60  bool differentLink = ((thisLink.getLinkID() != lsaLink.getLinkID()) ||
61  (thisLink.getLinkData() != lsaLink.getLinkData()) ||
62  (thisLink.getType() != lsaLink.getType()) ||
63  (thisLink.getNumberOfTOS() != lsaLink.getNumberOfTOS()) ||
64  (thisLink.getLinkCost() != lsaLink.getLinkCost()) ||
65  (thisLink.getTosDataArraySize() != lsaLink.getTosDataArraySize()));
66 
67  if (!differentLink) {
68  unsigned int tosCount = thisLink.getTosDataArraySize();
69  for (unsigned int j = 0; j < tosCount; j++) {
70  bool differentTOS = ((thisLink.getTosData(j).tos != lsaLink.getTosData(j).tos) ||
71  (thisLink.getTosData(j).tosMetric[0] != lsaLink.getTosData(j).tosMetric[0]) ||
72  (thisLink.getTosData(j).tosMetric[1] != lsaLink.getTosData(j).tosMetric[1]) ||
73  (thisLink.getTosData(j).tosMetric[2] != lsaLink.getTosData(j).tosMetric[2]));
74 
75  if (differentTOS) {
76  differentLink = true;
77  break;
78  }
79  }
80  }
81 
82  if (differentLink) {
83  differentBody = true;
84  break;
85  }
86  }
87  }
88  }
89 
90  return differentHeader || differentBody;
91 }
virtual unsigned short getNumberOfLinks() const
virtual Link & getLinks(unsigned int k)
unsigned int links_arraysize
Definition: OSPFPacket_m.h:486
virtual unsigned int getLinksArraySize() const
virtual bool getE_ASBoundaryRouter() const
virtual bool getB_AreaBorderRouter() const
virtual bool getV_VirtualLinkEndpoint() const
#define MAX_AGE
Definition: OSPFcommon.h:36
virtual OSPFLSAHeader & getHeader()
bool inet::ospf::RouterLSA::update ( const OSPFRouterLSA lsa)

Referenced by inet::ospf::Area::ageDatabase(), inet::ospf::NeighborState::changeState(), inet::ospf::InterfaceState::changeState(), and inet::ospf::HelloHandler::processPacket().

25 {
26  bool different = differsFrom(lsa);
27  (*this) = (*lsa);
29  if (different) {
30  clearNextHops();
31  return true;
32  }
33  else {
34  return false;
35  }
36 }
void resetInstallTime()
Definition: LSA.h:80
bool differsFrom(const OSPFRouterLSA *routerLSA) const
Definition: RouterLSA.cc:38
void clearNextHops()
Definition: LSA.h:52
bool inet::ospf::RouterLSA::validateLSChecksum ( ) const
inline

Referenced by inet::ospf::Area::ageDatabase().

94 { return true; } // not implemented

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