IRoutingTable.h

Go to the documentation of this file.
00001 //
00002 // Copyright (C) 2008 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_IROUTINGTABLE_H
00019 #define __INET_IROUTINGTABLE_H
00020 
00021 #include <vector>
00022 #include <omnetpp.h>
00023 #include "INETDefs.h"
00024 #include "IPAddress.h"
00025 #include "IPRoute.h"  // not strictly required, but most clients will need it anyway
00026 
00027 
00029 struct MulticastRoute
00030 {
00031     InterfaceEntry *interf;
00032     IPAddress gateway;
00033 };
00034 typedef std::vector<MulticastRoute> MulticastRoutes;
00035 
00036 
00045 class INET_API IRoutingTable
00046 {
00047   public:
00048     virtual ~IRoutingTable() {};
00049 
00053     virtual void printRoutingTable() const = 0;
00054 
00057     virtual void configureInterfaceForIPv4(InterfaceEntry *ie) = 0;
00058 
00062     virtual InterfaceEntry *getInterfaceByAddress(const IPAddress& address) const = 0;
00064 
00068     virtual bool isIPForwardingEnabled() = 0;
00069 
00073     virtual IPAddress getRouterId() = 0;
00074 
00078     virtual void setRouterId(IPAddress a) = 0;
00079 
00085     virtual bool isLocalAddress(const IPAddress& dest) const = 0;
00086 
00090     virtual const IPRoute *findBestMatchingRoute(const IPAddress& dest) const = 0;
00091 
00098     virtual InterfaceEntry *getInterfaceForDestAddr(const IPAddress& dest) const = 0;
00099 
00107     virtual IPAddress getGatewayForDestAddr(const IPAddress& dest) const = 0;
00109 
00112 
00117     virtual bool isLocalMulticastAddress(const IPAddress& dest) const = 0;
00118 
00122     virtual MulticastRoutes getMulticastRoutesFor(const IPAddress& dest) const = 0;
00124 
00127 
00132     virtual int getNumRoutes() const = 0;
00133 
00139     virtual const IPRoute *getRoute(int k) const = 0;
00140 
00144     virtual const IPRoute *findRoute(const IPAddress& target, const IPAddress& netmask,
00145         const IPAddress& gw, int metric = 0, const char *dev = NULL) const = 0;
00146 
00150     virtual const IPRoute *getDefaultRoute() const = 0;
00151 
00156     virtual void addRoute(const IPRoute *entry) = 0;
00157 
00163     virtual bool deleteRoute(const IPRoute *entry) = 0;
00164 
00168     virtual std::vector<IPAddress> gatherAddresses() const = 0;
00170 
00171 };
00172 
00173 #endif
00174