00001 // 00002 // Copyright (C) 2000 Institut fuer Telematik, Universitaet Karlsruhe 00003 // Copyright (C) 2004,2005 Andras Varga 00004 // 00005 // This program is free software; you can redistribute it and/or 00006 // modify it under the terms of the GNU General Public License 00007 // as published by the Free Software Foundation; either version 2 00008 // of the License, or (at your option) any later version. 00009 // 00010 // This program is distributed in the hope that it will be useful, 00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 // GNU General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU General Public License 00016 // along with this program; if not, write to the Free Software 00017 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00018 // 00019 00025 // 00026 // Author: Jochen Reber 00027 // Rewrite: Andras Varga 2004,2005 00028 // Modifications: Stephan Krause, Bernhard Mueller 00029 // 00030 00031 #ifndef __SIMPLEUDP_H__ 00032 #define __SIMPLEUDP_H__ 00033 00034 #include <map> 00035 #include <list> 00036 00037 #include <InitStages.h> 00038 #include <UDP.h> 00039 00040 #include "UDPControlInfo_m.h" 00041 00042 class GlobalNodeList; 00043 class SimpleNodeEntry; 00044 class GlobalStatistics; 00045 00046 class IPControlInfo; 00047 class IPv6ControlInfo; 00048 class ICMP; 00049 class ICMPv6; 00050 class UDPPacket; 00051 00052 const int IPv6_HEADER_BYTES = 40; 00053 00059 class SimpleUDP : public UDP 00060 { 00061 public: 00062 00063 // delay fault type string and corresponding map for switch..case 00064 static std::string delayFaultTypeString; 00065 enum delayFaultTypeNum { 00066 delayFaultUndefined, 00067 delayFaultLiveAll, 00068 delayFaultLivePlanetlab, 00069 delayFaultSimulation 00070 }; 00071 static std::map<std::string, delayFaultTypeNum> delayFaultTypeMap; 00072 00073 protected: 00074 00075 // statistics 00076 int numQueueLost; 00077 int numPartitionLost; 00078 int numDestUnavailableLost; 00079 simtime_t delay; 00081 simtime_t constantDelay; 00082 bool useCoordinateBasedDelay; 00083 double jitter; 00084 bool faultyDelay; 00085 GlobalNodeList* globalNodeList; 00086 GlobalStatistics* globalStatistics; 00087 SimpleNodeEntry* nodeEntry; 00089 public: 00095 void setNodeEntry(SimpleNodeEntry* entry); 00096 00097 protected: 00101 void updateDisplayString(); 00102 00108 virtual void processMsgFromApp(cPacket *appData); 00109 00110 // process UDP packets coming from IP 00111 virtual void processUDPPacket(UDPPacket *udpPacket); 00112 00113 virtual void processUndeliverablePacket(UDPPacket *udpPacket, cPolymorphic *ctrl); 00114 00115 public: 00116 SimpleUDP(); 00117 00119 virtual ~SimpleUDP(); 00120 00121 protected: 00127 virtual void initialize(int stage); 00128 00134 virtual int numInitStages() const 00135 { 00136 return MAX_STAGE_UNDERLAY + 1; 00137 } 00138 00139 void finish(); 00140 }; 00141 00142 #endif 00143