INET Framework for OMNeT++/OMNEST
inet::ospfv2::RouterLsa Class Reference

#include <Lsa.h>

Inheritance diagram for inet::ospfv2::RouterLsa:
inet::ospfv2::Ospfv2RouterLsa inet::ospfv2::RoutingInfo inet::ospfv2::LsaTrackingInfo inet::ospfv2::Ospfv2Lsa

Public Member Functions

 RouterLsa ()
 
 RouterLsa (const Ospfv2RouterLsa &lsa)
 
 RouterLsa (const RouterLsa &lsa)
 
virtual ~RouterLsa ()
 
bool validateLSChecksum () const
 
bool update (const Ospfv2RouterLsa *lsa)
 
bool differsFrom (const Ospfv2RouterLsa *routerLSA) const
 
- Public Member Functions inherited from inet::ospfv2::Ospfv2RouterLsa
 Ospfv2RouterLsa ()
 
 Ospfv2RouterLsa (const Ospfv2RouterLsa &other)
 
virtual ~Ospfv2RouterLsa ()
 
Ospfv2RouterLsaoperator= (const Ospfv2RouterLsa &other)
 
virtual Ospfv2RouterLsadup () const override
 
virtual void parsimPack (omnetpp::cCommBuffer *b) const override
 
virtual void parsimUnpack (omnetpp::cCommBuffer *b) override
 
virtual unsigned short getReserved1 () const
 
virtual void setReserved1 (unsigned short reserved1)
 
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 getReserved2 () const
 
virtual void setReserved2 (unsigned short reserved2)
 
virtual unsigned short getNumberOfLinks () const
 
virtual void setNumberOfLinks (unsigned short numberOfLinks)
 
virtual void setLinksArraySize (size_t size)
 
virtual size_t getLinksArraySize () const
 
virtual const Ospfv2LinkgetLinks (size_t k) const
 
virtual Ospfv2LinkgetLinksForUpdate (size_t k)
 
virtual void setLinks (size_t k, const Ospfv2Link &links)
 
virtual void insertLinks (size_t k, const Ospfv2Link &links)
 
void insertLinks (const Ospfv2Link &links)
 
virtual void appendLinks (const Ospfv2Link &links)
 
virtual void eraseLinks (size_t k)
 
- Public Member Functions inherited from inet::ospfv2::Ospfv2Lsa
 Ospfv2Lsa ()
 
 Ospfv2Lsa (const Ospfv2Lsa &other)
 
virtual ~Ospfv2Lsa ()
 
Ospfv2Lsaoperator= (const Ospfv2Lsa &other)
 
virtual const Ospfv2LsaHeadergetHeader () const
 
virtual Ospfv2LsaHeadergetHeaderForUpdate ()
 
virtual void setHeader (const Ospfv2LsaHeader &header)
 
- Public Member Functions inherited from inet::ospfv2::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 (Ospfv2Lsa *p)
 
Ospfv2LsagetParent () const
 
- Public Member Functions inherited from inet::ospfv2::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::ospfv2::LsaTrackingInfo
enum  InstallSource { ORIGINATED = 0, FLOODED = 1 }
 
- Protected Member Functions inherited from inet::ospfv2::Ospfv2RouterLsa
bool operator== (const Ospfv2RouterLsa &)=delete
 
- Protected Member Functions inherited from inet::ospfv2::Ospfv2Lsa
bool operator== (const Ospfv2Lsa &)=delete
 
- Protected Attributes inherited from inet::ospfv2::Ospfv2RouterLsa
unsigned short reserved1 = 0
 
bool V_VirtualLinkEndpoint = false
 
bool E_ASBoundaryRouter = false
 
bool B_AreaBorderRouter = false
 
unsigned short reserved2 = 0
 
unsigned short numberOfLinks = 0
 
Ospfv2Linklinks = nullptr
 
size_t links_arraysize = 0
 
- Protected Attributes inherited from inet::ospfv2::Ospfv2Lsa
Ospfv2LsaHeader header
 

Constructor & Destructor Documentation

◆ RouterLsa() [1/3]

inet::ospfv2::RouterLsa::RouterLsa ( )
inline

◆ RouterLsa() [2/3]

inet::ospfv2::RouterLsa::RouterLsa ( const Ospfv2RouterLsa lsa)
inline

◆ RouterLsa() [3/3]

inet::ospfv2::RouterLsa::RouterLsa ( const RouterLsa lsa)
inline
80 : Ospfv2RouterLsa(lsa), RoutingInfo(lsa), LsaTrackingInfo(lsa) {}

◆ ~RouterLsa()

virtual inet::ospfv2::RouterLsa::~RouterLsa ( )
inlinevirtual
81 {}

Member Function Documentation

◆ differsFrom()

