![]() |
Multicast Routing Modelling In OMNeT++
|
00001 00008 #ifndef MULTICASTIPROUTE_H_ 00009 #define MULTICASTIPROUTE_H_ 00010 00011 #include <omnetpp.h> 00012 #include "IPAddress.h" 00013 #include "InterfaceEntry.h" 00014 #include "PIMTimer_m.h" 00015 00019 enum flag 00020 { 00021 D, 00022 S, 00023 C, 00024 P, 00025 A 00026 }; 00027 00031 enum intState 00032 { 00033 Densemode = 1, 00034 Sparsemode = 2, 00035 Forward, 00036 Pruned 00037 }; 00038 00042 enum AssertState 00043 { 00044 NoInfo = 0, 00045 Winner = 1, 00046 Loser = 2 00047 }; 00048 00053 struct inInterface 00054 { 00055 InterfaceEntry *intPtr; 00056 int intId; 00057 IPAddress nextHop; 00058 }; 00059 00064 struct outInterface 00065 { 00066 InterfaceEntry *intPtr; 00067 int intId; 00068 intState forwarding; 00069 intState mode; 00070 PIMpt *pruneTimer; 00071 AssertState assert; 00072 }; 00073 00077 typedef std::vector<outInterface> InterfaceVector; 00078 00079 00083 class INET_API MulticastIPRoute : public cPolymorphic 00084 { 00085 private: 00086 IPAddress source; 00087 IPAddress group; 00088 IPAddress RP; 00089 std::vector<flag> flags; 00090 // timers 00091 PIMgrt *grt; 00092 PIMsat *sat; 00093 PIMsrt *srt; 00094 // interfaces 00095 inInterface inInt; 00096 InterfaceVector outInt; 00100 //Originated from destination.Ensures loop freeness. 00101 unsigned int sequencenumber; 00102 //Time of routing table entry creation 00103 simtime_t installtime; 00104 00105 00106 private: 00107 MulticastIPRoute& operator=(const MulticastIPRoute& obj); 00108 00109 public: 00110 MulticastIPRoute(); 00111 virtual ~MulticastIPRoute() {} 00112 virtual std::string info() const; 00113 virtual std::string detailedInfo() const; 00114 00115 void setSource(IPAddress source) {this->source = source;} 00116 void setGroup(IPAddress group) {this->group = group;} 00117 void setRP(IPAddress RP) {this->RP = RP;} 00118 void setGrt (PIMgrt *grt) {this->grt = grt;} 00119 void setSat (PIMsat *sat) {this->sat = sat;} 00120 void setSrt (PIMsrt *srt) {this->srt = srt;} 00122 void setFlags(std::vector<flag> flags) {this->flags = flags;} 00123 bool isFlagSet(flag fl); 00124 void addFlag(flag fl); 00125 void removeFlag(flag fl); 00127 void setInInt(InterfaceEntry *interfacePtr, int intId, IPAddress nextHop) {this->inInt.intPtr = interfacePtr; this->inInt.intId = intId; this->inInt.nextHop = nextHop;} 00128 void setInInt(inInterface inInt) {this->inInt = inInt;} 00130 void setOutInt(InterfaceVector outInt) {EV << "MulticastIPRoute: New OutInt" << endl; this->outInt = outInt;} 00131 void addOutInt(outInterface outInt) {this->outInt.push_back(outInt);} 00133 bool isRpf(int intId){if (intId == inInt.intId) return true; else return false;} 00134 bool isOilistNull(); 00137 IPAddress getSource() const {return source;} 00138 IPAddress getGroup() const {return group;} 00139 IPAddress getRP() const {return RP;} 00140 PIMgrt* getGrt() const {return grt;} 00141 PIMsat* getSat() const {return sat;} 00142 PIMsrt* getSrt() const {return srt;} 00143 std::vector<flag> getFlags() const {return flags;} 00145 // get incoming interface 00146 inInterface getInInt() const {return inInt;} 00147 InterfaceEntry* getInIntPtr() const {return inInt.intPtr;} 00148 int getInIntId() const {return inInt.intId;} 00149 IPAddress getInIntNextHop() const {return inInt.nextHop;} 00151 // get outgoing interface 00152 InterfaceVector getOutInt() const {return outInt;} 00153 outInterface getOutIntByIntId(int intId); 00154 int getOutIdByIntId(int intId); 00157 simtime_t getInstallTime() const {return installtime;} 00158 void setInstallTime(simtime_t time) {installtime = time;} 00159 void setSequencenumber(int i){sequencenumber =i;} 00160 unsigned int getSequencenumber() const {return sequencenumber;} 00161 00162 }; 00163 00164 00165 #endif /* MULTICASTIPROUTE_H_ */