00001 // 00002 // Copyright (C) 2006 Andras Babos and Andras Varga 00003 // 00004 // This program is free software; you can redistribute it and/or 00005 // modify it under the terms of the GNU Lesser General Public License 00006 // as published by the Free Software Foundation; either version 2 00007 // of the License, or (at your option) any later version. 00008 // 00009 // This program is distributed in the hope that it will be useful, 00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 // GNU Lesser General Public License for more details. 00013 // 00014 // You should have received a copy of the GNU Lesser General Public License 00015 // along with this program; if not, see <http://www.gnu.org/licenses/>. 00016 // 00017 00018 #ifndef __INET_OSPFROUTING_H 00019 #define __INET_OSPFROUTING_H 00020 00021 #include <vector> 00022 #include <omnetpp.h> 00023 #include "IRoutingTable.h" 00024 #include "IInterfaceTable.h" 00025 #include "OSPFPacket_m.h" 00026 #include "OSPFRouter.h" 00027 00032 class OSPFRouting : public cSimpleModule 00033 { 00034 private: 00035 IInterfaceTable* ift; 00036 IRoutingTable* rt; 00037 OSPF::Router* ospfRouter; 00038 00039 int ResolveInterfaceName(const std::string& name) const; 00040 void GetAreaListFromXML(const cXMLElement& routerNode, std::map<std::string, int>& areaList) const; 00041 void LoadAreaFromXML(const cXMLElement& asConfig, const std::string& areaID); 00042 void LoadInterfaceParameters(const cXMLElement& ifConfig); 00043 void LoadExternalRoute(const cXMLElement& externalRouteConfig); 00044 void LoadHostRoute(const cXMLElement& hostRouteConfig); 00045 void LoadVirtualLink(const cXMLElement& virtualLinkConfig); 00046 00047 bool LoadConfigFromXML(const char * filename); 00048 00049 public: 00050 OSPFRouting(); 00051 virtual ~OSPFRouting(void); 00052 00053 protected: 00054 virtual int numInitStages() const {return 5;} 00055 virtual void initialize(int stage); 00056 virtual void handleMessage(cMessage *msg); 00057 }; 00058 00059 #endif // __INET_OSPFROUTING_H 00060 00061