IPAddressResolver.h

Go to the documentation of this file.
00001 //
00002 // Copyright (C) 2004 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
00006 // License as published by the Free Software Foundation; either
00007 // version 2.1 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
00015 // License along with this program; if not, see <http://www.gnu.org/licenses/>.
00016 //
00017 
00018 
00019 #ifndef __INET_IPADDRESSRESOLVER_H
00020 #define __INET_IPADDRESSRESOLVER_H
00021 
00022 #include <omnetpp.h>
00023 #include "IPvXAddress.h"
00024 
00025 class IInterfaceTable;
00026 class InterfaceEntry;
00027 class IRoutingTable;
00028 class RoutingTable6;
00029 class NotificationBoard;
00030 
00031 
00046 class INET_API IPAddressResolver
00047 {
00048   protected:
00049     // internal
00050     virtual IPAddress getIPv4AddressFrom(IInterfaceTable *ift);
00051     // internal
00052     virtual IPv6Address getIPv6AddressFrom(IInterfaceTable *ift);
00053     // internal
00054     //virtual IPv6Address getIPv6AddressFrom(IInterfaceTable *ift, int scope);
00055     // internal
00056     virtual IPv6Address getInterfaceIPv6Address(InterfaceEntry *ie);
00057 
00058   public:
00059     enum {
00060         ADDR_PREFER_IPv4,
00061         ADDR_PREFER_IPv6,
00062         ADDR_IPv4,
00063         ADDR_IPv6
00064     };
00065 
00066   public:
00067     IPAddressResolver() {}
00068     virtual ~IPAddressResolver() {}
00069 
00077     virtual IPvXAddress resolve(const char *str, int addrType=ADDR_PREFER_IPv6);
00078 
00085     virtual bool tryResolve(const char *str, IPvXAddress& result, int addrType=ADDR_PREFER_IPv6);
00086 
00095     virtual IPvXAddress addressOf(cModule *host, int addrType=ADDR_PREFER_IPv6);
00096 
00100     virtual IPvXAddress addressOf(cModule *host, const char *ifname, int addrType=ADDR_PREFER_IPv6);
00101 
00106     virtual IPAddress routerIdOf(cModule *host);
00107 
00112     virtual IPvXAddress getAddressFrom(IInterfaceTable *ift, int addrType=ADDR_PREFER_IPv6);
00113 
00117     virtual IPvXAddress getAddressFrom(InterfaceEntry *ie, int addrType=ADDR_PREFER_IPv6);
00118 
00124     virtual IInterfaceTable *interfaceTableOf(cModule *host);
00125 
00131     virtual IRoutingTable *routingTableOf(cModule *host);
00132 
00133 #ifndef WITHOUT_IPv6
00134 
00139     virtual RoutingTable6 *routingTable6Of(cModule *host);
00140 #endif
00141 
00147     virtual NotificationBoard *notificationBoardOf(cModule *host);
00148 
00152     virtual IInterfaceTable *findInterfaceTableOf(cModule *host);
00153 
00157     virtual IRoutingTable *findRoutingTableOf(cModule *host);
00158 
00159 #ifndef WITHOUT_IPv6
00160 
00163     virtual RoutingTable6 *findRoutingTable6Of(cModule *host);
00164 #endif
00165 
00169     virtual NotificationBoard *findNotificationBoardOf(cModule *host);
00171 };
00172 
00173 
00174 #endif
00175 
00176