00001 // 00002 // Copyright (C) 2005 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 00019 #ifndef __IPv6_H__ 00020 #define __IPv6_H__ 00021 00022 #include <omnetpp.h> 00023 #include "QueueBase.h" 00024 #include "RoutingTable6.h" 00025 #include "ICMPv6.h" 00026 #include "IPv6NeighbourDiscovery.h" 00027 #include "IPv6Datagram.h" 00028 #include "IPv6FragBuf.h" 00029 #include "ProtocolMap.h" 00030 00031 class ICMPv6Message; 00032 00036 class INET_API IPv6 : public QueueBase 00037 { 00038 protected: 00039 IInterfaceTable *ift; 00040 RoutingTable6 *rt; 00041 IPv6NeighbourDiscovery *nd; 00042 ICMPv6 *icmp; 00043 00044 // working vars 00045 long curFragmentId; // counter, used to assign unique fragmentIds to datagrams 00046 IPv6FragBuf fragbuf; // fragmentation reassembly buffer 00047 simtime_t lastCheckTime; // when fragbuf was last checked for state fragments 00048 ProtocolMapping mapping; // where to send packets after decapsulation 00049 00050 // statistics 00051 int numMulticast; 00052 int numLocalDeliver; 00053 int numDropped; 00054 int numUnroutable; 00055 int numForwarded; 00056 00057 protected: 00058 // utility: look up interface from getArrivalGate() 00059 virtual InterfaceEntry *getSourceInterfaceFrom(cPacket *msg); 00060 00061 // utility: show current statistics above the icon 00062 virtual void updateDisplayString(); 00063 00067 virtual IPv6Datagram *encapsulate(cPacket *transportPacket, InterfaceEntry *&destIE); 00068 00073 virtual void handleDatagramFromNetwork(IPv6Datagram *datagram); 00074 00079 virtual void handleMessageFromHL(cPacket *msg); 00080 00084 virtual void handleReceivedICMP(ICMPv6Message *msg); 00085 00092 virtual void fragmentAndRoute(IPv6Datagram *datagram, InterfaceEntry *destIE=NULL); 00093 00100 virtual void routePacket(IPv6Datagram *datagram, InterfaceEntry *destIE, bool fromHL); 00101 00105 virtual void routeMulticastPacket(IPv6Datagram *datagram, InterfaceEntry *destIE, InterfaceEntry *fromIE); 00106 00111 virtual void isLocalAddress(IPv6Datagram *datagram); 00112 00116 virtual cPacket *decapsulate(IPv6Datagram *datagram); 00117 00121 virtual void sendDatagramToOutput(IPv6Datagram *datagram, InterfaceEntry *ie, const MACAddress& macAddr); 00122 00123 public: 00124 IPv6() {} 00125 00126 protected: 00130 virtual void initialize(); 00131 00136 virtual void endService(cPacket *msg); 00137 }; 00138 00139 00140 #endif 00141 00142