Multicast Routing Modelling In OMNeT++
Public Member Functions | Protected Member Functions | Protected Attributes
PimNeighborTable Class Reference

Class represents Pim Neighbor Table. More...

#include <PimNeighborTable.h>

List of all members.

Public Member Functions

virtual PimNeighborgetNeighbor (int k)
virtual void addNeighbor (PimNeighbor entry)
virtual bool deleteNeighbor (int id)
virtual int getNumNeighbors ()
virtual void printPimNeighborTable ()
virtual std::vector< PimNeighborgetNeighborsByIntID (int intID)
virtual PimNeighborgetNeighborsByID (int id)
virtual int getIdCounter ()
virtual bool isInTable (PimNeighbor entry)
virtual PimNeighborfindNeighbor (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< PimNeighbornt

Detailed Description

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.


Member Function Documentation

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.

Parameters:
idIdentifier of entry in the table.
Returns:
True if entry was found and deleted successfully, otherwise false.

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.

PRINT PIM NEIGHBOR TABLE

Printout of Table of PIM interfaces

Definition at line 54 of file PimNeighborTable.cc.

{
        for(std::vector<PimNeighbor>::iterator i = nt.begin(); i < nt.end(); i++)
        {
                EV << (*i).info() << endl;
        }
}
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.

Parameters:
intIdIdentifier of interface.
Returns:
Vector of entries from PIM neighbor table.

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;
}

GET NEIGHBOR BY ID

The method returns pointer to neigbor which ais registered with given unique identifier.

Parameters:
idIdentifier of entry in the table.
Returns:
Pointer to entry from PIM neighbor 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.

Parameters:
entryPIM neighbor entry.
Returns:
True if entry was found in the table, otherwise false.

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.

Parameters:
intIdIdentifier of interface.
addrIP address of neighbor.
Returns:
Pointer to entry if entry was found in the table, otherwise NULL.

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.

Parameters:
intIdIdentifier of interface.
Returns:
Number of neighbors which are connected to given 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");
}

Member Data Documentation

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.


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