Multicast Routing Modelling In OMNeT++
PimNeighborTable.h
Go to the documentation of this file.
00001 
00011 #ifndef PIMNEIGHBOR_H_
00012 #define PIMNEIGHBOR_H_
00013 
00014 #include <omnetpp.h>
00015 #include "AnsaInterfaceTable.h"
00016 #include "PIMTimer_m.h"
00017 
00018 
00019 
00026 class INET_API PimNeighbor: public cPolymorphic
00027 {
00028         protected:
00029                 int                                     id;                                     
00030                 int                             intID;                  
00031                 InterfaceEntry          *intPtr;                        
00032                 IPAddress                       addr;                           
00033                 int                                     ver;                            
00034                 PIMnlt                          *nlt;                           
00036         public:
00037                 PimNeighbor(){};
00038             virtual ~PimNeighbor() {};
00039             virtual std::string info() const;
00040 
00041             // set methods
00042             void setId(int id)  {this->id = id;}                                                                                
00043             void setInterfaceID(int intID)  {this->intID = intID;}                                              
00044             void setInterfacePtr(InterfaceEntry *intPtr)  {this->intPtr = intPtr;}              
00045             void setAddr(IPAddress addr) {this->addr = addr;}                                                   
00046             void setVersion(int ver) {this->ver = ver;}                                                                 
00047             void setNlt(PIMnlt *nlt) {this->nlt = nlt;}                                                                 
00050             // get methods
00051             int getId() const {return id;}                                                                                              
00052             int getInterfaceID() const {return intID;}                                                                  
00053             InterfaceEntry *getInterfacePtr() const {return intPtr;}                                    
00054             IPAddress getAddr() const {return addr;}                                                                    
00055             int getVersion() const {return ver;}                                                                                
00056             PIMnlt *getNlt() const {return nlt;}                                                                                
00057 };
00058 
00063 class INET_API PimNeighborTable: public cSimpleModule
00064 {
00065         protected:
00066                 int                                                     id;                             
00067                 std::vector<PimNeighbor>        nt;                             
00069         public:
00070                 PimNeighborTable(){};
00071                 virtual ~PimNeighborTable(){};
00072 
00073                 virtual PimNeighbor *getNeighbor(int k){return &this->nt[k];}                           
00074                 virtual void addNeighbor(PimNeighbor entry){entry.setId(id); this->nt.push_back(entry); id++;}  
00075                 virtual bool deleteNeighbor(int id);
00076                 virtual int getNumNeighbors() {return this->nt.size();}                                         
00077                 virtual void printPimNeighborTable();
00078                 virtual std::vector<PimNeighbor> getNeighborsByIntID(int intID);
00079                 virtual PimNeighbor *getNeighborsByID(int id);
00080                 virtual int getIdCounter(){return this->id;}                                                            
00081                 virtual bool isInTable(PimNeighbor entry);
00082                 virtual PimNeighbor *findNeighbor(int intId, IPAddress addr);
00083                 virtual int getNumNeighborsOnInt(int intId);
00084 
00085         protected:
00086                 virtual void initialize(int stage);
00087                 virtual void handleMessage(cMessage *);
00088 };
00089 
00093 class INET_API PimNeighborTableAccess : public ModuleAccess<PimNeighborTable>
00094 {
00095         public:
00096                 PimNeighborTableAccess() : ModuleAccess<PimNeighborTable>("PimNeighborTable") {}
00097 };
00098 
00099 #endif /* PIMNEIGHBOR_H_ */