INET Framework for OMNeT++/OMNEST
inet::eigrp::EigrpNeighborTable< IPAddress > Class Template Reference

Class represents EIGRP Neighbor Table. More...

#include <EigrpNeighborTable.h>

Inheritance diagram for inet::eigrp::EigrpNeighborTable< IPAddress >:

Public Member Functions

 EigrpNeighborTable ()
 
virtual ~EigrpNeighborTable ()
 
int addNeighbor (EigrpNeighbor< IPAddress > *neighbor)
 Adds neighbor to the table. More...
 
EigrpNeighbor< IPAddress > * findNeighbor (const IPAddress &ipAddress)
 Finds neighbor by IP address. More...
 
EigrpNeighbor< IPAddress > * findNeighborById (int id)
 Finds neighbor by ID. More...
 
EigrpNeighbor< IPAddress > * removeNeighbor (EigrpNeighbor< IPAddress > *neighbor)
 Removes neighbor form the table, but the record still exists. More...
 
EigrpNeighbor< IPAddress > * getFirstNeighborOnIf (int ifaceId)
 Returns first neighbor that resides on specified interface. More...
 
int getNumNeighbors () const
 
EigrpNeighbor< IPAddress > * getNeighbor (int k) const
 
int setAckOnIface (int ifaceId, uint32_t ackNum)
 
int getStubCount () const
 
void incStubCount ()
 
void decStubCount ()
 

Protected Types

typedef std::vector< EigrpNeighbor< IPAddress > * > NeighborVector
 

Protected Member Functions

virtual void initialize (int stage) override
 
virtual void handleMessage (cMessage *msg) override
 
virtual int numInitStages () const override
 

Protected Attributes

NeighborVector neighborVec
 Table with neighbors. More...
 
int neighborCounter
 For unique ID of neighbor. More...
 
int stubCount
 Number of stub neighbors for optimization. More...
 

Detailed Description

template<typename IPAddress>
class inet::eigrp::EigrpNeighborTable< IPAddress >

Class represents EIGRP Neighbor Table.

Member Typedef Documentation

◆ NeighborVector

template<typename IPAddress >
typedef std::vector<EigrpNeighbor<IPAddress> *> inet::eigrp::EigrpNeighborTable< IPAddress >::NeighborVector
protected

Constructor & Destructor Documentation

◆ EigrpNeighborTable()

template<typename IPAddress >
inet::eigrp::EigrpNeighborTable< IPAddress >::EigrpNeighborTable ( )
inline
43 { neighborCounter = 1; stubCount = 0; }

◆ ~EigrpNeighborTable()

template<typename IPAddress >
inet::eigrp::EigrpNeighborTable< IPAddress >::~EigrpNeighborTable
virtual
57 {
58 /*
59  int cnt = neighborVec.size();
60  EigrpNeighbor<IPAddress> *neigh;
61 
62  for (int i = 0; i < cnt; i++)
63  {
64  neigh = neighborVec[i];
65 // cancelHoldTimer(neigh);
66  delete neigh;
67  }
68  neighborVec.clear();
69 */
70 }

Member Function Documentation

◆ addNeighbor()

template<typename IPAddress >
int inet::eigrp::EigrpNeighborTable< IPAddress >::addNeighbor ( EigrpNeighbor< IPAddress > *  neighbor)

Adds neighbor to the table.

119 {
120  neighbor->setNeighborId(neighborCounter);
121  this->neighborVec.push_back(neighbor);
122  return neighborCounter++;
123 }

Referenced by inet::eigrp::EigrpIpv4Pdm::createNeighbor(), and inet::eigrp::EigrpIpv6Pdm::createNeighbor().

◆ decStubCount()

template<typename IPAddress >
void inet::eigrp::EigrpNeighborTable< IPAddress >::decStubCount ( )
inline

◆ findNeighbor()

template<typename IPAddress >
EigrpNeighbor< IPAddress > * inet::eigrp::EigrpNeighborTable< IPAddress >::findNeighbor ( const IPAddress &  ipAddress)

Finds neighbor by IP address.

Returns null if neighbor is not found.

89 {
90  typename NeighborVector::iterator it;
91  EigrpNeighbor<IPAddress> *neigh;
92 
93  for (it = neighborVec.begin(); it != neighborVec.end(); it++) {
94  neigh = *it;
95  if (neigh->getIPAddress() == ipAddress) {
96  return neigh;
97  }
98  }
99 
100  return nullptr;
101 }

Referenced by inet::eigrp::EigrpIpv4Pdm::processInterRoute(), inet::eigrp::EigrpIpv6Pdm::processInterRoute(), inet::eigrp::EigrpIpv4Pdm::processMsgFromNetwork(), and inet::eigrp::EigrpIpv6Pdm::processMsgFromNetwork().

◆ findNeighborById()

template<typename IPAddress >
EigrpNeighbor< IPAddress > * inet::eigrp::EigrpNeighborTable< IPAddress >::findNeighborById ( int  id)

Finds neighbor by ID.

