|
INET Framework for OMNeT++/OMNEST
|
00001 // 00002 // Marek Cerny, 2MSK 00003 // FIT VUT 2011 00004 // 00005 // This program is free software: you can redistribute it and/or modify 00006 // it under the terms of the GNU Lesser General Public License as published by 00007 // the Free Software Foundation, either version 3 of the License, or 00008 // (at your option) any later version. 00009 // 00010 // This program is distributed in the hope that it will be useful, 00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 // GNU Lesser General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU Lesser General Public License 00016 // along with this program. If not, see http://www.gnu.org/licenses/. 00017 // 00018 00019 #ifndef ANSAROUTINGTABLE6_H_ 00020 #define ANSAROUTINGTABLE6_H_ 00021 00022 #include "RoutingTable6.h" 00023 00024 class AnsaIPv6Route : public IPv6Route { 00025 protected: 00026 bool active; 00027 std::string _interfaceName; 00028 00029 public: 00030 AnsaIPv6Route(IPv6Address destPrefix, int length, RouteSrc src) : IPv6Route(destPrefix, length, src){}; 00031 00032 std::string printRoute() const; 00033 bool isActive() const { return active; } 00034 void setActive(bool a) { active = a; } 00035 00036 void setInterfaceName(const char *interfaceName) { _interfaceName = interfaceName; } 00037 const char * getInterfaceName() const { return _interfaceName.c_str(); } 00038 }; 00039 00040 00041 class AnsaRoutingTable6 : public RoutingTable6 { 00042 protected: 00043 std::vector<AnsaIPv6Route*> *routes; 00044 00045 public: 00046 AnsaRoutingTable6(); 00047 const IPv6Route *doLongestPrefixMatch(const IPv6Address& dest); 00048 void addDirectRoute(const IPv6Address& destPrefix, int prefixLength, unsigned int interfaceId); 00049 protected: 00050 virtual int numInitStages() const {return 5;} 00051 virtual void initialize(int stage); 00052 virtual void receiveChangeNotification(int category, const cPolymorphic *details); 00053 static bool routeLessThan(const IPv6Route *a, const IPv6Route *b); 00054 virtual void addRoute(IPv6Route *route); 00055 }; 00056 00057 #endif /* ANSAROUTINGTABLE6_H_ */