![]() |
Multicast Routing Modelling In OMNeT++
|
Class represents Pim Neighbor Table. More...
#include <PimNeighborTable.h>
Public Member Functions | |
virtual PimNeighbor * | getNeighbor (int k) |
virtual void | addNeighbor (PimNeighbor entry) |
virtual bool | deleteNeighbor (int id) |
virtual int | getNumNeighbors () |
virtual void | printPimNeighborTable () |
virtual std::vector< PimNeighbor > | getNeighborsByIntID (int intID) |
virtual PimNeighbor * | getNeighborsByID (int id) |
virtual int | getIdCounter () |
virtual bool | isInTable (PimNeighbor entry) |
virtual PimNeighbor * | findNeighbor (int intId, IPAddress addr) |
virtual int | getNumNeighborsOnInt (int intId) |
Protected Member Functions | |
virtual void | initialize (int stage) |
virtual void | handleMessage (cMessage *) |
Protected Attributes | |
int | id |
std::vector< PimNeighbor > | nt |
Class represents Pim Neighbor Table.
Table is list of PimNeighbor and class contains methods to work with them.
Definition at line 63 of file PimNeighborTable.h.
virtual PimNeighbor* PimNeighborTable::getNeighbor | ( | int | k | ) | [inline, virtual] |
Get k-th entry in the table
Definition at line 73 of file PimNeighborTable.h.
virtual void PimNeighborTable::addNeighbor | ( | PimNeighbor | entry | ) | [inline, virtual] |
Add new entry to the table
Definition at line 74 of file PimNeighborTable.h.
bool PimNeighborTable::deleteNeighbor | ( | int | id | ) | [virtual] |
DELETE NEIGHBOR
The method removes entry with given unique identifier from the table.
id | Identifier of entry in the table. |
Definition at line 113 of file PimNeighborTable.cc.
{ for(int i = 0; i < getNumNeighbors(); i++) { if(id == getNeighbor(i)->getId()) { nt.erase(nt.begin() + i); return true; } } return false; }
virtual int PimNeighborTable::getNumNeighbors | ( | ) | [inline, virtual] |
Get number of entries in the table
Definition at line 76 of file PimNeighborTable.h.
void PimNeighborTable::printPimNeighborTable | ( | ) | [virtual] |
PRINT PIM NEIGHBOR TABLE
Printout of Table of PIM interfaces
Definition at line 54 of file PimNeighborTable.cc.
std::vector< PimNeighbor > PimNeighborTable::getNeighborsByIntID | ( | int | intId | ) | [virtual] |
GET NEIGHBORS BY INTERFACE ID
The method returns all neigbors which are connected to given router interface.
intId | Identifier of interface. |
Definition at line 70 of file PimNeighborTable.cc.
{ vector<PimNeighbor> nbr; for(int i = 0; i < getNumNeighbors(); i++) { if(intId == getNeighbor(i)->getInterfaceID()) { nbr.push_back(*getNeighbor(i)); } } return nbr; }
PimNeighbor * PimNeighborTable::getNeighborsByID | ( | int | id | ) | [virtual] |
GET NEIGHBOR BY ID
The method returns pointer to neigbor which ais registered with given unique identifier.
id | Identifier of entry in the table. |
Definition at line 92 of file PimNeighborTable.cc.
{ for(int i = 0; i < getNumNeighbors(); i++) { if(id == getNeighbor(i)->getId()) { return getNeighbor(i); break; } } return NULL; }
virtual int PimNeighborTable::getIdCounter | ( | ) | [inline, virtual] |
Get counter of entry IDs
Definition at line 80 of file PimNeighborTable.h.
bool PimNeighborTable::isInTable | ( | PimNeighbor | entry | ) | [virtual] |
IS IN TABLE
The method finds out if given entry is present in the table.
entry | PIM neighbor entry. |
Definition at line 134 of file PimNeighborTable.cc.
{ for(int i = 0; i < getNumNeighbors(); i++) { if((entry.getAddr() == getNeighbor(i)->getAddr()) && (entry.getInterfaceID() == getNeighbor(i)->getInterfaceID())) return true; } return false; }
PimNeighbor * PimNeighborTable::findNeighbor | ( | int | intId, |
IPAddress | addr | ||
) | [virtual] |
FIND NEIGHBOR
The method finds entry in the table according given interface ID and neighbor IP address.
intId | Identifier of interface. |
addr | IP address of neighbor. |
Definition at line 153 of file PimNeighborTable.cc.
{ for(int i = 0; i < getNumNeighbors(); i++) { if((addr == getNeighbor(i)->getAddr()) && (intId == getNeighbor(i)->getInterfaceID())) return getNeighbor(i); } return NULL; }
int PimNeighborTable::getNumNeighborsOnInt | ( | int | intId | ) | [virtual] |
GET NUMBER OF NEIGHBORS ON INTERFACE
The method returns number of neighbors which are connected to given interface.
intId | Identifier of interface. |
Definition at line 171 of file PimNeighborTable.cc.
{ std::vector<PimNeighbor> neighbors = getNeighborsByIntID(intId); return neighbors.size(); }
void PimNeighborTable::handleMessage | ( | cMessage * | msg | ) | [protected, virtual] |
HANDLE MESSAGE
Module does not have any gate, it cannot get messages
Definition at line 38 of file PimNeighborTable.cc.
{
opp_error("This module doesn't process messages");
}
int PimNeighborTable::id [protected] |
Counter of PimNeighbor IDs
Definition at line 66 of file PimNeighborTable.h.
std::vector<PimNeighbor> PimNeighborTable::nt [protected] |
List of PIM neighbors (show ip pim neighbor)
Definition at line 67 of file PimNeighborTable.h.