105 {
106  typename NeighborVector::iterator it;
107 
108  for (it = neighborVec.begin(); it != neighborVec.end(); it++) {
109  if ((*it)->getNeighborId() == id) {
110  return *it;
111  }
112  }
113 
114  return nullptr;
115 }

Referenced by inet::eigrp::EigrpIpv4Pdm::getDestIpAddress(), inet::eigrp::EigrpIpv6Pdm::getDestIpAddress(), inet::eigrp::EigrpIpv4Pdm::sendReply(), inet::eigrp::EigrpIpv6Pdm::sendReply(), inet::eigrp::EigrpIpv4Pdm::setDelayedRemove(), and inet::eigrp::EigrpIpv6Pdm::setDelayedRemove().

◆ getFirstNeighborOnIf()

template<typename IPAddress >
EigrpNeighbor< IPAddress > * inet::eigrp::EigrpNeighborTable< IPAddress >::getFirstNeighborOnIf ( int  ifaceId)

Returns first neighbor that resides on specified interface.

145 {
146  typename NeighborVector::iterator it;
147 
148  for (it = neighborVec.begin(); it != neighborVec.end(); ++it) {
149  if ((*it)->getIfaceId() == ifaceId)
150  return *it;
151  }
152 
153  return nullptr;
154 }

Referenced by inet::eigrp::EigrpIpv4Pdm::msgToIface(), and inet::eigrp::EigrpIpv6Pdm::msgToIface().

◆ getNeighbor()

◆ getNumNeighbors()

◆ getStubCount()

◆ handleMessage()

template<typename IPAddress >
void inet::eigrp::EigrpNeighborTable< IPAddress >::handleMessage ( cMessage *  msg)
overrideprotectedvirtual
83 {
84  throw cRuntimeError("This module does not process messages");
85 }

◆ incStubCount()

template<typename IPAddress >
void inet::eigrp::EigrpNeighborTable< IPAddress >::incStubCount ( )
inline

◆ initialize()

template<typename IPAddress >
void inet::eigrp::EigrpNeighborTable< IPAddress >::initialize ( int  stage)
overrideprotectedvirtual
74 {
75  cSimpleModule::initialize(stage);
76  if (stage == INITSTAGE_ROUTING_PROTOCOLS) {
77  WATCH_PTRVECTOR(neighborVec);
78  }
79 }

◆ numInitStages()

template<typename IPAddress >
virtual int inet::eigrp::EigrpNeighborTable< IPAddress >::numInitStages ( ) const
inlineoverrideprotectedvirtual
40 { return NUM_INIT_STAGES; }

◆ removeNeighbor()

template<typename IPAddress >
EigrpNeighbor< IPAddress > * inet::eigrp::EigrpNeighborTable< IPAddress >::removeNeighbor ( EigrpNeighbor< IPAddress > *  neighbor)

Removes neighbor form the table, but the record still exists.

130 {
131  typename NeighborVector::iterator it;
132 
133  for (it = neighborVec.begin(); it != neighborVec.end(); ++it) {
134  if (*it == neighbor) {
135  neighborVec.erase(it);
136  return neighbor;
137  }
138  }
139 
140  return nullptr;
141 }

Referenced by inet::eigrp::EigrpIpv4Pdm::removeNeighbor(), and inet::eigrp::EigrpIpv6Pdm::removeNeighbor().

◆ setAckOnIface()

template<typename IPAddress >
int inet::eigrp::EigrpNeighborTable< IPAddress >::setAckOnIface ( int  ifaceId,
uint32_t  ackNum 
)
158 {
159  typename NeighborVector::iterator it;
160  int neighCnt = 0;
161 
162  for (it = neighborVec.begin(); it != neighborVec.end(); ++it) {
163  if ((*it)->getIfaceId() == ifaceId) {
164  neighCnt++;
165  (*it)->setAck(ackNum);
166  }
167  }
168 
169  return neighCnt;
170 }

Member Data Documentation

◆ neighborCounter

template<typename IPAddress >
int inet::eigrp::EigrpNeighborTable< IPAddress >::neighborCounter
protected

◆ neighborVec

◆ stubCount


The documentation for this class was generated from the following files:
inet::eigrp::EigrpNeighborTable::stubCount
int stubCount
Number of stub neighbors for optimization.
Definition: EigrpNeighborTable.h:36
NUM_INIT_STAGES
#define NUM_INIT_STAGES
Definition: InitStageRegistry.h:73
inet::eigrp::EigrpNeighborTable::neighborVec
NeighborVector neighborVec
Table with neighbors.
Definition: EigrpNeighborTable.h:34
inet::physicallayer::k
const double k
Definition: Qam1024Modulation.cc:14
inet::INITSTAGE_ROUTING_PROTOCOLS
INET_API InitStage INITSTAGE_ROUTING_PROTOCOLS
Initialization of routing protocols.
inet::eigrp::EigrpNeighborTable::neighborCounter
int neighborCounter
For unique ID of neighbor.
Definition: EigrpNeighborTable.h:35