|
INET Framework for OMNeT++/OMNEST
|
00001 /******************************************************************* 00002 * 00003 * This library is free software, you can redistribute it 00004 * and/or modify 00005 * it under the terms of the GNU Lesser General Public License 00006 * as published by the Free Software Foundation; 00007 * either version 2 of the License, or any later version. 00008 * The library is distributed in the hope that it will be useful, 00009 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00011 * See the GNU Lesser General Public License for more details. 00012 * 00013 * 00014 *********************************************************************/ 00015 00016 #ifndef __INET_OSPFROUTING_H 00017 #define __INET_OSPFROUTING_H 00018 00019 #include <vector> 00020 #include <map> 00021 #include <omnetpp.h> 00022 #include "IRoutingTable.h" 00023 #include "IInterfaceTable.h" 00024 #include "NotificationBoard.h" 00025 #include "AnsaOSPFInterface.h" 00026 #include "OSPFPacket_m.h" 00027 #include "AnsaOSPFRouter.h" 00028 00033 class AnsaOSPFRouting : public cSimpleModule, protected INotifiable 00034 { 00035 private: 00036 IInterfaceTable* ift; 00037 IRoutingTable* rt; 00038 AnsaOSPF::Router* ospfRouter; 00039 bool ospfEnabled; 00040 00041 cXMLElement* IntNode; // interface configuration xml element 00042 cXMLElement* OspfNode; // ospf configuration xml element 00043 00044 std::map<int, AnsaOSPF::AreaID> ifToAreaList; 00045 00046 int ResolveInterfaceName(const std::string& name) const; 00047 void GetAreaListFromXML(const cXMLElement& routerNode, std::map<std::string, int>& areaList) const; 00048 void LoadAreaFromXML(const cXMLElement& asConfig, const std::string& areaID); 00049 void LoadInterfaceParameters(const cXMLElement& ifConfig); 00050 void LoadExternalRoute(const cXMLElement& externalRouteConfig); 00051 void LoadHostRoute(const cXMLElement& hostRouteConfig); 00052 void LoadVirtualLink(const cXMLElement& virtualLinkConfig); 00053 00054 bool LoadConfigFromXML(const char * filename); 00055 00056 void AnsaLoadArea(const cXMLElement& areaConfig); 00057 void AnsaLoadInterface(AnsaOSPF::Area &area, AnsaOSPF::IPv4AddressRange &addressRange); 00058 00059 bool AnsaLoadConfigFromXML(const char * filename); 00060 00061 public: 00062 AnsaOSPFRouting(); 00063 virtual ~AnsaOSPFRouting(void); 00064 00065 protected: 00066 00067 NotificationBoard *nb; // cached pointer 00068 00069 virtual int numInitStages() const {return 5;} 00070 virtual void initialize(int stage); 00071 virtual void handleMessage(cMessage *msg); 00072 virtual void finish(); 00073 00078 virtual void receiveChangeNotification(int category, const cPolymorphic *details); 00079 }; 00080 00081 #endif // __INET_OSPFROUTING_H 00082 00083