bool inet::ospfv2::RouterLsa::differsFrom ( const Ospfv2RouterLsa routerLSA) const
28 {
29  const Ospfv2LsaHeader& thisHeader = getHeader();
30  const Ospfv2LsaHeader& lsaHeader = routerLSA->getHeader();
31  bool differentHeader = ((thisHeader.getLsOptions() != lsaHeader.getLsOptions()) ||
32  ((thisHeader.getLsAge() == MAX_AGE) && (lsaHeader.getLsAge() != MAX_AGE)) ||
33  ((thisHeader.getLsAge() != MAX_AGE) && (lsaHeader.getLsAge() == MAX_AGE)) ||
34  (thisHeader.getLsaLength() != lsaHeader.getLsaLength()));
35  bool differentBody = false;
36 
37  if (!differentHeader) {
38  differentBody = ((getV_VirtualLinkEndpoint() != routerLSA->getV_VirtualLinkEndpoint()) ||
39  (getE_ASBoundaryRouter() != routerLSA->getE_ASBoundaryRouter()) ||
40  (getB_AreaBorderRouter() != routerLSA->getB_AreaBorderRouter()) ||
41  (getNumberOfLinks() != routerLSA->getNumberOfLinks()) ||
42  (getLinksArraySize() != routerLSA->getLinksArraySize()));
43 
44  if (!differentBody) {
45  unsigned int linkCount = links_arraysize;
46  for (unsigned int i = 0; i < linkCount; i++) {
47  auto thisLink = getLinks(i);
48  auto lsaLink = routerLSA->getLinks(i);
49  bool differentLink = ((thisLink.getLinkID() != lsaLink.getLinkID()) ||
50  (thisLink.getLinkData() != lsaLink.getLinkData()) ||
51  (thisLink.getType() != lsaLink.getType()) ||
52  (thisLink.getNumberOfTOS() != lsaLink.getNumberOfTOS()) ||
53  (thisLink.getLinkCost() != lsaLink.getLinkCost()) ||
54  (thisLink.getTosDataArraySize() != lsaLink.getTosDataArraySize()));
55 
56  if (!differentLink) {
57  unsigned int tosCount = thisLink.getTosDataArraySize();
58  for (unsigned int j = 0; j < tosCount; j++) {
59  bool differentTOS = ((thisLink.getTosData(j).tos != lsaLink.getTosData(j).tos) ||
60  (thisLink.getTosData(j).tosMetric != lsaLink.getTosData(j).tosMetric));
61 
62  if (differentTOS) {
63  differentLink = true;
64  break;
65  }
66  }
67  }
68 
69  if (differentLink) {
70  differentBody = true;
71  break;
72  }
73  }
74  }
75  }
76 
77  return differentHeader || differentBody;
78 }

Referenced by update().

◆ update()

bool inet::ospfv2::RouterLsa::update ( const Ospfv2RouterLsa lsa)
14 {
15  bool different = differsFrom(lsa);
16  (*this) = (*lsa);
18  if (different) {
19  clearNextHops();
20  return true;
21  }
22  else {
23  return false;
24  }
25 }

Referenced by inet::ospfv2::Ospfv2Area::ageDatabase(), inet::ospfv2::Ospfv2InterfaceState::changeState(), inet::ospfv2::HelloHandler::processPacket(), and inet::ospfv2::NeighborState::updateLsa().

◆ validateLSChecksum()

bool inet::ospfv2::RouterLsa::validateLSChecksum ( ) const
inline
83 { return true; } // not implemented

Referenced by inet::ospfv2::Ospfv2Area::ageDatabase().


The documentation for this class was generated from the following files:
inet::ospfv2::RouterLsa::differsFrom
bool differsFrom(const Ospfv2RouterLsa *routerLSA) const
Definition: RouterLsa.cc:27
inet::ospfv2::RoutingInfo::clearNextHops
void clearNextHops()
Definition: Lsa.h:41
MAX_AGE
#define MAX_AGE
Definition: Ospfv2Common.h:27
inet::ospfv2::Ospfv2RouterLsa::Ospfv2RouterLsa
Ospfv2RouterLsa()
inet::ospfv2::Ospfv2RouterLsa::getV_VirtualLinkEndpoint
virtual bool getV_VirtualLinkEndpoint() const
inet::ospfv2::LsaTrackingInfo::LsaTrackingInfo
LsaTrackingInfo()
Definition: Lsa.h:63
inet::ospfv2::Ospfv2RouterLsa::getB_AreaBorderRouter
virtual bool getB_AreaBorderRouter() const
inet::ospfv2::Ospfv2RouterLsa::getNumberOfLinks
virtual unsigned short getNumberOfLinks() const
inet::ospfv2::LsaTrackingInfo::resetInstallTime
void resetInstallTime()
Definition: Lsa.h:69
inet::ospfv2::Ospfv2RouterLsa::getE_ASBoundaryRouter
virtual bool getE_ASBoundaryRouter() const
inet::ospfv2::Ospfv2RouterLsa::getLinks
virtual const Ospfv2Link & getLinks(size_t k) const
inet::ospfv2::Ospfv2RouterLsa::getLinksArraySize
virtual size_t getLinksArraySize() const
inet::ospfv2::Ospfv2RouterLsa::links_arraysize
size_t links_arraysize
Definition: Ospfv2Packet_m.h:557
inet::ospfv2::Ospfv2Lsa::getHeader
virtual const Ospfv2LsaHeader & getHeader() const
inet::ospfv2::RoutingInfo::RoutingInfo
RoutingInfo()
Definition: Lsa.h:36